java.lang.Object
es.urjc.etsii.grafo.algorithms.vns.DefaultVNSNeighChange<S,I>
- Type Parameters:
S
- Solution classI
- 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.
-
Field Summary
Fields inherited from interface es.urjc.etsii.grafo.algorithms.vns.VNSNeighChange
STOPNOW
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
-
Constructor Details
-
DefaultVNSNeighChange
public DefaultVNSNeighChange(int maxK, int increment)
-
-
Method Details
-
apply
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 interfaceBiFunction<S extends Solution<S,
I>, Integer, Integer> - Specified by:
apply
in interfaceVNSNeighChange<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
-