OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
#include <Variator.h>
Inherits CrossoverOperator< ind_t >, and MutationOperator< ind_t >.
Public Member Functions | |
Variator (std::vector< std::string > dNames, Optimizer::bounds_t dVarBounds, Expressions::Named_t constraints, CmdArguments_t args) | |
~Variator () | |
boost::shared_ptr< Population< ind_t > > | population () |
void | initial_population (size_t sizeInitial, std::string fname) |
create an initial population More... | |
void | infeasible (boost::shared_ptr< ind_t > ind) |
set an individual as infeasible: replace with a new individual More... | |
bool | hasMoreIndividualsToEvaluate () |
returns false if all individuals have been evaluated More... | |
boost::shared_ptr< ind_t > | popIndividualToEvaluate () |
return next individual to evaluate More... | |
void | variate (std::vector< unsigned int > parents) |
Protected Member Functions | |
void | new_individual (Individual::genes_t &dvars) |
create a new individual More... | |
void | new_individual () |
create a new individual More... | |
void | new_individual (boost::shared_ptr< ind_t > ind) |
copy an individual More... | |
Private Member Functions | |
double | drand (double range) |
Private Attributes | |
boost::shared_ptr< Population< ind_t > > | population_m |
population of individuals More... | |
CmdArguments_t | args_ |
user specified command line arguments More... | |
std::queue< unsigned int > | individualsToEvaluate_m |
keep a queue of individuals that have to be evaluated More... | |
std::vector< std::string > | dNames_m |
names of the design variables More... | |
Optimizer::bounds_t | dVarBounds_m |
bounds on design variables More... | |
Expressions::Named_t | constraints_m |
constraints More... | |
double | mutationProbability_m |
probability of applying the mutation operator More... | |
double | recombinationProbability_m |
probability of applying the recombination operator More... | |
Definition at line 44 of file Variator.h.
|
inline |
Definition at line 50 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::args_, Variator< ind_t, CrossoverOperator, MutationOperator >::constraints_m, Variator< ind_t, CrossoverOperator, MutationOperator >::dNames_m, Expressions::find(), Variator< ind_t, CrossoverOperator, MutationOperator >::mutationProbability_m, Variator< ind_t, CrossoverOperator, MutationOperator >::population_m, and Variator< ind_t, CrossoverOperator, MutationOperator >::recombinationProbability_m.
|
inline |
Definition at line 85 of file Variator.h.
|
inlineprivate |
Get a random double between [0, range]
[in] | range | of random number |
Definition at line 320 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::variate().
|
inline |
returns false if all individuals have been evaluated
Definition at line 164 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m.
|
inline |
set an individual as infeasible: replace with a new individual
Definition at line 158 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual(), and Variator< ind_t, CrossoverOperator, MutationOperator >::population_m.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::variate().
|
inline |
create an initial population
Definition at line 94 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual().
|
inlineprotected |
create a new individual
Definition at line 280 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::constraints_m, Variator< ind_t, CrossoverOperator, MutationOperator >::dNames_m, Variator< ind_t, CrossoverOperator, MutationOperator >::dVarBounds_m, Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m, and Variator< ind_t, CrossoverOperator, MutationOperator >::population_m.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::infeasible(), Variator< ind_t, CrossoverOperator, MutationOperator >::initial_population(), and Variator< ind_t, CrossoverOperator, MutationOperator >::variate().
|
inlineprotected |
copy an individual
Definition at line 286 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m, and Variator< ind_t, CrossoverOperator, MutationOperator >::population_m.
|
inlineprotected |
create a new individual
Definition at line 273 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::constraints_m, Variator< ind_t, CrossoverOperator, MutationOperator >::dNames_m, Variator< ind_t, CrossoverOperator, MutationOperator >::dVarBounds_m, Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m, and Variator< ind_t, CrossoverOperator, MutationOperator >::population_m.
|
inline |
return next individual to evaluate
Definition at line 169 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m, and Variator< ind_t, CrossoverOperator, MutationOperator >::population_m.
|
inline |
Definition at line 89 of file Variator.h.
References Variator< ind_t, CrossoverOperator, MutationOperator >::population_m.
|
inline |
Performs variation (recombination and mutation) on a set of parent individuals.
[in] | parents |
Definition at line 180 of file Variator.h.
References a, Variator< ind_t, CrossoverOperator, MutationOperator >::args_, Variator< ind_t, CrossoverOperator, MutationOperator >::drand(), endl(), Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m, Variator< ind_t, CrossoverOperator, MutationOperator >::infeasible(), Variator< ind_t, CrossoverOperator, MutationOperator >::mutationProbability_m, Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual(), Variator< ind_t, CrossoverOperator, MutationOperator >::population_m, and Variator< ind_t, CrossoverOperator, MutationOperator >::recombinationProbability_m.
|
private |
user specified command line arguments
Definition at line 298 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::variate(), and Variator< ind_t, CrossoverOperator, MutationOperator >::Variator().
|
private |
constraints
Definition at line 308 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual(), and Variator< ind_t, CrossoverOperator, MutationOperator >::Variator().
|
private |
names of the design variables
Definition at line 304 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual(), and Variator< ind_t, CrossoverOperator, MutationOperator >::Variator().
|
private |
bounds on design variables
Definition at line 306 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual().
|
private |
keep a queue of individuals that have to be evaluated
Definition at line 301 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::hasMoreIndividualsToEvaluate(), Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual(), Variator< ind_t, CrossoverOperator, MutationOperator >::popIndividualToEvaluate(), and Variator< ind_t, CrossoverOperator, MutationOperator >::variate().
|
private |
probability of applying the mutation operator
Definition at line 311 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::variate(), and Variator< ind_t, CrossoverOperator, MutationOperator >::Variator().
|
private |
population of individuals
Definition at line 295 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::infeasible(), Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual(), Variator< ind_t, CrossoverOperator, MutationOperator >::popIndividualToEvaluate(), Variator< ind_t, CrossoverOperator, MutationOperator >::population(), Variator< ind_t, CrossoverOperator, MutationOperator >::variate(), and Variator< ind_t, CrossoverOperator, MutationOperator >::Variator().
|
private |
probability of applying the recombination operator
Definition at line 313 of file Variator.h.
Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::variate(), and Variator< ind_t, CrossoverOperator, MutationOperator >::Variator().