int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { tspProblem graph(argv[1]); tspSolution route(graph); edaExpCoolingSchedule sched(0, N, 0.98); tsp2Opt opt; edaPopulation pop; pop.init(route, N); edaTimeCondition crit( N ); edaSA sa(opt, sched, crit); workflow.set(graph); workflow.insertVertex(sa); workflow.search(pop); tspSolution& result = *(tspSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { unsigned int N = 40; tspProblem graph(argv[1]); tspSolution route(graph); edaBestAspirCrit aspir; edaStaticTabu tabu(1200); tsp2Opt opt; edaPopulation pop; pop.init(route, N); edaLoopCondition crit( 15); edaTS ts(opt, aspir, tabu, crit); workflow.set(graph); workflow.insertVertex(ts); workflow.search(pop); tspSolution& result = *(tspSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { unsigned int N = 40; schedProblem graph(argv[1]); schedSolution route(graph); edaFirstImprovement stgy; sched2Opt opt; edaPopulation pop; pop.init(route, N); edaLoopCondition crit(1500); edaHC hc(opt, stgy, crit); workflow.set(graph); workflow.insertVertex(hc); workflow.search(pop); schedSolution& result = *(schedSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { tspProblem graph(argv[1]); tspSolution route(graph); edaBestImprovement stgy; edaExpCoolingSchedule sched(0, N, 0.98); edaBestAspirCrit aspir; edaStaticTabu tabu(N); edaRankSelection rank; edaPMCrossover cross; cross.set( N / 20 ); edaRandSwapMutation mute; tsp2Opt opt; edaPopulation pop; pop.init(route, N); edaTimeCondition crit( N/7. ); edaSA saSearch(opt, sched, crit); edaTS tsSearch(opt, aspir, tabu, crit); edaHC hcSearch(opt, stgy, crit); edaGA gaSearch(rank, cross, mute, crit); unsigned int said0 = workflow.insertVertex (saSearch); unsigned int said1 = workflow.insertVertex (saSearch); unsigned int tsid2 = workflow.insertVertex (tsSearch); unsigned int tsid3 = workflow.insertVertex (tsSearch); unsigned int hcid4 = workflow.insertVertex (hcSearch); unsigned int hcid5 = workflow.insertVertex (hcSearch); unsigned int gaid6 = workflow.insertVertex (gaSearch); workflow.insertEdge(said0, hcid4); workflow.insertEdge(hcid4, tsid2); workflow.insertEdge(said1, hcid5); workflow.insertEdge(hcid5, tsid3); workflow.insertEdge(tsid3, gaid6); workflow.insertEdge(tsid2, gaid6); workflow.set(graph); workflow.search(pop); tspSolution& result = *(tspSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { unsigned int N = 40; schedProblem graph(argv[1]); schedSolution route(graph); edaBestImprovement stgy; edaExpCoolingSchedule sched(0, 50, 0.98); edaBestAspirCrit aspir; edaStaticTabu tabu(1200); sched2Opt opt; edaPopulation pop; pop.init(route, N); edaLoopCondition crit( 1500 ); edaLoopCondition loop(1); edaEliteCollect elite; edaSA saSearch(opt, sched, crit); edaTS tsSearch(opt, aspir, tabu, crit); edaHC hcSearch(opt, stgy, crit); unsigned int tsid0 = workflow.insertVertex (tsSearch); unsigned int said1 = workflow.insertVertex (saSearch); unsigned int said2 = workflow.insertVertex (saSearch); unsigned int said3 = workflow.insertVertex (saSearch); unsigned int hcid4 = workflow.insertVertex (hcSearch, elite); workflow.insertEdge(tsid0, said1); workflow.insertEdge(tsid0, said2); workflow.insertEdge(tsid0, said3); workflow.insertEdge(said1, hcid4); workflow.insertEdge(said2, hcid4); workflow.insertEdge(said3, hcid4); workflow.insertLoop(hcid4, tsid0, loop); workflow.set(graph); workflow.search(pop); schedSolution& result = *(schedSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { schedProblem graph(argv[1]); schedSolution route(graph); edaExpCoolingSchedule sched(0, N, 0.98); sched2Opt opt; edaPopulation pop; pop.init(route, 1); edaTimeCondition crit( N/21. ); edaRankSelection rank; edaPMCrossover cross; cross.set( N / 20 ); edaRandSwapMutation mute; edaSA saSearch(opt, sched, crit); edaGA gaSearch(rank, cross, mute, crit); unsigned int said[N], gaid; for(unsigned int i = 0; i < N; i++) { said[i] = workflow.insertVertex (saSearch); } gaid = workflow.insertVertex (gaSearch); for(unsigned int i = 0; i < N; i++) { workflow.insertEdge(said[i], gaid); } workflow.set(graph); workflow.search(pop); schedSolution& result = *(schedSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { unsigned int N = 40; tspProblem graph(argv[1]); tspSolution route(graph); edaRankSelection rank; edaPMCrossover cross; edaRandSwapMutation mute; edaLoopCondition crit( 1500 ); edaPopulation pop; pop.init(route, N); edaGA ga(rank, cross, mute, crit); workflow.set(graph); workflow.insertVertex(ga); workflow.search(pop); tspSolution& result = *(tspSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }
int main(int argc, char** argv) { EDAMetasearchStart(argc, argv); if (argc != 2) { std::cerr << "Usage : ./" << __progname << " [instance]" << std::endl; } else { tspProblem graph(argv[1]); tspSolution route(graph); edaBestImprovement stgy; edaLoopCondition loop; tsp2Opt opt; edaHC hcSearch(opt, stgy, loop); edaTimeCondition crit(N); edaRankSelection rank; edaPMCrossover cross; edaRandSwapMutation mute; cross.set( N / 20 ); edaPopulation pop; pop.init(route, N); #if COMM_MPI edaLoopCondition noLoop(0); edaLoopCondition oneLoop(1); edaHC trash(opt, stgy, noLoop); edaGA gaSearch(rank, cross, mute, oneLoop); unsigned int trashid, hcid[N], gaid; trashid = workflow.insertVertex(trash); for(unsigned int i = 0; i < N; i++) { edaIDCollect clect(i); hcid[i] = workflow.insertVertex (hcSearch, clect); } gaid = workflow.insertVertex (gaSearch); for(unsigned int i = 0; i < N; i++) { workflow.insertEdge(trashid, hcid[i]); workflow.insertEdge(hcid[i], gaid); } workflow.insertLoop(gaid, trashid, crit); #else edaRateAdapt adapt(hcSearch); edaMA ma(rank, cross, mute, adapt, crit); workflow.insertVertex(ma); #endif workflow.set(graph); workflow.search(pop); tspSolution& result = *(tspSolution*) pop[pop.best()]; cout << "[Route] " << result << endl; cout << "[Fitness] " << result.evaluate () << endl; } EDAMetasearchStop(); return 0; }