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

#include <individual.hpp>

List of all members.

Public Member Functions

 individual (size_t varCount)
 individual (const de::DVector &vars)
void init (constraints_ptr constraints)
double cost () const
void ensureConstraints (constraints_ptr constraints, de::DVectorPtr origin)
de::DVectorPtr vars () const
de::Doubleoperator[] (size_t index)
const de::Doubleoperator[] (size_t index) const
void setCost (double cost)
bool operator<= (const individual &ind) const
bool operator< (const individual &ind) const
bool better_or_equal (const individual_ptr ind, bool minimize) const
bool better (const individual_ptr ind, bool minimize) const
size_t size () const
std::string to_string () const

Detailed Description

An individual of a Differrential Evolution population

An individual has a set of variables and a cost associated with these variables

An individual is thread safe

Author:
adrian (12/1/2011)

Constructor & Destructor Documentation

de::individual::individual ( size_t  varCount) [inline]

constructs an individual

Author:
adrian (12/4/2011)
Parameters:
varCountthe number of variables for each individual
de::individual::individual ( const de::DVector &  vars) [inline]

constructs an individual

Author:
adrian (12/4/2011)
Parameters:
varsa vector of variables that will be copied into the internal vector of variables

Member Function Documentation

bool de::individual::better ( const individual_ptr  ind,
bool  minimize 
) const [inline]

compares the current individual with another individual based on cost. Returns true if the current cost is strictly better than the cost of the other individual, where better is either lower or higher depending on the minimize flag

Author:
adrian (12/4/2011)
Parameters:
indthe individual to compare with
minimize< if true, > if false
Returns:
bool
bool de::individual::better_or_equal ( const individual_ptr  ind,
bool  minimize 
) const [inline]

compares the current individual with another individual based on cost. Returns true if the current cost is better or equal than the cost of the other individual, where better is either lower or higher depending on the minimize flag

Author:
adrian (12/4/2011)
Parameters:
indthe individual to compare with
minimize<= if true, >= if false
Returns:
bool
double de::individual::cost ( ) const [inline]

returns the cost

Author:
adrian (12/4/2011)
Returns:
double

Here is the caller graph for this function:

void de::individual::ensureConstraints ( constraints_ptr  constraints,
de::DVectorPtr  origin 
) [inline]

Sets the variables to new random values within the constraints, using origin and old value

Author:
adrian (12/4/2011)
Parameters:
constraints
origin
void de::individual::init ( constraints_ptr  constraints) [inline]

Initialized the internal vector of variables with random values within the constraints

Author:
adrian (12/4/2011)
Parameters:
constraints
bool de::individual::operator< ( const individual ind) const [inline]

compares the current individual with another individual based on cost. Returns true if the current cost is strictly lower than the cost of the other individual

Author:
adrian (12/4/2011)
Parameters:
indthe individual to compare with
Returns:
bool

Here is the call graph for this function:

bool de::individual::operator<= ( const individual ind) const [inline]

compares the current individual with another individual based on cost. Returns true if the current cost is lower or equal to the cost of the other individual

Author:
adrian (12/4/2011)
Parameters:
indthe individual to compare with
Returns:
bool

Here is the call graph for this function:

de::Double& de::individual::operator[] ( size_t  index) [inline]

returns a non constant reference to a variable value based on an index, which can be used as an lvalue.

Author:
adrian (12/4/2011)
Parameters:
indexthe index of the variable whose reference to return
Returns:
de::Double&
const de::Double& de::individual::operator[] ( size_t  index) const [inline]

returns a constant reference to a variable value based on an index, which can be used as an lvalue.

Author:
adrian (12/4/2011)
Parameters:
indexthe index of the variable whose reference to return
Returns:
de::Double&
void de::individual::setCost ( double  cost) [inline]

Sets the cost

Author:
adrian (12/4/2011)
Parameters:
cost

Here is the call graph for this function:

size_t de::individual::size ( ) const [inline]

returns the size of variables vector

Author:
adrian (12/4/2011)
Returns:
size_t

Here is the caller graph for this function:

std::string de::individual::to_string ( ) const [inline]

returns a string representation of the internals of an individual (cost and list of variables)

Author:
adrian (12/4/2011)
Returns:
std::string

Here is the call graph for this function:

de::DVectorPtr de::individual::vars ( ) const [inline]

returns the internal variable vector

Author:
adrian (12/4/2011)
Returns:
de::DVectorPtr

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