Class HillClimber
java.lang.Object
repast.simphony.parameter.optimizer.HillClimber
- All Implemented Interfaces:
AdvancementChooser
- Direct Known Subclasses:
AnnealingAdvancementChooser
This is a simple advancement algorithm that will perform a Hill Climbing traversal of the space.
- Author:
- Jerry Vos
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
protected boolean
protected boolean
protected double
protected ParameterSetter
protected double
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionchooseAdvancement
(ParameterSetter setter, AdvanceType lastType, double runResult) This performs the hill climbing algorithm.boolean
shouldRevert
(double runResult) Returns true when the previous run's value was greater than runResult or when we're exploring the local space to figure out which direction to go.
-
Field Details
-
lastValue
protected double lastValue -
checkingLocal
protected boolean checkingLocal -
forwardValid
protected boolean forwardValid -
forwardValue
protected double forwardValue -
centerValue
protected double centerValue -
lastSetter
-
-
Constructor Details
-
HillClimber
public HillClimber()Constructs the climber.
-
-
Method Details
-
chooseAdvancement
public AdvanceType chooseAdvancement(ParameterSetter setter, AdvanceType lastType, double runResult) This performs the hill climbing algorithm. In the best case it will traverse the space by (assuming we've just chosen a new parameter):- Explore the local space to find which direction to follow. It first will explore to the right (FORWARD) of the current position, then to the left (BACKWARD).
- Next it will move whichever direction is best of left, right, and the neither (if we're
at a peak). If we're on a peak it will return
AdvanceType.SWITCH
.
- Specified by:
chooseAdvancement
in interfaceAdvancementChooser
- Parameters:
setter
- the current setterlastType
- the last executed parameter commandrunResult
- the last run's value- Returns:
- the action to perform
-
shouldRevert
public boolean shouldRevert(double runResult) Returns true when the previous run's value was greater than runResult or when we're exploring the local space to figure out which direction to go.- Specified by:
shouldRevert
in interfaceAdvancementChooser
- Parameters:
runResult
- the result of the previous run- Returns:
- if we should revert to the previous space
-