OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Individual Class Reference

#include <Individual.h>

Public Types

typedef std::vector< double > genes_t
 representation of genes More...
 
typedef std::vector< std::string > names_t
 gene names More...
 
typedef std::vector< double > objectives_t
 objectives array More...
 
typedef std::vector< std::pair
< double, double > > 
bounds_t
 bounds on design variables More...
 
typedef Expressions::Named_t constraints_t
 constraints More...
 

Public Member Functions

 Individual ()
 
 Individual (bounds_t gene_bounds, names_t names, constraints_t constraints)
 create a new individual and initialize with random genes More...
 
 Individual (boost::shared_ptr< Individual > individual)
 copy another individual More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 serialization of structure More...
 
double new_gene (size_t gene_idx)
 
bool viable ()
 test if individual within bounds and constraints More...
 

Public Attributes

genes_t genes_m
 genes of an individual More...
 
objectives_t objectives_m
 values of objectives of an individual More...
 
unsigned int id_m = 0
 id More...
 

Private Member Functions

bool checkBounds ()
 check bounds More...
 
bool checkConstraints ()
 check if all constraints on design variables are checked More...
 

Private Attributes

bounds_t bounds_m
 bounds on each gene More...
 
names_t names_m
 gene names More...
 
constraints_t constraints_m
 constraints that depend only on design variables More...
 

Detailed Description

Structure for an individual in the population holding genes and objective values.

See Also
Types.h

Definition at line 21 of file Individual.h.

Member Typedef Documentation

typedef std::vector< std::pair<double, double> > Individual::bounds_t

bounds on design variables

Definition at line 32 of file Individual.h.

constraints

Definition at line 34 of file Individual.h.

typedef std::vector<double> Individual::genes_t

representation of genes

Definition at line 26 of file Individual.h.

typedef std::vector<std::string> Individual::names_t

gene names

Definition at line 28 of file Individual.h.

typedef std::vector<double> Individual::objectives_t

objectives array

Definition at line 30 of file Individual.h.

Constructor & Destructor Documentation

Individual::Individual ( )
inline

Definition at line 36 of file Individual.h.

Individual::Individual ( bounds_t  gene_bounds,
names_t  names,
constraints_t  constraints 
)
inline

create a new individual and initialize with random genes

Definition at line 40 of file Individual.h.

References bounds_m, checkConstraints(), endl(), genes_m, names_m, new_gene(), and objectives_m.

Here is the call graph for this function:

Individual::Individual ( boost::shared_ptr< Individual individual)
inline

copy another individual

Definition at line 69 of file Individual.h.

References bounds_m, constraints_m, genes_m, id_m, names_m, and objectives_m.

Member Function Documentation

bool Individual::checkBounds ( )
inlineprivate

check bounds

Definition at line 109 of file Individual.h.

References bounds_m, genes_m, max(), and min().

Referenced by viable().

Here is the call graph for this function:

bool Individual::checkConstraints ( )
inlineprivate

check if all constraints on design variables are checked

Definition at line 123 of file Individual.h.

References constraints_m, endl(), Expression::evaluate(), Expressions::find(), genes_m, Expression::getReqVars(), and names_m.

Referenced by Individual(), and viable().

Here is the call graph for this function:

double Individual::new_gene ( size_t  gene_idx)
inline

initialize the gene with index gene_idx with a new random value contained in the specified gene boundaries

Definition at line 88 of file Individual.h.

References abs(), bounds_m, genes_m, max(), and min().

Referenced by Individual().

Here is the call graph for this function:

template<class Archive >
void Individual::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

serialization of structure

Definition at line 80 of file Individual.h.

References genes_m, id_m, and objectives_m.

bool Individual::viable ( )
inline

test if individual within bounds and constraints

Definition at line 96 of file Individual.h.

References checkBounds(), and checkConstraints().

Here is the call graph for this function:

Member Data Documentation

bounds_t Individual::bounds_m
private

bounds on each gene

Definition at line 153 of file Individual.h.

Referenced by checkBounds(), Individual(), and new_gene().

constraints_t Individual::constraints_m
private

constraints that depend only on design variables

Definition at line 157 of file Individual.h.

Referenced by checkConstraints(), and Individual().

genes_t Individual::genes_m

genes of an individual

Definition at line 101 of file Individual.h.

Referenced by checkBounds(), checkConstraints(), Individual(), new_gene(), and serialize().

unsigned int Individual::id_m = 0

id

Definition at line 105 of file Individual.h.

Referenced by Individual(), and serialize().

names_t Individual::names_m
private

gene names

Definition at line 155 of file Individual.h.

Referenced by checkConstraints(), and Individual().

objectives_t Individual::objectives_m

values of objectives of an individual

Definition at line 103 of file Individual.h.

Referenced by Individual(), and serialize().


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