|
Differential Evolution C++ library
|
#include <individual.hpp>
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::Double & | operator[] (size_t index) |
| const de::Double & | operator[] (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 |
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
| de::individual::individual | ( | size_t | varCount | ) | [inline] |
constructs an individual
| varCount | the number of variables for each individual |
| de::individual::individual | ( | const de::DVector & | vars | ) | [inline] |
constructs an individual
| vars | a vector of variables that will be copied into the internal vector of variables |
| 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
| ind | the individual to compare with |
| minimize | < if true, > if false |
| 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
| ind | the individual to compare with |
| minimize | <= if true, >= if false |
| double de::individual::cost | ( | ) | const [inline] |
returns the cost

| 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
| constraints | |
| origin |
| void de::individual::init | ( | constraints_ptr | constraints | ) | [inline] |
Initialized the internal vector of variables with random values within the constraints
| 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
| ind | the individual to compare with |

| 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
| ind | the individual to compare with |

| 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.
| index | the index of the variable whose reference to return |
| 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.
| index | the index of the variable whose reference to return |
| void de::individual::setCost | ( | double | cost | ) | [inline] |
Sets the cost
| cost |

| size_t de::individual::size | ( | ) | const [inline] |
returns the size of variables vector

| std::string de::individual::to_string | ( | ) | const [inline] |
returns a string representation of the internals of an individual (cost and list of variables)

| de::DVectorPtr de::individual::vars | ( | ) | const [inline] |
returns the internal variable vector