Commit 77fddbae authored by Alexis Lebis's avatar Alexis Lebis

add display option -d

parent 79bdf0e8
...@@ -44,6 +44,7 @@ int main(int argc, char* argv[]){ ...@@ -44,6 +44,7 @@ int main(int argc, char* argv[]){
unsigned int _seedParam = parser.createParam((unsigned int)(0), "seed", "Random number seed", 'S').value(); unsigned int _seedParam = parser.createParam((unsigned int)(0), "seed", "Random number seed", 'S').value();
std::string _outputFile = parser.createParam(std::string("/scratch"), "outputfile", "", '\0', "Representation", true).value(); std::string _outputFile = parser.createParam(std::string("/scratch"), "outputfile", "", '\0', "Representation", true).value();
eo::rng.reseed(_seedParam); eo::rng.reseed(_seedParam);
unsigned int localDisplay = parser.createParam((unsigned int)(0), "localDisplay", "whether or not display on local output", 'd', "Param").value();
//PROBLEM PARAMETERS //PROBLEM PARAMETERS
unsigned int SEED = parser.createParam((unsigned int)(7777), "csdvpSeed", "Seed used for the CSDVP",'s',"Param").value(); unsigned int SEED = parser.createParam((unsigned int)(7777), "csdvpSeed", "Seed used for the CSDVP",'s',"Param").value();
...@@ -301,46 +302,52 @@ int main(int argc, char* argv[]){ ...@@ -301,46 +302,52 @@ int main(int argc, char* argv[]){
filename+=oss.str(); filename+=oss.str();
std::ofstream outputfile4(filename.c_str(), std::ios::app); std::ofstream outputfile4(filename.c_str(), std::ios::app);
std::pair<bool, double> resECTS;
std::pair<bool, double> resRep ;
std::pair<bool, double> resJob ;
std::pair<bool, double> resPrq ;
if(localDisplay)
{
std::cout << "===== CURRENT POP =====" << std::endl;
pop.best_element().printOn(std::cout);
std::cout << " fitness:" << pop.best_element().fitness() << std::endl;
std::cout << "Stats & metrics: \n" << std::endl;
resECTS = ctrECTS.integrityCheck(pop.best_element());
resRep = ctrRep.integrityCheck(pop.best_element());
resJob = ctrJob.integrityCheck(pop.best_element());
resPrq = ctrPrq.integrityCheck(pop.best_element());
std::cout << "ECTS: ";
if(resECTS.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resECTS.second << std::endl;
std::cout << "Repetition: ";
if(resRep.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resRep.second << std::endl;
/*std::cout << "===== CURRENT POP =====" << std::endl; std::cout << "Job: ";
pop.best_element().printOn(std::cout); if(resJob.first)
std::cout << " fitness:" << pop.best_element().fitness() << std::endl; std::cout << "succeed";
std::cout << "Stats & metrics: \n" << std::endl; else
std::pair<bool, double> resECTS = ctrECTS.integrityCheck(pop.best_element()); std::cout << "failed";
std::pair<bool, double> resRep = ctrRep.integrityCheck(pop.best_element()); std::cout << " | value: " << resJob.second << std::endl;
std::pair<bool, double> resJob = ctrJob.integrityCheck(pop.best_element());
std::pair<bool, double> resPrq = ctrPrq.integrityCheck(pop.best_element()); std::cout << "Prereq: ";
if(resPrq.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resPrq.second << std::endl;
std::cout << "\n==========" << std::endl;
}
std::cout << "ECTS: ";
if(resECTS.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resECTS.second << std::endl;
std::cout << "Repetition: ";
if(resRep.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resRep.second << std::endl;
std::cout << "Job: ";
if(resJob.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resJob.second << std::endl;
std::cout << "Prereq: ";
if(resPrq.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resPrq.second << std::endl;
std::cout << "\n==========" << std::endl;
*/
// ---------- ALGO HERE // ---------- ALGO HERE
eoEasyEA<QUEEN> algo(cont,eval,select,transform,replace); eoEasyEA<QUEEN> algo(cont,eval,select,transform,replace);
...@@ -389,48 +396,49 @@ int main(int argc, char* argv[]){ ...@@ -389,48 +396,49 @@ int main(int argc, char* argv[]){
// ------------------- // -------------------
/* if(localDisplay)
std::cout << "\n===== BEST INDIVIDU =====" << std::endl; {
pop.best_element().printOn(std::cout); std::cout << "\n===== BEST INDIVIDU =====" << std::endl;
std::cout << " fitness:" << pop.best_element().fitness() << std::endl; pop.best_element().printOn(std::cout);
std::cout << "Stats & metrics: \n" << std::endl; std::cout << " fitness:" << pop.best_element().fitness() << std::endl;
resECTS = ctrECTS.integrityCheck(pop.best_element()); std::cout << "Stats & metrics: \n" << std::endl;
resRep = ctrRep.integrityCheck(pop.best_element()); resECTS = ctrECTS.integrityCheck(pop.best_element());
resJob = ctrJob.integrityCheck(pop.best_element()); resRep = ctrRep.integrityCheck(pop.best_element());
resPrq = ctrPrq.integrityCheck(pop.best_element()); resJob = ctrJob.integrityCheck(pop.best_element());
resPrq = ctrPrq.integrityCheck(pop.best_element());
std::cout << "ECTS: ";
if(resECTS.first) std::cout << "ECTS: ";
std::cout << "succeed"; if(resECTS.first)
else std::cout << "succeed";
std::cout << "failed"; else
std::cout << " | value: " << resECTS.second << std::endl; std::cout << "failed";
std::cout << " | value: " << resECTS.second << std::endl;
std::cout << "Repetition: ";
if(resRep.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resRep.second << std::endl;
std::cout << "Job: ";
if(resJob.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resJob.second << std::endl;
std::cout << "Prereq: ";
if(resPrq.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resPrq.second << std::endl;
std::cout << "===============" << std::endl; std::cout << "Repetition: ";
if(resRep.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resRep.second << std::endl;
*/ std::cout << "Job: ";
if(resJob.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resJob.second << std::endl;
std::cout << "Prereq: ";
if(resPrq.first)
std::cout << "succeed";
else
std::cout << "failed";
std::cout << " | value: " << resPrq.second << std::endl;
std::cout << "===============" << std::endl;
}
// ================================= END RUN ZONE =============================== // ================================= END RUN ZONE ===============================
return EXIT_SUCCESS; return EXIT_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment