DMP_BBO library
Public Member Functions | Friends | List of all members
CostFunction Class Referenceabstract

Interface for cost functions, which define a cost_function. More...

#include <CostFunction.hpp>

Inheritance diagram for CostFunction:
Inheritance graph
[legend]

Public Member Functions

virtual void evaluate (const Eigen::VectorXd &sample, Eigen::VectorXd &cost) const =0
 The cost function which defines the cost_function. More...
 
virtual unsigned int getNumberOfCostComponents (void) const =0
 Get the number of individual cost components that constitute the final total cost. More...
 
virtual std::string toString (void) const =0
 Returns a string representation of the object. More...
 

Friends

std::ostream & operator<< (std::ostream &output, const CostFunction &cost_function)
 Write to output stream. More...
 

Detailed Description

Interface for cost functions, which define a cost_function.

For further information see the section on CostFunction vs Task/TaskSolver

Definition at line 35 of file CostFunction.hpp.

Member Function Documentation

virtual void evaluate ( const Eigen::VectorXd &  sample,
Eigen::VectorXd &  cost 
) const
pure virtual

The cost function which defines the cost_function.

Parameters
[in]sampleA sample in the search space
[out]costThe cost for the sample. The first entry cost[0] is the total cost. cost[1..n_cost_components] can contain individual cost components.
virtual unsigned int getNumberOfCostComponents ( void  ) const
pure virtual

Get the number of individual cost components that constitute the final total cost.

Returns
The number of cost components.

Implemented in DemoCostFunctionDistanceToPoint.

virtual std::string toString ( void  ) const
pure virtual

Returns a string representation of the object.

Returns
A string representation of the object.

Implemented in DemoCostFunctionDistanceToPoint.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const CostFunction cost_function 
)
friend

Write to output stream.

Parameters
[in]outputOutput stream to which to write to
[in]cost_functionCostFunction object to write
Returns
Output to which the object was written
Remarks
Calls virtual function CostFunction::toString, which must be implemented by subclasses: http://stackoverflow.com/questions/4571611/virtual-operator

Definition at line 64 of file CostFunction.hpp.

64  {
65  output << cost_function.toString();
66  return output;
67  }

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