public class StrategiesSequencer extends AbstractStrategy<Variable>
StrategiesSequencer
is class for AbstractStrategy
composition.
this
is created with a list of AbstractStrategy
, and calling
getDecision()
retrieves the current active AbstractStrategy
and
calls the delegate getDecision()
method.
AbstractStrategy
becomes "inactive" when no more decision can be computed,
ie every decisions have been computed and used.
vars
Constructor and Description |
---|
StrategiesSequencer(AbstractStrategy... strategies) |
StrategiesSequencer(IEnvironment environment,
AbstractStrategy... strategies) |
Modifier and Type | Method and Description |
---|---|
Decision<Variable> |
computeDecision(Variable variable)
Computes a decision to be applied to variable var
This method should be implemented in order to use search patterns
|
Decision |
getDecision()
Provides access to the current decision in the strategy.
|
boolean |
init()
Prepare
this to be used in a search loop
The initialization can detect inconsistency, in that case, it returns false |
void |
remove()
Remove the current strategy.
|
String |
toString()
Creates a
String object containing a pretty print of the current variables. |
getVariables, makeIntDecision
public StrategiesSequencer(IEnvironment environment, AbstractStrategy... strategies)
public StrategiesSequencer(AbstractStrategy... strategies)
public boolean init()
AbstractStrategy
this
to be used in a search loop
The initialization can detect inconsistency, in that case, it returns falseinit
in class AbstractStrategy<Variable>
public void remove()
AbstractStrategy
remove
in class AbstractStrategy<Variable>
public Decision<Variable> computeDecision(Variable variable)
AbstractStrategy
computeDecision
in class AbstractStrategy<Variable>
variable
- a variablepublic Decision getDecision()
null
.
Iterates over the declared sub-strategies and gets the overall current decision.getDecision
in class AbstractStrategy<Variable>
public String toString()
String
object containing a pretty print of the current variables.
This is based on the print()
method of every sub-strategies.toString
in class AbstractStrategy<Variable>
String
objectCopyright © 2018. All rights reserved.