InformedStateSampler.cpp
49 InformedSampler::InformedSampler(const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls)
58 throw Exception ("InformedSampler: An optimization objective must be specified at construction.");
65 throw Exception ("InformedSampler: At least one start state must be specified at construction.");
75 // Subtract the measures defined by the max and min costs. These will be defined in the deriving class.
81 // Return the best heuristic estimate of the cost-to-come and cost-to-go from the state considering all starts.
87 return opt_->combineCosts(opt_->motionCostHeuristic(probDefn_->getStartState(0u), statePtr), opt_->costToGo(statePtr, probDefn_->getGoal().get()));
101 bestCost = opt_->betterCost(bestCost, opt_->combineCosts(opt_->motionCostHeuristic(probDefn_->getStartState(i), statePtr), opt_->costToGo(statePtr, probDefn_->getGoal().get())));
117 InformedStateSampler::InformedStateSampler(const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls, const GetCurrentCostFunc &costFunc)
121 commonConstructor(costFunc, probDefn->getOptimizationObjective()->allocInformedStateSampler(probDefn, maxNumberCalls));
124 InformedStateSampler::InformedStateSampler(const ProblemDefinitionPtr &probDefn, const GetCurrentCostFunc &costFunc, const InformedSamplerPtr &infSampler)
131 void InformedStateSampler::commonConstructor(const GetCurrentCostFunc &costFunc, const InformedSamplerPtr &infSampler)
160 void InformedStateSampler::sampleUniformNear(State *statePtr, const State *near, const double distance)
167 void InformedStateSampler::sampleGaussian(State *statePtr, const State *mean, const double stdDev)
A shared pointer wrapper for ompl::base::ProblemDefinition.
virtual Cost heuristicSolnCost(const State *statePtr) const
A helper function to calculate the heuristic estimate of the solution cost for a given state using th...
Definition: InformedStateSampler.cpp:79
OptimizationObjectivePtr opt_
A copy of the optimization objective.
Definition: InformedStateSampler.h:99
virtual void sampleUniformNear(State *statePtr, const State *near, const double distance)
By default sampleUniformNear throws. This can be overloaded by a specific informed sampler if desired...
Definition: InformedStateSampler.cpp:160
virtual void sampleUniform(State *statePtr)
Sample uniformly in the subset of the state space whose heuristic solution estimates are less than th...
Definition: InformedStateSampler.cpp:143
virtual double getInformedMeasure(const Cost ¤tCost) const =0
The measure of the subset of the state space defined by the current solution cost that is being searc...
InformedStateSampler(const ProblemDefinitionPtr &probDefn, unsigned int maxNumberCalls, const GetCurrentCostFunc &costFunc)
Construct a sampler that only generates states with a heuristic solution estimate that is less than t...
Definition: InformedStateSampler.cpp:117
virtual StateSamplerPtr allocDefaultStateSampler() const =0
Allocate an instance of the default uniform state sampler for this space.
ProblemDefinitionPtr probDefn_
A copy of the problem definition.
Definition: InformedStateSampler.h:97
std::function< Cost()> GetCurrentCostFunc
The definition of a function pointer for querying the current solution cost.
Definition: InformedStateSampler.h:115
Definition of a cost value. Can represent the cost of a motion or the cost of a state.
Definition: Cost.h:47
virtual void sampleGaussian(State *statePtr, const State *mean, const double stdDev)
By default sampleGaussian throws. This can be overloaded by a specific informed sampler if desired...
Definition: InformedStateSampler.cpp:167