EITstar.cpp
70 declareParam<bool>("use_k_nearest", this, &EITstar::setUseKNearest, &EITstar::getUseKNearest, "0,1");
71 declareParam<double>("rewire_factor", this, &EITstar::setRadiusFactor, &EITstar::getRadiusFactor,
73 declareParam<std::size_t>("batch_size", this, &EITstar::setBatchSize, &EITstar::getBatchSize, "1:1:10000");
74 declareParam<bool>("use_graph_pruning", this, &EITstar::enablePruning, &EITstar::isPruningEnabled, "0,1");
81 addPlannerProgressProperty("iterations INTEGER", [this]() { return std::to_string(iteration_); });
82 addPlannerProgressProperty("best cost DOUBLE", [this]() { return std::to_string(solutionCost_.value()); });
173 ompl::base::PlannerStatus EITstar::solve(const ompl::base::PlannerTerminationCondition &terminationCondition)
195 OMPL_INFORM("%s: Solving the given planning problem. The current best solution cost is %.4f", name_.c_str(),
204 // Someone might call ProblemDefinition::clearSolutionPaths() between invocations of Planner::sovle(), in
205 // which case previously found solutions are not registered with the problem definition anymore.
230 // Reset the solution costs. Cannot use infiniteCost() before resetting the objective because the objective
235 approximateSolutionCostToGoal_ = ompl::base::Cost(std::numeric_limits<double>::signaling_NaN());
475 // only consisting of start/goals, since this completely ignores the computational effort we have already
493 } // If neither the reverse nor the forward search needs to be continued, improve the approximation.
592 const bool inReverseTree = edge.source->asReverseVertex()->isParent(edge.target->asReverseVertex()) ||
734 void EITstar::improveApproximation(const ompl::base::PlannerTerminationCondition &terminationCondition)
736 // Add new states, also prunes states if enabled. The method returns true if all states have been added.
776 EITstar::ensureStartAndGoalStates(const ompl::base::PlannerTerminationCondition &terminationCondition)
837 bool EITstar::continueSolving(const ompl::base::PlannerTerminationCondition &terminationCondition) const
842 // - There is no better solution to be found for the current start goal pair and no new starts or
870 // Always continue the reverse search if the reverse queue is not empty but the forward queue is.
878 If multiquery-planning is enabled, and we are in the process of searching for the initial solution,
881 1. The best edge in the forward search has a closed target (i.e. there is a path to an edge in the
882 forward queue). Since we expand the reverse queue ordered by effort in the case that the suboptimality
887 If multiquery-planning is not enabled, there are three conditions under which the reverse search can be
890 1. The best edge in the forward search has a closed target (admissible cost-to-go estimate), and the
895 3. We do not care about solution cost and the least-effort edge in the forward queue is connected to the
928 const bool condition3 = !std::isfinite(suboptimalityFactor_) && forwardEdge.target->hasReverseVertex();
942 // The forward search must be continued if the potential solution cost of the best edge is lower than the
1006 start->asForwardVertex()->callOnBranch([this](const std::shared_ptr<eitstar::State> &state) -> void
1028 state->setCurrentCostToCome(combine(forwardVertex->getParent().lock()->getState()->getCurrentCostToCome(),
1050 // If we found this solution with a suboptimality factor greater than 1, set the factor to one now.
1102 ompl::base::Cost EITstar::computeCostToGoToGoal(const std::shared_ptr<eitstar::State> &state) const
1107 bestCost = objective_->betterCost(bestCost, objective_->motionCost(state->raw(), goal->raw()));
1114 OMPL_INFORM("%s (%u iterations): Found a new exact solution of cost %.4f. Sampled a total of %u states, %u "
1115 "of which were valid samples (%.1f \%). Processed %u edges, %u of which were collision checked "
1116 "(%.1f \%). The forward search tree has %u vertices. The reverse search tree has %u vertices.",
1136 OMPL_INFORM("%s (%u iterations): Found an exact solution of cost %.4f.", name_.c_str(), iteration_,
1142 OMPL_INFORM("%s (%u iterations): Did not find an exact solution, but found an approximate solution "
1262 const std::size_t fullSegmentCount = space_->validSegmentCount(edge.source->raw(), edge.target->raw());
1264 const std::size_t performedChecks = edge.target->getIncomingCollisionCheckResolution(edge.source);
1274 // The number of checks required to determine whether the edge is valid is the valid segment count minus one
1276 const std::size_t numChecks = space_->validSegmentCount(edge.source->raw(), edge.target->raw()) - 1u;
1301 const std::size_t fullSegmentCount = space_->validSegmentCount(edge.source->raw(), edge.target->raw());
1303 // The segment count is the number of checks on this level plus 1, capped by the full resolution segment
1315 with the outermost indices and then break the segment in half until the segment collapses to a single
1344 const std::size_t performedChecks = edge.target->getIncomingCollisionCheckResolution(edge.source);
1394 // Remember at what resolution this edge was already checked. We're assuming that the number of collision
1418 ompl::base::Cost EITstar::combine(const ompl::base::Cost &lhs, const ompl::base::Cost &rhs) const
1481 bool EITstar::doesImproveReverseTree(const Edge &edge, const ompl::base::Cost &admissibleEdgeCost) const
void enableMultiquery(bool multiquery)
Set wheter multiquery is enabled or not.
Definition: EITstar.cpp:316
void clear() override
Clears all internal planner structures but retains settings. Subsequent calls to solve() will start f...
Definition: EITstar.cpp:213
void clearQuery() override
Clears all query-specific information, such as start and goal states and search trees....
Definition: EITstar.cpp:248
eitstar::Edge getNextForwardEdge() const
Returns the next edge in the forward queue.
Definition: EITstar.cpp:429
bool multithreaded
Flag indicating whether multiple threads are used in the computation of the planner.
Definition: Planner.h:256
void enableMultiquery(bool multiquery)
Enable multiquery usage of the graph.
Definition: RandomGeometricGraph.cpp:741
std::size_t getExpandTag() const
Returns the tag when this vertex was last expanded.
Definition: Vertex.cpp:304
void setMaxNumberOfGoals(unsigned int maxNumberOfGoals)
Sets the maximum number of goals EIT* will sample from sampleable goal regions.
Definition: RandomGeometricGraph.cpp:761
ompl::base::Cost bestCost() const
Returns the cost of the current best solution.
Definition: EITstar.cpp:279
void setUseKNearest(bool useKNearest)
Set whether to use a k-nearest connection model. If false, it uses an r-disc model.
Definition: RandomGeometricGraph.cpp:751
bool getUseKNearest() const
Returns whether to use a k-nearest RGG connection model. If false, EIT* uses an r-disc model.
Definition: EITstar.cpp:362
void setStartGoalPruningThreshold(unsigned int threshold)
Set start/goal pruning threshold.
Definition: EITstar.cpp:327
bool provingSolutionNonExistence
Flag indicating whether the planner is able to prove that no solution path exists.
Definition: Planner.h:272
unsigned int getMaxNumberOfGoals() const
Returns the maximum number of goals EIT* will sample from sampleable goal regions.
Definition: RandomGeometricGraph.cpp:766
bool getUseKNearest() const
Returns whether the graph uses a k-nearest connection model. If false, it uses an r-disc model.
Definition: RandomGeometricGraph.cpp:756
bool isGoal(const std::shared_ptr< State > &state) const
Returns whether the given state is a goal state.
Definition: RandomGeometricGraph.cpp:509
void addPlannerProgressProperty(const std::string &progressPropertyName, const PlannerProgressProperty &prop)
Add a planner progress property called progressPropertyName with a property querying function prop to...
Definition: Planner.h:467
unsigned int getStartGoalPruningThreshold() const
Get threshold at which we prune starts/goals.
Definition: EITstar.cpp:332
std::vector< eitstar::Edge > getReverseQueue() const
Returns a copy of the reverse queue.
Definition: EITstar.cpp:394
Representation of a solution to a planning problem.
Definition: ProblemDefinition.h:133
void setRadiusFactor(double factor)
Sets the radius factor (eta in the paper).
Definition: RandomGeometricGraph.cpp:448
Definition of a cost value. Can represent the cost of a motion or the cost of a state.
Definition: Cost.h:111
bool isStart(const std::shared_ptr< State > &state) const
Returns whether the given state is a start state.
Definition: RandomGeometricGraph.cpp:503
bool isReverseQueueEmpty() const
Returns true if the reverse queue is empty.
Definition: EITstar.cpp:383
unsigned int getEffortThreshold() const
Gets the effort threshold.
Definition: RandomGeometricGraph.cpp:463
unsigned int getNumberOfSampledStates() const
Returns the number of sampled states.
Definition: RandomGeometricGraph.cpp:478
bool hasForwardVertex() const
Returns whether the state has an associated forward vertex.
Definition: State.cpp:183
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique,...
Definition: PlannerData.h:238
const std::vector< std::shared_ptr< State > > & getStartStates() const
Returns the start states.
Definition: RandomGeometricGraph.cpp:468
const std::vector< std::shared_ptr< State > > & getGoalStates() const
Returns the goal states.
Definition: RandomGeometricGraph.cpp:473
void setup() override
Setup the parts of the planner that rely on the problem definition being set.
Definition: EITstar.cpp:96
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
Definition: PlannerTerminationCondition.h:127
bool areApproximateSolutionsTracked() const
Returns whether approximate solutions are tracked or not.
Definition: EITstar.cpp:352
bool directed
Flag indicating whether the planner is able to account for the fact that the validity of a motion fro...
Definition: Planner.h:269
void trackApproximateSolutions(bool track)
Sets whether to track approximate solutions or not.
Definition: EITstar.cpp:347
void setup(const std::shared_ptr< ompl::base::ProblemDefinition > &problem, ompl::base::PlannerInputStates *inputStates)
Setup the graph with the given problem definition and planner input states.
Definition: RandomGeometricGraph.cpp:168
bool optimizingPaths
Flag indicating whether the planner attempts to optimize the path and reduce its length until the max...
Definition: Planner.h:263
std::vector< eitstar::Edge > getReverseTree() const
Returns copies of the edges in the reverse tree.
Definition: EITstar.cpp:399
void setBatchSize(unsigned int numSamples)
Sets the number of samples per batch.
Definition: EITstar.cpp:284
std::shared_ptr< Vertex > asForwardVertex()
Returns the state as a reverse vertex.
Definition: State.cpp:193
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:112
ompl::base::PlannerStatus solve(const ompl::base::PlannerTerminationCondition &terminationCondition) override
Solves the provided motion planning problem, respecting the given termination condition.
Definition: EITstar.cpp:173
bool canReportIntermediateSolutions
Flag indicating whether the planner is able to report the computation of intermediate paths.
Definition: Planner.h:275
void clearQuery()
Clears all query-specific structures, such as start and goal states.
Definition: RandomGeometricGraph.cpp:261
void clear()
Clears all internal planner structures but retains settings. Subsequent calls to solve() will start f...
Definition: RandomGeometricGraph.cpp:201
std::shared_ptr< Vertex > asReverseVertex()
Returns the state as a reverse vertex.
Definition: State.cpp:218
unsigned int getNumberOfNearestNeighborCalls() const
Returns the number of nearest neighbor calls.
Definition: RandomGeometricGraph.cpp:488
void setEffortThreshold(const unsigned int threshold)
Sets the effort threshold.
Definition: RandomGeometricGraph.cpp:458
@ GOAL_SAMPLEABLE_REGION
This bit is set if casting to sampleable goal regions (ompl::base::GoalSampleableRegion) is possible.
Definition: GoalTypes.h:152
std::vector< eitstar::Edge > getForwardQueue() const
Returns a copy of the forward queue.
Definition: EITstar.cpp:389
unsigned int addVertex(const PlannerDataVertex &st)
Adds the given vertex to the graph data. The vertex index is returned. Duplicates are not added....
Definition: PlannerData.cpp:389
unsigned int getMaxNumberOfGoals() const
Returns the maximum number of goals EIT* will sample from sampleable goal regions.
Definition: EITstar.cpp:372
bool hasReverseVertex() const
Returns whether the state has an associated reverse vertex.
Definition: State.cpp:188
void setUseKNearest(bool useKNearest)
Set whether to use a k-nearest RGG connection model. If false, EIT* uses an r-disc model.
Definition: EITstar.cpp:357
bool approximateSolutions
Flag indicating whether the planner is able to compute approximate solutions.
Definition: Planner.h:259
std::vector< std::shared_ptr< State > > getStates() const
Returns all sampled states (that have not been pruned).
Definition: RandomGeometricGraph.cpp:515
void setInitialNumberOfSparseCollisionChecks(std::size_t numChecks)
Sets the initial number of collision checks on the reverse search.
Definition: EITstar.cpp:294
virtual bool addEdge(unsigned int v1, unsigned int v2, const PlannerDataEdge &edge=PlannerDataEdge(), Cost weight=Cost(1.0))
Adds a directed edge between the given vertex indexes. An optional edge structure and weight can be s...
Definition: PlannerData.cpp:430
bool isForwardQueueEmpty() const
Returns true if the forward queue is empty.
Definition: EITstar.cpp:377
void setMaxNumberOfGoals(unsigned int numberOfGoals)
Set the maximum number of goals EIT* will sample from sampleable goal regions.
Definition: EITstar.cpp:367
eitstar::Edge getNextReverseEdge() const
Returns the next edge in the reverse queue.
Definition: EITstar.cpp:439
Base class for a vertex in the PlannerData structure. All derived classes must implement the clone an...
Definition: PlannerData.h:122
bool isPruningEnabled() const
Returns Whether pruning is enabled.
Definition: RandomGeometricGraph.cpp:736
void setSuboptimalityFactor(double factor)
Sets the (initial) suboptimality factor.
Definition: EITstar.cpp:311
void getPlannerData(base::PlannerData &data) const override
Returns the planner data.
Definition: EITstar.cpp:449
double getRadiusFactor() const
Returns the radius factor (eta in the paper).
Definition: RandomGeometricGraph.cpp:453
unsigned int getBatchSize() const
Returns the number of samples per batch.
Definition: EITstar.cpp:289