Class RandomNeighborhood

  • All Implemented Interfaces:
    ICause, INeighbor

    public class RandomNeighborhood
    extends IntNeighbor
    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

      • fixSomeVariables

        public void fixSomeVariables()
                              throws ContradictionException
        Description copied from interface: INeighbor
        Freezes some variables in order to have a fast computation. The fixed variables are declared as decisions in the decision path.
        Throws:
        ContradictionException
      • restrictLess

        public void restrictLess()
        Description copied from interface: INeighbor
        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)