Beispiel #1
0
/**
 * Will construct ZDT6.
 *
 * @see problem::base constructors.
 */
zdt6::zdt6():base(10,0,2)
{
	// Set bounds.
	set_lb(0.0);
	set_ub(1.0);
	m_pi = 4*atan(1.0);
}
Beispiel #2
0
/**
 * Search bounds are set to \f$ x \in \left[ 0,10 \right] \f$ and \f$ y \in \left[ -10,10 \right]\f$.
 */
snopt_toyprob::snopt_toyprob():base(2,0,1,2,2)
{
	const double lb[] = {0,-10};
	const double ub[] = {10,10};
	set_lb(lb);
	set_ub(ub);
}
Beispiel #3
0
/**
 * Will construct an n dimensional Levy problem.
 *
 * @param[in] n integer dimension of the problem.
 *
 * @see problem::base constructors.
 */
levy5::levy5(int n):base(n)
{
	if (n < 2) {
		pagmo_throw(value_error,"the Levy5 problem's dimension must be at least 2");
	}
	// Set bounds.
	set_lb(-100);
	set_ub(100);
}
Beispiel #4
0
/**
 * Construct the problem from its dimension.
 * Setting cub=clb=0 creates an instance of the original Luksan Vlcek equality constrained problem, example  5.3
 * Using clb < cub allows the obtain a problem formulation with inequality constraints
 *
 * @param[in] N Problem dimension
 * @param[in] clb lower bounds for the constraints.
 * @param[in] cub upper bounds for the constraints.
 * @throws value_error if N is smaller than 6 and N+2 (the resulting problem dimension)
 * is not multiple of 4, cub < clb
 *
 * @see L.Luksan and J.Vlcek, "Sparse and Parially Separable Test Problems for Unconstrained and Equality Constrained Optimization"
 */
luksan_vlcek_3::luksan_vlcek_3(int N, const double &clb, const double &cub):base(__check__(N),0,1,2*2,2*2)
{
	if (clb > cub)
	{
		pagmo_throw(value_error,"constraints lower bound is higher than the upper bound");
	}
	set_lb(-5);
	set_ub(5);
	m_clb = std::vector<double>(2,clb);
	m_cub = std::vector<double>(2,cub);
}
Beispiel #5
0
 /**
  * @param[in] n_cities number of cities
  * @param[in] nc total number of constraints
  * @param[in] nic total number of inequality constraints
  * @param[in] encoding encoding_type, i.e. one of base_tsp::CITIES, base_tsp::FULL, base_tsp::RANDOMKEYS
  */
 base_tsp::base_tsp(int n_cities, int nc, int nic, encoding_type encoding): 
     base(
         (encoding==FULL ? n_cities*(n_cities-1): n_cities), 
         (encoding==RANDOMKEYS ? 0 : (encoding==FULL ? n_cities*(n_cities-1):n_cities)), 
         1, nc, nic, 0.0
     ), 
     m_encoding(encoding), 
     m_n_cities(n_cities)
 {
     switch( m_encoding ) {
         case FULL:
             set_lb(0);
             set_ub(1);
             break;
         case RANDOMKEYS:
             set_lb(0);
             set_ub(1);
             break;
         case CITIES:
             set_lb(0);
             set_ub(m_n_cities-1);
             break;
     }
 }
Beispiel #6
0
/**
 * Will construct an lavor_maculan problem with hydrocarbon chain of N atoms (N-3 parameters).
 *
 * @param[in] atoms number of atoms
 *
 * @see problem::base constructors.
 */
lavor_maculan::lavor_maculan(int atoms): base(atoms - 3)
{
	if (atoms <= 0 || atoms < 4) {
		pagmo_throw(value_error, "number of atoms for lavor-maculan problem must be positive and greater than 3");
	}
	// Set bounds.
	set_lb(0.0);
	set_ub(5.0);

	// Initialise global minima vector
	std::vector<decision_vector> best_x(1);
	// Single global minimum of Lavor Maculan is a repeating sequence of
	// (1.039195303, 3.141592654, 1.039195303, 3.141592654, 1.039195303, ...)
	double rep[] = {1.039195303, 3.141592654};
	for(int i = 0; i < atoms - 3; ++i) {
		best_x[0].push_back(rep[i % 2]);
	}

	set_best_x(best_x);
}
Beispiel #7
0
/**
 * Will construct an n dimensional Michalewicz problem.
 *
 * @param[in] n integer dimension of the problem.
 * @param[in] m sin factor exponent 
 *
 * @see problem::base constructors.
 */
michalewicz::michalewicz(int n, int m):base(n), m_m(m) {
	// Set bounds.
	set_lb(0);
	set_ub(boost::math::constants::pi<double>()); //pi
}
Beispiel #8
0
/**
 * Will construct an n dimensional De Jong's problem.
 *
 * @param[in] n integer dimension of the problem.
 *
 * @see problem::base constructors.
 */
dejong::dejong(int n):base(n) {
	set_lb(-5.12);
	set_ub(5.12);
}
Beispiel #9
0
/**
 * Will construct an n dimensional Rastrigin problem.
 *
 * @param[in] n integer dimension of the problem.
 *
 * @see problem::base constructors.
 */
rastrigin::rastrigin(int n):base(n)
{
	// Set bounds.
	set_lb(-5.12);
	set_ub(5.12);
}
Beispiel #10
0
/**
 * Will construct an n dimensional Rosenbrock problem.
 *
 * @param[in] n integer dimension of the problem.
 *
 * @see problem::base constructors.
 */
rosenbrock::rosenbrock(int n):base(n)
{
	// Set bounds.
	set_lb(-5.0);
	set_ub(10);
}
Beispiel #11
0
/**
 * Will construct ZDT2.
 *
 * @see problem::base constructors.
 */
zdt2::zdt2():base(30,0,2)
{
	// Set bounds.
	set_lb(0.0);
	set_ub(1.0);
}
Beispiel #12
0
/**
 * Will construct an n dimensional Schwefel problem.
 *
 * @param[in] n integer dimension of the problem.
 *
 * @see problem::base constructors.
 */
schwefel::schwefel(int n):base(n)
{
	// Set bounds.
	set_lb(-500);
	set_ub(500);
}