public class StepCountingHillClimber.StepCountingHillClimberContext extends HillClimber.HillClimberContext
Modifier and Type | Field and Description |
---|---|
protected Double |
iBound |
protected int |
iCounter |
iLastImprovingIter
iIter, iT0
Constructor and Description |
---|
StepCountingHillClimberContext() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(Assignment<V,T> assignment,
Model<V,T> model,
Neighbour<V,T> neighbour,
double value,
boolean lazy)
Accept any move that does not worsen the solution (value <= 0) or that is below the bound.
|
void |
activate(Solution<V,T> solution)
Reset the bound and the steps counter.
|
protected boolean |
canContinue(Solution<V,T> solution)
Stop the search when the number of idle iterations is reached and the bound is no longer decreasing
|
protected int |
getCounterLimit(int idx) |
void |
incIteration(Solution<V,T> solution)
Increase iteration number, also update bound when the given number of steps is reached.
|
bestCleared, bestRestored, bestSaved, deactivate, getInfo, getInfo, getTimeMillis, solutionUpdated
public StepCountingHillClimberContext()
public void activate(Solution<V,T> solution)
activate
in class HillClimber.HillClimberContext
solution
- current solutionprotected int getCounterLimit(int idx)
public void incIteration(Solution<V,T> solution)
incIteration
in class HillClimber.HillClimberContext
solution
- current solutionprotected boolean accept(Assignment<V,T> assignment, Model<V,T> model, Neighbour<V,T> neighbour, double value, boolean lazy)
accept
in class HillClimber.HillClimberContext
assignment
- current assignmentmodel
- problem modelneighbour
- a generated movevalue
- value of the generated move (i.e., its impact on the solution value)lazy
- true if lazy moveprotected boolean canContinue(Solution<V,T> solution)
canContinue
in class HillClimber.HillClimberContext
solution
- current solution