Differential Evolution C++ library
de::constraints Class Reference

#include <de_constraints.hpp>

List of all members.

Public Member Functions

 constraints (size_t varCount, double defMin, double defMax)
 constraints (const std::vector< std::string > &str, size_t var_count, double def_min, double def_max)
double get_rand_value (size_t index)
double get_rand_value (size_t index, double value, double origin)
DVectorPtr get_square_zone_rand_values (const DVectorPtr origin, double sidePct) const
DVectorPtr get_middle_point ()
DVectorPtr get_rand_values () const

Detailed Description

A collection of constraints, implemented as a vector.

Is used to define the constraints for all variables used during an optimization session.

Author:
adrian (12/1/2011)

Constructor & Destructor Documentation

de::constraints::constraints ( size_t  varCount,
double  defMin,
double  defMax 
) [inline]

Initializes a collection of constraints with default values. All constraints are of type real and have the same default min and max.

Author:
adrian (12/1/2011)
Parameters:
varCountnumber of constraints
defMindefault min limit
defMaxdefault max limit
de::constraints::constraints ( const std::vector< std::string > &  str,
size_t  var_count,
double  def_min,
double  def_max 
) [inline]

Initializes a collection of constraints from string descsriptions. Currently used only for range based constraints.

A constraint can be described as "type;min;max" where type can be real or integer and min and max are the range limits.

Author:
adrian (12/1/2011)
Parameters:
stra a collection (vector) of constraint description strings, each string describing constraints for one variable
var_countthe total number of variables (can be different than the number of strings). If there are more variables than strings, the extra constraints are set to be real and use the default min and max arguments for the range
def_mindefault min value in case the number of variables is higher than the number of constraints specified as strings.
def_maxdefault max value in case the number of variables is higher than the number of constraints specified as strings.

Member Function Documentation

double de::constraints::get_rand_value ( size_t  index) [inline]

returns a random value limited to the type and range of the constraint

Author:
adrian (12/4/2011)
Returns:
double
double de::constraints::get_rand_value ( size_t  index,
double  value,
double  origin 
) [inline]

returns a random value limited to the type and range of the constraint based on a previous value and an origin

Author:
adrian (12/4/2011)
Parameters:
indexthe constraint index
valueprevious value
originorigin
Returns:
double
DVectorPtr de::constraints::get_rand_values ( ) const [inline]

Get a set of random values within the limits set by the constraints

Author:
adrian (12/13/2011)
Returns:
DVectorPtr
DVectorPtr de::constraints::get_square_zone_rand_values ( const DVectorPtr  origin,
double  sidePct 
) const [inline]

Generates a set of random values within a "hypercube" region defined by an origin and an area expressed as a percentage of the entire range

Author:
adrian (12/13/2011)
Parameters:
originthe origin coordinates of the region
sidePctthe side of the hypercube in pct of the entire side
Returns:
DVectorPtr

The documentation for this class was generated from the following file: