Loading...
Searching...
No Matches

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. More...

#include <ompl/tools/multiplan/ParallelPlan.h>

Public Member Functions

 ParallelPlan (const base::ProblemDefinitionPtr &pdef)
 Create an instance for a specified space information.
 
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.
 
const base::ProblemDefinitionPtr & getProblemDefinition () const
 Get the problem definition used.
 
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 Member 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_.
 

Detailed Description

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.

Definition at line 66 of file ParallelPlan.h.

Constructor & Destructor Documentation

◆ ParallelPlan()

ompl::tools::ParallelPlan::ParallelPlan ( const base::ProblemDefinitionPtr &  pdef)

Create an instance for a specified space information.

Definition at line 41 of file ParallelPlan.cpp.

Member Function Documentation

◆ addPlanner()

void ompl::tools::ParallelPlan::addPlanner ( const base::PlannerPtr &  planner)

Add a planner to use.

Definition at line 48 of file ParallelPlan.cpp.

◆ addPlannerAllocator()

void ompl::tools::ParallelPlan::addPlannerAllocator ( const base::PlannerAllocator pa)

Add a planner allocator to use.

Definition at line 57 of file ParallelPlan.cpp.

◆ clearHybridizationPaths()

void ompl::tools::ParallelPlan::clearHybridizationPaths ( )

Clear the set of paths recorded for hybrididzation.

Definition at line 69 of file ParallelPlan.cpp.

◆ clearPlanners()

void ompl::tools::ParallelPlan::clearPlanners ( )

Clear the set of planners to be executed.

Definition at line 64 of file ParallelPlan.cpp.

◆ getProblemDefinition() [1/2]

base::ProblemDefinitionPtr & ompl::tools::ParallelPlan::getProblemDefinition ( )
inline

Get the problem definition used.

Definition at line 93 of file ParallelPlan.h.

◆ getProblemDefinition() [2/2]

const base::ProblemDefinitionPtr & ompl::tools::ParallelPlan::getProblemDefinition ( ) const
inline

Get the problem definition used.

Definition at line 87 of file ParallelPlan.h.

◆ solve() [1/4]

ompl::base::PlannerStatus ompl::tools::ParallelPlan::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.

Definition at line 86 of file ParallelPlan.cpp.

◆ solve() [2/4]

ompl::base::PlannerStatus ompl::tools::ParallelPlan::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.

Definition at line 91 of file ParallelPlan.cpp.

◆ solve() [3/4]

ompl::base::PlannerStatus ompl::tools::ParallelPlan::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.

Definition at line 74 of file ParallelPlan.cpp.

◆ solve() [4/4]

ompl::base::PlannerStatus ompl::tools::ParallelPlan::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.

Definition at line 79 of file ParallelPlan.cpp.

◆ solveMore()

void ompl::tools::ParallelPlan::solveMore ( base::Planner planner,
std::size_t  minSolCount,
std::size_t  maxSolCount,
const base::PlannerTerminationCondition ptc 
)
protected

Run the planner and collect the solutions. This function is only called if hybridize_ is true.

Definition at line 162 of file ParallelPlan.cpp.

◆ solveOne()

void ompl::tools::ParallelPlan::solveOne ( base::Planner planner,
std::size_t  minSolCount,
const base::PlannerTerminationCondition ptc 
)
protected

Run the planner and call ompl::base::PlannerTerminationCondition::terminate() for the other planners once a first solution is found.

Definition at line 144 of file ParallelPlan.cpp.

Member Data Documentation

◆ pdef_

base::ProblemDefinitionPtr ompl::tools::ParallelPlan::pdef_
protected

The problem definition used.

Definition at line 147 of file ParallelPlan.h.

◆ phlock_

std::mutex ompl::tools::ParallelPlan::phlock_
protected

Lock for phybrid_.

Definition at line 156 of file ParallelPlan.h.

◆ phybrid_

geometric::PathHybridizationPtr ompl::tools::ParallelPlan::phybrid_
protected

The instance of the class that performs path hybridization.

Definition at line 153 of file ParallelPlan.h.

◆ planners_

std::vector<base::PlannerPtr> ompl::tools::ParallelPlan::planners_
protected

The set of planners to be used.

Definition at line 150 of file ParallelPlan.h.


The documentation for this class was generated from the following files: