25 #include <boost/math/constants/constants.hpp>
27 #include "../exceptions.h"
30 #include "welded_beam.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[] = {0.1,0.1,0.1,0.1};
60 const double ub[] = {2.,10.,10.,2.};
74 f[0] = 1.10471 * x[0]*x[0] * x[1] + 0.04811 * x[2] * x[3] * (14. + x[1]);
84 double t_max = 13600.;
85 double s_max = 30000.;
88 double M = P*(L + x[1] / 2.);
89 double R = std::sqrt(0.25 * (x[1]*x[1] + (x[0] + x[2]) * (x[0] + x[2])));
90 double J = 2. / std::sqrt(2.) * x[0] * x[1] * (x[1]*x[1] / 12. + 0.25 *
91 (x[0] + x[2])*(x[0] + x[2]));
92 double P_c = (4.013 * E / (6. * L*L)) * x[2] * x[3]*x[3]*x[3] *
93 (1 - 0.25 * x[2] * std::sqrt(E / G) / L);
94 double t1 = P / (std::sqrt(2.) * x[0] * x[1]);
95 double t2 = M * R / J;
96 double t = sqrt(t1*t1 + t1 * t2 * x[1] / R + t2*t2);
97 double s = 6. * P * L / (x[3] * x[2]*x[2]);
98 double d = 4. * P * L*L*L / (E*x[3] * x[2]*x[2]*x[2]);
103 c[3] = 0.10471 * x[0]*x[0] + 0.04811 * x[2] * x[3] * (14.0 + x[1]) - 5.0;
111 std::string retval(
"Welded beam");
115 void welded_beam::initialize_best(
void)
117 std::vector<decision_vector> best_x;
121 const double x_vector[] = {0.202369, 3.544214, 9.048210, 0.205723};
124 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 set_best_x(const std::vector< decision_vector > &)
Sets the best known decision vectors.
void compute_constraints_impl(constraint_vector &, const decision_vector &) const
Implementation of the constraint function.
std::string get_name() const
Get problem's name.
welded_beam()
Constructor.
base_ptr clone() const
Clone method.
void objfun_impl(fitness_vector &, const decision_vector &) const
Implementation of the objective function.
std::vector< double > fitness_vector
Fitness vector type.
The welded beam design problem: Constrained Real-Parameter Optimization.
std::vector< double > constraint_vector
Constraint vector type.
void set_bounds(const decision_vector &, const decision_vector &)
Bounds setter from pagmo::decision_vector.