本文整理汇总了C++中edaMpiWorkflow类的典型用法代码示例。如果您正苦于以下问题:C++ edaMpiWorkflow类的具体用法?C++ edaMpiWorkflow怎么用?C++ edaMpiWorkflow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了edaMpiWorkflow类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
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;
}
开发者ID:mohcicin,项目名称:metaheuristics,代码行数:32,代码来源:tspSASearch.cpp
示例2: main
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;
}
开发者ID:nghiabui,项目名称:Metaheuristic,代码行数:34,代码来源:tspTSSearch.cpp
示例3: main
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;
}
开发者ID:nghiabui,项目名称:Metaheuristic,代码行数:34,代码来源:schedHCSearch.cpp
示例4: main
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;
}
开发者ID:tanthmjvn,项目名称:meta-heuristics-1.3,代码行数:59,代码来源:tspWF01Search.cpp
示例5: main
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;
}
开发者ID:nghiabui,项目名称:Metaheuristic,代码行数:52,代码来源:tspWF04Search.cpp
示例6: main
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;
}
开发者ID:nghiabui,项目名称:Metaheuristic,代码行数:57,代码来源:schedWF03Search.cpp
示例7: main
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;
}
开发者ID:nghiabui,项目名称:Metaheuristic,代码行数:36,代码来源:tspGASearch.cpp
示例8: main
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;
}
开发者ID:nghiabui,项目名称:Metaheuristic,代码行数:71,代码来源:tspMASearch.cpp
注:本文中的edaMpiWorkflow类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论