SolutionType
- solution type for which this neighbourhood can be applied, required to extend Solution
public interface Neighbourhood<SolutionType extends Solution>
Modifier and Type | Method and Description |
---|---|
List<? extends Move<? super SolutionType>> |
getAllMoves(SolutionType solution)
Get a list of all moves that can be applied to the given solution to transform
it into each of the neighbouring solutions contained in this specific neighbourhood.
|
default Move<? super SolutionType> |
getRandomMove(SolutionType solution)
Generates a random move, using a default source of randomness.
|
Move<? super SolutionType> |
getRandomMove(SolutionType solution,
Random rnd)
Generates a move that transforms the given solution into a random neighbour
contained in this specific neighbourhood.
|
Move<? super SolutionType> getRandomMove(SolutionType solution, Random rnd)
null
is returned.solution
- solution to which the move is to be appliedrnd
- source of randomness used to generate a random movenull
if the given solution does not have any neighboursdefault Move<? super SolutionType> getRandomMove(SolutionType solution)
getRandomMove(solution, ThreadLocalRandom.current())
where a thread
local random generator is used to avoid overhead and contention for parallel calls.solution
- solution to which the move is to be appliednull
if the given solution does not have any neighboursList<? extends Move<? super SolutionType>> getAllMoves(SolutionType solution)
solution
- solution to which the moves are to be appliedCopyright © 2016. All rights reserved.