Class RandomNeighborhood

  • All Implemented Interfaces:
    ICause

    public class RandomNeighborhood
    extends Neighbor
    A Random LNS

    Since:
    18/04/13
    Author:
    Charles Prud'homme
    • Field Detail

      • n

        protected final int n
        Number of variables to consider in this neighbor
      • limit

        protected int limit
        Next time the level should be increased
      • level

        protected final int level
        Relaxing factor
      • fragment

        protected BitSet fragment
        Indicate which variables are selected to be part of the fragment
    • Constructor Detail

      • RandomNeighborhood

        public RandomNeighborhood​(IntVar[] vars,
                                  int level,
                                  long seed)
        Create a neighbor for LNS which randomly selects variable to be part of a fragment
        Parameters:
        vars - variables to consider in this
        level - relaxing factor
        seed - for randomness
    • Method Detail

      • recordSolution

        public void recordSolution()
        Description copied from class: Neighbor
        Record values of decision variables to freeze some ones during the next LNS run
        Overrides:
        recordSolution in class Neighbor
      • loadFromSolution

        public void loadFromSolution​(Solution solution)
        Description copied from class: Neighbor
        Load a solution and record it
        Overrides:
        loadFromSolution in class Neighbor
        Parameters:
        solution - a solution to record
      • restrictLess

        public void restrictLess()
        Description copied from class: Neighbor
        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)
        Overrides:
        restrictLess in class Neighbor