Linear combination of objective functions. More...
#include <shark/ObjectiveFunctions/CombinedObjectiveFunction.h>
Public Types | |
typedef AbstractObjectiveFunction< SearchSpaceType, ResultT > | super |
typedef AbstractObjectiveFunction< SearchSpaceType, ResultT > | element |
Public Types inherited from shark::AbstractObjectiveFunction< SearchSpaceType, ResultT > | |
enum | Feature |
List of features that are supported by an implementation. More... | |
typedef SearchSpaceType | 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 | |
CombinedObjectiveFunction () | |
Constructor. More... | |
std::string | name () const |
From INameable: return the class name. More... | |
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. More... | |
super::ResultType | eval (const typename super::SearchPointType &input) const |
Evaluates the objective function. More... | |
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< SearchSpaceType, ResultT > | |
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... | |
void | setRng (random::rng_type *rng) |
Sets the Rng used by the objective function. 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 () |
Protected Attributes | |
std::vector< double > | m_weight |
list of weights More... | |
std::vector< element * > | m_elements |
list of "base" objective functions More... | |
Protected Attributes inherited from shark::AbstractObjectiveFunction< SearchSpaceType, ResultT > | |
Features | m_features |
std::size_t | m_evaluationCounter |
Evaluation counter, default value: 0. More... | |
AbstractConstraintHandler< SearchPointType > const * | m_constraintHandler |
random::rng_type * | mep_rng |
Additional Inherited Members | |
Protected Member Functions inherited from shark::AbstractObjectiveFunction< SearchSpaceType, ResultT > | |
void | announceConstraintHandler (AbstractConstraintHandler< SearchPointType > const *handler) |
helper function which is called to announce the presence of an constraint handler. More... | |
Linear combination of objective functions.
Definition at line 52 of file CombinedObjectiveFunction.h.
typedef AbstractObjectiveFunction<SearchSpaceType, ResultT> shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::element |
Definition at line 57 of file CombinedObjectiveFunction.h.
typedef AbstractObjectiveFunction<SearchSpaceType, ResultT> shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::super |
Definition at line 56 of file CombinedObjectiveFunction.h.
|
inline |
Constructor.
Definition at line 60 of file CombinedObjectiveFunction.h.
References shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::HAS_FIRST_DERIVATIVE, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::HAS_SECOND_DERIVATIVE, and shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::m_features.
|
inline |
Adds a new objective function with a weight of one to the linear combination.
Definition at line 72 of file CombinedObjectiveFunction.h.
|
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< SearchSpaceType, ResultT >::HAS_FIRST_DERIVATIVE, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::HAS_SECOND_DERIVATIVE, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::IS_CONSTRAINED_FEATURE, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::m_features, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_weight, shark::TypedFlags< Flag >::reset(), shark::TypedFlags< Flag >::set(), SHARK_RUNTIME_CHECK, and shark::TypedFlags< Flag >::test().
|
inline |
Evaluates the objective function.
Definition at line 113 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::m_evaluationCounter, and shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_weight.
|
inline |
Evaluates the objective function and calculates its gradient.
Definition at line 125 of file CombinedObjectiveFunction.h.
References shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::HAS_FIRST_DERIVATIVE, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::m_evaluationCounter, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::m_features, shark::CombinedObjectiveFunction< SearchSpaceType, 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< SearchSpaceType, ResultT >::HAS_SECOND_DERIVATIVE, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_elements, shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::m_features, shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_weight, SHARK_RUNTIME_CHECK, and shark::TypedFlags< Flag >::test().
|
inlinevirtual |
Reimplemented from shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >.
Definition at line 100 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_elements, and shark::AbstractObjectiveFunction< SearchSpaceType, 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< SearchSpaceType, ResultT >::m_elements.
|
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< SearchSpaceType, ResultT >.
Definition at line 107 of file CombinedObjectiveFunction.h.
References shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::m_elements.
|
protected |
list of "base" objective functions
Definition at line 164 of file CombinedObjectiveFunction.h.
Referenced by shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::add(), shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::eval(), shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::evalDerivative(), shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::init(), shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::isFeasible(), and shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::numberOfVariables().
|
protected |
list of weights
Definition at line 161 of file CombinedObjectiveFunction.h.
Referenced by shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::add(), shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::eval(), and shark::CombinedObjectiveFunction< SearchSpaceType, ResultT >::evalDerivative().