Class 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
    • Constructor Detail

      • IntDomainMiddle

        public IntDomainMiddle​(boolean roundingPolicy)
        Selects the middle value
        Parameters:
        roundingPolicy - should be either FLOOR or !FLOOR (ceil)
    • 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 of variable.
        Specified by:
        selectValue in interface IntValueSelector
        Returns:
        the value, based on the domain of variable