Super class of all objective functions for optimization and learning. More...
#include <shark/ObjectiveFunctions/AbstractObjectiveFunction.h>
Classes | |
struct | SecondOrderDerivative |
Public Types | |
enum | Feature { HAS_VALUE = 1, HAS_FIRST_DERIVATIVE = 2, HAS_SECOND_DERIVATIVE = 4, CAN_PROPOSE_STARTING_POINT = 8, IS_CONSTRAINED_FEATURE = 16, HAS_CONSTRAINT_HANDLER = 32, CAN_PROVIDE_CLOSEST_FEASIBLE = 64, IS_THREAD_SAFE = 128, IS_NOISY = 256 } |
List of features that are supported by an implementation. More... | |
typedef PointType | SearchPointType |
typedef ResultT | ResultType |
typedef boost::mpl::if_< std::is_arithmetic< ResultT >, SearchPointType, RealMatrix >::type | FirstOrderDerivative |
typedef TypedFlags< Feature > | Features |
This statement declares the member m_features. See Core/Flags.h for details. More... | |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Member Functions | |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasValue () const |
returns whether this function can calculate it's function value More... | |
bool | hasFirstDerivative () const |
returns whether this function can calculate the first derivative More... | |
bool | hasSecondDerivative () const |
returns whether this function can calculate the second derivative More... | |
bool | canProposeStartingPoint () const |
returns whether this function can propose a starting point. More... | |
bool | isConstrained () const |
returns whether this function can return More... | |
bool | hasConstraintHandler () const |
returns whether this function can return More... | |
bool | canProvideClosestFeasible () const |
Returns whether this function can calculate thee closest feasible to an infeasible point. More... | |
bool | isThreadSafe () const |
Returns true, when the function can be usd in parallel threads. More... | |
bool | isNoisy () const |
Returns true, when the function can be usd in parallel threads. More... | |
AbstractObjectiveFunction () | |
Default ctor. More... | |
virtual | ~AbstractObjectiveFunction () |
Virtual destructor. More... | |
virtual void | init () |
void | setRng (random::rng_type *rng) |
Sets the Rng used by the objective function. More... | |
virtual std::size_t | numberOfVariables () const =0 |
Accesses the number of variables. More... | |
virtual bool | hasScalableDimensionality () const |
virtual void | setNumberOfVariables (std::size_t numberOfVariables) |
Adjusts the number of variables if the function is scalable. More... | |
virtual std::size_t | numberOfObjectives () const |
virtual bool | hasScalableObjectives () const |
virtual void | setNumberOfObjectives (std::size_t numberOfObjectives) |
Adjusts the number of objectives if the function is scalable. More... | |
std::size_t | evaluationCounter () const |
Accesses the evaluation counter of the function. More... | |
AbstractConstraintHandler< SearchPointType > const & | getConstraintHandler () const |
Returns the constraint handler of the function if it has one. More... | |
virtual bool | isFeasible (const SearchPointType &input) const |
Tests whether a point in SearchSpace is feasible, e.g., whether the constraints are fulfilled. More... | |
virtual void | closestFeasible (SearchPointType &input) const |
If supported, the supplied point is repaired such that it satisfies all of the function's constraints. More... | |
virtual SearchPointType | proposeStartingPoint () const |
Proposes a starting point in the feasible search space of the function. More... | |
virtual ResultType | eval (SearchPointType const &input) const |
Evaluates the objective function for the supplied argument. More... | |
ResultType | operator() (SearchPointType const &input) const |
Evaluates the function. Useful together with STL-Algorithms like std::transform. More... | |
virtual ResultType | evalDerivative (SearchPointType const &input, FirstOrderDerivative &derivative) const |
Evaluates the objective function and calculates its gradient. More... | |
virtual ResultType | evalDerivative (SearchPointType const &input, SecondOrderDerivative &derivative) const |
Evaluates the objective function and calculates its gradient. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
virtual std::string | name () const |
returns the name of the object More... | |
Protected Member Functions | |
void | announceConstraintHandler (AbstractConstraintHandler< SearchPointType > const *handler) |
helper function which is called to announce the presence of an constraint handler. More... | |
Protected Attributes | |
Features | m_features |
std::size_t | m_evaluationCounter |
Evaluation counter, default value: 0. More... | |
AbstractConstraintHandler< SearchPointType > const * | m_constraintHandler |
random::rng_type * | mep_rng |
Super class of all objective functions for optimization and learning.
AbstractObjectiveFunction offers a rich interface to support different types of optimizers. Since not every objective function meets every requirement, a flag system exists which tells the optimizer which features are available. These are: HAS_VALUE: The function can be evaluated. If not set, evalDerivative returns a meaningless value (for example std::numeric_limits<double>::quiet_nan()); HAS_FIRST_DERIVATIVE: evalDerivative can be called for the FirstOrderDerivative. The Derivative is defined and as exact as possible; HAS_SECOND_DERIVATIVE: evalDerivative can be called for the second derivative. IS_CONSTRAINED_FEATURE: The function has constraints and isFeasible might return false; CAN_PROPOSE_STARTING_POINT: the function can return a possibly randomized starting point; CAN_PROVIDE_CLOSEST_FEASIBLE: if the function is constrained, closest feasible can be called to construct a feasible point.
In the single objective case, the shark convention is to return a double value, while in Multi objective optimization a RealVector is returned with an entry for every objective. Moreoever, derivatives in the single objective case are RealVectors, while they are RealMatrix in the multi-objective case (i.e. the jacobian of the function).
Calling the derivatives, proposeStartingPoint or closestFeasible when the flags are not set will throw an exception. The features can be queried using the method features() as in if(!(f.features()&Function::HAS_VALUE))
PointType | The search space the function is defined upon. |
ResultT | The objective space the function is defined upon. |
Definition at line 85 of file AbstractObjectiveFunction.h.
typedef TypedFeatureNotAvailableException<Feature> shark::AbstractObjectiveFunction< PointType, ResultT >::FeatureNotAvailableException |
Definition at line 116 of file AbstractObjectiveFunction.h.
typedef TypedFlags<Feature> shark::AbstractObjectiveFunction< PointType, ResultT >::Features |
This statement declares the member m_features. See Core/Flags.h for details.
Definition at line 116 of file AbstractObjectiveFunction.h.
typedef boost::mpl::if_< std::is_arithmetic<ResultT>, SearchPointType, RealMatrix >::type shark::AbstractObjectiveFunction< PointType, ResultT >::FirstOrderDerivative |
Definition at line 95 of file AbstractObjectiveFunction.h.
typedef ResultT shark::AbstractObjectiveFunction< PointType, ResultT >::ResultType |
Definition at line 88 of file AbstractObjectiveFunction.h.
typedef PointType shark::AbstractObjectiveFunction< PointType, ResultT >::SearchPointType |
Definition at line 87 of file AbstractObjectiveFunction.h.
enum shark::AbstractObjectiveFunction::Feature |
List of features that are supported by an implementation.
Enumerator | |
---|---|
HAS_VALUE | The function can be evaluated and evalDerivative returns a meaningless value (for example std::numeric_limits<double>::quiet_nan()). |
HAS_FIRST_DERIVATIVE | The method evalDerivative is implemented for the first derivative and returns a sensible value. |
HAS_SECOND_DERIVATIVE | The method evalDerivative is implemented for the second derivative and returns a sensible value. |
CAN_PROPOSE_STARTING_POINT | The function can propose a sensible starting point to search algorithms. |
IS_CONSTRAINED_FEATURE | The objective function is constrained. |
HAS_CONSTRAINT_HANDLER | The constraints are governed by a constraint handler which can be queried by getConstraintHandler() |
CAN_PROVIDE_CLOSEST_FEASIBLE | If the function is constrained, the method closestFeasible is implemented and returns a "repaired" solution. |
IS_THREAD_SAFE | can eval or evalDerivative be called in parallel? |
IS_NOISY | The function value is perturbed by some kind of noise. |
Definition at line 103 of file AbstractObjectiveFunction.h.
|
inline |
Default ctor.
Definition at line 164 of file AbstractObjectiveFunction.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 168 of file AbstractObjectiveFunction.h.
|
inlineprotected |
helper function which is called to announce the presence of an constraint handler.
This function quries the propabilities of the handler and sts up the flags accordingly
Definition at line 305 of file AbstractObjectiveFunction.h.
Referenced by shark::DTLZ1::DTLZ1(), shark::DTLZ2::DTLZ2(), shark::DTLZ3::DTLZ3(), shark::DTLZ4::DTLZ4(), shark::DTLZ5::DTLZ5(), shark::DTLZ6::DTLZ6(), shark::DTLZ7::DTLZ7(), shark::Fonseca::Fonseca(), shark::GSP::GSP(), shark::IHR1::IHR1(), shark::IHR2::IHR2(), shark::IHR3::IHR3(), shark::IHR4::IHR4(), shark::IHR6::IHR6(), shark::LZ1::LZ1(), shark::LZ2::LZ2(), shark::LZ3::LZ3(), shark::LZ4::LZ4(), shark::LZ5::LZ5(), shark::LZ6::LZ6(), shark::LZ7::LZ7(), shark::LZ8::LZ8(), shark::LZ9::LZ9(), shark::ZDT1::ZDT1(), shark::ZDT2::ZDT2(), shark::ZDT3::ZDT3(), shark::ZDT4::ZDT4(), and shark::ZDT6::ZDT6().
|
inline |
returns whether this function can propose a starting point.
Definition at line 134 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::RotatedObjectiveFunction().
|
inline |
Returns whether this function can calculate thee closest feasible to an infeasible point.
Definition at line 149 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::checkFeatures().
|
inlinevirtual |
If supported, the supplied point is repaired such that it satisfies all of the function's constraints.
[in,out] | input | The point to be repaired. |
FeatureNotAvailableException | in the default implementation. |
Reimplemented in shark::EvaluationArchive< PointType, ResultT >.
Definition at line 241 of file AbstractObjectiveFunction.h.
|
inlinevirtual |
Evaluates the objective function for the supplied argument.
[in] | input | The argument for which the function shall be evaluated. |
FeatureNotAvailableException | in the default implementation and if a function does not support this feature. |
Reimplemented in shark::TwoNormRegularizer, shark::EvaluationArchive< PointType, ResultT >, shark::MultiObjectiveBenchmark< Objectives >, shark::KernelTargetAlignment< InputType, LabelType >, shark::MarkovPole< HiddenNeuron, OutputNeuron >, shark::NonMarkovPole, shark::LooError< ModelTypeT, LabelType >, shark::SvmLogisticInterpretation< InputType >, shark::CrossValidationError< ModelTypeT, LabelTypeT >, shark::Rosenbrock, shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >, shark::IHR6, shark::RadiusMarginQuotient< InputType, CacheType >, shark::ELLI2, shark::ELLI1, shark::IHR2, shark::CIGTAB2, shark::ConstrainedSphere, shark::IHR1, shark::IHR3, shark::IHR4, shark::ZDT4, shark::CIGTAB1, shark::VariationalAutoencoderError, shark::LZ2, shark::DTLZ1, shark::LZ3, shark::LZ4, shark::LZ5, shark::LZ6, shark::LZ8, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, shark::LZ1, shark::LZ7, shark::ZDT1, shark::ZDT6, shark::DTLZ3, shark::Fonseca, shark::ZDT2, shark::OneNormRegularizer, shark::ZDT3, shark::RotatedObjectiveFunction, shark::NegativeLogLikelihood, shark::LZ9, shark::Himmelblau, shark::CigarDiscus, shark::Ellipsoid, shark::Ackley, shark::Discus, shark::Cigar, shark::ExactGradient< RBMType >, shark::Sphere, shark::Schwefel, shark::DiffPowers, and shark::GSP.
Definition at line 268 of file AbstractObjectiveFunction.h.
Referenced by shark::ExactGradient< RBMType >::eval(), shark::SimplexDownhill::init(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::operator()(), shark::GridSearch::step(), shark::NestedGridSearch::step(), shark::PointSearch::step(), shark::ValidatedStoppingCriterion::stop(), and shark::TwoPointStepSizeAdaptation::update().
|
inlinevirtual |
Evaluates the objective function and calculates its gradient.
[in] | input | The argument to eval the function for. |
[out] | derivative | The derivate is placed here. |
FeatureNotAvailableException | in the default implementation and if a function does not support this feature. |
Reimplemented in shark::TwoNormRegularizer, shark::EvaluationArchive< PointType, ResultT >, shark::KernelTargetAlignment< InputType, LabelType >, shark::MergeBudgetMaintenanceStrategy< RealVector >::MergingProblemFunction, shark::SvmLogisticInterpretation< InputType >, shark::MultiObjectiveBenchmark< Objectives >, shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >, shark::MultiChainApproximator< MarkovChainType >, shark::VariationalAutoencoderError, shark::RadiusMarginQuotient< InputType, CacheType >, shark::ContrastiveDivergence< Operator >, shark::SingleChainApproximator< MarkovChainType >, shark::Rosenbrock, shark::ErrorFunction, shark::NegativeLogLikelihood, shark::OneNormRegularizer, shark::Ellipsoid, shark::RotatedObjectiveFunction, shark::Cigar, shark::Discus, shark::ExactGradient< RBMType >, and shark::Sphere.
Definition at line 283 of file AbstractObjectiveFunction.h.
Referenced by shark::SteepestDescent::init(), and shark::SteepestDescent::step().
|
inlinevirtual |
Evaluates the objective function and calculates its gradient.
[in] | input | The argument to eval the function for. |
[out] | derivative | The derivate and the Hessian are placed here. |
FeatureNotAvailableException | in the default implementation and if a function does not support this feature. |
Reimplemented in shark::TwoNormRegularizer, shark::EvaluationArchive< PointType, ResultT >, shark::Rosenbrock, shark::OneNormRegularizer, and shark::Ellipsoid.
Definition at line 293 of file AbstractObjectiveFunction.h.
|
inline |
Accesses the evaluation counter of the function.
Definition at line 215 of file AbstractObjectiveFunction.h.
Referenced by main().
|
inline |
Definition at line 116 of file AbstractObjectiveFunction.h.
Referenced by shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::add().
|
inline |
Returns the constraint handler of the function if it has one.
If the function does not offer a constraint handler, an exception is thrown.
Definition at line 222 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::closestFeasible(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isFeasible(), and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::proposeStartingPoint().
|
inline |
returns whether this function can return
Definition at line 144 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::closestFeasible(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isFeasible(), and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::proposeStartingPoint().
|
inline |
returns whether this function can calculate the first derivative
Definition at line 124 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::checkFeatures(), and shark::RotatedObjectiveFunction::RotatedObjectiveFunction().
|
inlinevirtual |
Reimplemented in shark::TwoNormRegularizer, shark::MultiObjectiveBenchmark< Objectives >, shark::Rosenbrock, shark::IHR6, shark::ELLI1, shark::ELLI2, shark::ZDT4, shark::CIGTAB1, shark::CIGTAB2, shark::DTLZ1, shark::IHR2, shark::ZDT1, shark::IHR1, shark::IHR3, shark::IHR4, shark::ZDT2, shark::ZDT6, shark::Fonseca, shark::LZ2, shark::LZ8, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, shark::LZ1, shark::LZ3, shark::LZ4, shark::LZ5, shark::LZ6, shark::LZ7, shark::DTLZ3, shark::ZDT3, shark::OneNormRegularizer, shark::RotatedObjectiveFunction, shark::LZ9, shark::ConstrainedSphere, shark::Ellipsoid, shark::Cigar, shark::CigarDiscus, shark::Discus, shark::Ackley, shark::Sphere, shark::GSP, shark::Schwefel, and shark::DiffPowers.
Definition at line 190 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::hasScalableDimensionality().
|
inlinevirtual |
Reimplemented in shark::EvaluationArchive< PointType, ResultT >, shark::DTLZ1, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, and shark::DTLZ3.
Definition at line 203 of file AbstractObjectiveFunction.h.
|
inline |
returns whether this function can calculate the second derivative
Definition at line 129 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::checkFeatures().
|
inline |
returns whether this function can calculate it's function value
Definition at line 119 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::checkFeatures().
|
inlinevirtual |
Reimplemented in shark::EvaluationArchive< PointType, ResultT >, shark::MultiObjectiveBenchmark< Objectives >, shark::ErrorFunction, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >, shark::IHR6, shark::ELLI1, shark::ELLI2, shark::IHR2, shark::CIGTAB1, shark::CIGTAB2, shark::IHR1, shark::IHR3, shark::IHR4, and shark::RotatedObjectiveFunction.
Definition at line 170 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::init(), main(), run_one_trial(), and trainRBM().
|
inline |
returns whether this function can return
Definition at line 139 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractOptimizer< RealVector, RealVector, std::vector< ResultSet< RealVector, RealVector > > >::checkFeatures(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::closestFeasible(), and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isFeasible().
|
inlinevirtual |
Tests whether a point in SearchSpace is feasible, e.g., whether the constraints are fulfilled.
[in] | input | The point to be tested for feasibility. |
Reimplemented in shark::EvaluationArchive< PointType, ResultT >, shark::SvmLogisticInterpretation< InputType >, and shark::ConstrainedSphere.
Definition at line 230 of file AbstractObjectiveFunction.h.
Referenced by shark::GridSearch::step(), shark::NestedGridSearch::step(), and shark::PointSearch::step().
|
inline |
Returns true, when the function can be usd in parallel threads.
Definition at line 159 of file AbstractObjectiveFunction.h.
|
inline |
Returns true, when the function can be usd in parallel threads.
Definition at line 154 of file AbstractObjectiveFunction.h.
|
inlinevirtual |
Reimplemented in shark::EvaluationArchive< PointType, ResultT >, shark::MultiObjectiveBenchmark< Objectives >, shark::ZDT3, shark::IHR6, shark::ELLI1, shark::ELLI2, shark::ZDT4, shark::CIGTAB1, shark::CIGTAB2, shark::IHR2, shark::ZDT1, shark::IHR1, shark::IHR3, shark::IHR4, shark::ZDT2, shark::ZDT6, shark::Fonseca, shark::LZ2, shark::LZ8, shark::LZ1, shark::LZ3, shark::LZ4, shark::LZ5, shark::LZ6, shark::LZ7, shark::DTLZ1, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, shark::DTLZ3, shark::LZ9, and shark::GSP.
Definition at line 200 of file AbstractObjectiveFunction.h.
|
pure virtual |
Accesses the number of variables.
Implemented in shark::EvaluationArchive< PointType, ResultT >, shark::TwoNormRegularizer, shark::KernelTargetAlignment< InputType, LabelType >, shark::MergeBudgetMaintenanceStrategy< RealVector >::MergingProblemFunction, shark::MarkovPole< HiddenNeuron, OutputNeuron >, shark::NonMarkovPole, shark::MultiChainApproximator< MarkovChainType >, shark::SvmLogisticInterpretation< InputType >, shark::CrossValidationError< ModelTypeT, LabelTypeT >, shark::MultiObjectiveBenchmark< Objectives >, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >, shark::LooError< ModelTypeT, LabelType >, shark::SingleChainApproximator< MarkovChainType >, shark::ErrorFunction, shark::NegativeGaussianProcessEvidence< InputType, OutputType, LabelType >, shark::ContrastiveDivergence< Operator >, shark::VariationalAutoencoderError, shark::RadiusMarginQuotient< InputType, CacheType >, shark::NegativeLogLikelihood, shark::Rosenbrock, shark::IHR6, shark::ELLI1, shark::ELLI2, shark::ZDT4, shark::CIGTAB1, shark::CIGTAB2, shark::DTLZ1, shark::IHR2, shark::ZDT1, shark::LooErrorCSvm< InputType, CacheType >, shark::IHR1, shark::IHR3, shark::IHR4, shark::ZDT2, shark::ZDT6, shark::Fonseca, shark::LZ2, shark::LZ8, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, shark::LZ1, shark::LZ3, shark::LZ4, shark::LZ5, shark::LZ6, shark::LZ7, shark::DTLZ3, shark::ZDT3, shark::OneNormRegularizer, shark::ExactGradient< RBMType >, shark::Himmelblau, shark::LZ9, shark::ConstrainedSphere, shark::RotatedObjectiveFunction, shark::Ellipsoid, shark::Cigar, shark::CigarDiscus, shark::Discus, shark::Ackley, shark::Sphere, shark::GSP, shark::Schwefel, and shark::DiffPowers.
Referenced by shark::SteepestDescent::init(), shark::Adam::init(), shark::RotatedObjectiveFunction::numberOfVariables(), and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::setRng().
|
inline |
Evaluates the function. Useful together with STL-Algorithms like std::transform.
Definition at line 273 of file AbstractObjectiveFunction.h.
|
inlinevirtual |
Proposes a starting point in the feasible search space of the function.
FeatureNotAvailableException | in the default implementation and if a function does not support this feature. |
Reimplemented in shark::MultiObjectiveBenchmark< Objectives >, shark::MarkovPole< HiddenNeuron, OutputNeuron >, shark::KernelTargetAlignment< InputType, LabelType >, shark::NonMarkovPole, shark::MultiChainApproximator< MarkovChainType >, shark::CIGTAB1, shark::ELLI2, shark::CIGTAB2, shark::ELLI1, shark::SingleChainApproximator< MarkovChainType >, shark::ErrorFunction, shark::Rosenbrock, shark::VariationalAutoencoderError, shark::ContrastiveDivergence< Operator >, shark::RotatedObjectiveFunction, shark::NegativeLogLikelihood, shark::ConstrainedSphere, shark::CigarDiscus, shark::Ellipsoid, shark::Discus, shark::Ackley, shark::Cigar, shark::Himmelblau, shark::Sphere, shark::Schwefel, shark::DiffPowers, and shark::ExactGradient< RBMType >.
Definition at line 252 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::proposeStartingPoint().
|
inlinevirtual |
Adjusts the number of objectives if the function is scalable.
numberOfObjectives | The new number of objectives to optimize for. |
Reimplemented in shark::EvaluationArchive< PointType, ResultT >, shark::DTLZ1, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, and shark::DTLZ3.
Definition at line 209 of file AbstractObjectiveFunction.h.
|
inlinevirtual |
Adjusts the number of variables if the function is scalable.
[in] | numberOfVariables | The new dimension. |
Reimplemented in shark::TwoNormRegularizer, shark::MultiObjectiveBenchmark< Objectives >, shark::Rosenbrock, shark::ZDT4, shark::CIGTAB1, shark::CIGTAB2, shark::IHR6, shark::ZDT1, shark::ELLI1, shark::ELLI2, shark::ZDT2, shark::ZDT6, shark::DTLZ1, shark::IHR2, shark::LZ2, shark::LZ8, shark::DTLZ2, shark::DTLZ4, shark::DTLZ5, shark::DTLZ6, shark::DTLZ7, shark::IHR1, shark::IHR3, shark::IHR4, shark::LZ1, shark::LZ3, shark::LZ4, shark::LZ5, shark::LZ6, shark::LZ7, shark::DTLZ3, shark::Fonseca, shark::ZDT3, shark::OneNormRegularizer, shark::RotatedObjectiveFunction, shark::LZ9, shark::ConstrainedSphere, shark::CigarDiscus, shark::Ellipsoid, shark::Discus, shark::Ackley, shark::Cigar, shark::Sphere, shark::GSP, shark::Schwefel, and shark::DiffPowers.
Definition at line 196 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::setNumberOfVariables().
|
inline |
Sets the Rng used by the objective function.
Objective functions need random numbers for different tasks, e.g. to provide a first starting point or for example mini batch learning where batches are chosen randomly. By default, shark::random::globalRng is used. In a multi-threaded environment this might not be safe as the Rng is not thread safe. In this case, every thread should use its own Rng.
Definition at line 183 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::init().
|
inlinevirtual |
Definition at line 116 of file AbstractObjectiveFunction.h.
|
protected |
Definition at line 299 of file AbstractObjectiveFunction.h.
Referenced by shark::EvaluationArchive< PointType, ResultT >::EvaluationArchive(), and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::getConstraintHandler().
|
mutableprotected |
Evaluation counter, default value: 0.
Definition at line 298 of file AbstractObjectiveFunction.h.
Referenced by shark::GSP::eval(), shark::Sphere::eval(), shark::Ackley::eval(), shark::CigarDiscus::eval(), shark::Himmelblau::eval(), shark::LZ9::eval(), shark::RotatedObjectiveFunction::eval(), shark::ZDT3::eval(), shark::Fonseca::eval(), shark::DTLZ3::eval(), shark::ZDT2::eval(), shark::DTLZ2::eval(), shark::ZDT1::eval(), shark::DTLZ4::eval(), shark::ZDT6::eval(), shark::DTLZ5::eval(), shark::DTLZ6::eval(), shark::LZ1::eval(), shark::DTLZ7::eval(), shark::LZ7::eval(), shark::LZ8::eval(), shark::DTLZ1::eval(), shark::LZ6::eval(), shark::LZ3::eval(), shark::LZ5::eval(), shark::LZ4::eval(), shark::LZ2::eval(), shark::CIGTAB1::eval(), shark::ConstrainedSphere::eval(), shark::IHR1::eval(), shark::IHR3::eval(), shark::ZDT4::eval(), shark::CIGTAB2::eval(), shark::IHR4::eval(), shark::IHR2::eval(), shark::ELLI1::eval(), shark::ELLI2::eval(), shark::IHR6::eval(), shark::Rosenbrock::eval(), shark::NonMarkovPole::eval(), shark::EvaluationArchive< PointType, ResultT >::eval(), shark::Sphere::evalDerivative(), shark::EvaluationArchive< PointType, ResultT >::evalDerivative(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::evaluationCounter(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::init(), and shark::NonMarkovPole::NonMarkovPole().
|
protected |
Definition at line 116 of file AbstractObjectiveFunction.h.
Referenced by shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::AbstractObjectiveFunction(), shark::Ackley::Ackley(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::announceConstraintHandler(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::canProposeStartingPoint(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::canProvideClosestFeasible(), shark::CigarDiscus::CigarDiscus(), shark::CIGTAB1::CIGTAB1(), shark::CIGTAB2::CIGTAB2(), shark::ConstrainedSphere::ConstrainedSphere(), shark::ContrastiveDivergence< Operator >::ContrastiveDivergence(), shark::ELLI1::ELLI1(), shark::ELLI2::ELLI2(), shark::EvaluationArchive< PointType, ResultT >::EvaluationArchive(), shark::ExactGradient< RBMType >::ExactGradient(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::hasConstraintHandler(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::hasFirstDerivative(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::hasSecondDerivative(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::hasValue(), shark::Himmelblau::Himmelblau(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isConstrained(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isNoisy(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::isThreadSafe(), shark::MultiChainApproximator< MarkovChainType >::MultiChainApproximator(), shark::NonMarkovPole::NonMarkovPole(), shark::Rosenbrock::Rosenbrock(), shark::RotatedObjectiveFunction::RotatedObjectiveFunction(), shark::SingleChainApproximator< MarkovChainType >::SingleChainApproximator(), shark::Sphere::Sphere(), and shark::SvmLogisticInterpretation< InputType >::SvmLogisticInterpretation().
|
protected |
Definition at line 300 of file AbstractObjectiveFunction.h.
Referenced by shark::RotatedObjectiveFunction::init(), shark::CIGTAB1::init(), shark::IHR4::init(), shark::IHR3::init(), shark::CIGTAB2::init(), shark::IHR1::init(), shark::IHR2::init(), shark::ELLI1::init(), shark::ELLI2::init(), shark::IHR6::init(), shark::ErrorFunction::init(), shark::EvaluationArchive< PointType, ResultT >::init(), shark::Sphere::proposeStartingPoint(), shark::Himmelblau::proposeStartingPoint(), shark::Ackley::proposeStartingPoint(), shark::CigarDiscus::proposeStartingPoint(), shark::ConstrainedSphere::proposeStartingPoint(), shark::Rosenbrock::proposeStartingPoint(), shark::CIGTAB2::proposeStartingPoint(), shark::ELLI1::proposeStartingPoint(), shark::ELLI2::proposeStartingPoint(), shark::CIGTAB1::proposeStartingPoint(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::proposeStartingPoint(), and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::setRng().