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.9
  • Constructor Details

    • LinearFloat

      @Deprecated public LinearFloat(Store store, FloatVar[] list, double[] weights, 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, 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, List<? extends FloatVar> variables, List<Double> weights, 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, 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, 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(List<? extends FloatVar> variables, List<Double> weights, 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 Details

    • 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.
    • derivative

      public FloatVar derivative(Store store, FloatVar f, Set<FloatVar> vars, FloatVar x)
      Overrides:
      derivative in class DecomposedConstraint<Constraint>