PathLengthDirectInfSampler.cpp
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2014, University of Toronto
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the University of Toronto nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 /* Authors: Jonathan Gammell */
36 
37 #include "ompl/base/samplers/informed/PathLengthDirectInfSampler.h"
38 #include "ompl/util/Exception.h"
39 #include "ompl/base/OptimizationObjective.h"
40 //For ompl::base::GoalSampleableRegion, which both GoalState and GoalStates derive from:
41 #include "ompl/base/goals/GoalSampleableRegion.h"
42 #include "ompl/base/StateSpace.h"
43 #include "ompl/base/spaces/RealVectorStateSpace.h"
44 
45 // For std::make_shared
46 #include <memory>
47 // For std::vector
48 #include <vector>
49 
50 namespace ompl
51 {
52  namespace base
53  {
55  //Public functions:
56 
57  // The direct ellipsoid sampling class for path-length:
59  : InformedSampler(probDefn, maxNumberCalls),
60  informedIdx_(0u),
61  uninformedIdx_(0u)
62  {
63  // Variables
64  // The number of start states
65  unsigned int numStarts;
66  // The number of goal states
67  unsigned numGoals;
68  // The foci of the PHSs as a std::vector of states. Goals must be nonconst, as we need to allocate them (unfortunately):
69  std::vector<const State*> startStates;
70  std::vector<State*> goalStates;
71 
72  if (probDefn_->getGoal()->hasType(ompl::base::GOAL_SAMPLEABLE_REGION) == false)
73  {
74  throw Exception("PathLengthDirectInfSampler: The direct path-length informed sampler currently only supports goals that can be cast to a sampleable goal region (i.e., are countable sets).");
75  }
76 
78 
79  // Store the number of starts and goals
80  numStarts = probDefn_->getStartStateCount();
81  numGoals = probDefn_->getGoal()->as<ompl::base::GoalSampleableRegion>()->maxSampleCount();
82 
83  // Sanity check that there is atleast one of each
84  if (numStarts < 1u || numGoals < 1u)
85  {
86  throw Exception("PathLengthDirectInfSampler: There must be at least 1 start and and 1 goal state when the informed sampler is created.");
87  }
88 
89  // Check that the provided statespace is compatible and extract the necessary indices.
90  // The statespace must either be R^n or SE(2) or SE(3)
91  if (InformedSampler::space_->isCompound() == false)
92  {
94  {
95  informedIdx_ = 0u;
96  uninformedIdx_ = 0u;
97  }
98  else
99  {
100  throw Exception("PathLengthDirectInfSampler only supports RealVector, SE2 and SE3 StateSpaces.");
101  }
102  }
103  else if (InformedSampler::space_->isCompound() == true)
104  {
105  // Check that it is SE2 or SE3
107  {
108  // Variable:
109  // An ease of use upcasted pointer to the space as a compound space
110  const CompoundStateSpace* compoundSpace = InformedSampler::space_->as<CompoundStateSpace>();
111 
112  // Sanity check
113  if (compoundSpace->getSubspaceCount() != 2u)
114  {
115  // Pout
116  throw Exception("The provided compound StateSpace is SE(2) or SE(3) but does not have exactly 2 subspaces.");
117  }
118 
119  // Iterate over the state spaces, finding the real vector and SO components.
120  for (unsigned int idx = 0u; idx < InformedSampler::space_->as<CompoundStateSpace>()->getSubspaceCount(); ++idx)
121  {
122  // Check if the space is real-vectored, SO2 or SO3
123  if (compoundSpace->getSubspace(idx)->getType() == STATE_SPACE_REAL_VECTOR)
124  {
125  informedIdx_ = idx;
126  }
127  else if (compoundSpace->getSubspace(idx)->getType() == STATE_SPACE_SO2)
128  {
129  uninformedIdx_ = idx;
130  }
131  else if (compoundSpace->getSubspace(idx)->getType() == STATE_SPACE_SO3)
132  {
133  uninformedIdx_ = idx;
134  }
135  else
136  {
137  // Pout
138  throw Exception("The provided compound StateSpace is SE(2) or SE(3) but contains a subspace that is not R^2, R^3, SO(2), or SO(3).");
139  }
140  }
141  }
142  else
143  {
144  throw Exception("PathLengthDirectInfSampler only supports RealVector, SE2 and SE3 statespaces.");
145  }
146  }
147 
148  // Create a sampler for the whole space that we can use if we have no information
149  baseSampler_ = InformedSampler::space_->allocDefaultStateSampler();
150 
151  // Check if the space is compound
152  if (InformedSampler::space_->isCompound() == false)
153  {
154  // It is not.
155 
156  // The informed subspace is the full space
157  informedSubSpace_ = InformedSampler::space_;
158 
159  // And the uniformed subspace and its associated sampler are null
160  uninformedSubSpace_ = StateSpacePtr();
161  uninformedSubSampler_ = StateSamplerPtr();
162  }
163  else
164  {
165  // It is
166 
167  // Get a pointer to the informed subspace...
168  informedSubSpace_ = InformedSampler::space_->as<CompoundStateSpace>()->getSubspace(informedIdx_);
169 
170  // And the uninformed subspace is the remainder.
171  uninformedSubSpace_ = InformedSampler::space_->as<CompoundStateSpace>()->getSubspace(uninformedIdx_);
172 
173  // Create a sampler for the uniformed subset:
174  uninformedSubSampler_ = uninformedSubSpace_->allocDefaultStateSampler();
175  }
176 
177  // Store the foci, first the starts:
178  for (unsigned int i = 0u; i < numStarts; ++i)
179  {
180  startStates.push_back(probDefn_->getStartState(i));
181  }
182 
183 
184  // Extract the state of each goal one and place into the goal vector!
185  for (unsigned int i = 0u; i < numGoals; ++i)
186  {
187  // Allocate a state onto the back of the vector:
188  goalStates.push_back(InformedSampler::space_->allocState());
189 
190  // Now sample a goal into that state:
191  probDefn_->getGoal()->as<ompl::base::GoalSampleableRegion>()->sampleGoal(goalStates.back());
192  }
193 
194  // Now, iterate create a PHS for each start-goal pair
195  // Each start
196  for (unsigned int i = 0u; i < numStarts; ++i)
197  {
198  // Variable
199  // The start as a vector
200  std::vector<double> startFocusVector = getInformedSubstate(startStates.at(i));
201 
202  // Each goal
203  for (unsigned int j = 0u; j < numGoals; ++ j)
204  {
205  // Variable
206  // The goal as a vector
207  std::vector<double> goalFocusVector = getInformedSubstate(goalStates.at(j));
208 
209  // Create the definition of the PHS
210  listPhsPtrs_.push_back(std::make_shared<ProlateHyperspheroid>(informedSubSpace_->getDimension(), &startFocusVector[0], &goalFocusVector[0]));
211  }
212  }
213 
214  // Finally deallocate the states in the goal state vector:
215  for (unsigned int i = 0u; i < numGoals; ++i)
216  {
217  // Free the state in the vector:
218  InformedSampler::space_->freeState(goalStates.at(i));
219  }
220 
221  if (listPhsPtrs_.size() > 100u)
222  {
223  OMPL_WARN("PathLengthDirectInfSampler: Rejection sampling is used in order to maintain uniform density in the presence of overlapping informed subsets. At some number of independent subsets, this will become prohibitively expensive. Current number of independent subsets: %d", listPhsPtrs_.size());
224  }
225  }
226 
227 
228 
229  PathLengthDirectInfSampler::~PathLengthDirectInfSampler()
230  {
231  }
232 
233 
234 
235  bool PathLengthDirectInfSampler::sampleUniform(State *statePtr, const Cost &maxCost)
236  {
237  // Variable
238  // The persistent iteration counter:
239  unsigned int iter = 0u;
240 
241  //Call the sampleUniform helper function with my iteration counter:
242  return sampleUniform(statePtr, maxCost, &iter);
243  }
244 
245 
246 
247  bool PathLengthDirectInfSampler::sampleUniform(State *statePtr, const Cost &minCost, const Cost &maxCost)
248  {
249  // Sample from the larger PHS until the sample does not lie within the smaller PHS.
250  // Since volume in a sphere/spheroid is proportionately concentrated near the surface, this isn't horribly inefficient, though a direct method would be better
251 
252  // Variable
253  // Whether we were successful in creating an informed sample. Initially not:
254  bool foundSample = false;
255 
256  // Spend numIters_ iterations trying to find an informed sample:
257  for (unsigned int i = 0u; i < InformedSampler::numIters_ && foundSample == false; ++i)
258  {
259  // Call the helper function for the larger PHS. It will move our iteration counter:
260  foundSample = sampleUniform(statePtr, maxCost, &i);
261 
262  // Did we find a sample?
263  if (foundSample == true)
264  {
265  // We did, but it only satisfied the upper bound. Check that it meets the lower bound.
266 
267  // Variables
268  // The cost of the sample we found
269  Cost sampledCost = heuristicSolnCost(statePtr);
270 
271  // Check if the sample's cost is greater than or equal to the lower bound
272  foundSample = InformedSampler::opt_->isCostEquivalentTo(minCost, sampledCost) || InformedSampler::opt_->isCostBetterThan(minCost, sampledCost);
273  }
274  // No else, no sample was found.
275  }
276 
277  // All done, one way or the other.
278  return foundSample;
279  }
280 
281 
282 
284  {
285  return true;
286  }
287 
288 
289 
290  double PathLengthDirectInfSampler::getInformedMeasure(const Cost &currentCost) const
291  {
292  // Variable
293  // The measure of the informed set
294  double informedMeasure = 0.0;
295 
296  // The informed measure is then the sum of the measure of the individual PHSs for the given cost:
297  for (std::list<ompl::ProlateHyperspheroidPtr>::const_iterator phsIter = listPhsPtrs_.begin(); phsIter != listPhsPtrs_.end(); ++phsIter)
298  {
299  //It is nonsensical for a PHS to have a transverse diameter less than the distance between its foci, so skip those that do
300  if (currentCost.value() > (*phsIter)->getMinTransverseDiameter())
301  {
302  informedMeasure = informedMeasure + (*phsIter)->getPhsMeasure(currentCost.value());
303  }
304  //No else, this value is better than this ellipse. It will get removed later.
305  }
306 
307  // And if the space is compound, further multiplied by the measure of the uniformed subspace
308  if (InformedSampler::space_->isCompound() == true)
309  {
310  informedMeasure = informedMeasure * uninformedSubSpace_->getMeasure();
311  }
312 
313  // Return the smaller of the two measures
314  return std::min(InformedSampler::space_->getMeasure(), informedMeasure);
315  }
316 
317 
318 
320  {
321  // Variable
322  // The raw data in the state
323  std::vector<double> rawData = getInformedSubstate(statePtr);
324  // The Cost, infinity to start
325  Cost minCost = InformedSampler::opt_->infiniteCost();
326 
327  // Iterate over the separate subsets and return the minimum
328  for (std::list<ompl::ProlateHyperspheroidPtr>::const_iterator phsIter = listPhsPtrs_.begin(); phsIter != listPhsPtrs_.end(); ++phsIter)
329  {
331  minCost = InformedSampler::opt_->betterCost(minCost, Cost((*phsIter)->getPathLength(&rawData[0])));
332  }
333 
334  return minCost;
335  }
337 
338 
339 
341  //Private functions:
342  bool PathLengthDirectInfSampler::sampleUniform(State *statePtr, const Cost &maxCost, unsigned int *iters)
343  {
344  // Variable
345  // Whether we were successful in creating an informed sample. Initially not:
346  bool foundSample = false;
347 
348  //Whether we successfully returnes
349  // Check if a solution path has been found
350  if (InformedSampler::opt_->isFinite(maxCost) == false)
351  {
352  // We don't have a solution yet, we sample from our basic sampler instead...
353  baseSampler_->sampleUniform(statePtr);
354 
355  //Up our counter by one:
356  ++(*iters);
357 
358  // Mark that we sampled:
359  foundSample = true;
360  }
361  else // We have a solution
362  {
363  // Update the definitions of the PHSs
364  updatePhsDefinitions(maxCost);
365 
366  // Sample from the PHSs.
367 
368  // When the summed measure of the PHSes are suitably large, it makes more sense to just sample from the entire planning space and keep the sample if it lies in any PHS
369  // Check if the average measure is greater than half the domain's measure. Half is an arbitrary number.
370  if (informedSubSpace_->getMeasure() < summedMeasure_/static_cast<double>(listPhsPtrs_.size()))
371  {
372  // The measure is large, sample from the entire world and keep if it's in any PHS
373  foundSample = sampleBoundsRejectPhs(statePtr, iters);
374  }
375  else
376  {
377  // The measure is sufficiently small that we will directly sample the PHSes, with the weighting given by their relative measures
378  foundSample = samplePhsRejectBounds(statePtr, iters);
379  }
380  }
381 
382  // Return:
383  return foundSample;
384  }
385 
386 
387 
388  bool PathLengthDirectInfSampler::sampleBoundsRejectPhs(State* statePtr, unsigned int *iters)
389  {
390  // Variable
391  // Whether we've found a sample:
392  bool foundSample = false;
393 
394  // Spend numIters_ iterations trying to find an informed sample:
395  while (foundSample == false && *iters < InformedSampler::numIters_)
396  {
397  // Generate a random sample
398  baseSampler_->sampleUniform(statePtr);
399 
400  // The informed substate
401  std::vector<double> informedVector = getInformedSubstate(statePtr);
402 
403  // Check if the informed state is in any PHS.
404  foundSample = isInAnyPhs(informedVector);
405 
406  // Increment the provided counter
407  ++(*iters);
408  }
409 
410  // successful?
411  return foundSample;
412  }
413 
414 
415 
416  bool PathLengthDirectInfSampler::samplePhsRejectBounds(State *statePtr, unsigned int *iters)
417  {
418  // Variable
419  // Whether we were successful in creating an informed sample. Initially not:
420  bool foundSample = false;
421 
422  // Due to the possibility of overlap between multiple PHSs, we keep a sample with a probability of 1/K, where K is the number of PHSs the sample is in.
423  while (foundSample == false && *iters < InformedSampler::numIters_)
424  {
425  // Variables
426  // The informed subset of the sample as a vector
427  std::vector<double> informedVector(informedSubSpace_->getDimension());
428  // The random PHS in use for this sample.
429  ProlateHyperspheroidCPtr phsCPtr = randomPhsPtr();
430 
431  // Use the PHS to get a sample in the informed subspace irrespective of boundary
432  rng_.uniformProlateHyperspheroid(phsCPtr, &informedVector[0]);
433 
434  // Keep with probability 1/K
435  foundSample = keepSample(informedVector);
436 
437  //If we're keeping it, then check if the state is in the problem domain:
438  if (foundSample == true)
439  {
440  // Turn into a state of our full space
441  createFullState(statePtr, informedVector);
442 
443  // Return if the resulting state is in the problem:
444  foundSample = InformedSampler::space_->satisfiesBounds(statePtr);
445  }
446  // No else
447  }
448 
449  // Successful?
450  return foundSample;
451  }
452 
453 
454 
455  std::vector<double> PathLengthDirectInfSampler::getInformedSubstate(const State *statePtr) const
456  {
457  // Variable
458  // The raw data in the state
459  std::vector<double> rawData(informedSubSpace_->getDimension());
460 
461  // Get the raw data
462  if (InformedSampler::space_->isCompound() == false)
463  {
464  informedSubSpace_->copyToReals(rawData, statePtr);
465  }
466  else
467  {
468  informedSubSpace_->copyToReals(rawData, statePtr->as<CompoundState>()->components[informedIdx_]);
469  }
470 
471  return rawData;
472  }
473 
474 
475 
476  void PathLengthDirectInfSampler::createFullState(State * statePtr, const std::vector<double> &informedVector)
477  {
478 
479  // If there is an extra "uninformed" subspace, we need to add that to the state before converting the raw vector representation into a state....
480  if (InformedSampler::space_->isCompound() == false)
481  {
482  // No, space_ == informedSubSpace_
483  // Copy into the state pointer
484  informedSubSpace_->copyFromReals(statePtr, informedVector);
485  }
486  else
487  {
488  // Yes, we need to also sample the uninformed subspace
489  // Variables
490  // A state for the uninformed subspace
491  State *uninformedState = uninformedSubSpace_->allocState();
492 
493  // Copy the informed subspace into the state pointer
494  informedSubSpace_->copyFromReals(statePtr->as<CompoundState>()->components[informedIdx_], informedVector);
495 
496  // Sample the uniformed subspace
497  uninformedSubSampler_->sampleUniform(uninformedState);
498 
499  // Copy the informed subspace into the state pointer
500  uninformedSubSpace_->copyState(statePtr->as<CompoundState>()->components[uninformedIdx_], uninformedState);
501 
502  // Free the state
503  uninformedSubSpace_->freeState(uninformedState);
504  }
505  }
506 
507 
508 
509  void PathLengthDirectInfSampler::updatePhsDefinitions(const Cost &maxCost)
510  {
511  // Variable
512  // The iterator for the list:
513  std::list<ompl::ProlateHyperspheroidPtr>::iterator phsIter = listPhsPtrs_.begin();
514 
515  // Iterate over the list of PHSs, updating the summed measure
516  // Reset the sum
517  summedMeasure_ = 0.0;
518  while (phsIter != listPhsPtrs_.end())
519  {
520  // Check if the specific PHS can ever be better than the given maxCost, i.e., if the distance between the foci is less than the current max cost
521  if ((*phsIter)->getMinTransverseDiameter() < maxCost.value())
522  {
523  // It can improve the solution, or it's the only PHS we have, update it
524 
525  // Update the transverse diameter
526  (*phsIter)->setTransverseDiameter(maxCost.value());
527 
528  // Increment the summed measure of the ellipses.
529  summedMeasure_ = summedMeasure_ + (*phsIter)->getPhsMeasure();
530 
531  // Increment the iterator
532  ++phsIter;
533  }
534  else if (listPhsPtrs_.size() > 1u)
535  {
536  // It can't, and it is not the last PHS, remove it
537 
538  // Remove the iterator to delete from the list, this returns the next:
540  phsIter = listPhsPtrs_.erase(phsIter);
541  }
542  else
543  {
544  // It can't, but it's the last PHS, so we can't remove it.
545 
546  // Make sure it's transverse diameter is set to something:
547  (*phsIter)->setTransverseDiameter((*phsIter)->getMinTransverseDiameter());
548 
549  // Set the summed measure to 0.0 (as a degenerate PHS is a line):
550  summedMeasure_ = 0.0;
551 
552  // Increment the iterator so we move past this to the end.
553  ++phsIter;
554  }
555  }
556  }
557 
558 
559 
560  ompl::ProlateHyperspheroidPtr PathLengthDirectInfSampler::randomPhsPtr()
561  {
562  // Variable
563  // The return value
564  ompl::ProlateHyperspheroidPtr rval;
565 
566  // If we only have one PHS, this can be simplified:
567  if (listPhsPtrs_.size() == 1u)
568  {
569  // One PHS, keep this simple.
570 
571  // Return it
572  rval = listPhsPtrs_.front();
573  }
574  else
575  {
576  // We have more than one PHS to consider
577 
578  // Variables
579  // A randomly generated number in the interval [0,1]
580  double randDbl = rng_.uniform01();
581  // The running measure
582  double runningRelativeMeasure = 0.0;
583 
584  // The probability of using each PHS is weighted by it's measure. Therefore, if we iterate up the list of PHSs, the first one who's relative measure is greater than the PHS randomly selected
585  for (std::list<ompl::ProlateHyperspheroidPtr>::const_iterator phsIter = listPhsPtrs_.begin(); phsIter != listPhsPtrs_.end() && static_cast<bool>(rval) == false; ++phsIter)
586  {
587  // Update the running measure
588  runningRelativeMeasure = runningRelativeMeasure + (*phsIter)->getPhsMeasure()/summedMeasure_;
589 
590  // Check if it's now greater than the proportion of the summed measure
591  if (runningRelativeMeasure > randDbl)
592  {
593  // It is, return this PHS:
594  rval = *phsIter;
595  }
596  // No else, continue
597  }
598  }
599 
600  // Return
601  return rval;
602  }
603 
604 
605 
606  bool PathLengthDirectInfSampler::keepSample(const std::vector<double>& informedVector)
607  {
608  // Variable
609  // The return value, do we keep this sample? Start true.
610  bool keep = true;
611 
612  // Is there more than 1 goal?
613  if (listPhsPtrs_.size() > 1u)
614  {
615  // There is, do work
616 
617  // Variable
618  // The number of PHSs the sample is in
619  unsigned int numIn = numberOfPhsInclusions(informedVector);
620  // The random number between [0,1]
621  double randDbl = rng_.uniform01();
622 
623  // Keep the sample if the random number is less than 1/K
624  keep = (randDbl <= 1.0/static_cast<double>(numIn));
625  }
626  // No else, keep is true by default.
627 
628  return keep;
629  }
630 
631 
632 
633  bool PathLengthDirectInfSampler::isInAnyPhs(const std::vector<double>& informedVector) const
634  {
635  // Variable
636  // The return value, whether the given state is in any PHS
637  bool inPhs = false;
638 
639  // Iterate over the list, stopping as soon as we get our first true
640  for (std::list<ompl::ProlateHyperspheroidPtr>::const_iterator phsIter = listPhsPtrs_.begin(); phsIter != listPhsPtrs_.end() && inPhs == false; ++ phsIter)
641  {
642  inPhs = isInPhs(*phsIter, informedVector);
643  }
644 
645  return inPhs;
646  }
647 
648 
649 
650  bool PathLengthDirectInfSampler::isInPhs(const ProlateHyperspheroidCPtr &phsCPtr, const std::vector<double> &informedVector) const
651  {
652  return phsCPtr->isInPhs(&informedVector[0]);
653  }
654 
655 
656 
657  unsigned int PathLengthDirectInfSampler::numberOfPhsInclusions(const std::vector<double>& informedVector) const
658  {
659  // Variable
660  // The return value, the number of PHSs the vector is in
661  unsigned int numInclusions = 0u;
662 
663  // Iterate over the list counting
664  for (std::list<ompl::ProlateHyperspheroidPtr>::const_iterator phsIter = listPhsPtrs_.begin(); phsIter != listPhsPtrs_.end(); ++ phsIter)
665  {
666  // Conditionally increment
667  if ((*phsIter)->isInPhs(&informedVector[0]) == true)
668  {
669  ++numInclusions;
670  }
671  // No else
672  }
673 
674  return numInclusions;
675  }
677  }; // base
678 }; // ompl
A shared pointer wrapper for ompl::base::ProblemDefinition.
ompl::base::SO3StateSpace
A shared pointer wrapper for ompl::base::StateSpace.
A shared pointer wrapper for ompl::base::StateSampler.
virtual Cost heuristicSolnCost(const State *statePtr) const
A helper function to calculate the heuristic estimate of the solution cost for the informed subset of...
OptimizationObjectivePtr opt_
A copy of the optimization objective.
An abstract class for the concept of using information about the state space and the current solution...
StateSpacePtr space_
A copy of the state space.
const StateSpacePtr & getSubspace(const unsigned int index) const
Get a specific subspace from the compound state space.
Definition: StateSpace.cpp:898
PathLengthDirectInfSampler(const ProblemDefinitionPtr probDefn, unsigned int maxNumberCalls)
Construct a sampler that only generates states with a heuristic solution estimate that is less than t...
virtual bool sampleUniform(State *statePtr, const Cost &maxCost)
Sample uniformly in the subset of the state space whose heuristic solution estimates are less than th...
double uniform01()
Generate a random real between 0 and 1.
Definition: RandomNumbers.h:69
Abstract definition of a goal region that can be sampled.
A space to allow the composition of state spaces.
Definition: StateSpace.h:549
virtual bool hasInformedMeasure() const
Whether the sampler can provide a measure of the informed subset.
ompl::base::SE3StateSpace
double value() const
The value of the cost.
Definition: Cost.h:54
ompl::base::SE2StateSpace
Definition of an abstract state.
Definition: State.h:50
ompl::base::SO2StateSpace
#define OMPL_WARN(fmt,...)
Log a formatted warning string.
Definition: Console.h:66
The exception type for ompl.
Definition: Exception.h:47
ompl::base::RealVectorStateSpace
ProblemDefinitionPtr probDefn_
A copy of the problem definition.
unsigned int getSubspaceCount() const
Get the number of state spaces that make up the compound state space.
Definition: StateSpace.cpp:893
virtual double getInformedMeasure(const Cost &currentCost) const
The measure of the subset of the state space defined by the current solution cost that is being searc...
unsigned int numIters_
The number of iterations I'm allowed to attempt.
Definition of a cost value. Can represent the cost of a motion or the cost of a state.
Definition: Cost.h:47
This bit is set if casting to sampleable goal regions (ompl::base::GoalSampleableRegion) is possible...
Definition: GoalTypes.h:55