Class RandomMoveShake<S extends Solution<S,I>,I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.shake.Shake<S,I>
es.urjc.etsii.grafo.shake.RandomMoveShake<S,I>
Type Parameters:
S - Solution class
I - Instance class

public class RandomMoveShake<S extends Solution<S,I>,I extends Instance> extends Shake<S,I>
Shake a solution by executing a sequence of random moves
  • Constructor Details

    • RandomMoveShake

      @AutoconfigConstructor public RandomMoveShake(@IntegerParam(min=1,max=1000) int ratio, RandomizableNeighborhood<?,S,I> neighborhood)
      Create a new RandomMoveShake
      Parameters:
      ratio - number of moves to execute = ratio * K
      neighborhood - neighborhoods to use
    • RandomMoveShake

      public RandomMoveShake(RandomizableNeighborhood<?,S,I> neighborhood)
      Create a new RandomMoveShake. Equivalent to RandomMoveShake(1, neighborhoods)
      Parameters:
      neighborhood - neighborhoods to use
  • Method Details

    • shake

      public S shake(S solution, int k)
      Shake the solution. Use k to calculate how powerful the shake should be in your implementation. Can be as simple as number of elements to remove, or to swap. Whatever you want. Shake the solution applying random movements from the configured neighborhood
      Specified by:
      shake in class Shake<S extends Solution<S,I>,I extends Instance>
      Parameters:
      solution - Solution to shake
      k - shake strength
      Returns:
      shaken solution. Shaken, not stirred.
    • toString

      public String toString()
      Overrides:
      toString in class Object