- java.lang.Object
-
- org.chocosolver.solver.search.strategy.strategy.AbstractStrategy<IntVar>
-
- org.chocosolver.solver.objective.ObjectiveStrategy
-
public class ObjectiveStrategy extends AbstractStrategy<IntVar>
Class that defines a branching strategy over the objective variable- Since:
- Oct. 2012
- Author:
- Jean-Guillaume Fages
-
-
Field Summary
-
Fields inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
vars
-
-
Constructor Summary
Constructors Constructor Description ObjectiveStrategy(IntVar objective, int[] coefs, OptimizationPolicy policy)
Defines a parametrized dichotomic branching over the objective variable BEWARE: only activated after a first solutionObjectiveStrategy(IntVar objective, OptimizationPolicy policy)
Defines a branching strategy over the objective variable BEWARE: only activated after a first solution
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Decision<IntVar>
getDecision()
Provides access to the current decision in the strategy.boolean
init()
Preparethis
to be used in a search loop The initialization can detect inconsistency, in that case, it returns falsevoid
remove()
Remove the current strategy.-
Methods inherited from class org.chocosolver.solver.search.strategy.strategy.AbstractStrategy
computeDecision, getVariables, makeIntDecision, toString
-
-
-
-
Constructor Detail
-
ObjectiveStrategy
public ObjectiveStrategy(IntVar objective, OptimizationPolicy policy)
Defines a branching strategy over the objective variable BEWARE: only activated after a first solution- Parameters:
objective
- variablepolicy
- BOTTOM_UP, TOP_TOWN or DICHOTOMIC
-
ObjectiveStrategy
public ObjectiveStrategy(IntVar objective, int[] coefs, OptimizationPolicy policy)
Defines a parametrized dichotomic branching over the objective variable BEWARE: only activated after a first solution- Parameters:
objective
- variablecoefs
- [a,b] defines how to split the domain of the objective variable [1,1] will halve its domain [1,2] will take a value closer to the upper bound than the lower boundpolicy
- should be DICHOTOMIC
-
-
Method Detail
-
init
public boolean init()
Description copied from class:AbstractStrategy
Preparethis
to be used in a search loop The initialization can detect inconsistency, in that case, it returns false- Overrides:
init
in classAbstractStrategy<IntVar>
-
remove
public void remove()
Description copied from class:AbstractStrategy
Remove the current strategy. This implies unplugging variable or search monitors.- Overrides:
remove
in classAbstractStrategy<IntVar>
-
getDecision
public Decision<IntVar> getDecision()
Description copied from class:AbstractStrategy
Provides access to the current decision in the strategy. If there are no more decision to provide, it returnsnull
.- Specified by:
getDecision
in classAbstractStrategy<IntVar>
- Returns:
- the current decision
-
-