java.lang.Object
es.urjc.etsii.grafo.algorithms.Algorithm<S,I>
es.urjc.etsii.grafo.algorithms.vns.VNS<S,I>
- Type Parameters:
S
- type of the problem solutionI
- type of the problem instance
Variable neighborhood search (VNS) is a metaheuristic for solving combinatorial
and global optimization problems. Its basic idea is the systematic change of
neighborhood both in a descent phase to find a local optimum and in a perturbation
phase to exit the corresponding local optimum
Algorithmic outline one of the simplest versions of VNS
s = GenerateInitialSolution while (Termination criteria is not met){ k = 1 while (k != kmax){ s' = Shake(s,k) s'' = Improve (s') NeighborhoodChange(s,s'',k) } }
More information can be found in: Hansen P., Mladenović N. (2018) Variable Neighborhood Search. In: Martí R., Pardalos P., Resende M. (eds) Handbook of Heuristics. Springer, Cham. ...
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Constructive
<S, I> Constructive procedureprotected VNSNeighChange
<S, I> Calculates K value for each VNS step.Objective function to optimizeShake procedure -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
VNS
(String algorithmName, int maxK, Constructive<S, I> constructive, Shake<S, I> shake, Improver<S, I> improver) VNS with default KMapper, which starts at 0 and increments by 1 each time the solution does not improve.VNS
(String algorithmName, Objective<?, S, I> objective, VNSNeighChange<S, I> neighChange, Constructive<S, I> constructive, Shake<S, I> shake, Improver<S, I> improver) Execute VNS until finished -
Method Summary
Methods inherited from class es.urjc.etsii.grafo.algorithms.Algorithm
getBuilder, getName, newSolution, setBuilder, setName
-
Field Details
-
improver
-
constructive
Constructive procedure -
shake
Shake procedure -
neighChange
Calculates K value for each VNS step. -
objective
Objective function to optimize
-
-
Constructor Details
-
VNS
@AutoconfigConstructor protected VNS(@ProvidedParam String algorithmName, @IntegerParam(min=1,max=100) int maxK, Constructive<S, I> constructive, Shake<S, I> shake, Improver<S, I> improver) VNS with default KMapper, which starts at 0 and increments by 1 each time the solution does not improve. Stops when k >= 5. Behaviour can be customized passing a custom kMapper, such as:(solution, originalK) -> originalK >= 10 ? KMapper.STOPNOW : originalK
- Parameters:
algorithmName
- Algorithm name, example "VNS1-GRASP". Uniquely identifies the current algorithm. Tip: If you dont care about the name, generate a random one usingStringUtil.randomAlgorithmName()
constructive
- Constructive methodshake
- Perturbation methodimprover
- List of improvers/local searches
-
VNS
public VNS(String algorithmName, Objective<?, S, I> objective, VNSNeighChange<S, I> neighChange, Constructive<S, I> constructive, Shake<S, I> shake, Improver<S, I> improver) Execute VNS until finished- Parameters:
algorithmName
- Algorithm name, example: "VNSWithRandomConstructive"objective
- function to optimizeneighChange
- k value provider, @see VNS.KMapperconstructive
- Constructive methodshake
- Perturbation methodimprover
- List of improvers/local searches
-
-
Method Details
-
algorithm
VNS algorithm. This procedure follows this schema:s = GenerateInitial solution k = 1 while (k != kmax){ s' = Shake(s,k) s'' = Improve (s') NeighborhoodChange(s,s'',k) }
To run the VNS procedure multiples time consider use MultiStart algorithm class
-
toString
-