本文整理汇总了C++中Population::calcBestIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ Population::calcBestIndex方法的具体用法?C++ Population::calcBestIndex怎么用?C++ Population::calcBestIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Population
的用法示例。
在下文中一共展示了Population::calcBestIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildModificationRequest
/**
* This method builds a ModificationRequest srv
* For stop operator, the path can be retreived from srv
* */
void Modifier::buildModificationRequest(const Population& pop, bool imminent_collision, ramp_msgs::ModificationRequest& result)
{
// Push the target paths onto the modification request
std::vector<int> targets;
if(!imminent_collision || (move_dist_ > 100 && move_dir_ > 100))
{
////ROS_INFO("Modifier: No IC");
result.request.op = getOperator();
targets = getTargets(result.request.op, pop);
}
else
{
////ROS_INFO("Modifier: Calling Move because IC exists");
result.request.op = "move";
targets.push_back(pop.calcBestIndex());
}
//////ROS_INFO("targets.size(): %i", (int)targets.size());
for(unsigned int i=0;i<targets.size();i++)
{
//std::cout<<"\nTarget index: "<<targets.at(i);
//std::cout<<"\nPath "<<targets.at(i)<<" size: "<<pop.paths_.at(targets.at(i)).size()<<"\n";
result.request.paths.push_back(
pop.paths_.at(targets.at(i)).buildPathMsg());
}
result.request.move_dir = move_dir_;
result.request.move_dist = move_dist_;
} // End buildModificationRequest