Linear combination of objective functions. More...
#include <shark/ObjectiveFunctions/CombinedObjectiveFunction.h>
Inheritance diagram for shark::CombinedObjectiveFunction< SearchPointType, ResultT >:Public Types | |
| typedef AbstractObjectiveFunction< SearchPointType, ResultT > | super |
| typedef AbstractObjectiveFunction< SearchPointType, ResultT > | element |
Public Types inherited from shark::AbstractObjectiveFunction< SearchPointType, ResultT > | |
| enum | Feature |
| List of features that are supported by an implementation. More... | |
| typedef SearchPointType | 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. | |
| typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Member Functions | |
| CombinedObjectiveFunction () | |
| Constructor. | |
| std::string | name () const |
| From INameable: return the class name. | |
| void | add (element &e) |
| void | add (double weight, element &e) |
| bool | isFeasible (const typename super::SearchPointType &input) const |
| void | init () |
| std::size_t | numberOfVariables () const |
| Accesses the number of variables. | |
| super::ResultType | eval (const typename super::SearchPointType &input) const |
| Evaluates the objective function. | |
| super::ResultType | evalDerivative (const typename super::SearchPointType &input, typename super::FirstOrderDerivative &derivative) const |
| super::ResultType | evalDerivative (const typename super::SearchPointType &input, typename super::SecondOrderDerivative &derivative) const |
Public Member Functions inherited from shark::AbstractObjectiveFunction< SearchPointType, ResultT > | |
| const Features & | features () const |
| virtual void | updateFeatures () |
| bool | hasValue () const |
| returns whether this function can calculate it's function value | |
| bool | hasFirstDerivative () const |
| returns whether this function can calculate the first derivative | |
| bool | hasSecondDerivative () const |
| returns whether this function can calculate the second derivative | |
| bool | canProposeStartingPoint () const |
| returns whether this function can propose a starting point. | |
| bool | isConstrained () const |
| returns whether this function can return | |
| bool | hasConstraintHandler () const |
| returns whether this function can return | |
| bool | canProvideClosestFeasible () const |
| Returns whether this function can calculate thee closest feasible to an infeasible point. | |
| bool | isThreadSafe () const |
| Returns true, when the function can be usd in parallel threads. | |
| bool | isNoisy () const |
| Returns true, when the function can be usd in parallel threads. | |
| AbstractObjectiveFunction () | |
| Default ctor. | |
| virtual | ~AbstractObjectiveFunction () |
| Virtual destructor. | |
| void | setRng (random::rng_type *rng) |
| Sets the Rng used by the objective function. | |
| virtual bool | hasScalableDimensionality () const |
| virtual void | setNumberOfVariables (std::size_t numberOfVariables) |
| Adjusts the number of variables if the function is scalable. | |
| 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. | |
| std::size_t | evaluationCounter () const |
| Accesses the evaluation counter of the function. | |
| AbstractConstraintHandler< SearchPointType > const & | getConstraintHandler () const |
| Returns the constraint handler of the function if it has one. | |
| virtual bool | isFeasible (const SearchPointType &input) const |
| Tests whether a point in SearchSpace is feasible, e.g., whether the constraints are fulfilled. | |
| virtual void | closestFeasible (SearchPointType &input) const |
| If supported, the supplied point is repaired such that it satisfies all of the function's constraints. | |
| virtual SearchPointType | proposeStartingPoint () const |
| Proposes a starting point in the feasible search space of the function. | |
| virtual ResultType | eval (SearchPointType const &input) const |
| Evaluates the objective function for the supplied argument. | |
| ResultType | operator() (SearchPointType const &input) const |
| Evaluates the function. Useful together with STL-Algorithms like std::transform. | |
| virtual ResultType | evalDerivative (SearchPointType const &input, FirstOrderDerivative &derivative) const |
| Evaluates the objective function and calculates its gradient. | |
| virtual ResultType | evalDerivative (SearchPointType const &input, SecondOrderDerivative &derivative) const |
| Evaluates the objective function and calculates its gradient. | |
Public Member Functions inherited from shark::INameable | |
| virtual | ~INameable () |
Protected Attributes | |
| std::vector< double > | m_weight |
| list of weights | |
| std::vector< element * > | m_elements |
| list of "base" objective functions | |
Protected Attributes inherited from shark::AbstractObjectiveFunction< SearchPointType, ResultT > | |
| Features | m_features |
| std::size_t | m_evaluationCounter |
| Evaluation counter, default value: 0. | |
| AbstractConstraintHandler< SearchPointType > const * | m_constraintHandler |
| random::rng_type * | mep_rng |
Additional Inherited Members | |
Protected Member Functions inherited from shark::AbstractObjectiveFunction< SearchPointType, ResultT > | |
| void | announceConstraintHandler (AbstractConstraintHandler< SearchPointType > const *handler) |
| helper function which is called to announce the presence of an constraint handler. | |
Linear combination of objective functions.
Definition at line 52 of file CombinedObjectiveFunction.h.
| typedef AbstractObjectiveFunction<SearchPointType, ResultT> shark::CombinedObjectiveFunction< SearchPointType, ResultT >::element |
Definition at line 57 of file CombinedObjectiveFunction.h.
| typedef AbstractObjectiveFunction<SearchPointType, ResultT> shark::CombinedObjectiveFunction< SearchPointType, ResultT >::super |
Definition at line 56 of file CombinedObjectiveFunction.h.
|
inline |
Constructor.
Definition at line 60 of file CombinedObjectiveFunction.h.
References shark::AbstractObjectiveFunction< SearchPointType, ResultT >::HAS_FIRST_DERIVATIVE, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::HAS_SECOND_DERIVATIVE, and shark::AbstractObjectiveFunction< SearchPointType, ResultT >::m_features.
|
inline |
Adds a new objective function with a weight to the linear combination.
Definition at line 78 of file CombinedObjectiveFunction.h.
References shark::AbstractObjectiveFunction< PointType, ResultT >::features(), shark::AbstractObjectiveFunction< SearchPointType, ResultT >::HAS_FIRST_DERIVATIVE, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::HAS_SECOND_DERIVATIVE, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::IS_CONSTRAINED_FEATURE, shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::m_features, shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_weight, shark::TypedFlags< Flag >::reset(), shark::TypedFlags< Flag >::set(), SHARK_RUNTIME_CHECK, and shark::TypedFlags< Flag >::test().
|
inline |
Adds a new objective function with a weight of one to the linear combination.
Definition at line 72 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchPointType, ResultT >::add().
Referenced by shark::CombinedObjectiveFunction< SearchPointType, ResultT >::add().
|
inline |
Evaluates the objective function.
Definition at line 113 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchPointType, ResultT >::eval(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::m_evaluationCounter, and shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_weight.
Referenced by shark::CombinedObjectiveFunction< SearchPointType, ResultT >::eval().
|
inline |
Evaluates the objective function and calculates its gradient.
Definition at line 125 of file CombinedObjectiveFunction.h.
References shark::AbstractObjectiveFunction< SearchPointType, ResultT >::HAS_FIRST_DERIVATIVE, shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::m_evaluationCounter, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::m_features, shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_weight, SHARK_RUNTIME_CHECK, and shark::TypedFlags< Flag >::test().
|
inline |
Evaluates the objective function and calculates its gradient and its Hessian.
Definition at line 143 of file CombinedObjectiveFunction.h.
References shark::AbstractObjectiveFunction< SearchPointType, ResultT >::HAS_SECOND_DERIVATIVE, shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchPointType, ResultT >::m_features, shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_weight, SHARK_RUNTIME_CHECK, and shark::TypedFlags< Flag >::test().
|
inlinevirtual |
Reimplemented from shark::AbstractObjectiveFunction< SearchPointType, ResultT >.
Definition at line 100 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements, and shark::AbstractObjectiveFunction< SearchPointType, ResultT >::mep_rng.
|
inline |
Tests whether a point in SearchSpace is feasible, e.g., whether the constraints are fulfilled.
Definition at line 92 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchPointType, ResultT >::isFeasible(), and shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements.
Referenced by shark::CombinedObjectiveFunction< SearchPointType, ResultT >::isFeasible().
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 66 of file CombinedObjectiveFunction.h.
|
inlinevirtual |
Accesses the number of variables.
Implements shark::AbstractObjectiveFunction< SearchPointType, ResultT >.
Definition at line 107 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchPointType, ResultT >::m_elements.
|
protected |
list of "base" objective functions
Definition at line 164 of file CombinedObjectiveFunction.h.
Referenced by shark::CombinedObjectiveFunction< SearchPointType, ResultT >::add(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::eval(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::evalDerivative(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::evalDerivative(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::init(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::isFeasible(), and shark::CombinedObjectiveFunction< SearchPointType, ResultT >::numberOfVariables().
|
protected |
list of weights
Definition at line 161 of file CombinedObjectiveFunction.h.
Referenced by shark::CombinedObjectiveFunction< SearchPointType, ResultT >::add(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::eval(), shark::CombinedObjectiveFunction< SearchPointType, ResultT >::evalDerivative(), and shark::CombinedObjectiveFunction< SearchPointType, ResultT >::evalDerivative().