SolutionType- solution type for which this neighbourhood can be applied, required to extend
public class CompositeNeighbourhood<SolutionType extends Solution> extends Object implements Neighbourhood<SolutionType>
|Constructor and Description|
Creates a composite neighbourhood consisting of the list of given neighbourhoods and specified weights.
|Modifier and Type||Method and Description|
Creates and returns the union of all moves generated by each of the contained neighbourhoods.
Produces a random move generated by one of the contained neighbourhoods based on the assigned weights.
Create string representation that indicates the contained neighbourhoods and respective weights.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public CompositeNeighbourhood(List<? extends Neighbourhood<? super SolutionType>> neighbourhoods, List<Double> neighbourhoodWeights)
null, should be of the same size and can not contain any
nullelements. At least one neighbourhood should be given and all weights should be strictly positive.
neighbourhoods- list of neighbourhoods
neighbourhoodWeights- list of weights assigned to the neighbourhoods (same order as neighbourhoods)
nullor contain any
neighbourhoodWeightsare not of the same size or both empty, or if
neighbourhoodWeightscontains any weight ≤ 0
public Move<? super SolutionType> getRandomMove(SolutionType solution, Random rnd)
null. Else, it selects a move through roulette selection based on the weights assigned at construction.
Neighbourhood<SolutionType extends Solution>
solution- solution for which a move is generated
rnd- source of randomness used to generate random move
nullif none of the contained neighbourhoods are able to produce a random move
public List<Move<? super SolutionType>> getAllMoves(SolutionType solution)
Copyright © 2016. All rights reserved.