MMKP_Param.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MMKP_PARAM_INCLUDED
00014 #define MMKP_PARAM_INCLUDED
00015
00016
00017 #include "UtilMacros.h"
00018 #include "UtilMacrosDecomp.h"
00019 #include "UtilParameters.h"
00020
00021
00022 using namespace std;
00023
00024
00031
00032 class MMKP_Param {
00033 public:
00034 int LogLevel;
00035 string DataDir;
00036 string Instance;
00037 string DataFormat;
00038 string ModelNameCore;
00039 string ModelNameRelax;
00040 string ModelNameRelaxNest;
00041 bool UsePisinger;
00042
00043 public:
00044 void getSettings(UtilParameters & utilParam){
00045 static const char * common = "MMKP";
00046 LogLevel = utilParam.GetSetting("LogLevel", 0, common);
00047 DataDir = utilParam.GetSetting("DataDir", "", common);
00048 Instance = utilParam.GetSetting("Instance", "", common);
00049 DataFormat = utilParam.GetSetting("DataFormat", "", common);
00050 ModelNameCore = utilParam.GetSetting("ModelNameCore", "MDKP0", common);
00051 ModelNameRelax = utilParam.GetSetting("ModelNameRelax", "MCKP0", common);
00052 ModelNameRelaxNest
00053 = utilParam.GetSetting("ModelNameRelaxNest", "", common);
00054 UsePisinger = utilParam.GetSetting("UsePisinger", true, common);
00055 if(!checkOptions())
00056 throw UtilException("Bad Parameter", "getSettings", "MMKP_Param");
00057 }
00058
00059 bool checkOptions(){
00060 bool optionsOk = true;
00061 if(!(ModelNameCore == "MDKP0" ||
00062 ModelNameCore == "MCP" ||
00063 ModelNameCore == "MMKPHalf")){
00064 cerr << "Error: Parameter ModelNameCore = " << ModelNameCore
00065 << " is not a defined model choice." << endl;
00066 optionsOk = false;
00067 }
00068 if(!(ModelNameRelax == "MCKP0" ||
00069 ModelNameRelax == "MDKP" ||
00070 ModelNameRelax == "MDKPHalf")){
00071 cerr << "Error: Parameter ModelNameRelax = " << ModelNameRelax
00072 << " is not a defined model choice." << endl;
00073 optionsOk = false;
00074 }
00075 if(!(ModelNameRelaxNest == "MC2KP0" ||
00076 ModelNameRelaxNest == "MDKP" ||
00077 ModelNameRelaxNest == "MMKP" ||
00078 ModelNameRelaxNest == "")){
00079 cerr << "Error: Parameter ModelNameRelaxNest = "
00080 << ModelNameRelaxNest
00081 << " is not a defined model choice." << endl;
00082 optionsOk = false;
00083 }
00084
00085 return optionsOk;
00086 }
00087
00088 void dumpSettings(ostream * os = &cout){
00089 static const char * common = "MMKP";
00090 (*os) << "\n=====================================================\n"
00091 << "MMKP_DECOMP PARAMETER SETTINGS \n";
00092 (*os) << common << ": LogLevel : " << LogLevel << endl;
00093 (*os) << common << ": DataDir : " << DataDir << endl;
00094 (*os) << common << ": Instance : " << Instance << endl;
00095 (*os) << common << ": DataFormat : " << DataFormat << endl;
00096 (*os) << common << ": ModelNameCore : " << ModelNameCore << endl;
00097 (*os) << common << ": ModelNameRelax : " << ModelNameRelax << endl;
00098 (*os) << common << ": ModelNameRelaxNest: " << ModelNameRelaxNest<< endl;
00099 (*os) << common << ": UsePisinger : " << UsePisinger << endl;
00100 (*os) << "=====================================================\n";
00101 }
00102
00103 public:
00104 MMKP_Param() :
00105 LogLevel (0),
00106 DataDir (""),
00107 Instance (""),
00108 DataFormat ("hifi"),
00109 ModelNameCore ("MDKP0"),
00110 ModelNameRelax ("MCKP0"),
00111 ModelNameRelaxNest("" ),
00112 UsePisinger (true ){}
00113 ~MMKP_Param() {};
00114 };
00115
00116 #endif