OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Individual Class Reference

#include <Individual.h>

Collaboration diagram for Individual:

Public Types

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

Public Member Functions

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

Public Attributes

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

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 36 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 47 of file Individual.h.

◆ constraints_t

constraints

Definition at line 49 of file Individual.h.

◆ genes_t

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

representation of genes

Definition at line 41 of file Individual.h.

◆ names_t

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

gene names

Definition at line 43 of file Individual.h.

◆ objectives_t

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

objectives array

Definition at line 45 of file Individual.h.

Constructor & Destructor Documentation

◆ Individual() [1/3]

Individual::Individual ( )
inline

Definition at line 51 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 55 of file Individual.h.

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

Here is the call graph for this function:

◆ Individual() [3/3]

Individual::Individual ( std::shared_ptr< Individual > individual)
inline

copy another individual

Definition at line 84 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 124 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 138 of file Individual.h.

References constraints_m, Expression::evaluate(), 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 103 of file Individual.h.

References 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 95 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 111 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 168 of file Individual.h.

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

◆ constraints_m

constraints_t Individual::constraints_m
private

constraints that depend only on design variables

Definition at line 172 of file Individual.h.

Referenced by checkConstraints(), Individual(), and Individual().

◆ genes_m

genes_t Individual::genes_m

genes of an individual

Definition at line 116 of file Individual.h.

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

◆ id_m

unsigned int Individual::id_m = 0

id

Definition at line 120 of file Individual.h.

Referenced by Individual(), and serialize().

◆ names_m

names_t Individual::names_m
private

gene names

Definition at line 170 of file Individual.h.

Referenced by checkConstraints(), Individual(), and Individual().

◆ objectives_m

objectives_t Individual::objectives_m

values of objectives of an individual

Definition at line 118 of file Individual.h.

Referenced by Individual(), Individual(), and serialize().


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