OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Variator< ind_t, CrossoverOperator, MutationOperator > Class Template Reference

#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...
 

Detailed Description

template<class ind_t, template< class > class CrossoverOperator, template< class > class MutationOperator>
class Variator< ind_t, CrossoverOperator, MutationOperator >

Definition at line 44 of file Variator.h.

Constructor & Destructor Documentation

◆ Variator()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
Variator< ind_t, CrossoverOperator, MutationOperator >::Variator ( std::vector< std::string >  dNames,
Optimizer::bounds_t  dVarBounds,
Expressions::Named_t  constraints,
CmdArguments_t  args 
)
inline

◆ ~Variator()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
Variator< ind_t, CrossoverOperator, MutationOperator >::~Variator ( )
inline

Definition at line 85 of file Variator.h.

Member Function Documentation

◆ drand()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
double Variator< ind_t, CrossoverOperator, MutationOperator >::drand ( double  range)
inlineprivate

Get a random double between [0, range]

Parameters
[in]rangeof random number
Returns
random double value between [0, range]

Definition at line 320 of file Variator.h.

Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::variate().

◆ hasMoreIndividualsToEvaluate()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
bool Variator< ind_t, CrossoverOperator, MutationOperator >::hasMoreIndividualsToEvaluate ( )
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.

◆ infeasible()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
void Variator< ind_t, CrossoverOperator, MutationOperator >::infeasible ( boost::shared_ptr< ind_t >  ind)
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().

Here is the call graph for this function:

◆ initial_population()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
void Variator< ind_t, CrossoverOperator, MutationOperator >::initial_population ( size_t  sizeInitial,
std::string  fname 
)
inline

create an initial population

Definition at line 94 of file Variator.h.

References Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual().

Here is the call graph for this function:

◆ new_individual() [1/3]

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
void Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual ( )
inlineprotected

◆ new_individual() [2/3]

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
void Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual ( boost::shared_ptr< ind_t >  ind)
inlineprotected

◆ new_individual() [3/3]

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
void Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual ( Individual::genes_t dvars)
inlineprotected

◆ popIndividualToEvaluate()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
boost::shared_ptr<ind_t> Variator< ind_t, CrossoverOperator, MutationOperator >::popIndividualToEvaluate ( )
inline

◆ population()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
boost::shared_ptr< Population<ind_t> > Variator< ind_t, CrossoverOperator, MutationOperator >::population ( )
inline

◆ variate()

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
void Variator< ind_t, CrossoverOperator, MutationOperator >::variate ( std::vector< unsigned int >  parents)
inline

Member Data Documentation

◆ args_

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
CmdArguments_t Variator< ind_t, CrossoverOperator, MutationOperator >::args_
private

◆ constraints_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
Expressions::Named_t Variator< ind_t, CrossoverOperator, MutationOperator >::constraints_m
private

◆ dNames_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
std::vector<std::string> Variator< ind_t, CrossoverOperator, MutationOperator >::dNames_m
private

◆ dVarBounds_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
Optimizer::bounds_t Variator< ind_t, CrossoverOperator, MutationOperator >::dVarBounds_m
private

bounds on design variables

Definition at line 306 of file Variator.h.

Referenced by Variator< ind_t, CrossoverOperator, MutationOperator >::new_individual().

◆ individualsToEvaluate_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
std::queue<unsigned int> Variator< ind_t, CrossoverOperator, MutationOperator >::individualsToEvaluate_m
private

◆ mutationProbability_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
double Variator< ind_t, CrossoverOperator, MutationOperator >::mutationProbability_m
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().

◆ population_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
boost::shared_ptr< Population<ind_t> > Variator< ind_t, CrossoverOperator, MutationOperator >::population_m
private

◆ recombinationProbability_m

template<class ind_t , template< class > class CrossoverOperator, template< class > class MutationOperator>
double Variator< ind_t, CrossoverOperator, MutationOperator >::recombinationProbability_m
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().


The documentation for this class was generated from the following file: