Class 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 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

      • delete

        public void delete()
      • 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 optimize
        cnt - [in] Max count to use. If cnt=0, only the time limit will be used
        time - [in] Max time to use (in seconds). If time=0, only the cnt limit will be used
        subDivideLength - [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,
                                                                              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 optimize
        cnt - [in] Max count to use. If cnt=0, only the time limit will be used
        time - [in] Max time to use (in seconds). If time=0, only the cnt limit will be used
        subDivideLength - [in] The length into which the path is subdivided
      • 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