Class PathLengthOptimizer
- java.lang.Object
-
- org.robwork.sdurw_pathoptimization.PathLengthOptimizer
-
public class PathLengthOptimizer extends java.lang.Object
The PathLengthOptimizer implements the 3 different path length optimizers
presented in [1].
[1]: R. Geraerts and M.H. Overmars, Creating High-Quality Paths for Motion Planning,
The International Journal of Robotics Research, Vol. 26, No. 8, 845-863 (2007)
The simplest algorithm pathPruning runs through the path an tests if nodes with
index i and i+2 can be directly connected. If so it removed node i+1.
The shortCut algorithm works similary except that it takes two random indices
i and j and tries to connect those. This algorithm is non-deterministic but more
powerful than pathPruning.
The partialShortCut algorithm select two random node indices i and j and a random
position in the configuration vector. A shortcut is then only tried between the values
corresponding to the random position. This algorithm is generally more powerful than
shortCut but may in some cases be more computational expensive.
-
-
Constructor Summary
Constructors Constructor Description PathLengthOptimizer(long cPtr, boolean cMemoryOwn)
PathLengthOptimizer(PlannerConstraint constraint, MetricQCPtr metric)
Constructor
Path optimization is based on a constraint for edges together with a
distance metric to measure whether the path modifications decrease
the length of the path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
static long
getCPtr(PathLengthOptimizer obj)
static java.lang.String
getPROP_LOOPCOUNT()
Property key for the maximal number of loopsstatic java.lang.String
getPROP_MAXTIME()
Property key for max timestatic java.lang.String
getPROP_SUBDIVLENGTH()
Property key for length of segment in when subdividingPropertyMap
getPropertyMap()
Returns the propertymapSWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t
partialShortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path)
Optimizes using the partial shortcut technique
Works similar to partialShortCut(const rw::pathplanning::Path&,
size_t, double, double) except that parameters are read from the
propertymap.
SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t
partialShortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path, long cnt, double time, double subDivideLength)
Optimizes using the partial shortcut technique
The partialShortCut algorithm select two random node indices i and j and a random
position in the configuration vector.SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t
pathPruning(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path)
Optimizes using path pruning.
pathPruning runs through the path an tests if nodes with
index i and i+2 can be directly connected.SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t
shortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path)
Optimizes using the shortcut technique
Works similar to shortCut(const rw::pathplanning::Path&, size_t,
double, double) except that parameters are read from the propertymap.
SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t
shortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path, long cnt, double time, double subDivideLength)
Optimizes using the shortcut technique
The shortCut algorithm works by selecting two random indices i and j and
try to connect those.
The algorithm will loop until either the specified cnt is of met or the specified
time is reached.
-
-
-
Constructor Detail
-
PathLengthOptimizer
public PathLengthOptimizer(long cPtr, boolean cMemoryOwn)
-
PathLengthOptimizer
public PathLengthOptimizer(PlannerConstraint constraint, MetricQCPtr metric)
Constructor
Path optimization is based on a constraint for edges together with a
distance metric to measure whether the path modifications decrease
the length of the path.
- Parameters:
constraint
- [in] Verification of edges and configurations.metric
- [in] Distance metric for edge lengths
-
-
Method Detail
-
getCPtr
public static long getCPtr(PathLengthOptimizer obj)
-
delete
public void delete()
-
pathPruning
public SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t pathPruning(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path)
Optimizes using path pruning.
pathPruning runs through the path an tests if nodes with
index i and i+2 can be directly connected. If so it removes node i+1.
- Parameters:
path
- [in] Path to optimize
-
shortCut
public SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t shortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path, long cnt, double time, double subDivideLength)
Optimizes using the shortcut technique
The shortCut algorithm works by selecting two random indices i and j and
try to connect those.
The algorithm will loop until either the specified cnt is of met or the specified
time is reached.
- Parameters:
path
- [inout] Path to optimizecnt
- [in] Max count to use. If cnt=0, only the time limit will be usedtime
- [in] Max time to use (in seconds). If time=0, only the cnt limit will be usedsubDivideLength
- [in] The length into which the path is subdivided
-
shortCut
public SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t shortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path)
Optimizes using the shortcut technique
Works similar to shortCut(const rw::pathplanning::Path&, size_t,
double, double) except that parameters are read from the propertymap.
- Parameters:
path
- [inout] Path to optimize
-
partialShortCut
public SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t partialShortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path, long cnt, double time, double subDivideLength)
Optimizes using the partial shortcut technique
The partialShortCut algorithm select two random node indices i and j and a random
position in the configuration vector. A shortcut is then only tried between the values
corresponding to the random position.
The algorithm will loop until either the specified cnt is of met or the specified
time is reached.
- Parameters:
path
- [inout] Path to optimizecnt
- [in] Max count to use. If cnt=0, only the time limit will be usedtime
- [in] Max time to use (in seconds). If time=0, only the cnt limit will be usedsubDivideLength
- [in] The length into which the path is subdivided
-
partialShortCut
public SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t partialShortCut(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path)
Optimizes using the partial shortcut technique
Works similar to partialShortCut(const rw::pathplanning::Path&,
size_t, double, double) except that parameters are read from the
propertymap.
- Parameters:
path
- [inout] Path to optimize- Returns:
- The optimized path
-
getPropertyMap
public PropertyMap getPropertyMap()
Returns the propertymap- Returns:
- Reference to the property map
-
getPROP_LOOPCOUNT
public static java.lang.String getPROP_LOOPCOUNT()
Property key for the maximal number of loops
-
getPROP_MAXTIME
public static java.lang.String getPROP_MAXTIME()
Property key for max time
-
getPROP_SUBDIVLENGTH
public static java.lang.String getPROP_SUBDIVLENGTH()
Property key for length of segment in when subdividing
-
-