Package com.google.ortools.modelbuilder
Class LinearConstraint
- java.lang.Object
-
- com.google.ortools.modelbuilder.LinearConstraint
-
public class LinearConstraint extends java.lang.ObjectWrapper around a linear constraint stored in the ModelBuilderHelper instance.
-
-
Constructor Summary
Constructors Constructor Description LinearConstraint(ModelBuilderHelper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTerm(Variable v, double coeff)Adds var * coeff to the constraint.voidclearTerms()Clear all terms.ModelBuilderHelpergetHelper()Returns the constraint builder.intgetIndex()Returns the index of the constraint in the model.doublegetLowerBound()Returns the lower bound of the constraint.java.lang.StringgetName()Returns the name of the constraint given upon creation.doublegetUpperBound()Returns the upper bound of the constraint.voidsetCoefficient(Variable v, double coeff)Sets the coefficient of v to coeff, adding or removing a term if needed.voidsetLowerBound(double lb)Returns the lower bound of the constraint.voidsetName(java.lang.String name)Sets the name of the constraint.voidsetUpperBound(double ub)Returns the upper bound of the constraint.LinearConstraintwithName(java.lang.String name)Inline setter
-
-
-
Constructor Detail
-
LinearConstraint
public LinearConstraint(ModelBuilderHelper helper)
-
-
Method Detail
-
getIndex
public int getIndex()
Returns the index of the constraint in the model.
-
getHelper
public ModelBuilderHelper getHelper()
Returns the constraint builder.
-
getLowerBound
public double getLowerBound()
Returns the lower bound of the constraint.
-
setLowerBound
public void setLowerBound(double lb)
Returns the lower bound of the constraint.
-
getUpperBound
public double getUpperBound()
Returns the upper bound of the constraint.
-
setUpperBound
public void setUpperBound(double ub)
Returns the upper bound of the constraint.
-
getName
public java.lang.String getName()
Returns the name of the constraint given upon creation.
-
setName
public void setName(java.lang.String name)
Sets the name of the constraint.
-
addTerm
public void addTerm(Variable v, double coeff)
Adds var * coeff to the constraint.
-
setCoefficient
public void setCoefficient(Variable v, double coeff)
Sets the coefficient of v to coeff, adding or removing a term if needed.
-
clearTerms
public void clearTerms()
Clear all terms.
-
withName
public LinearConstraint withName(java.lang.String name)
Inline setter
-
-