Class ParallelPlan
Defined in File ParallelPlan.h
Class Documentation
-
class ParallelPlan
This is a utility that allows executing multiple planners in parallel, until one or more find a solution. Optionally, the results are automatically hybridized using ompl::geometric::PathHybridization. Between calls to solve(), the set of known solutions (maintained by ompl::base::Goal) are not cleared, and neither is the hybridization datastructure.
Public Functions
-
ParallelPlan(const base::ProblemDefinitionPtr &pdef)
Create an instance for a specified space information.
-
virtual ~ParallelPlan()
-
void addPlanner(const base::PlannerPtr &planner)
Add a planner to use.
-
void addPlannerAllocator(const base::PlannerAllocator &pa)
Add a planner allocator to use.
-
void clearHybridizationPaths()
Clear the set of paths recorded for hybrididzation.
-
void clearPlanners()
Clear the set of planners to be executed.
-
inline const base::ProblemDefinitionPtr &getProblemDefinition() const
Get the problem definition used.
-
inline base::ProblemDefinitionPtr &getProblemDefinition()
Get the problem definition used.
-
base::PlannerStatus solve(double solveTime, bool hybridize = true)
Call Planner::solve() for all planners, in parallel, each planner running for at most solveTime seconds. If hybridize is false, when the first solution is found, the rest of the planners are stopped as well. If hybridize is true, all planners are executed until termination and the obtained solution paths are hybridized.
-
base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc, bool hybridize = true)
Call Planner::solve() for all planners, in parallel, until the termination condition ptc becomes true. If hybridize is false, when the first solution is found, the rest of the planners are stopped as well. If hybridize is true, all planners are executed until termination and the obtained solution paths are hybridized.
-
base::PlannerStatus solve(double solveTime, std::size_t minSolCount, std::size_t maxSolCount, bool hybridize = true)
Call Planner::solve() for all planners, in parallel, each planner running for at most solveTime seconds. If hybridize is false, when minSolCount new solutions are found (added to the set of solutions maintained by ompl::base::Goal), the rest of the planners are stopped as well. If hybridize is true, all planners are executed until termination or until maxSolCount new solutions were obtained. While hybridize is true, if minSolCount or more solution paths are available, they are hybridized.
-
base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc, std::size_t minSolCount, std::size_t maxSolCount, bool hybridize = true)
Call Planner::solve() for all planners, in parallel, until the termination condition ptc becomes true. If hybridize is false, when minSolCount new solutions are found (added to the set of solutions maintained by ompl::base::Goal), the rest of the planners are stopped as well. If hybridize is true, all planners are executed until termination or until maxSolCount new solutions were obtained. While hybridize is true, if minSolCount or more solution paths are available, they are hybridized.
Protected Functions
-
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 once a first solution is found.
-
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.
Protected Attributes
-
base::ProblemDefinitionPtr pdef_
The problem definition used.
-
std::vector<base::PlannerPtr> planners_
The set of planners to be used.
-
geometric::PathHybridizationPtr phybrid_
The instance of the class that performs path hybridization.
-
std::mutex phlock_
Lock for phybrid_.
-
ParallelPlan(const base::ProblemDefinitionPtr &pdef)