Class RealStrategy
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.strategy.AbstractStrategy<RealVar>
-
- org.chocosolver.solver.search.strategy.strategy.RealStrategy
-
public class RealStrategy extends AbstractStrategy<RealVar>
Define a strategy based onRealVar. It defines how a variable is selected to be part of the next decision, and which value from its domain is selected too. Then, the decision will bevar≤ {value}.- Since:
- 2 juil. 2010
- Author:
- Charles Prud'homme
-
-
Field Summary
-
Fields inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
vars
-
-
Constructor Summary
Constructors Constructor Description RealStrategy(RealVar[] scope, VariableSelector<RealVar> varselector, RealValueSelector valueIterator, double epsilon, boolean leftFirst)Create a real strategy which generates decision over real variables.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Decision<RealVar>computeDecision(RealVar variable)Computes a decision to be applied to variable var This method should be implemented in order to use search patternsDecisiongetDecision()Provides access to the current decision in the strategy.booleaninit()Preparethisto be used in a search loop The initialization can detect inconsistency, in that case, it returns false-
Methods inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
getVariables, makeIntDecision, toString
-
-
-
-
Constructor Detail
-
RealStrategy
public RealStrategy(RealVar[] scope, VariableSelector<RealVar> varselector, RealValueSelector valueIterator, double epsilon, boolean leftFirst)
Create a real strategy which generates decision over real variables.A real decision is like:
- left branch: X ≤ v
- right branch: X ≥ v + e
- Parameters:
scope- variables to be managed with this strategyvarselector- how to select the next variable to branch onvalueIterator- on to select the valueepsilon- gap value for refutationleftFirst- select left range first
-
-
Method Detail
-
init
public boolean init()
Description copied from class:AbstractStrategyPreparethisto be used in a search loop The initialization can detect inconsistency, in that case, it returns false- Overrides:
initin classAbstractStrategy<RealVar>
-
computeDecision
public Decision<RealVar> computeDecision(RealVar variable)
Description copied from class:AbstractStrategyComputes a decision to be applied to variable var This method should be implemented in order to use search patterns- Overrides:
computeDecisionin classAbstractStrategy<RealVar>- Parameters:
variable- a variable- Returns:
- a decision to be applied to variable var
-
getDecision
public Decision getDecision()
Description copied from class:AbstractStrategyProvides access to the current decision in the strategy. If there are no more decision to provide, it returnsnull.- Specified by:
getDecisionin classAbstractStrategy<RealVar>- Returns:
- the current decision
-
-