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).
void
delete()
protected void
finalize()
protected static long
getCPtr
(MPVariable obj) int
index()
Returns the index of the variable in the MPSolver::variables_.double
lb()
Returns the lower bound.name()
Returns the name of the variable.double
Advanced usage: returns the reduced cost of the variable in the current
solution (only available for continuous problems).void
setBounds
(double lb, double ub) Sets both the lower and upper bounds.void
setInteger
(boolean integer) Sets the integrality requirement of the variable.void
setLb
(double lb) Sets the lower bound.void
setUb
(double ub) Sets the upper bound.double
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).protected static long
swigRelease
(MPVariable obj) double
ub()
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).
-