Class LinearFloat

  • All Implemented Interfaces:
    SatisfiedPresent, StoreAware, UsesQueueVariable
    Direct Known Subclasses:
    SumFloat

    public class LinearFloat
    extends Linear
    implements UsesQueueVariable
    LinearFloat constraint implements the weighted summation over several Variable's . It provides the weighted sum from all Variable's on the list.

    This version works as argument to Reified and Xor constraints. For other constraints And, Or, Not, Eq, IfThen, IfThenElse it does not work currently.

    Version:
    4.7
    • Constructor Detail

      • LinearFloat

        @Deprecated
        public LinearFloat​(Store store,
                           FloatVar[] list,
                           double[] weights,
                           java.lang.String rel,
                           double sum)
        Deprecated.
        LinearFloat constraint does not use Store parameter any longer.
        Parameters:
        store - current store
        list - variables which are being multiplied by weights.
        weights - weight for each variable.
        rel - the relation, one of "==", "<", ">", "<=", ">=", "!="
        sum - the sum of weighted variables.
      • LinearFloat

        @Deprecated
        public LinearFloat​(Store store,
                           FloatVar[] list,
                           double[] weights,
                           java.lang.String rel,
                           FloatVar sum)
        Deprecated.
        LinearFloat constraint does not use Store parameter any longer.
        Parameters:
        store - current store
        list - variables which are being multiplied by weights.
        weights - weight for each variable.
        rel - the relation, one of "==", "<", ">", "<=", ">=", "!="
        sum - variable containing the sum of weighted variables.
      • LinearFloat

        @Deprecated
        public LinearFloat​(Store store,
                           java.util.List<? extends FloatVar> variables,
                           java.util.List<java.lang.Double> weights,
                           java.lang.String rel,
                           double sum)
        Deprecated.
        LinearFloat constraint does not use Store parameter any longer.
        It constructs the constraint LinearFloat.
        Parameters:
        store - current store
        variables - variables which are being multiplied by weights.
        weights - weight for each variable.
        rel - the relation, one of "==", "<", ">", "<=", ">="
        sum - variable containing the sum of weighted variables.
      • LinearFloat

        public LinearFloat​(FloatVar[] list,
                           double[] weights,
                           java.lang.String rel,
                           double sum)
        Parameters:
        list - variables which are being multiplied by weights.
        weights - weight for each variable.
        rel - the relation, one of "==", "<", ">", "<=", ">=", "!="
        sum - the sum of weighted variables.
      • LinearFloat

        public LinearFloat​(FloatVar[] list,
                           double[] weights,
                           java.lang.String rel,
                           FloatVar sum)
        Parameters:
        list - variables which are being multiplied by weights.
        weights - weight for each variable.
        rel - the relation, one of "==", "<", ">", "<=", ">=", "!="
        sum - variable containing the sum of weighted variables.
      • LinearFloat

        public LinearFloat​(java.util.List<? extends FloatVar> variables,
                           java.util.List<java.lang.Double> weights,
                           java.lang.String rel,
                           double sum)
        It constructs the constraint LinearFloat.
        Parameters:
        variables - variables which are being multiplied by weights.
        weights - weight for each variable.
        rel - the relation, one of "==", "<", ">", "<=", ">="
        sum - variable containing the sum of weighted variables.
    • Method Detail

      • queueVariable

        public void queueVariable​(int level,
                                  Var var)
        Description copied from class: Constraint
        This is a function called to indicate which variable in a scope of constraint has changed. It also indicates a store level at which the change has occurred.
        Overrides:
        queueVariable in class Linear
        Parameters:
        level - the level of the store at which the change has occurred.
        var - variable which has changed.