Class Neighbor

    • Field Detail

      • variables

        protected final IntVar[] variables
      • values

        protected final int[] values
    • Constructor Detail

      • Neighbor

        protected Neighbor​(IntVar[] variables)
    • Method Detail

      • init

        public void init()
        Initialize this neighbor
      • recordSolution

        public void recordSolution()
        Record values of decision variables to freeze some ones during the next LNS run
      • fixSomeVariables

        public abstract void fixSomeVariables()
                                       throws ContradictionException
        Freezes some variables in order to have a fast computation. The fixed variables are declared as decisions in the decision path.
        Throws:
        ContradictionException
      • freeze

        public void freeze​(int i)
                    throws ContradictionException
        Freeze variable at position 'i' to its value in that recorded solution.
        Parameters:
        i - position of the variable to instantiate
        Throws:
        ContradictionException - if a contradiction occurs
      • restrictLess

        public void restrictLess()
        Use less restriction at the beginning of a LNS run in order to get better solutions Called when no solution was found during a LNS run (trapped into a local optimum)
      • isSearchComplete

        public boolean isSearchComplete()
        Returns:
        true iff the search is in a complete mode (no fixed variable)
      • loadFromSolution

        public void loadFromSolution​(Solution solution)
        Load a solution and record it
        Parameters:
        solution - a solution to record
      • forEachIntVar

        public void forEachIntVar​(Consumer<IntVar> action)
        Description copied from interface: ICause
        Apply an action on each variable declared on the scope of this cause, if any.
        Specified by:
        forEachIntVar in interface ICause
        Parameters:
        action - action to perform on each variable declared in this cause.