shark::PenalizingEvaluator Struct Reference

Penalizing evaluator for scalar objective functions. More...

#include <shark/Algorithms/DirectSearch/Operators/Evaluation/PenalizingEvaluator.h>

Public Member Functions

 PenalizingEvaluator ()
 Default c'tor, initializes the penalty factor to \(10^{-6}\). More...
 
template<typename Function , typename IndividualType >
void operator() (Function const &f, IndividualType &individual) const
 Evaluates the supplied function on the supplied individual. More...
 
template<typename Function , typename Iterator >
void operator() (Function const &f, Iterator begin, Iterator end) const
 Evaluates The function on individuals in the range [first,last]. More...
 
template<class SearchPointType >
void penalize (SearchPointType const &s, SearchPointType const &t, double &fitness) const
 
template<class SearchPointType >
void penalize (SearchPointType const &s, SearchPointType const &t, RealVector &fitness) const
 
template<typename Archive >
void serialize (Archive &archive, const unsigned int version)
 Stores/loads the evaluator's state. More...
 

Public Attributes

double m_penaltyFactor
 Penalty factor \(\alpha\), default value: \(10^{-6}\) . More...
 
std::size_t m_numEvaluations
 Number of Evaluations on a noisy function. More...
 

Detailed Description

Penalizing evaluator for scalar objective functions.

Evaluates the supplied single-objective function \(f\) for the search point \(s\) according to:

\begin{align*} y & = & f( s' )\\ y' & = & f( s' ) + \alpha \vert\vert s - s' \vert\vert_2^2 \end{align*}

where \(s'\) is the repaired version of \(s\) if \(s\) is not feasible and equal to \(s\) otherwise. The default value of \(\alpha\) is \(10^{-6}\).

This Evaluator can also handle noisy functions by applying reevaluations of a single point on f and averaging the results.

Definition at line 57 of file PenalizingEvaluator.h.

Constructor & Destructor Documentation

◆ PenalizingEvaluator()

shark::PenalizingEvaluator::PenalizingEvaluator ( )
inline

Default c'tor, initializes the penalty factor to \(10^{-6}\).

Definition at line 61 of file PenalizingEvaluator.h.

Member Function Documentation

◆ operator()() [1/2]

template<typename Function , typename IndividualType >
void shark::PenalizingEvaluator::operator() ( Function const &  f,
IndividualType individual 
) const
inline

Evaluates the supplied function on the supplied individual.

Parameters
[in]fThe function to be evaluated.
[in]individualThe individual to evaluate the function for.

Definition at line 70 of file PenalizingEvaluator.h.

References m_numEvaluations, penalize(), shark::Individual< PointType, FitnessTypeT, Chromosome >::penalizedFitness(), shark::Individual< PointType, FitnessTypeT, Chromosome >::searchPoint(), and shark::Individual< PointType, FitnessTypeT, Chromosome >::unpenalizedFitness().

◆ operator()() [2/2]

template<typename Function , typename Iterator >
void shark::PenalizingEvaluator::operator() ( Function const &  f,
Iterator  begin,
Iterator  end 
) const
inline

Evaluates The function on individuals in the range [first,last].

Parameters
[in]fThe function to be evaluated.
[in]beginfirst indivdual in the range to be evaluated
[in]enditerator pointing directly beehind the last individual to be evaluated

Definition at line 93 of file PenalizingEvaluator.h.

◆ penalize() [1/2]

template<class SearchPointType >
void shark::PenalizingEvaluator::penalize ( SearchPointType const &  s,
SearchPointType const &  t,
double &  fitness 
) const
inline

Definition at line 100 of file PenalizingEvaluator.h.

References m_penaltyFactor.

Referenced by operator()().

◆ penalize() [2/2]

template<class SearchPointType >
void shark::PenalizingEvaluator::penalize ( SearchPointType const &  s,
SearchPointType const &  t,
RealVector &  fitness 
) const
inline

Definition at line 105 of file PenalizingEvaluator.h.

References m_penaltyFactor.

◆ serialize()

template<typename Archive >
void shark::PenalizingEvaluator::serialize ( Archive &  archive,
const unsigned int  version 
)
inline

Stores/loads the evaluator's state.

Template Parameters
ArchiveThe type of the archive.
Parameters
[in,out]archiveThe archive to use for loading/storing.
[in]versionCurrently unused.

Definition at line 117 of file PenalizingEvaluator.h.

References m_penaltyFactor.

Member Data Documentation

◆ m_numEvaluations

std::size_t shark::PenalizingEvaluator::m_numEvaluations

Number of Evaluations on a noisy function.

Definition at line 122 of file PenalizingEvaluator.h.

Referenced by operator()().

◆ m_penaltyFactor

double shark::PenalizingEvaluator::m_penaltyFactor

Penalty factor \(\alpha\), default value: \(10^{-6}\) .

Definition at line 121 of file PenalizingEvaluator.h.

Referenced by shark::ElitistCMA::constrainedPenaltyFactor(), penalize(), and serialize().


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