00001 #ifndef PRINTMODULE_HPP_
00002 #define PRINTMODULE_HPP_
00003
00004 #include "../OptFrameModule.hpp"
00005
00006 template<class R, class M>
00007 class PrintModule : public OptFrameModule<R,M>
00008 {
00009 public:
00010 string id()
00011 {
00012 return "print";
00013 }
00014 string usage()
00015 {
00016 string u = "print loadsol id";
00017
00018 return u;
00019 }
00020
00021 void run(vector<OptFrameModule<R,M>*> all_modules, HeuristicFactory<R,M>* factory, map<string,string>* dictionary, string input)
00022 {
00023 cout << "print: "<<input<<endl;
00024 Scanner scanner(input);
00025
00026 if(!scanner.hasNext())
00027 {
00028 cout << "Usage: " << usage() << endl;
00029 return;
00030 }
00031
00032 string sol = scanner.next();
00033
00034 if(sol!="loadsol")
00035 {
00036 cout << "First parameter must be a 'loadsol'!" << endl;
00037 cout << "Usage: "<<usage()<<endl;
00038 return;
00039 }
00040
00041 string id = scanner.next();
00042
00043 Scanner s2(sol+" "+id);
00044 Solution<R>* s = factory->read_loadsol(&s2);
00045 s->print();
00046 }
00047
00048 };
00049
00050 #endif