Class MPVariable
java.lang.Object
com.google.ortools.linearsolver.MPVariable
The class for variables of a Mathematical Programming (MP) model.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdvanced usage: returns the basis status of the variable in the current
solution (only available for continuous problems).
voiddelete()protected voidfinalize()protected static longgetCPtr(MPVariable obj) intindex()Returns the index of the variable in the MPSolver::variables_.doublelb()Returns the lower bound.name()Returns the name of the variable.doubleAdvanced usage: returns the reduced cost of the variable in the current
solution (only available for continuous problems).voidsetBounds(double lb, double ub) Sets both the lower and upper bounds.voidsetInteger(boolean integer) Sets the integrality requirement of the variable.voidsetLb(double lb) Sets the lower bound.voidsetUb(double ub) Sets the upper bound.doubleReturns the value of the variable in the current solution.
If the variable is integer, then the value will always be an integer (the
underlying solver handles floating-point values only, but this function
automatically rounds it to the nearest integer; see: man 3 round).protected static longswigRelease(MPVariable obj) doubleub()Returns the upper bound.
-
Field Details
-
swigCMemOwn
protected transient boolean swigCMemOwn
-
-
Constructor Details
-
MPVariable
protected MPVariable(long cPtr, boolean cMemoryOwn)
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
-
delete
public void delete() -
name
Returns the name of the variable. -
setInteger
public void setInteger(boolean integer) Sets the integrality requirement of the variable. -
solutionValue
public double solutionValue()Returns the value of the variable in the current solution.
If the variable is integer, then the value will always be an integer (the
underlying solver handles floating-point values only, but this function
automatically rounds it to the nearest integer; see: man 3 round). -
index
public int index()Returns the index of the variable in the MPSolver::variables_. -
lb
public double lb()Returns the lower bound. -
ub
public double ub()Returns the upper bound. -
setLb
public void setLb(double lb) Sets the lower bound. -
setUb
public void setUb(double ub) Sets the upper bound. -
setBounds
public void setBounds(double lb, double ub) Sets both the lower and upper bounds. -
reducedCost
public double reducedCost()Advanced usage: returns the reduced cost of the variable in the current
solution (only available for continuous problems). -
basisStatus
Advanced usage: returns the basis status of the variable in the current
solution (only available for continuous problems).
-