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;
}
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());
}
Esempio n. 3
0
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.;
}