shark::Individual< PointType, FitnessTypeT, Chromosome > Class Template Reference

Individual is a simple templated class modelling an individual that acts as a candidate solution in an evolutionary algorithm. More...

#include <shark/Algorithms/DirectSearch/Individual.h>

Classes

struct  FitnessOrdering
 Ordering relation by the fitness of the individuals(only single objective) More...
 
struct  RankOrdering
 Ordering relation by the ranks of the individuals. More...
 

Public Types

typedef FitnessTypeT FitnessType
 
typedef PointType SearchPointType
 

Public Member Functions

 Individual ()
 Default constructor that initializes the individual's attributes to default values. More...
 
SearchPointTypesearchPoint ()
 Returns a reference to the search point that is associated with the individual. More...
 
SearchPointType const & searchPoint () const
 Returns a const reference to the search point that is associated with the individual. More...
 
Chromosome & chromosome ()
 Returns a reference to the chromosome that is associated with the individual. More...
 
Chromosome const & chromosome () const
 Returns a const reference to the chromosome that is associated with the individual. More...
 
FitnessTypeunpenalizedFitness ()
 Returns a reference to the unpenalized fitness of the individual. More...
 
FitnessType const & unpenalizedFitness () const
 Returns the unpenalized fitness of the individual. More...
 
FitnessTypepenalizedFitness ()
 Returns a reference to the penalized fitness of the individual. More...
 
FitnessType const & penalizedFitness () const
 Returns the unpenalized fitness of the individual. More...
 
unsigned int rank () const
 Returns the level of non-dominance of the individual. More...
 
unsigned int & rank ()
 Returns a reference to the level of non-dominance of the individual. Allows for lvalue()-semantic. More...
 
bool selected () const
 Returns true if the individual is selected for the next parent generation. More...
 
bool & selected ()
 Returns true if the individual is selected for the next parent generation. More...
 
template<typename Archive >
void serialize (Archive &archive, const unsigned int version)
 Stores the individual and all of its chromosomes in an archive. More...
 

Protected Attributes

SearchPointType m_searchPoint
 The search point associated with the individual. More...
 
Chromosome m_chromosome
 The search point associated with the individual. More...
 
unsigned int m_rank
 The level of non-dominance of the individual. The lower the better. More...
 
bool m_selected
 Is the individual selected for the next parent set? More...
 
FitnessType m_penalizedFitness
 Penalized fitness of the individual. More...
 
FitnessType m_unpenalizedFitness
 Unpenalized fitness of the individual. More...
 

Friends

void swap (Individual &i1, Individual &i2)
 

Detailed Description

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
class shark::Individual< PointType, FitnessTypeT, Chromosome >

Individual is a simple templated class modelling an individual that acts as a candidate solution in an evolutionary algorithm.

The class holds the current search point as well as the penalized and unpenalized fitness, its domination rank with respect to the population, its age, a boolean variable determining whether the individual is selected for the next parent generation and some payload chromosome which is by default a RealVector.

The states mean the following:

  • the search point is the point in search space the individual represents.
  • the penalized and unpenailzed fitness are related by: if the search point is in the search region of the optimization region, penalized and unpenalized fitness are the same. otherwise the unpenalized fitness is the value of the closest feasible point to the search point. The penalized fitness is the same value plus an penalty term. Usually this is ||s-closestFeasible(s)||^2, the squared distance between the search point and the closest feasible point.
    • the domination rank indicates in which front the individual is. a nondominated individual has rank 1, individuals that are only dominated by individuals with rank one have rank 2 and so on. In single objective optimization, the rank is simply the number of individuals with better fitness+1.
  • the age is the number of generations the individual has survived.
  • selection: survival selection schemes never delete or move points, instead they indicate which points are to be deleted.

Definition at line 61 of file Individual.h.

Member Typedef Documentation

◆ FitnessType

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
typedef FitnessTypeT shark::Individual< PointType, FitnessTypeT, Chromosome >::FitnessType

Definition at line 64 of file Individual.h.

◆ SearchPointType

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
typedef PointType shark::Individual< PointType, FitnessTypeT, Chromosome >::SearchPointType

Definition at line 66 of file Individual.h.

Constructor & Destructor Documentation

◆ Individual()

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
shark::Individual< PointType, FitnessTypeT, Chromosome >::Individual ( )
inline

Default constructor that initializes the individual's attributes to default values.

Definition at line 83 of file Individual.h.

Member Function Documentation

◆ chromosome() [1/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
Chromosome& shark::Individual< PointType, FitnessTypeT, Chromosome >::chromosome ( )
inline

Returns a reference to the chromosome that is associated with the individual.

Definition at line 99 of file Individual.h.

Referenced by main(), and shark::ElitistCMA::sigma().

◆ chromosome() [2/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
Chromosome const& shark::Individual< PointType, FitnessTypeT, Chromosome >::chromosome ( ) const
inline

Returns a const reference to the chromosome that is associated with the individual.

Definition at line 104 of file Individual.h.

◆ penalizedFitness() [1/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
FitnessType& shark::Individual< PointType, FitnessTypeT, Chromosome >::penalizedFitness ( )
inline

Returns a reference to the penalized fitness of the individual.

Definition at line 119 of file Individual.h.

Referenced by shark::PenalizingEvaluator::operator()().

◆ penalizedFitness() [2/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
FitnessType const& shark::Individual< PointType, FitnessTypeT, Chromosome >::penalizedFitness ( ) const
inline

Returns the unpenalized fitness of the individual.

Definition at line 123 of file Individual.h.

◆ rank() [1/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
unsigned int shark::Individual< PointType, FitnessTypeT, Chromosome >::rank ( ) const
inline

◆ rank() [2/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
unsigned int& shark::Individual< PointType, FitnessTypeT, Chromosome >::rank ( )
inline

Returns a reference to the level of non-dominance of the individual. Allows for lvalue()-semantic.

Definition at line 133 of file Individual.h.

◆ searchPoint() [1/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
SearchPointType& shark::Individual< PointType, FitnessTypeT, Chromosome >::searchPoint ( )
inline

◆ searchPoint() [2/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
SearchPointType const& shark::Individual< PointType, FitnessTypeT, Chromosome >::searchPoint ( ) const
inline

Returns a const reference to the search point that is associated with the individual.

Definition at line 94 of file Individual.h.

◆ selected() [1/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
bool shark::Individual< PointType, FitnessTypeT, Chromosome >::selected ( ) const
inline

Returns true if the individual is selected for the next parent generation.

Definition at line 138 of file Individual.h.

Referenced by shark::IndicatorBasedSteadyStateMOCMA< Indicator >::updatePopulation().

◆ selected() [2/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
bool& shark::Individual< PointType, FitnessTypeT, Chromosome >::selected ( )
inline

Returns true if the individual is selected for the next parent generation.

Definition at line 143 of file Individual.h.

◆ serialize()

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
template<typename Archive >
void shark::Individual< PointType, FitnessTypeT, Chromosome >::serialize ( Archive &  archive,
const unsigned int  version 
)
inline

Stores the individual and all of its chromosomes in an archive.

Definition at line 149 of file Individual.h.

◆ unpenalizedFitness() [1/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
FitnessType& shark::Individual< PointType, FitnessTypeT, Chromosome >::unpenalizedFitness ( )
inline

Returns a reference to the unpenalized fitness of the individual.

Definition at line 109 of file Individual.h.

Referenced by shark::PenalizingEvaluator::operator()(), and shark::Individual< PointType, FitnessTypeT, Chromosome >::FitnessOrdering::operator()().

◆ unpenalizedFitness() [2/2]

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
FitnessType const& shark::Individual< PointType, FitnessTypeT, Chromosome >::unpenalizedFitness ( ) const
inline

Returns the unpenalized fitness of the individual.

Definition at line 114 of file Individual.h.

Friends And Related Function Documentation

◆ swap

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
void swap ( Individual< PointType, FitnessTypeT, Chromosome > &  i1,
Individual< PointType, FitnessTypeT, Chromosome > &  i2 
)
friend

Definition at line 159 of file Individual.h.

Member Data Documentation

◆ m_chromosome

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
Chromosome shark::Individual< PointType, FitnessTypeT, Chromosome >::m_chromosome
protected

◆ m_penalizedFitness

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
FitnessType shark::Individual< PointType, FitnessTypeT, Chromosome >::m_penalizedFitness
protected

◆ m_rank

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
unsigned int shark::Individual< PointType, FitnessTypeT, Chromosome >::m_rank
protected

The level of non-dominance of the individual. The lower the better.

Definition at line 173 of file Individual.h.

Referenced by shark::Individual< RealVector, FitnessType, CMAChromosome >::rank(), and shark::Individual< RealVector, FitnessType, CMAChromosome >::serialize().

◆ m_searchPoint

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
SearchPointType shark::Individual< PointType, FitnessTypeT, Chromosome >::m_searchPoint
protected

◆ m_selected

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
bool shark::Individual< PointType, FitnessTypeT, Chromosome >::m_selected
protected

◆ m_unpenalizedFitness

template<typename PointType, class FitnessTypeT, class Chromosome = RealVector>
FitnessType shark::Individual< PointType, FitnessTypeT, Chromosome >::m_unpenalizedFitness
protected

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