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.
LOGGER, 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.
|
void |
init()
Prepare
this to be used in a search loop |
String |
toString()
Creates a
String object containing a pretty print of the current variables. |
getVariables
public StrategiesSequencer(IEnvironment environment, AbstractStrategy... strategies)
public StrategiesSequencer(AbstractStrategy... strategies)
public void init() throws ContradictionException
AbstractStrategy
this
to be used in a search loopinit
in class AbstractStrategy<Variable>
ContradictionException
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 © 2015. All rights reserved.