Package com.google.ortools.modelbuilder
Class Variable
- java.lang.Object
-
- com.google.ortools.modelbuilder.Variable
-
- All Implemented Interfaces:
LinearArgument
public class Variable extends java.lang.Object implements LinearArgument
An integer variable.
-
-
Field Summary
Fields Modifier and Type Field Description protected ModelBuilderHelperhelperprotected intindex
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LinearExprbuild()Builds a linear expression.intgetIndex()Returns the index of the variable in the underlying ModelBuilderHelper.booleangetIntegrality()Returns whether the variable is integral.doublegetLowerBound()Returns the lower bound of the variable.java.lang.StringgetName()Returns the name of the variable given upon creation.doublegetObjectiveCoefficient()Returns the objective coefficient of the variable.doublegetUpperBound()Returns the upper bound of the variable.voidsetIntegrality(boolean isIntegral)Sets the integrality of the variable.voidsetLowerBound(double lowerBound)Sets the lower bound of the variable.voidsetName(java.lang.String name)voidsetObjectiveCoefficient(double objectiveCoefficient)Sets the objective coefficient of the variable in the objective.voidsetUpperBound(double upperBound)Sets the upper bound of the variable.java.lang.StringtoString()
-
-
-
Field Detail
-
helper
protected final ModelBuilderHelper helper
-
index
protected final int index
-
-
Method Detail
-
getIndex
public int getIndex()
Returns the index of the variable in the underlying ModelBuilderHelper.
-
build
public LinearExpr build()
Description copied from interface:LinearArgumentBuilds a linear expression.- Specified by:
buildin interfaceLinearArgument
-
getLowerBound
public double getLowerBound()
Returns the lower bound of the variable.
-
setLowerBound
public void setLowerBound(double lowerBound)
Sets the lower bound of the variable.
-
getUpperBound
public double getUpperBound()
Returns the upper bound of the variable.
-
setUpperBound
public void setUpperBound(double upperBound)
Sets the upper bound of the variable.
-
getIntegrality
public boolean getIntegrality()
Returns whether the variable is integral.
-
setIntegrality
public void setIntegrality(boolean isIntegral)
Sets the integrality of the variable.
-
getObjectiveCoefficient
public double getObjectiveCoefficient()
Returns the objective coefficient of the variable.
-
setObjectiveCoefficient
public void setObjectiveCoefficient(double objectiveCoefficient)
Sets the objective coefficient of the variable in the objective.
-
getName
public java.lang.String getName()
Returns the name of the variable given upon creation.
-
setName
public void setName(java.lang.String name)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-