Module org.chocosolver
Class IntDomainMiddle
- java.lang.Object
-
- org.chocosolver.solver.search.strategy.selectors.values.IntDomainMiddle
-
- All Implemented Interfaces:
IntValueSelector
public class IntDomainMiddle extends Object implements IntValueSelector
Selects the value in the variable domain closest to the mean of its current bounds.
It computes the middle value of the domain. Then it checks if the mean is contained in the domain. If not, the closest value to the middle is chosen. It uses a policy to define whether the mean value should be floored or ceiled
BEWARE: should not be used with assignment decisions over bounded variables (because the decision negation would result in no inference)
- Since:
- 2 juil. 2010
- Author:
- Charles Prud'homme, Jean-Guillaume Fages
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
FLOOR
-
Constructor Summary
Constructors Constructor Description IntDomainMiddle(boolean roundingPolicy)
Selects the middle valueIntDomainMiddle(ToDoubleFunction<IntVar> middle, boolean roudingPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
selectValue(IntVar var)
Selects and returns the value to constrained chosen variable with.
-
-
-
Field Detail
-
FLOOR
public static final boolean FLOOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IntDomainMiddle
public IntDomainMiddle(boolean roundingPolicy)
Selects the middle value- Parameters:
roundingPolicy
- should be either FLOOR or !FLOOR (ceil)
-
IntDomainMiddle
public IntDomainMiddle(ToDoubleFunction<IntVar> middle, boolean roudingPolicy)
-
-
Method Detail
-
selectValue
public int selectValue(IntVar var)
Selects and returns the value to constrained chosen variable with. The chosen value must belong to the domain ofvariable
.- Specified by:
selectValue
in interfaceIntValueSelector
- Returns:
- the value, based on the domain of variable
-
-