Created by Scott Robert Ladd at Coyote Gulch Productions.
A potential solution to the problem at hand. More...
#include <function_optimizer.h>
Public Member Functions | |
| function_solution () | |
| Default contructor. More... | |
| function_solution (int a_nargs, double a_minarg, double a_maxarg) | |
| Creation constructor. More... | |
| function_solution (const vector< double > &a_source) | |
| Construct from raw genes. More... | |
| function_solution (const organism< vector< double > > &a_source) | |
| Construct from base class. More... | |
| function_solution (const function_solution &a_source) | |
| Copy constructor. More... | |
| virtual | ~function_solution () |
| Virtual destructor. More... | |
| function_solution & | operator= (const function_solution &a_source) |
| Assignment operator. More... | |
| virtual bool | operator< (const organism< vector< double > > &a_right) const |
| Comparison operator for algorithms. More... | |
Public Member Functions inherited from libevocosm::organism< vector< double > > | |
| organism () | |
| Creation constructor. More... | |
| organism (const vector< double > &a_genes) | |
| Value constructor. More... | |
| organism (const organism &a_source) | |
| Copy constructor. More... | |
| virtual | ~organism () |
| Virtual destructor. More... | |
| organism & | operator= (const organism &a_source) |
| assignment operator More... | |
| organism & | operator= (const vector< double > &a_genes) |
| assignment operator More... | |
| virtual bool | operator< (const organism &a_right) const |
| Comparison operator for algorithms. More... | |
| virtual void | reset () |
| Resets an object to it's initial state. More... | |
Public Attributes | |
| double | value |
Public Attributes inherited from libevocosm::organism< vector< double > > | |
| double | fitness |
| vector< double > | genes |
Protected Member Functions | |
| virtual void | child_copy (const organism &a_source) |
Additional Inherited Members | |
Protected Types inherited from libevocosm::fopt_global | |
| typedef vector< double > | t_function (vector< double > a_args) |
| Definition of a function type. More... | |
Static Protected Member Functions inherited from libevocosm::globals | |
| static size_t | rand_index (size_t n) |
| Static function to allow use of g_random function pointer in random_shuffle. | |
| static void | set_seed (uint32_t a_seed) |
| Set the seed for the random number generator. | |
| static uint32_t | get_seed () |
| Set the seed for the random number generator. | |
| static std::string | version () |
| Get version number. | |
Static Protected Attributes inherited from libevocosm::globals | |
| static prng | g_random |
| A shared random number generator. | |
| static std::string | g_version |
| Version number. | |
Static Protected Attributes inherited from libevocosm::fopt_global | |
| static evoreal | g_evoreal |
| Provides mutation and crossover services for doubles. | |
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.
|
inline |
Creates an empty solution.
|
inline |
Creates a new solution with an empty vector.
References libevocosm::globals::g_random, libevocosm::organism< vector< double > >::genes, and libevocosm::prng::get_real().
|
inline |
Constructs a new function solution from a set of genes
|
inline |
Constructs a function solution from a base-class object.
| a_source | - The source object |
|
inline |
Duplicates an existing object.
| a_source | - The source object |
|
inlinevirtual |
Satisfies the requirements of the base class; does nothing
|
inlineprotectedvirtual |
used to cast base class pointer to concrete class
References value.
|
inlinevirtual |
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.
|
inline |
Assigns the state of one solution to another.
| a_source | - The source object |
References value.
| double libevocosm::function_solution::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.