SolutionType
- solution type of the problems that may be solved using this search, required to extend Solution
public class RandomDescent<SolutionType extends Solution> extends SingleNeighbourhoodSearch<SolutionType>
Constructor and Description |
---|
RandomDescent(Problem<SolutionType> problem,
Neighbourhood<? super SolutionType> neighbourhood)
Creates a new random descent search, specifying the problem to solve and the neighbourhood used to
modify the current solution.
|
RandomDescent(String name,
Problem<SolutionType> problem,
Neighbourhood<? super SolutionType> neighbourhood)
Creates a new random descent search, specifying the problem to solve, the neighbourhood used to
modify the current solution, and a custom search name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
searchStep()
Creates a random neighbour of the current solution and accepts it if it improves over the current solution.
|
getNeighbourhood, setNeighbourhood
accept, evaluate, getBestMove, getNumAcceptedMoves, getNumRejectedMoves, incNumAcceptedMoves, incNumRejectedMoves, init, isImprovement, reject, setEvaluatedMoveCache, updateCurrentSolution, validate
generateRandomInitialSolution, getCurrentSolution, getCurrentSolutionEvaluation, getCurrentSolutionValidation, setCurrentSolution, setCurrentSolution, updateCurrentAndBestSolution, updateCurrentAndBestSolution, updateCurrentSolution
addSearchListener, addStopCriterion, assertIdle, clearSearchListeners, clearStopCriteria, computeDelta, dispose, getBestSolution, getBestSolutionEvaluation, getBestSolutionValidation, getID, getMinDelta, getName, getProblem, getRandom, getRuntime, getSearchListeners, getStatus, getStatusLock, getSteps, getStepsWithoutImprovement, getTimeWithoutImprovement, removeSearchListener, removeStopCriterion, run, searchDisposed, searchStarted, searchStopped, setRandom, setStopCriterionCheckPeriod, start, stop, toString, updateBestSolution, updateBestSolution
public RandomDescent(Problem<SolutionType> problem, Neighbourhood<? super SolutionType> neighbourhood)
null
. The search name defaults
to "RandomDescent".problem
- problem to solveneighbourhood
- neighbourhood used to create neighbouring solutionsNullPointerException
- if problem
or neighbourhood
are null
public RandomDescent(String name, Problem<SolutionType> problem, Neighbourhood<? super SolutionType> neighbourhood)
null
. The search name can be null
in which case the default name
"RandomDescent" is assigned.problem
- problem to solveneighbourhood
- neighbourhood used to create neighbouring solutionsname
- custom search nameNullPointerException
- if problem
or neighbourhood
are null
protected void searchStep()
searchStep
in class Search<SolutionType extends Solution>
JamesRuntimeException
- if depending on malfunctioning components (problem, neighbourhood, ...)Copyright © 2016. All rights reserved.