28 #include "../exceptions.h"
35 if( method > 2 || method < 0) {
36 pagmo_throw(value_error,
"The constrained to multi-objective method must be set to OBJ_CSTRS for Coello type constrained to multi-objective, to OBJ_CSTRSVIO for COMOGO type constrained to nobj+1 objectives problem or to OBJ_EQVIO_INEQVIO for COMOGO type constrained to nobj+2 objectives problem.");
40 pagmo_throw(value_error,
"The original problem has no constraints.");
68 namespace pagmo {
namespace problem {
82 problem.get_dimension(),
83 problem.get_i_dimension(),
84 __mo_dimension__(problem, method),
87 std::vector<double>()),
114 for(
c_size_type i=0; i<number_of_constraints; i++){
116 number_of_violated_constraints += 1;
124 for(
c_size_type i=0; i<number_of_constraints; i++) {
125 if(i<number_of_eq_constraints){
126 c[i] = std::abs(c[i]) - c_tol.at(i);
129 c[i] = c[i] - c_tol.at(i);
140 f[i] = original_f.at(i);
148 for(
c_size_type i=0; i<number_of_constraints; i++) {
150 f[original_nbr_obj+i] = c.at(i);
151 }
else if(number_of_violated_constraints != 0) {
152 f[original_nbr_obj+i] = number_of_violated_constraints;
154 f[original_nbr_obj+i] = 0.;
156 f[original_nbr_obj+i] += original_f.at(j);
164 for(
c_size_type i=0; i<number_of_constraints; i++) {
166 f[original_nbr_obj] += c.at(i);
174 for(
c_size_type i=0; i<number_of_eq_constraints; i++) {
176 f[original_nbr_obj] += c.at(i);
180 for(
c_size_type i=number_of_eq_constraints; i<number_of_constraints; i++) {
182 f[original_nbr_obj+1] += c.at(i);
188 pagmo_throw(value_error,
"Error: There are only 3 methods for the constrained to multi-objective!");
199 std::ostringstream oss;
201 oss <<
"\n\tConstraints handled with constrained to multi-objective, method ";
208 oss <<
"OBJ_CSTRSVIO ";
212 oss <<
"OBJ_EQVIO_INEQVIO ";
226 method =
"OBJ_CSTRS ";
230 method =
"OBJ_CSTRSVIO ";
234 method =
"OBJ_EQVIO_INEQVIO ";
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
base_ptr clone() const
Clone method.
method_type
Mechanism used to deal with constraints in the objectives.
fitness_vector::size_type f_size_type
Fitness' size type: the same as pagmo::fitness_vector's size type.
void objfun_impl(fitness_vector &, const decision_vector &) const
Each constraint violation is transformed into one objective.
The total constraint violation is addd as two objectives (equalities + inequalities) ...
con2mo(const base &=cec2006(4), const method_type=OBJ_CSTRS)
The total constraint violation is addd as one objective.
std::vector< double > fitness_vector
Fitness vector type.
c_size_type get_c_dimension() const
Return global constraints dimension.
std::vector< double > constraint_vector
Constraint vector type.
std::string get_name() const
Get problem's name.
std::string human_readable_extra() const
Extra human readable info for the problem.
Constrainted to Multi-Objective meta-problem.
f_size_type get_f_dimension() const
Return fitness dimension.
constraint_vector::size_type c_size_type
Constraints' size type: the same as pagmo::constraint_vector's size type.