Package com.google.ortools.linearsolver
Class MPVariable
- java.lang.Object
-
- com.google.ortools.linearsolver.MPVariable
-
public class MPVariable extends java.lang.ObjectThe class for variables of a Mathematical Programming (MP) model.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanswigCMemOwn
-
Constructor Summary
Constructors Modifier Constructor Description protectedMPVariable(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MPSolver.BasisStatusbasisStatus()Advanced 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.java.lang.Stringname()Returns the name of the variable.doublereducedCost()Advanced 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.doublesolutionValue()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 longswigRelease(MPVariable obj)doubleub()Returns the upper bound.
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(MPVariable obj)
-
swigRelease
protected static long swigRelease(MPVariable obj)
-
finalize
protected void finalize()
- Overrides:
finalizein classjava.lang.Object
-
delete
public void delete()
-
name
public java.lang.String 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
public MPSolver.BasisStatus basisStatus()
Advanced usage: returns the basis status of the variable in the current
solution (only available for continuous problems).
-
-