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

java.lang.Object
es.urjc.etsii.grafo.algorithms.vns.DefaultVNSNeighChange<S,I>
Type Parameters:
S - Solution class
I - Instance class
All Implemented Interfaces:
VNSNeighChange<S,I>, BiFunction<S,Integer,Integer>

public class DefaultVNSNeighChange<S extends Solution<S,I>,I extends Instance> extends Object implements VNSNeighChange<S,I>
Default VNSNeighChange implementation that increments K one by one until it reaches maxK. VNS stops when K is equal or greater than maxK.
  • Constructor Details

    • DefaultVNSNeighChange

      public DefaultVNSNeighChange(int maxK, int increment)
  • Method Details

    • apply

      public Integer apply(S solution, Integer originalK)
      Description copied from interface: VNSNeighChange
      Implements the neighborhood change strategy for VNS. K starts at 0 and can be incremented or modified based on the solution's state.
      Specified by:
      apply in interface BiFunction<S extends Solution<S,I>,Integer,Integer>
      Specified by:
      apply in interface VNSNeighChange<S extends Solution<S,I>,I extends Instance>
      Parameters:
      solution - Current solution, provided as a parameter so K can be adapted or scaled to instance size.
      originalK - Current k strength. Starts at 0 and increments by 1 each time the solution does not improve.
      Returns:
      new K value. Return VNSNeighChange.STOPNOW to stop when the VNS should terminate