Class PathOperator


  • public class PathOperator
    extends IntVarLocalSearchOperator
    Base class of the local search operators dedicated to path modifications
    (a path is a set of nodes linked together by arcs).
    This family of neighborhoods supposes they are handling next variables
    representing the arcs (var[i] represents the node immediately after i on
    a path).
    Several services are provided:
    - arc manipulators (SetNext(), ReverseChain(), MoveChain())
    - path inspectors (Next(), Prev(), IsPathEnd())
    - path iterators: operators need a given number of nodes to define a
    neighbor; this class provides the iteration on a given number of (base)
    nodes which can be used to define a neighbor (through the BaseNode method)
    Subclasses only need to override MakeNeighbor to create neighbors using
    the services above (no direct manipulation of assignments).
    • Method Detail

      • getCPtr

        protected static long getCPtr​(PathOperator obj)
      • swigRelease

        protected static long swigRelease​(PathOperator obj)
      • neighbor

        public boolean neighbor()
      • Prev

        public long Prev​(long node)
        Returns the node before node in the current delta.
      • OnNodeInitialization

        protected void OnNodeInitialization()
        Called by OnStart() after initializing node information. Should be
        overridden instead of OnStart() to avoid calling PathOperator::OnStart
        explicitly.
      • restartAtPathStartOnSynchronize

        protected boolean restartAtPathStartOnSynchronize()
        When the operator is being synchronized with a new solution (when Start()
        is called), returns true to restart the exploration of the neighborhood
        from the start of the last paths explored; returns false to restart the
        exploration at the last nodes visited.
        This is used to avoid restarting on base nodes which have changed paths,
        leading to potentially skipping neighbors.
      • onSamePathAsPreviousBase

        protected boolean onSamePathAsPreviousBase​(long base_index)
        Returns true if a base node has to be on the same path as the "previous"
        base node (base node of index base_index - 1).
        Useful to limit neighborhood exploration to nodes on the same path.
        it's currently way more complicated to implement.
      • getBaseNodeRestartPosition

        protected long getBaseNodeRestartPosition​(int base_index)
        Returns the index of the node to which the base node of index base_index
        must be set to when it reaches the end of a path.
        By default, it is set to the start of the current path.
        When this method is called, one can only assume that base nodes with
        indices < base_index have their final position.
      • setNextBaseToIncrement

        protected void setNextBaseToIncrement​(long base_index)
        Set the next base to increment on next iteration. All base > base_index
        will be reset to their start value.
      • ConsiderAlternatives

        protected boolean ConsiderAlternatives​(long base_index)
        Indicates if alternatives should be considered when iterating over base
        nodes.
      • initPosition

        protected boolean initPosition()
        Returns true if the operator needs to restart its initial position at each
        call to Start()