/** * MOMULPER - Multi-Objective MULtilayer PERceptron * * This is the main "driver" program for experiments. Algorithmic * details are to be encapsulated in the classes. */ #include #include #include #include #include #include #include #include #define BOOST_FILESYSTEM_NO_DEPRECATED #include #include "MlpLearnAlgorithm.hpp" #include "Algorithm.hpp" using boost::property_tree::ptree; using boost::property_tree::json_parser::read_json; using namespace std; void usage(ostream & os, const char* arg0){ os << "Usage:" << endl; os << " " << arg0 << " [OPTIONS] CASEDEF" << endl << endl; os << "where CASEDEF is a case definition file. By default, " < time_start, time_end; time_start = chrono::system_clock::now(); if (argc < 2){ usage(cerr, argv[0]); return 1; } ptree pt; ifstream casedef(argv[1]); read_json(casedef, pt); casedef.close(); string tag, brief, task, alg, comm; tag = pt.get("tag"); brief = pt.get("brief"); task = pt.get("task"); alg = pt.get("algorithm"); comm = pt.get("comment"); cout << "Run case: " << endl; cout << tag << " (" << brief << ")" << endl; cout << "Using algorithm: " << alg << endl; //string rundirname = "runs/" + pt.get("tag") + "/"; string rundirname = "runs/" + pt.get("tag"); boost::filesystem::path dir(rundirname); // FIXME: Something wrong here.. doesn't notice that we have the dir already: if( !(boost::filesystem::exists(dir))){ if(!(boost::filesystem::create_directories(dir))) { std::cerr << "Could not create output directory " << rundirname << "\n"; exit(1); } } if (alg == "MLP_learn") { MlpLearnAlgorithm alg; alg.setup(pt, rundirname + "/", "datasets/"); alg.run(); } else { cerr << "Unknown algorithm: " << alg << endl; return 1; } time_end = chrono::system_clock::now(); chrono::duration duration = time_end - time_start; cout << "Elapsed wall-clock seconds: " << duration.count() << endl; return 0; }