Class StateCostIntegralObjective
Defined in File StateCostIntegralObjective.h
Inheritance Relationships
Base Type
public ompl::base::OptimizationObjective
(Class OptimizationObjective)
Class Documentation
-
class StateCostIntegralObjective : public ompl::base::OptimizationObjective
Defines optimization objectives where path cost can be represented as a path integral over a cost function defined over the state space. This cost function is specified by implementing the stateCost() method.
Public Functions
-
StateCostIntegralObjective(const SpaceInformationPtr &si, bool enableMotionCostInterpolation = false)
If enableMotionCostInterpolation is set to true, then calls to motionCost() will divide the motion segment into smaller parts (the number of parts being defined by StateSpace::validSegmentCount()) for more accurate cost integral computation (but this takes more computation time). If enableMotionCostInterpolation is false (the default), only the two endpoint states are used for motion cost computation.
-
virtual Cost motionCost(const State *s1, const State *s2) const override
Compute the cost of a path segment from s1 to s2 (including endpoints)
By default, this function computes
\[\begin{eqnarray*} \mbox{cost} &=& \frac{cost(s_1) + cost(s_2)}{2}\vert s_1 - s_2 \vert \end{eqnarray*}\]If enableMotionCostInterpolation was specified as true in constructing this object, the cost will be computed by separating the motion into StateSpace::validSegmentCount() segments, using the above formula to compute the cost of each of those segments, and adding them up.
- Parameters:
s1 – start state of the motion to be evaluated
s2 – final state of the motion to be evaluated
cost – the cost of the motion segment
-
virtual Cost motionCostBestEstimate(const State *s1, const State *s2) const override
Estimate the cost of a path segment from s1 to s2 (including endpoints).
This function computes
\[\begin{eqnarray*} \mbox{cost} &=& \frac{cost(s_1) + cost(s_2)}{2}\vert s_1 - s_2 \vert \end{eqnarray*}\]regardless of whether enableMotionCostInterpolation was specified as true in constructing this object.- Parameters:
s1 – start state of the motion to be evaluated
s2 – final state of the motion to be evaluated
cost – the cost of the motion segment
-
bool isMotionCostInterpolationEnabled() const
Returns whether this objective subdivides motions into smaller segments for more accurate motion cost computation. Motion cost interpolation is disabled by default.
Protected Functions
Protected Attributes
-
bool interpolateMotionCost_
If true, then motionCost() will more accurately compute the cost of a motion by taking small steps along the motion and accumulating the cost. This sacrifices speed for accuracy. If false, the motion cost will be approximated by taking the average of the costs at the two end points, and normalizing by the distance between the two end points.
-
StateCostIntegralObjective(const SpaceInformationPtr &si, bool enableMotionCostInterpolation = false)