本文整理汇总了C++中Transformation::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::getNext方法的具体用法?C++ Transformation::getNext怎么用?C++ Transformation::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::getNext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
vector<int> *Greedy::solve(Generate *pgenData, unsigned int pintMaxIterCount, string ovFileName) {
_timer.start();
DataSaver *vSaver = DataSaver::GetIterationFile(ovFileName + ".vec");
int noSeenN = 0;
vector<int> *best = pgenData->getRandomResult();
int bestScore = pgenData->calculateWholeDistance(best);
Transformation *t = new Transformation2OPT();
vector<int> *current = NULL;
bool progress; //contains progress flag
_ovallSaver->saveOverallLine(ovFileName, _timer.getRunTime(), 0, 0, bestScore);
for (unsigned int i = 0; i < pintMaxIterCount; i++) {
progress = false;
t->reset(best);
//iterate until better solution is found
while(t->getNext(¤t)) {
noSeenN++;
int currScore = pgenData->calculateWholeDistance(current);
if (currScore < bestScore) {
progress = true;
delete best;
best = current;
bestScore = currScore;
break;
} else {
delete current;
}
}
_ovallSaver->saveOverallLine(ovFileName, _timer.getRunTime(), i+1, noSeenN, bestScore);
if (!progress) {
vSaver->saveLine("greedy", best);
delete vSaver;
return best;
}
}
vSaver->saveLine("greedy", best);
delete vSaver;
return best;
}