public class HillClimbingSelector extends InitialPopulationSelector
Constructor and Description |
---|
HillClimbingSelector() |
Modifier and Type | Method and Description |
---|---|
ITransition |
getNextTransition(boolean lastWasSuccessful)
Returns the next
ITransition to fire, the next step in the design space. |
void |
init(ThreadContext context)
Initializes the strategy, called once before the first
LocalSearchStrategyBase#getNextTransition(ThreadContext) is called for every new thread. |
void |
interrupted()
Called if the exploration process is interrupted for example by timeout.
|
void |
newStateIsProcessed(boolean isAlreadyTraversed,
Fitness fitness,
boolean constraintsNotSatisfied)
Called after the chosen transition is fired and the new state has been processed.
|
void |
setChildStore(IStoreChild store)
The initial population selector must call the
IStoreChild.addChild(org.eclipse.viatra.dse.base.ThreadContext) method when a potentially good trajectory
is found. |
void |
setPopulationSize(int populationSize)
Sets the populations size in the initialization phase.
|
HillClimbingSelector |
withTrialsToMake(int trialsToMake) |
explore, initStrategy, interruptStrategy
public HillClimbingSelector withTrialsToMake(int trialsToMake)
public void setChildStore(IStoreChild store)
InitialPopulationSelector
IStoreChild.addChild(org.eclipse.viatra.dse.base.ThreadContext)
method when a potentially good trajectory
is found.setChildStore
in class InitialPopulationSelector
store
- An interface with the call back method.public void setPopulationSize(int populationSize)
InitialPopulationSelector
IStoreChild
implementation.setPopulationSize
in class InitialPopulationSelector
populationSize
- Expected number of children.public void init(ThreadContext context)
LocalSearchStrategyBase
LocalSearchStrategyBase#getNextTransition(ThreadContext)
is called for every new thread.init
in class LocalSearchStrategyBase
context
- The ThreadContext
which contains necessary informations. Should be assigned to a field.public ITransition getNextTransition(boolean lastWasSuccessful)
LocalSearchStrategyBase
ITransition
to fire, the next step in the design space. It can be a quite complex method
or a simple depth first search.getNextTransition
in class LocalSearchStrategyBase
lastWasSuccessful
- False if the last returned transition was already fired by someone and therefore should choose an
other transition, otherwise true.ITransition
which is not traversed yet. Null if there is no more to fire.public void newStateIsProcessed(boolean isAlreadyTraversed, Fitness fitness, boolean constraintsNotSatisfied)
LocalSearchStrategyBase
newStateIsProcessed
in class LocalSearchStrategyBase
isAlreadyTraversed
- True if the new state is already traversed in the past.fitness
- A map containing the values of the objectives.public void interrupted()
LocalSearchStrategyBase
LocalSearchStrategyBase#getNextTransition(ThreadContext, boolean)
method witch is called right after this
one.interrupted
in class LocalSearchStrategyBase