本文整理汇总了C++中problem::base_ptr::feasibility_x方法的典型用法代码示例。如果您正苦于以下问题:C++ base_ptr::feasibility_x方法的具体用法?C++ base_ptr::feasibility_x怎么用?C++ base_ptr::feasibility_x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类problem::base_ptr
的用法示例。
在下文中一共展示了base_ptr::feasibility_x方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: worst
double worst(archipelago a, problem::base_ptr original_problem) {
double retval = - boost::numeric::bounds<double>::highest();
for (archipelago::size_type i = 0; i< a.get_size(); ++i) {
// test feasibility
if(original_problem->feasibility_x(a.get_island(i)->get_population().champion().x))
retval = std::max(retval, a.get_island(i)->get_population().champion().f[0]);
}
return retval;
}
示例2: std_dev
double std_dev(archipelago a, double mean, problem::base_ptr original_problem) {
double retval = 0;
for (archipelago::size_type i = 0; i< a.get_size(); ++i) {
// test feasibility
if(original_problem->feasibility_x(a.get_island(i)->get_population().champion().x))
retval += pow((a.get_island(i)->get_population().champion().f[0] - mean),2);
}
return sqrt(retval / a.get_size());
}
示例3: mean
double mean(archipelago a, problem::base_ptr original_problem) {
double retval = 0;
int count_feasible_arch = 0;
for (archipelago::size_type i = 0; i< a.get_size(); ++i) {
// test feasibility
if(original_problem->feasibility_x(a.get_island(i)->get_population().champion().x)) {
retval += a.get_island(i)->get_population().champion().f[0];
count_feasible_arch++;
}
}
if(count_feasible_arch != 0)
return retval / count_feasible_arch;
else
return 0.;
}