public class LRSubsetSearch extends LocalSearch<SubsetSolution>
The search only considers additions and deletions that yield valid solutions without checking the current subset
size as this size is actively brought into the valid range during search. By default, in case of an increasing
subset size, the search starts with an empty subset, and in case of a decreasing subset size all items are initially
selected. Alternatively, a custom initial solution can be set by calling LocalSearch.setCurrentSolution(Solution)
before starting the search.
The search terminates as soon as the entire valid subset size range has been explored or when there are no valid additions/removals.
Constructor and Description |
---|
LRSubsetSearch(String name,
SubsetProblem<?> problem,
int l,
int r)
Create an LR subset search, given the subset problem to solve, a value for \(L \ge 0\) and \(R \ge 0\),
\(L \ne R\), and a custom search name.
|
LRSubsetSearch(SubsetProblem<?> problem,
int l,
int r)
Create an LR subset search, given the subset problem to solve and a value for \(L \ge 0\) and \(R \ge 0\),
\(L \ne R\).
|
Modifier and Type | Method and Description |
---|---|
int |
getL()
Get \(L\): the number of additions performed in every search step.
|
SubsetProblem<?> |
getProblem()
Returns the subset problem that is being solved.
|
int |
getR()
Get \(R\): the number of deletions performed in every search step.
|
void |
init()
When the search is initialized, and no custom initial solution has been set,
an empty or full subset solution is created depending on whether \(L \gt R\)
or \(R \gt L\), respectively.
|
protected void |
searchStep()
In every search step, the \(L\) best additions and \(R\) best deletions of a single item are performed.
|
generateRandomInitialSolution, getCurrentSolution, getCurrentSolutionEvaluation, getCurrentSolutionValidation, setCurrentSolution, setCurrentSolution, updateCurrentAndBestSolution, updateCurrentAndBestSolution, updateCurrentSolution, updateCurrentSolution
addSearchListener, addStopCriterion, assertIdle, clearSearchListeners, clearStopCriteria, computeDelta, dispose, getBestSolution, getBestSolutionEvaluation, getBestSolutionValidation, getID, getMinDelta, getName, getRandom, getRuntime, getSearchListeners, getStatus, getStatusLock, getSteps, getStepsWithoutImprovement, getTimeWithoutImprovement, removeSearchListener, removeStopCriterion, run, searchDisposed, searchStarted, searchStopped, setRandom, setStopCriterionCheckPeriod, start, stop, toString, updateBestSolution, updateBestSolution
public LRSubsetSearch(SubsetProblem<?> problem, int l, int r)
problem
can not be null
and that both l
and
r
should be positive and distinct. The search name is set to the default name "LRSubsetSearch".problem
- subset problem to solvel
- number of additions per search stepr
- number of deletions per search stepNullPointerException
- if problem
is null
IllegalArgumentException
- if l
or r
are negative or equalpublic LRSubsetSearch(String name, SubsetProblem<?> problem, int l, int r)
problem
can not be null
and
that both l
and r
should be positive and distinct. The search name can be
null
in which case it is set to the default name "LRSubsetSearch".name
- custom search nameproblem
- subset problem to solvel
- number of additions per search stepr
- number of deletions per search stepNullPointerException
- if problem
is null
IllegalArgumentException
- if l
or r
are negative or equalpublic int getL()
public int getR()
public SubsetProblem<?> getProblem()
getProblem
in class Search<SubsetSolution>
public void init()
init
in class LocalSearch<SubsetSolution>
protected void searchStep()
searchStep
in class Search<SubsetSolution>
Copyright © 2016. All rights reserved.