Created by Scott Robert Ladd at Coyote Gulch Productions.
A potential solution to the problem at hand. More...
#include <function_optimizer.h>
To support a wide variety of applications, I defined a function solution as a vector of doubles. This allows functions of any dimension to be optimized (within platform limits, of course). Note that the solution begins with an empty vector; this is because the number of elements and their initialization is application specific. Initialization of the genes takes place in the constructor for function_optimizer through a pointer to a user-supplied function.
libevocosm::function_solution::function_solution | ( | ) | [inline] |
Creates an empty solution.
libevocosm::function_solution::function_solution | ( | int | a_nargs, |
double | a_minarg, | ||
double | a_maxarg | ||
) | [inline] |
Creates a new solution with an empty vector.
References libevocosm::globals::g_random, libevocosm::organism< vector< double > >::genes, and libevocosm::prng::get_real().
libevocosm::function_solution::function_solution | ( | const vector< double > & | a_source | ) | [inline] |
Constructs a new function solution from a set of genes
libevocosm::function_solution::function_solution | ( | const organism< vector< double > > & | a_source | ) | [inline] |
Constructs a function solution from a base-class object.
a_source | - The source object |
libevocosm::function_solution::function_solution | ( | const function_solution & | a_source | ) | [inline] |
Duplicates an existing object.
a_source | - The source object |
virtual libevocosm::function_solution::~function_solution | ( | ) | [inline, virtual] |
Satisfies the requirements of the base class; does nothing
virtual void libevocosm::function_solution::child_copy | ( | const organism & | a_source | ) | [inline, protected, virtual] |
used to cast base class pointer to concrete class
References value.
virtual bool libevocosm::function_solution::operator< | ( | const organism< vector< double > > & | a_right | ) | const [inline, virtual] |
Returns true if the target object is greater than a_source. While the operator may be "less than", what it really meands for algorithms is "comes before" -- and I want the highest fitness to come first.
a_right | - Right hand argument for less than operator |
a_right.fitness
; false otherwise References libevocosm::organism< vector< double > >::fitness.
function_solution& libevocosm::function_solution::operator= | ( | const function_solution & | a_source | ) | [inline] |
Assigns the state of one solution to another.
a_source | - The source object |
References value.
Value is the actual computed value of this solution, which may or may not correspond directly to fitness. For example, when minimizing a function, the lowest value may correspond to the highest fitness. Generally, this is a display property.
Referenced by child_copy(), operator=(), and libevocosm::function_landscape::test().
© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.