本文整理汇总了C++中UndirectedGraph::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ UndirectedGraph::copy方法的具体用法?C++ UndirectedGraph::copy怎么用?C++ UndirectedGraph::copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UndirectedGraph
的用法示例。
在下文中一共展示了UndirectedGraph::copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if ((!(card_counter == cardb)) || (!(trial_counter == 1))) {
reset_pheromone_trail();
for (list<KCT_Ant*>::iterator ant = ants.begin(); ant != ants.end(); ant++) {
(*ant)->restart_reset();
}
}
int iter = 1;
double cf = 0.0;
bool restart = false;
bool program_stop = false;
bool bs_update = false;
while (program_stop == false) {
for (list<KCT_Ant*>::iterator ant = ants.begin(); ant != ants.end(); ant++) {
for (k = 0; k < cardinality; k++) {
(*ant)->step(0.8);
}
(*ant)->evaluate();
}
if (!(newSol == NULL)) {
delete(newSol);
}
if (elite_action == "no") {
newSol = getBestDaemonSolutionInIteration();
}
else {
KCT_Ant* bestAnt = getBestDaemonAntInIteration();
bestAnt->eliteAction();
newSol = new UndirectedGraph();
newSol->copy(bestAnt->getCurrentDaemonSolution());
}
if (iter == 1) {
best = new UndirectedGraph();
printf("best %f\ttime %f\n",newSol->weight(),timer.elapsed_time(Timer::VIRTUAL));
best->copy(newSol);
restartBest = new UndirectedGraph(newSol);
results.push_back(newSol->weight());
times_best_found.push_back(timer.elapsed_time(Timer::VIRTUAL));
if (trial_counter == 1) {
biar = newSol->weight();
}
else {
if (newSol->weight() < biar) {
biar = newSol->weight();
}
}
}
else {
if (restart) {
restart = false;
restartBest->copy(newSol);
if (newSol->weight() < best->weight()) {
printf("best %f\ttime %f\n",newSol->weight(),timer.elapsed_time(Timer::VIRTUAL));
best->copy(newSol);
results[trial_counter-1] = newSol->weight();
times_best_found[trial_counter-1] = timer.elapsed_time(Timer::VIRTUAL);
if (newSol->weight() < biar) {
biar = newSol->weight();
}
}
}