Initializing help system before first use

Variable

  • All Implemented Interfaces:
    Index, java.lang.Comparable<Variable>

    public final class Variable
    extends Expression
    implements Index, java.lang.Comparable<Variable>
    A reference to a variable.
    Since:
    43.00
    • Method Summary

      Modifier and Type Method Description
      GeneralConstraint.Definition absOf​(Variable x)
      Create a constraint that requires this variable to be the absolute value of x.
      GeneralConstraint.Definition andOf​(Variable... variables)
      Create a constraint that requires this variable to be the and of the specified other variables.
      GeneralConstraint.Definition andOf​(Variable[] variables, java.lang.String name)
      Create a constraint that requires this variable to be the and of the specified arguments.
      GeneralConstraint.Definition andOf​(java.util.Collection<Variable> variables)
      Create a constraint that requires this variable to be the and of the specified arguments.
      GeneralConstraint.Definition andOf​(java.util.stream.Stream<Variable> variables)
      Create a constraint that requires this variable to be the and of the specified arguments.
      void chgCoef​(Inequality r, double newCoef)
      Change the coefficient for this variable in a row.
      void chgCoefs​(Inequality[] r, double[] newCoef)
      Change the coefficients for this variable in multiple rows.
      Variable chgObj​(double newCoef)
      Change objective coefficient for this variable.
      Variable chgObjN​(int objidx, double newCoef)
      Change objective coefficient for this variable.
      int compareTo​(Variable other)
      LinTerm div​(double arg)
      Create a new expression that represents the quotient of this and arg.
      LinTerm div​(ConstantExpression arg)
      Create a new expression that represents the quotient of this and arg.
      Expression div​(Expression arg)
      Create a new expression that represents the quotient of this and arg.
      Inequality.Definition eq​(double rhs)
      Create an "equals" constraint with this expression as left-hand side.
      Inequality.Definition eq​(Expression rhs)
      Create an "equals" constraint with this expression as left-hand side.
      boolean equals​(java.lang.Object other)
      double evaluate​(double[] solution)
      Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).
      Variable fix​(double value)
      Fix this variable to a value.
      Inequality.Definition geq​(double rhs)
      Create a "greater than or equal" constraint with this expression as left-hand side.
      Inequality.Definition geq​(Expression rhs)
      Create a "greater than or equal" constraint with this expression as left-hand side.
      double getCallbackRedCost()
      Get reduced cost value for this variable from the solution associated with the current callback.
      double getCallbackSolution()
      Get value for this variable from the solution associated with the current callback.
      int getIndex()
      Get the index that this object has in the underlying model.
      int getIndexForProb​(XpressProblem xprob)
      Get the index stored in this object but raise an exception if the problem that created this object is not prob.
      double getLB()
      Get the lower bound for this variable.
      java.lang.String getName()
      Get the name of this object.
      double getObj()
      Get objective coefficient for this variable.
      double getObjN​(int objIdx)
      Get objective coefficient for this variable.
      XpressProblem getProblem()
      Get the problem to which this element belongs.
      double getRedCost()
      Get the current reduced cost value for this variable.
      double getSolution()
      Get the current solution value for this variable.
      ColumnType getType()
      Get the type for this variable.
      double getUB()
      Get the upper bound for this variable.
      double getValue​(double[] data)
      Get the value of this variable from an array.
      int hashCode()  
      IndicatorDescription ifNotThen​(Inequality.Definition implied)
      Create an indicator constraint with this variable as indicator variable.
      IndicatorDescription ifThen​(Inequality.Definition implied)
      Create an indicator constraint with this variable as indicator variable.
      Inequality.Definition in​(double lb, double ub)
      Create a range constraint that bounds this expression from below and above.
      Inequality.Definition leq​(double rhs)
      Create a "less than or equal" constraint with this expression as left-hand side.
      Inequality.Definition leq​(Expression rhs)
      Create a "less than or equal" constraint with this expression as left-hand side.
      GeneralConstraint.Definition maxOf​(Variable... variables)
      Create a constraint that requires this variable to be the maximum of the specified other variables.
      GeneralConstraint.Definition maxOf​(Variable[] variables, double... values)
      Create a constraint that requires this variable to be the maximum of the specified other variables and values.
      GeneralConstraint.Definition maxOf​(Variable[] variables, double[] values, java.lang.String name)
      Create a constraint that requires this variable to be the maximum of the specified arguments.
      GeneralConstraint.Definition maxOf​(java.util.Collection<Variable> variables, java.util.Collection<java.lang.Double> values)
      Create a constraint that requires this variable to be the maximum of the specified arguments.
      GeneralConstraint.Definition maxOf​(java.util.stream.Stream<Variable> variables, java.util.stream.Stream<java.lang.Double> values)
      Create a constraint that requires this variable to be the maximum of the specified arguments.
      GeneralConstraint.Definition minOf​(Variable... variables)
      Create a constraint that requires this variable to be the minimum of the specified other variables.
      GeneralConstraint.Definition minOf​(Variable[] variables, double... values)
      Create a constraint that requires this variable to be the minimum of the specified other variables and values.
      GeneralConstraint.Definition minOf​(Variable[] variables, double[] values, java.lang.String name)
      Create a constraint that requires this variable to be the minimum of the specified arguments.
      GeneralConstraint.Definition minOf​(java.util.Collection<Variable> variables, java.util.Collection<java.lang.Double> values)
      Create a constraint that requires this variable to be the minimum of the specified arguments.
      GeneralConstraint.Definition minOf​(java.util.stream.Stream<Variable> variables, java.util.stream.Stream<java.lang.Double> values)
      Create a constraint that requires this variable to be the minimum of the specified arguments.
      LinTerm mul​(double arg)
      Create a new expression that represents the product of this and arg.
      LinTerm mul​(ConstantExpression arg)
      Create a new expression that represents the product of this and arg.
      Expression mul​(Expression arg)
      Create a new expression that represents the product of this and arg.
      QuadTerm mul​(LinTerm arg)
      Create a new expression that represents the product of this and arg.
      QuadTerm mul​(Variable arg)
      Create a new expression that represents the product of this and arg.
      GeneralConstraint.Definition orOf​(Variable... variables)
      Create a constraint that requires this variable to be the or of the specified other variables.
      GeneralConstraint.Definition orOf​(Variable[] variables, java.lang.String name)
      Create a constraint that requires this variable to be the or of the specified arguments.
      GeneralConstraint.Definition orOf​(java.util.Collection<Variable> variables)
      Create a constraint that requires this variable to be the or of the specified arguments.
      GeneralConstraint.Definition orOf​(java.util.stream.Stream<Variable> variables)
      Create a constraint that requires this variable to be the or of the specified arguments.
      PWL.Definition pwlOf​(Variable input, double[] xval, double[] yval)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/ yval evaluated for input.
      PWL.Definition pwlOf​(Variable input, double[] xval, double[] yval, java.lang.String name)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/ yval evaluated for input.
      PWL.Definition pwlOf​(Variable input, PwlBreakpoint... breakpoints)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      PWL.Definition pwlOf​(Variable input, PwlBreakpoint[] breakpoints, java.lang.String name)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      PWL.Definition pwlOf​(Variable input, java.lang.Iterable<PwlBreakpoint> breakpoints)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      PWL.Definition pwlOf​(Variable input, java.util.Collection<PwlBreakpoint> breakpoints)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      PWL.Definition pwlOf​(Variable input, java.util.Collection<PwlBreakpoint> breakpoints, java.lang.String name)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      PWL.Definition pwlOf​(Variable input, java.util.stream.Stream<PwlBreakpoint> breakpoints)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      PWL.Definition pwlOf​(Variable input, java.util.stream.Stream<PwlBreakpoint> breakpoints, java.lang.String name)
      Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
      Variable setLB​(double newLB)
      Set the lower bound for this variable.
      Variable setLimit​(double newLimit)
      Set the limit for this variable.
      Variable setName​(java.lang.String newName)
      Set the name of this variable.
      Variable setType​(ColumnType newType)
      Set the type for this variable.
      Variable setUB​(double newUB)
      Set the upper bound for this variable.
      QuadTerm square()
      Create a quadratic term by multiplying this variable with itself.
      java.lang.String toString()
      Returns the name from getName().
      LinTerm uminus()
      Create a new expression that represents the unary minus of this one.
      void updateIndex​(int delta)
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getIndex

        public int getIndex()
        Get the index that this object has in the underlying model. Attention: this is a very advanced function. Use it only if you know exactly what you are doing.

        Used in these examples:

        • GlobalObjectiveParametrics
        • GlobalRHSParametrics
        Specified by:
        getIndex in interface  Index
        Returns:
        The index of this object in the underlying model.
        Since:
        43.00
      • updateIndex

        public void updateIndex​(int delta)
        Specified by:
        updateIndex in interface  Index
        Parameters:
        delta - The value to add to the index.
        Since:
        43.00
      • getIndexForProb

        public int getIndexForProb​(XpressProblem xprob)
        Get the index stored in this object but raise an exception if the problem that created this object is not prob.
        Specified by:
        getIndexForProb in interface  Index
        Parameters:
        xprob - The problem for which the index is queried. If this object does not belong to prob then an execption is raised.
        Returns:
        The low-level index for this object in prob.
        Since:
        43.00
      • getProblem

        public XpressProblem getProblem()
        Get the problem to which this element belongs.
        Specified by:
        getProblem in interface  Index
        Returns:
        The problem to which this element belongs. This will be null if the element was deleted.
        Since:
        43.00
      • equals

        public final boolean equals​(java.lang.Object other)
        Overrides:
        equals in class  java.lang.Object
        Parameters:
        other -
        Returns:
        Since:
        43.00
      • compareTo

        public final int compareTo​(Variable other)
        Specified by:
        compareTo in interface  java.lang.Comparable<Variable>
        Parameters:
        other -
        Returns:
        Since:
        43.00
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class  java.lang.Object
      • leq

        public Inequality.Definition leq​(double rhs)
        Create a "less than or equal" constraint with this expression as left-hand side.
        Specified by:
        leq in class  Expression
        Parameters:
        rhs - Right-hand side of new constraint.
        Returns:
        The new constraint.
        Since:
        43.00
      • leq

        public Inequality.Definition leq​(Expression rhs)
        Create a "less than or equal" constraint with this expression as left-hand side.
        Specified by:
        leq in class  Expression
        Parameters:
        rhs - Right-hand side of new constraint.
        Returns:
        The new constraint.
        Since:
        43.00
      • geq

        public Inequality.Definition geq​(double rhs)
        Create a "greater than or equal" constraint with this expression as left-hand side.
        Specified by:
        geq in class  Expression
        Parameters:
        rhs - Right-hand side of new constraint.
        Returns:
        The new constraint.
        Since:
        43.00
      • geq

        public Inequality.Definition geq​(Expression rhs)
        Create a "greater than or equal" constraint with this expression as left-hand side.
        Specified by:
        geq in class  Expression
        Parameters:
        rhs - Right-hand side of new constraint.
        Returns:
        The new constraint.
        Since:
        43.00
      • eq

        public Inequality.Definition eq​(double rhs)
        Create an "equals" constraint with this expression as left-hand side.
        Specified by:
        eq in class  Expression
        Parameters:
        rhs - Right-hand side of new constraint.
        Returns:
        The new constraint.
        Since:
        43.00
      • eq

        public Inequality.Definition eq​(Expression rhs)
        Create an "equals" constraint with this expression as left-hand side.
        Specified by:
        eq in class  Expression
        Parameters:
        rhs - Right-hand side of new constraint.
        Returns:
        The new constraint.
        Since:
        43.00
      • in

        public Inequality.Definition in​(double lb,
                                        double ub)
        Create a range constraint that bounds this expression from below and above.
        Specified by:
        in in class  Expression
        Parameters:
        lb - Lower bound for this expression.
        ub - Upper bound for this expression.
        Returns:
        The new constraint.
        Since:
        43.00
      • square

        public QuadTerm square()
        Create a quadratic term by multiplying this variable with itself.
        Returns:
        The new term representing the product of this variable with itself.
        Since:
        43.00
      • getLB

        public double getLB()
        Get the lower bound for this variable. Queries the com.dashoptimization.objects.XpressProblem instance to which this variable belongs and returns the lower bound obtained from that instance.

        Used in these examples:

        • Repair
        Since:
        43.00
      • getUB

        public double getUB()
        Get the upper bound for this variable. Queries the XpressProblem instance to which this variable belongs and returns the upper bound obtained from that instance.

        Used in these examples:

        • Repair
        Returns:
        The upper bound for this variable.
        Since:
        43.00
      • getName

        public java.lang.String getName()
        Get the name of this object. Queries the problem instance that owns this object and returns the name from that instance.
        Specified by:
        getName in interface  Index
        Returns:
        The name of this object.
        Since:
        43.00
      • getType

        public ColumnType getType()
        Get the type for this variable. Queries the XpressProblem instance to which this variable belongs and returns the name obtained from that instance.
        Returns:
        Type of this variable.
        Since:
        43.00
      • fix

        public Variable fix​(double value)
        Fix this variable to a value. Set the lower bound and upper bound in the XpressProblem instance to which this variable belongs.
        Parameters:
        value - New lower and upper bound.
        Returns:
        This variable
        Since:
        43.00
      • setLB

        public Variable setLB​(double newLB)
        Set the lower bound for this variable. Set the lower bound in the XpressProblem instance to which this variable belongs.
        Parameters:
        newLB - New lower bound.
        Returns:
        This variable
        Since:
        43.00
      • setUB

        public Variable setUB​(double newUB)
        Set the upper bound for this variable. Set the upper bound in the XpressProblem instance to which this variable belongs.
        Parameters:
        newUB - New upper bound.
        Returns:
        This variable
        Since:
        43.00
      • setType

        public Variable setType​(ColumnType newType)
        Set the type for this variable. Set the type in the XpressProblem instance to which this variable belongs.
        Parameters:
        newType - New type.
        Returns:
        This variable
        Since:
        43.00
      • setLimit

        public Variable setLimit​(double newLimit)
        Set the limit for this variable. Set the limit in the XpressProblem instance to which this variable belongs. Note that limits are ignored unless the variable is semi-continuous, semi-integer, or partial integer.
        Parameters:
        newLimit - New limit.
        Returns:
        This variable
        Since:
        43.00
      • setName

        public Variable setName​(java.lang.String newName)
        Set the name of this variable. Sets the name of this variable in the problem instance that owns the object.
        Parameters:
        newName - The name to be set.
        Returns:
        Always returns this instance.
        Since:
        43.00
      • getValue

        public double getValue​(double[] data)
        Get the value of this variable from an array. The function assumes that data is an array that stores a value for each variable in the underlying problem and returns the value from this array that corresponds to this variable. data arrays can be obtained for example from prob.getSolution() or prob.getCallbackSolution().

        Used in these examples:

        • AddMipSol
        • FixBV
        • GlobalObjectiveParametrics
        • GlobalRHSParametrics
        • GoalProg
        • Knapsack
        • LoadLP
        • MipSolEnum
        • MipSolPool
        • MostViolated
        • SaveSol
        • TSP
        • Tableau
        • Trimloss
        Parameters:
        data - Data for all variables.
        Returns:
        The value for this variable in data.
        Since:
        43.00
      • getSolution

        public double getSolution()
        Get the current solution value for this variable.

        Note: This functions uses XPRSprob.getSolution(IntHolder, double[], int, int) under the hood. This is only valid to call if the `XpressProblem` instance owning this variable is currently not under optimization.

        Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using XPRSprob.getSolution() to get the values for all variables and then use getValue(double[]) to extract the value for a particular variable. This strategy is also valid from callbacks.

        Used in these examples:

        • AddMipSol
        • GoalProg
        • Polygon
        • PolygonMap
        • PolygonMapDelta
        • PolygonMultiMap
        • PolygonMultiMapDelta
        • PolygonVecMap
        • PolygonVecMapDelta
        • Repair
        • RoundInt
        • TSP
        • Tableau
        • Trimloss
        Returns:
        Solution value for this variable.
        Since:
        43.00
      • getRedCost

        public double getRedCost()
        Get the current reduced cost value for this variable.

        Note: This functions uses XPRSprob.getRedCosts(IntHolder, double[], int, int) under the hood. This is only valid to call if the `com.dashoptimization.objects.XpressProblem` instance owning this variable is currently not under optimization.

        Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using XPRSprob.getRedCosts() to get the values for all variables and then use getValue(double[]) to extract the value for a particular variable. This strategy is also valid from callbacks.

        Returns:
        Reduced cost for this variable.
        Since:
        43.00
      • getCallbackSolution

        public double getCallbackSolution()
        Get value for this variable from the solution associated with the current callback.

        Note: This functions uses XPRSprob.getCallbackSolution(BoolHolder, double[], int, int) under the hood.

        Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using XPRSprob.getCallbackSolution() to get the values for all variables and then use getValue(double[]) to extract the value for a particular variable.

        Used in these examples:

        • AddMipSol
        • Knapsack
        • MostViolated
        • SaveSol
        • TSP
        Returns:
        Solution value for this variable.
        Since:
        43.00
      • getCallbackRedCost

        public double getCallbackRedCost()
        Get reduced cost value for this variable from the solution associated with the current callback.

        Note: This functions uses XPRSprob.getCallbackRedCosts(BoolHolder, double[], int, int) under the hood.

        Note: Calling this function for multiple variables is not efficient. If you need to get values for multiple variables then consider using XPRSprob.getCallbackRedCosts() to get the values for all variables and then use getValue(double[]) to extract the value for a particular variable.

        Returns:
        Reduced cost for this variable.
        Since:
        43.00
      • evaluate

        public double evaluate​(double[] solution)
        Compute the value of this expression with respect to the given solution vector (which is not required to be feasible).
        Specified by:
        evaluate in class  Expression
        Parameters:
        solution - Solution values for which the expression is evaluated.
        Returns:
        The value of this expression evaluated at solution.
        Since:
        43.00
      • chgCoef

        public void chgCoef​(Inequality r,
                            double newCoef)
        Change the coefficient for this variable in a row.
        Parameters:
        r - Inequality for which to change the coefficient.
        newCoef - New coefficient.
        Since:
        43.00
      • chgCoefs

        public void chgCoefs​(Inequality[] r,
                             double[] newCoef)
        Change the coefficients for this variable in multiple rows.
        Parameters:
        r - Inequalities for which to change the coefficient.
        newCoef - New coefficients.
        Since:
        43.00
      • chgObj

        public Variable chgObj​(double newCoef)
        Change objective coefficient for this variable.

        Used in these examples:

        • GlobalObjectiveParametrics
        • GoalProg
        Parameters:
        newCoef - New objective coefficient.
        Returns:
        Always returns this instance.
        Since:
        43.00
      • getObj

        public double getObj()
        Get objective coefficient for this variable.

        Used in these examples:

        • Knapsack
        Returns:
        Objective coefficient for this variable.
        Since:
        43.00
      • chgObjN

        public Variable chgObjN​(int objidx,
                                double newCoef)
        Change objective coefficient for this variable.

        Used in these examples:

        • GoalProg
        Parameters:
        objidx - Index of objective function to change.
        newCoef - New objective coefficient.
        Returns:
        Always returns this instance.
        Since:
        43.00
      • getObjN

        public double getObjN​(int objIdx)
        Get objective coefficient for this variable.
        Parameters:
        objIdx - Index of objective function to query.
        Returns:
        Objective coefficient for this variable.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    double[] xval,
                                    double[] yval)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/ yval evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        xval - X coordinates of breakpoints.
        yval - X coordinates of breakpoints.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    double[] xval,
                                    double[] yval,
                                    java.lang.String name)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by xval/ yval evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        xval - X coordinates of breakpoints.
        yval - X coordinates of breakpoints.
        name - Name of the new constraint, can be null.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    PwlBreakpoint... breakpoints)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - Breakpoints for new constraint.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    PwlBreakpoint[] breakpoints,
                                    java.lang.String name)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - Breakpoints for new constraint.
        name - Name for the PWL, can be null.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    java.util.Collection<PwlBreakpoint> breakpoints)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - Breakpoints for new constraint.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    java.util.Collection<PwlBreakpoint> breakpoints,
                                    java.lang.String name)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - Breakpoints for new constraints.
        name - Name of the new PWL, can be null.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    java.util.stream.Stream<PwlBreakpoint> breakpoints)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - Breakpoints for new constraint.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    java.util.stream.Stream<PwlBreakpoint> breakpoints,
                                    java.lang.String name)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - Breakpoints for new constraint.
        name - Name for new constraint, can be null.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • pwlOf

        public PWL.Definition pwlOf​(Variable input,
                                    java.lang.Iterable<PwlBreakpoint> breakpoints)
        Create a new piecewise linear constraint that requires this variable to be the value of the piecewise linear function specified by breakpoints evaluated for input.
        Parameters:
        input - Input for piecewise linear constraint.
        breakpoints - PWL breakpoints.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • maxOf

        public GeneralConstraint.Definition maxOf​(Variable[] variables,
                                                  double... values)
        Create a constraint that requires this variable to be the maximum of the specified other variables and values.
        Parameters:
        variables - Variables in the maximum constraint.
        values - Values in the maximum constraint.
        Returns:
        this = max(variables, value).
        Since:
        43.00
      • maxOf

        public GeneralConstraint.Definition maxOf​(Variable[] variables,
                                                  double[] values,
                                                  java.lang.String name)
        Create a constraint that requires this variable to be the maximum of the specified arguments.
        Parameters:
        variables - Variables in the maximum constraint.
        values - Values in the maximum constraint.
        name - Constraint name, can be null to indicate the constraint has no name.
        Returns:
        this = max(variables, value).
        Since:
        43.00
      • maxOf

        public GeneralConstraint.Definition maxOf​(java.util.Collection<Variable> variables,
                                                  java.util.Collection<java.lang.Double> values)
        Create a constraint that requires this variable to be the maximum of the specified arguments.
        Parameters:
        variables - Variables in the maximum constraint.
        values - Values in the maximum constraint.
        Returns:
        this = max(variables, value).
        Since:
        43.00
      • maxOf

        public GeneralConstraint.Definition maxOf​(java.util.stream.Stream<Variable> variables,
                                                  java.util.stream.Stream<java.lang.Double> values)
        Create a constraint that requires this variable to be the maximum of the specified arguments.
        Parameters:
        variables - Variables in the maximum constraint.
        values - Values in the maximum constraint.
        Returns:
        this = max(variables, value).
        Since:
        43.00
      • maxOf

        public GeneralConstraint.Definition maxOf​(Variable... variables)
        Create a constraint that requires this variable to be the maximum of the specified other variables.
        Parameters:
        variables - Variables in the maximum constraint.
        Returns:
        this = max(variables).
        Since:
        43.00
      • minOf

        public GeneralConstraint.Definition minOf​(Variable[] variables,
                                                  double... values)
        Create a constraint that requires this variable to be the minimum of the specified other variables and values.
        Parameters:
        variables - Variables in the minimum constraint.
        values - Values in the minimum constraint.
        Returns:
        this = min(variables, value).
        Since:
        43.00
      • minOf

        public GeneralConstraint.Definition minOf​(Variable[] variables,
                                                  double[] values,
                                                  java.lang.String name)
        Create a constraint that requires this variable to be the minimum of the specified arguments.
        Parameters:
        variables - Variables in the minimum constraint.
        values - Values in the minimum constraint.
        name - Constraint name, can be null to indicate the constraint has no name.
        Returns:
        this = min(variables, value).
        Since:
        43.00
      • minOf

        public GeneralConstraint.Definition minOf​(java.util.Collection<Variable> variables,
                                                  java.util.Collection<java.lang.Double> values)
        Create a constraint that requires this variable to be the minimum of the specified arguments.
        Parameters:
        variables - Variables in the minimum constraint.
        values - Values in the minimum constraint.
        Returns:
        this = min(variables, value).
        Since:
        43.00
      • minOf

        public GeneralConstraint.Definition minOf​(java.util.stream.Stream<Variable> variables,
                                                  java.util.stream.Stream<java.lang.Double> values)
        Create a constraint that requires this variable to be the minimum of the specified arguments.
        Parameters:
        variables - Variables in the minimum constraint.
        values - Values in the minimum constraint.
        Returns:
        this = min(variables, value).
        Since:
        43.00
      • minOf

        public GeneralConstraint.Definition minOf​(Variable... variables)
        Create a constraint that requires this variable to be the minimum of the specified other variables.
        Parameters:
        variables - Variables in the minimum constraint.
        Returns:
        this = min(variables).
        Since:
        43.00
      • orOf

        public GeneralConstraint.Definition orOf​(Variable[] variables,
                                                 java.lang.String name)
        Create a constraint that requires this variable to be the or of the specified arguments.
        Parameters:
        variables - Variables in the or constraint.
        name - Constraint name, can be null to indicate the constraint has no name.
        Returns:
        this = or(variables, value).
        Since:
        43.00
      • orOf

        public GeneralConstraint.Definition orOf​(java.util.Collection<Variable> variables)
        Create a constraint that requires this variable to be the or of the specified arguments.
        Parameters:
        variables - Variables in the or constraint.
        Returns:
        this = or(variables, value).
        Since:
        43.00
      • orOf

        public GeneralConstraint.Definition orOf​(java.util.stream.Stream<Variable> variables)
        Create a constraint that requires this variable to be the or of the specified arguments.
        Parameters:
        variables - Variables in the or constraint.
        Returns:
        this = or(variables, value).
        Since:
        43.00
      • orOf

        public GeneralConstraint.Definition orOf​(Variable... variables)
        Create a constraint that requires this variable to be the or of the specified other variables.
        Parameters:
        variables - Variables in the or constraint.
        Returns:
        this = or(variables).
        Since:
        43.00
      • andOf

        public GeneralConstraint.Definition andOf​(Variable[] variables,
                                                  java.lang.String name)
        Create a constraint that requires this variable to be the and of the specified arguments.
        Parameters:
        variables - Variables in the and constraint.
        name - Constraint name, can be null to indicate the constraint has no name.
        Returns:
        this = and(variables, value).
        Since:
        43.00
      • andOf

        public GeneralConstraint.Definition andOf​(java.util.Collection<Variable> variables)
        Create a constraint that requires this variable to be the and of the specified arguments.
        Parameters:
        variables - Variables in the and constraint.
        Returns:
        this = and(variables, value).
        Since:
        43.00
      • andOf

        public GeneralConstraint.Definition andOf​(java.util.stream.Stream<Variable> variables)
        Create a constraint that requires this variable to be the and of the specified arguments.
        Parameters:
        variables - Variables in the and constraint.
        Returns:
        this = and(variables, value).
        Since:
        43.00
      • andOf

        public GeneralConstraint.Definition andOf​(Variable... variables)
        Create a constraint that requires this variable to be the and of the specified other variables.
        Parameters:
        variables - Variables in the and constraint.
        Returns:
        this = and(variables).
        Since:
        43.00
      • absOf

        public GeneralConstraint.Definition absOf​(Variable x)
        Create a constraint that requires this variable to be the absolute value of x.
        Parameters:
        x - Argument for the absolute value constraint.
        Returns:
        this = abs(x).
        Since:
        43.00
      • ifThen

        public IndicatorDescription ifThen​(Inequality.Definition implied)
        Create an indicator constraint with this variable as indicator variable. The constraint will enforce implied if this variable is set to 1.
        Parameters:
        implied - The constraint that should be enforced if this variable is 1.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • ifNotThen

        public IndicatorDescription ifNotThen​(Inequality.Definition implied)
        Create an indicator constraint with this variable as indicator variable. The constraint will enforce implied if this variable is set to 0.
        Parameters:
        implied - The constraint that should be enforced if this variable is 0.
        Returns:
        Definition for the constraint described by the arguments.
        Since:
        43.00
      • toString

        public java.lang.String toString()
        Returns the name from getName().

        Used in these examples:

        • GlobalRHSParametrics
        • IISExample
        • Knapsack
        • Trimloss
        Overrides:
        toString in class  java.lang.Object
        Returns:
        This variable's name.
        Since:
        43.00
      • uminus

        public LinTerm uminus()
        Create a new expression that represents the unary minus of this one.
        Overrides:
        uminus in class  Expression
        Returns:
        Expression representing -this.
        Since:
        43.00
      • mul

        public Expression mul​(Expression arg)
        Create a new expression that represents the product of this and arg.
        Overrides:
        mul in class  Expression
        Parameters:
        arg - Factor.
        Returns:
        Product of this and arg.
        Since:
        43.00
      • mul

        public LinTerm mul​(ConstantExpression arg)
        Create a new expression that represents the product of this and arg.
        Parameters:
        arg - Factor.
        Returns:
        The new expression.
        Since:
        43.00
      • mul

        public LinTerm mul​(double arg)
        Create a new expression that represents the product of this and arg.
        Overrides:
        mul in class  Expression
        Parameters:
        arg - Factor.
        Returns:
        Product of this and arg.
        Since:
        43.00
      • mul

        public QuadTerm mul​(Variable arg)
        Create a new expression that represents the product of this and arg.
        Parameters:
        arg - Factor.
        Returns:
        The new expression.
        Since:
        43.00
      • mul

        public QuadTerm mul​(LinTerm arg)
        Create a new expression that represents the product of this and arg.
        Parameters:
        arg - Factor.
        Returns:
        The new expression.
        Since:
        43.00
      • div

        public Expression div​(Expression arg)
        Create a new expression that represents the quotient of this and arg.
        Overrides:
        div in class  Expression
        Parameters:
        arg - Divisor.
        Returns:
        Quotient of this and arg.
        Since:
        43.00
      • div

        public LinTerm div​(ConstantExpression arg)
        Create a new expression that represents the quotient of this and arg.
        Parameters:
        arg - Divisor.
        Returns:
        The new expression.
        Since:
        43.00
      • div

        public LinTerm div​(double arg)
        Create a new expression that represents the quotient of this and arg.
        Overrides:
        div in class  Expression
        Parameters:
        arg - Divisor.
        Returns:
        Quotient of this and arg.
        Since:
        43.00

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.