ParallelPlan.cpp
81 ompl::base::PlannerStatus ompl::tools::ParallelPlan::solve(double solveTime, std::size_t minSolCount, std::size_t maxSolCount, bool hybridize)
83 return solve(base::timedPlannerTerminationCondition(solveTime, std::min(solveTime / 100.0, 0.1)), minSolCount, maxSolCount, hybridize);
87 ompl::base::PlannerStatus ompl::tools::ParallelPlan::solve(const base::PlannerTerminationCondition &ptc, bool hybridize)
92 ompl::base::PlannerStatus ompl::tools::ParallelPlan::solve(const base::PlannerTerminationCondition &ptc, std::size_t minSolCount,
105 threads[i] = new std::thread(std::bind(&ParallelPlan::solveMore, this, planners_[i].get(), minSolCount, maxSolCount, &ptc));
108 threads[i] = new std::thread(std::bind(&ParallelPlan::solveOne, this, planners_[i].get(), minSolCount, &ptc));
124 pdef_->addSolutionPath(hsol, approximate, difference, phybrid_->getName()); // name this solution after the hybridization algorithm
129 OMPL_INFORM("ParallelPlan::solve(): Solution found by one or more threads in %f seconds", time::seconds(time::now() - start));
131 OMPL_WARN("ParallelPlan::solve(): Unable to find solution by any of the threads in %f seconds", time::seconds(time::now() - start));
136 void ompl::tools::ParallelPlan::solveOne(base::Planner *planner, std::size_t minSolCount, const base::PlannerTerminationCondition *ptc)
149 OMPL_DEBUG("ParallelPlan.solveOne: Solution found by %s in %lf seconds", planner->getName().c_str(), duration);
153 void ompl::tools::ParallelPlan::solveMore(base::Planner *planner, std::size_t minSolCount, std::size_t maxSolCount,
169 OMPL_DEBUG("ParallelPlan.solveMore: Solution found by %s in %lf seconds", planner->getName().c_str(), duration);
183 OMPL_DEBUG("ParallelPlan.solveMore: Spent %f seconds hybridizing %u solution paths (attempted %u connections between paths)", duration,
void clearHybridizationPaths()
Clear the set of paths recorded for hybrididzation.
Definition: ParallelPlan.cpp:71
A shared pointer wrapper for ompl::base::ProblemDefinition.
void addPlannerAllocator(const base::PlannerAllocator &pa)
Add a planner allocator to use.
Definition: ParallelPlan.cpp:59
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
Definition: PlannerTerminationCondition.h:66
void solveMore(base::Planner *planner, std::size_t minSolCount, std::size_t maxSolCount, const base::PlannerTerminationCondition *ptc)
Run the planner and collect the solutions. This function is only called if hybridize_ is true...
Definition: ParallelPlan.cpp:153
duration seconds(double sec)
Return the time duration representing a given number of seconds.
Definition: Time.h:78
PlannerTerminationCondition timedPlannerTerminationCondition(double duration)
Return a termination condition that will become true duration seconds in the future (wall-time) ...
Definition: PlannerTerminationCondition.cpp:222
base::PlannerStatus solve(double solveTime, bool hybridize=true)
Call Planner::solve() for all planners, in parallel, each planner running for at most solveTime secon...
Definition: ParallelPlan.cpp:76
std::vector< base::PlannerPtr > planners_
The set of planners to be used.
Definition: ParallelPlan.h:127
geometric::PathHybridizationPtr phybrid_
The instance of the class that performs path hybridization.
Definition: ParallelPlan.h:130
std::function< PlannerPtr(const SpaceInformationPtr &)> PlannerAllocator
Definition of a function that can allocate a planner.
Definition: Planner.h:423
A shared pointer wrapper for ompl::base::Planner.
ParallelPlan(const base::ProblemDefinitionPtr &pdef)
Create an instance for a specified space information.
Definition: ParallelPlan.cpp:41
std::vector< base::State * > & getStates()
Get the states that make up the path (as a reference, so it can be modified, hence the function is no...
Definition: PathGeometric.h:219
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
void addPlanner(const base::PlannerPtr &planner)
Add a planner to use.
Definition: ParallelPlan.cpp:50
virtual PlannerStatus solve(const PlannerTerminationCondition &ptc)=0
Function that can solve the motion planning problem. This function can be called multiple times on th...
void solveOne(base::Planner *planner, std::size_t minSolCount, const base::PlannerTerminationCondition *ptc)
Run the planner and call ompl::base::PlannerTerminationCondition::terminate() for the other planners ...
Definition: ParallelPlan.cpp:136
void terminate() const
Notify that the condition for termination should become true, regardless of what eval() returns...
Definition: PlannerTerminationCondition.cpp:168
A shared pointer wrapper for ompl::base::Path.