25 #include <boost/math/constants/constants.hpp>
27 #include "../exceptions.h"
30 #include "pressure_vessel.h"
32 static const std::vector<double> __constraint_tolerances__(
int c_dimension,
int ic_dimension)
34 std::vector<double> constraint_tolerances(c_dimension);
36 for(
int i=0; i<c_dimension-ic_dimension; i++) {
37 constraint_tolerances[i] = 0.0001;
40 for(
int i=c_dimension-ic_dimension; i<c_dimension; i++) {
41 constraint_tolerances[i] = 0.;
43 return constraint_tolerances;
46 namespace pagmo {
namespace problem {
59 const double lb[] = {1.,1.,10.,10.};
60 const double ub[] = {99.,99.,200.,200.};
74 f[0] = 0.6224 * x[0] * x[2] * x[3] +
75 1.7781 * x[1] * x[2]*x[2] +
76 3.1661 * x[0]*x[0] * x[3] +
77 19.84 * x[0]*x[0] * x[2];
84 c[0] = - x[0] + 0.0193 * x[2];
85 c[1] = - x[1] + 0.00954 * x[2];
86 c[2] = - boost::math::constants::pi<double>() * x[2]*x[2] * x[3] -
87 (4./3.) * boost::math::constants::pi<double>() * x[2]*x[2]*x[2] + 1296000.;
93 std::string retval(
"Pressure vessel");
97 void pressure_vessel::initialize_best(
void)
99 std::vector<decision_vector> best_x;
103 const double x_vector[] = {0.812500, 0.437500, 42.097398, 176.654050};
106 std::copy(x_vector,x_vector + x_dimension,x.begin());
boost::shared_ptr< base > base_ptr
Alias for shared pointer to base problem.
std::vector< double > decision_vector
Decision vector type.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
base_ptr clone() const
Clone method.
void set_best_x(const std::vector< decision_vector > &)
Sets the best known decision vectors.
std::string get_name() const
Get problem's name.
The pressure vessel design problem: Constrained Real-Parameter Optimization.
pressure_vessel()
Constructor.
void compute_constraints_impl(constraint_vector &, const decision_vector &) const
Implementation of the constraint function.
std::vector< double > fitness_vector
Fitness vector type.
std::vector< double > constraint_vector
Constraint vector type.
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.