An individual optimized for differential evolution.
More...
#include <i_de.h>
Inherits vita::individual< i_de >.
|
(Note that these are not member functions.)
|
std::ostream & | in_line (const i_de &de, std::ostream &s) |
| Prints the genes of the individual. More...
|
|
std::ostream & | operator<< (std::ostream &s, const i_de &ind) |
|
An individual optimized for differential evolution.
- See also
- https://github.com/morinim/vita/wiki/bibliography#10
Definition at line 26 of file i_de.h.
◆ const_iterator
using vita::i_de::const_iterator = genome_t::const_iterator |
◆ genome_t
using vita::i_de::genome_t = std::vector<double> |
◆ iterator
using vita::i_de::iterator = genome_t::iterator |
◆ value_type
using vita::i_de::value_type = genome_t::value_type |
◆ i_de()
vita::i_de::i_de |
( |
const problem & |
p | ) |
|
|
explicit |
Constructs a new, random DE individual.
- Parameters
-
The process that generates the initial, random expressions has to be implemented so as to ensure that they don't violate the type system's constraints.
Definition at line 29 of file i_de.cc.
◆ begin() [1/2]
i_de::iterator vita::i_de::begin |
( |
| ) |
|
|
inline |
- Returns
- an iterator pointing to the first gene
Definition at line 119 of file i_de.h.
◆ begin() [2/2]
i_de::const_iterator vita::i_de::begin |
( |
| ) |
const |
|
inline |
- Returns
- a const iterator pointing to the first gene
Definition at line 103 of file i_de.h.
◆ crossover()
i_de vita::i_de::crossover |
( |
double |
p, |
|
|
const range_t< double > & |
f, |
|
|
const i_de & |
a, |
|
|
const i_de & |
b, |
|
|
const i_de & |
c |
|
) |
| const |
Differential evolution crossover.
- Parameters
-
[in] | p | crossover probability |
[in] | f | scaling factor range (environment.de.weight ) |
[in] | a | first parent |
[in] | b | second parent |
[in] | c | third parent (base vector) |
- Returns
- the offspring (trial vector)
The offspring, also called trial vector, is generated as follows:
offspring = crossover(this, c + F * (a - b))
first the search direction is defined by calculating a difference vector between the pair of vectors a
and b
(usually choosen at random from the population). This difference vector is scaled by using the scale factor f
. This scaled difference vector is then added to a third vector c
, called the base vector. As a result a new vector is obtained, known as the mutant vector. The mutant vector is recombined, based on a used defined parameter, called crossover probability, with the target vector this
(also called parent vector).
This way no separate probability distribution has to be used which makes the scheme completely self-organizing.
a
and b
are used for mutation, this
and c
for crossover.
Definition at line 104 of file i_de.cc.
◆ empty()
bool vita::i_de::empty |
( |
| ) |
const |
|
inline |
- Returns
true
if the individual is empty, false
otherwise
Definition at line 64 of file i_de.h.
◆ end() [1/2]
i_de::iterator vita::i_de::end |
( |
| ) |
|
|
inline |
- Returns
- an iterator pointing to (one) past the last gene
Definition at line 127 of file i_de.h.
◆ end() [2/2]
i_de::const_iterator vita::i_de::end |
( |
| ) |
const |
|
inline |
- Returns
- a const iterator pointing to (one) past the last gene
Definition at line 111 of file i_de.h.
◆ graphviz()
void vita::i_de::graphviz |
( |
std::ostream & |
s | ) |
const |
Inserts into the output stream the graph representation of the individual.
- Parameters
-
- Note
- The format used to describe the graph is the dot language (http://www.graphviz.org/).
Definition at line 51 of file i_de.cc.
◆ is_valid()
bool vita::i_de::is_valid |
( |
| ) |
const |
- Returns
true
if the individual passes the internal consistency check
Definition at line 200 of file i_de.cc.
◆ operator=()
i_de & vita::i_de::operator= |
( |
const std::vector< value_type > & |
v | ) |
|
Sets up the individual with values from a vector.
- Parameters
-
[in] | v | input vector (a point in a multidimensional space) |
- Returns
- a reference to
*this
Definition at line 188 of file i_de.cc.
◆ operator[]() [1/2]
value_type & vita::i_de::operator[] |
( |
std::size_t |
i | ) |
|
|
inline |
◆ operator[]() [2/2]
value_type vita::i_de::operator[] |
( |
std::size_t |
i | ) |
const |
|
inline |
◆ parameters()
std::size_t vita::i_de::parameters |
( |
| ) |
const |
|
inline |
- Returns
- the number of parameters stored in the individual
Definition at line 67 of file i_de.h.
◆ signature()
hash_t vita::i_de::signature |
( |
| ) |
const |
- Returns
- the signature of this individual
Identical individuals, at genotypic level, have the same signature
Definition at line 140 of file i_de.cc.
◆ in_line()
std::ostream & in_line |
( |
const i_de & |
de, |
|
|
std::ostream & |
s |
|
) |
| |
|
related |
Prints the genes of the individual.
- Parameters
-
[in] | de | data to be printed |
[out] | s | output stream |
- Returns
- a reference to the output stream
Definition at line 70 of file i_de.cc.
◆ individual< i_de >
◆ operator<<()
std::ostream & operator<< |
( |
std::ostream & |
s, |
|
|
const i_de & |
ind |
|
) |
| |
|
related |
- Parameters
-
[out] | s | output stream |
[in] | ind | individual to print |
- Returns
- output stream including
ind
Definition at line 275 of file i_de.cc.
The documentation for this class was generated from the following files: