本文整理汇总了C++中archipelago::get_island方法的典型用法代码示例。如果您正苦于以下问题:C++ archipelago::get_island方法的具体用法?C++ archipelago::get_island怎么用?C++ archipelago::get_island使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类archipelago
的用法示例。
在下文中一共展示了archipelago::get_island方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: 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;
}
示例3: getSolutions
std::string getSolutions(archipelago a) {
std::ostringstream sol;
int solSize = a.get_island(0)->get_population().champion().x.size();
for (archipelago::size_type i = 0; i< a.get_size(); ++i) {
sol << "island " << i << ": (";
for(int j = 0; j < solSize; ++j) {
sol << a.get_island(i)->get_population().champion().x[j] << ",";
}
sol << ")" << std::endl;
}
return sol.str();
}
示例4: 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.;
}
示例5: std_dev
double std_dev(archipelago a, double mean) {
double retval = 0;
for (archipelago::size_type i = 0; i< a.get_size(); ++i) {
retval += pow((a.get_island(i)->get_population().champion().f[0] - mean),2);
}
return sqrt(retval / a.get_size());
}
示例6: mean
double mean(archipelago a) {
double retval = 0;
for (archipelago::size_type i = 0; i< a.get_size(); ++i) {
retval += a.get_island(i)->get_population().champion().f[0];
}
return retval / a.get_size();
}