Class IntVarLocalSearchOperator

  • Direct Known Subclasses:
    BaseLns, ChangeValue, PathOperator

    public class IntVarLocalSearchOperator
    extends LocalSearchOperator
    Specialization of LocalSearchOperator built from an array of IntVars
    which specifies the scope of the operator.
    This class also takes care of storing current variable values in Start(),
    keeps track of changes done by the operator and builds the delta.
    The Deactivate() method can be used to perform Large Neighborhood Search.
    • Constructor Detail

      • IntVarLocalSearchOperator

        protected IntVarLocalSearchOperator​(long cPtr,
                                            boolean cMemoryOwn)
      • IntVarLocalSearchOperator

        public IntVarLocalSearchOperator​(IntVar[] vars,
                                         boolean keep_inverse_values)
      • IntVarLocalSearchOperator

        public IntVarLocalSearchOperator​(IntVar[] vars)
    • Method Detail

      • start

        public void start​(Assignment assignment)
        This method should not be overridden. Override OnStart() instead which is
        called before exiting this method.
        Overrides:
        start in class LocalSearchOperator
      • isIncremental

        public boolean isIncremental()
      • size

        public int size()
      • value

        public long value​(long index)
        Returns the value in the current assignment of the variable of given
        index.
      • var

        public IntVar var​(long index)
        Returns the variable of given index.
      • SkipUnchanged

        public boolean SkipUnchanged​(int index)
      • oldValue

        public long oldValue​(long index)
      • PrevValue

        public long PrevValue​(long index)
      • setValue

        public void setValue​(long index,
                             long value)
      • activated

        public boolean activated​(long index)
      • activate

        public void activate​(long index)
      • deactivate

        public void deactivate​(long index)
      • RevertChanges

        public void RevertChanges​(boolean change_was_incremental)
      • addVars

        public void addVars​(IntVar[] vars)
      • onStart

        public void onStart()
        Called by Start() after synchronizing the operator with the current
        assignment. Should be overridden instead of Start() to avoid calling
        IntVarLocalSearchOperator::Start explicitly.
      • oneNeighbor

        protected boolean oneNeighbor()
        Creates a new neighbor. It returns false when the neighborhood is
        completely explored.
        MakeNextNeighbor() in a subclass of IntVarLocalSearchOperator.