shark::IndicatorBasedRealCodedNSGAII< Indicator > Class Template Reference

Implements the NSGA-II. More...

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

+ Inheritance diagram for shark::IndicatorBasedRealCodedNSGAII< Indicator >:

Public Member Functions

 IndicatorBasedRealCodedNSGAII (random::rng_type &rng=random::globalRng)
 Default c'tor. More...
 
std::string name () const
 returns the name of the object More...
 
double crossoverProbability () const
 Returns the probability that crossover is applied. More...
 
double & crossoverProbability ()
 Returns the probability that crossover is applied. More...
 
double nm () const
 Returns the mutation variation strength parameter. More...
 
double & nm ()
 Returns a reference to the mutation variation strength parameter. More...
 
double nc () const
 Returns the crossover variation strength parameter. More...
 
double & nc ()
 Returns a reference to the crossover variation strength parameter. More...
 
std::size_t mu () const
 Returns the number of elements in the front. More...
 
std::size_t & mu ()
 Returns the number of elements in the front. More...
 
std::size_t numInitPoints () const
 The number of points used for initialization of the algorithm. More...
 
Indicator & indicator ()
 Returns the indicator used. More...
 
Indicator const & indicator () const
 Returns the indicator used. More...
 
void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
void init (ObjectiveFunctionType const &function, std::vector< SearchPointType > const &initialSearchPoints)
 Initializes the algorithm for the supplied objective function. More...
 
void step (ObjectiveFunctionType const &function)
 Executes one iteration of the algorithm. More...
 
- Public Member Functions inherited from shark::AbstractMultiObjectiveOptimizer< RealVector >
SolutionType const & solution () const
 Accesses the current approximation of the Pareto-set and -front, respectively. More...
 
- Public Member Functions inherited from shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool requiresValue () const
 
bool requiresFirstDerivative () const
 
bool requiresSecondDerivative () const
 
bool canSolveConstrained () const
 
bool requiresClosestFeasible () const
 
virtual ~AbstractOptimizer ()
 
virtual void init (ObjectiveFunctionType const &function)
 Initialize the optimizer for the supplied objective function. More...
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Types

typedef shark::Individual< RealVector, RealVector > IndividualType
 The individual type of the NSGA-II. More...
 

Protected Member Functions

void doInit (std::vector< SearchPointType > const &initialSearchPoints, std::vector< ResultType > const &functionValues, RealVector const &lowerBounds, RealVector const &upperBounds, std::size_t mu, double nm, double nc, double crossover_prob)
 
std::vector< IndividualTypegenerateOffspring () const
 
void updatePopulation (std::vector< IndividualType > const &offspringVec)
 
- Protected Member Functions inherited from shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >
void checkFeatures (ObjectiveFunctionType const &objectiveFunction)
 Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer. More...
 

Protected Attributes

std::vector< IndividualTypem_parents
 Population of size \(\mu + 1\). More...
 
random::rng_type * mpe_rng
 
- Protected Attributes inherited from shark::AbstractMultiObjectiveOptimizer< RealVector >
SolutionType m_best
 The current Pareto-set/-front. More...
 
- Protected Attributes inherited from shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >
Features m_features
 

Additional Inherited Members

- Public Types inherited from shark::AbstractMultiObjectiveOptimizer< RealVector >
typedef super::SearchPointType SearchPointType
 
typedef super::SolutionType SolutionType
 
typedef super::ObjectiveFunctionType ObjectiveFunctionType
 
- Public Types inherited from shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >
enum  Feature
 Models features that the optimizer requires from the objective function. More...
 
typedef RealVector SearchPointType
 
typedef RealVector ResultType
 
typedef std::vector< ResultSet< RealVector, RealVector > > SolutionType
 
typedef AbstractObjectiveFunction< RealVector, ResultTypeObjectiveFunctionType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 

Detailed Description

template<typename Indicator>
class shark::IndicatorBasedRealCodedNSGAII< Indicator >

Implements the NSGA-II.

Please see the following papers for further reference: Deb, Agrawal, Pratap and Meyarivan. A Fast and Elitist Multiobjective Genetic Algorithm: NSGA-II IEEE TRANSACTIONS ON EVOLUTIONARY COMPUTATION, VOL. 6, NO. 2, APRIL 2002

Definition at line 60 of file RealCodedNSGAII.h.

Member Typedef Documentation

◆ IndividualType

template<typename Indicator>
typedef shark::Individual<RealVector,RealVector> shark::IndicatorBasedRealCodedNSGAII< Indicator >::IndividualType
protected

The individual type of the NSGA-II.

Definition at line 192 of file RealCodedNSGAII.h.

Constructor & Destructor Documentation

◆ IndicatorBasedRealCodedNSGAII()

template<typename Indicator>
shark::IndicatorBasedRealCodedNSGAII< Indicator >::IndicatorBasedRealCodedNSGAII ( random::rng_type &  rng = random::globalRng)
inline

Default c'tor.

Definition at line 64 of file RealCodedNSGAII.h.

Member Function Documentation

◆ crossoverProbability() [1/2]

template<typename Indicator>
double shark::IndicatorBasedRealCodedNSGAII< Indicator >::crossoverProbability ( ) const
inline

◆ crossoverProbability() [2/2]

template<typename Indicator>
double& shark::IndicatorBasedRealCodedNSGAII< Indicator >::crossoverProbability ( )
inline

Returns the probability that crossover is applied.

Definition at line 81 of file RealCodedNSGAII.h.

◆ doInit()

template<typename Indicator>
void shark::IndicatorBasedRealCodedNSGAII< Indicator >::doInit ( std::vector< SearchPointType > const &  initialSearchPoints,
std::vector< ResultType > const &  functionValues,
RealVector const &  lowerBounds,
RealVector const &  upperBounds,
std::size_t  mu,
double  nm,
double  nc,
double  crossover_prob 
)
inlineprotected

◆ generateOffspring()

template<typename Indicator>
std::vector<IndividualType> shark::IndicatorBasedRealCodedNSGAII< Indicator >::generateOffspring ( ) const
inlineprotected

◆ indicator() [1/2]

template<typename Indicator>
Indicator& shark::IndicatorBasedRealCodedNSGAII< Indicator >::indicator ( )
inline

Returns the indicator used.

Definition at line 117 of file RealCodedNSGAII.h.

Referenced by shark::IndicatorBasedRealCodedNSGAII< NSGA3Indicator >::doInit().

◆ indicator() [2/2]

template<typename Indicator>
Indicator const& shark::IndicatorBasedRealCodedNSGAII< Indicator >::indicator ( ) const
inline

Returns the indicator used.

Definition at line 121 of file RealCodedNSGAII.h.

◆ init()

template<typename Indicator>
void shark::IndicatorBasedRealCodedNSGAII< Indicator >::init ( ObjectiveFunctionType const &  function,
std::vector< SearchPointType > const &  initialSearchPoints 
)
inlinevirtual

Initializes the algorithm for the supplied objective function.

Parameters
[in]functionThe objective function.
[in]initialSearchPointsA set of intiial search points.

Implements shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >.

Definition at line 152 of file RealCodedNSGAII.h.

◆ mu() [1/2]

◆ mu() [2/2]

template<typename Indicator>
std::size_t& shark::IndicatorBasedRealCodedNSGAII< Indicator >::mu ( )
inline

Returns the number of elements in the front.

Definition at line 107 of file RealCodedNSGAII.h.

◆ name()

template<typename Indicator>
std::string shark::IndicatorBasedRealCodedNSGAII< Indicator >::name ( ) const
inlinevirtual

returns the name of the object

Reimplemented from shark::INameable.

Definition at line 72 of file RealCodedNSGAII.h.

◆ nc() [1/2]

◆ nc() [2/2]

template<typename Indicator>
double& shark::IndicatorBasedRealCodedNSGAII< Indicator >::nc ( )
inline

Returns a reference to the crossover variation strength parameter.

Definition at line 98 of file RealCodedNSGAII.h.

◆ nm() [1/2]

◆ nm() [2/2]

template<typename Indicator>
double& shark::IndicatorBasedRealCodedNSGAII< Indicator >::nm ( )
inline

Returns a reference to the mutation variation strength parameter.

Definition at line 90 of file RealCodedNSGAII.h.

◆ numInitPoints()

template<typename Indicator>
std::size_t shark::IndicatorBasedRealCodedNSGAII< Indicator >::numInitPoints ( ) const
inlinevirtual

The number of points used for initialization of the algorithm.

Implements shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >.

Definition at line 112 of file RealCodedNSGAII.h.

◆ read()

template<typename Indicator>
void shark::IndicatorBasedRealCodedNSGAII< Indicator >::read ( InArchive archive)
inlinevirtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Definition at line 125 of file RealCodedNSGAII.h.

◆ step()

template<typename Indicator>
void shark::IndicatorBasedRealCodedNSGAII< Indicator >::step ( ObjectiveFunctionType const &  function)
inlinevirtual

Executes one iteration of the algorithm.

Parameters
[in]functionThe function to iterate upon.

Implements shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >.

Definition at line 184 of file RealCodedNSGAII.h.

◆ updatePopulation()

template<typename Indicator>
void shark::IndicatorBasedRealCodedNSGAII< Indicator >::updatePopulation ( std::vector< IndividualType > const &  offspringVec)
inlineprotected

◆ write()

template<typename Indicator>
void shark::IndicatorBasedRealCodedNSGAII< Indicator >::write ( OutArchive archive) const
inlinevirtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Definition at line 135 of file RealCodedNSGAII.h.

Member Data Documentation

◆ m_parents

◆ mpe_rng

template<typename Indicator>
random::rng_type* shark::IndicatorBasedRealCodedNSGAII< Indicator >::mpe_rng
protected

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