OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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)
 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

Definition at line 38 of file Individual.h.

Member Typedef Documentation

◆ bounds_t

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

bounds on design variables

Definition at line 49 of file Individual.h.

◆ constraints_t

constraints

Definition at line 51 of file Individual.h.

◆ genes_t

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

representation of genes

Definition at line 43 of file Individual.h.

◆ names_t

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

gene names

Definition at line 45 of file Individual.h.

◆ objectives_t

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

objectives array

Definition at line 47 of file Individual.h.

Constructor & Destructor Documentation

◆ Individual() [1/3]

Individual::Individual ( )
inline

Definition at line 53 of file Individual.h.

◆ Individual() [2/3]

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 57 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() [3/3]

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

copy another individual

Definition at line 86 of file Individual.h.

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

Member Function Documentation

◆ checkBounds()

bool Individual::checkBounds ( )
inlineprivate

check bounds

Definition at line 126 of file Individual.h.

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

Referenced by viable().

Here is the call graph for this function:

◆ checkConstraints()

bool Individual::checkConstraints ( )
inlineprivate

check if all constraints on design variables are checked

Definition at line 140 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:

◆ new_gene()

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 105 of file Individual.h.

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

Referenced by Individual().

Here is the call graph for this function:

◆ serialize()

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

serialization of structure

Definition at line 97 of file Individual.h.

References genes_m, id_m, and objectives_m.

◆ viable()

bool Individual::viable ( )
inline

test if individual within bounds and constraints

Definition at line 113 of file Individual.h.

References checkBounds(), and checkConstraints().

Here is the call graph for this function:

Member Data Documentation

◆ bounds_m

bounds_t Individual::bounds_m
private

bounds on each gene

Definition at line 170 of file Individual.h.

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

◆ constraints_m

constraints_t Individual::constraints_m
private

constraints that depend only on design variables

Definition at line 174 of file Individual.h.

Referenced by checkConstraints(), and Individual().

◆ genes_m

genes_t Individual::genes_m

genes of an individual

Definition at line 118 of file Individual.h.

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

◆ id_m

unsigned int Individual::id_m = 0

id

Definition at line 122 of file Individual.h.

Referenced by Individual(), and serialize().

◆ names_m

names_t Individual::names_m
private

gene names

Definition at line 172 of file Individual.h.

Referenced by checkConstraints(), and Individual().

◆ objectives_m

objectives_t Individual::objectives_m

values of objectives of an individual

Definition at line 120 of file Individual.h.

Referenced by Individual(), and serialize().


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