本文整理汇总了C++中beagle::Context::setTerminationSuccessful方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::setTerminationSuccessful方法的具体用法?C++ Context::setTerminationSuccessful怎么用?C++ Context::setTerminationSuccessful使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beagle::Context
的用法示例。
在下文中一共展示了Context::setTerminationSuccessful方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hits
/*!
* \brief Check if the evolution must terminate.
* \param inDeme Actual deme of the evolution.
* \param ioContext Actual evolution context.
* \return True if the ending criterion is reached, false if not.
*/
bool GP::TermMaxHitsOp::terminate(const Beagle::Deme& inDeme, Beagle::Context& ioContext)
{
Beagle_StackTraceBeginM();
if(mMaxHits->getWrappedValue() == 0) return false;
for(unsigned int i=0; i<inDeme.size(); i++) {
const GP::FitnessKoza::Handle lFitness =
castHandleT<const GP::FitnessKoza>(inDeme[i]->getFitness());
if(mMaxHits->getWrappedValue() <= lFitness->getHits()) {
Beagle_LogInfoM(
ioContext.getSystem().getLogger(),
"termination", "Beagle::GP::TermMaxHitsOp",
std::string("Maximum number of hits (") +
uint2str(mMaxHits->getWrappedValue()) +
std::string(") termination criterion reached")
);
Beagle_LogInfoM(
ioContext.getSystem().getLogger(),
"termination", "Beagle::GP::TermMaxHitsOp",
std::string("The ")+uint2ordinal(i+1) +
std::string(" individual of the deme has ") +
uint2str(lFitness->getHits())+std::string(" hits")
);
ioContext.setTerminationSuccessful();
return true;
}
}
Beagle_LogTraceM(
ioContext.getSystem().getLogger(),
"termination", "Beagle::GP::TermMaxHitsOp",
std::string("Maximum number of hits (") +
uint2str(mMaxHits->getWrappedValue()) +
std::string(") termination criterion not reached")
);
return false;
Beagle_StackTraceEndM("bool GP::TermMaxHitsOp::terminate(const Beagle::Deme& inDeme, Beagle::Context& ioContext)");
}