本文整理汇总了C++中Problem::format方法的典型用法代码示例。如果您正苦于以下问题:C++ Problem::format方法的具体用法?C++ Problem::format怎么用?C++ Problem::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Problem
的用法示例。
在下文中一共展示了Problem::format方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
// Record start time
time_t top;
time(&top);
// Spit out CGI headers
cout << "Content-type: text/plain" << endl;
cout << "Connection: close" << endl;
cout << "Pragma: no-cache" << endl;
cout << "Server: wg6" << endl;
cout << endl;
// Print banner
cout << " _ This is wg6, the genetic schedule solver." << endl;
cout << " _|_ wg6 is designed to be quite verbose. Expect"<< endl;
cout << " \\/\\(_|_) lots of output." << endl;
cout << " _| Run started: " << ctime(&top) << endl;
cout << " Build information:" << endl;
cout << " - Version: " << MAJOR_VERS << "." << MINOR_VERS << endl;
cout << " - Build date: " << DATE << endl;
cout << " - Commit: " << REVISION << endl;
cout << endl;
// Print configuation
cout << " Configuration used:" << endl;
cout << " - Threads: " << NUMTHREADS << endl;
cout << " - Generations: " << GENS_COUNT << endl;
cout << " - Population: " << POPULATION << endl;
cout << " - Mutations: " << MUTS_COUNT << endl;
cout << " - Crossovers: " << CROSSOVERS << endl;
cout << " - Gap penalty: " << GAPPENALTY << endl;
cout << " - Length penalty: " << LENPENALTY << endl;
cout << " - Max events: " << MAX_EVENTS << endl;
cout << " - Highest block: " << MAXBLOCK << endl;
cout << endl;
// Print runtime information
cout << " Runtime information:" << endl;
cout << " - Processors: " << omp_get_num_procs() << endl;
cout << endl;
std::vector<block_t> tights = { 1, 2, 3, 4 };
std::vector<block_t> starts = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 };
Event ev1("Fred", tights, 2);
Event ev2("Hank", tights, 2);
Event ev3("Buck", starts, 3);
Event ev4("John", starts, 3);
Event ev5("Jack", starts, 2);
Event ev6("Mike", starts, 4);
Event ev7("Dave", starts, 3);
Event ev8("Luke", starts, 3);
Event ev9("Eddy", starts, 3);
Event ev10("Nick", starts, 3);
Problem p;
p.add_event(ev1);
p.add_event(ev2);
p.add_event(ev3);
p.add_event(ev4);
p.add_event(ev5);
p.add_event(ev6);
p.add_event(ev7);
p.add_event(ev8);
p.add_event(ev9);
p.add_event(ev10);
p.format(cout);
Solution s = p.solve();
s.format(p, cout);
if (KEEP_HIST) p.format_history(cout);
// Print footer
time_t bottom;
time(&bottom);
cout << endl;
cout << " Done " << ctime(&bottom);
cout << " Took " << difftime(bottom, top) << " seconds, " << clock() << " ticks" << endl;
cout << endl;
}