|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgurobi.GRBVar
public class GRBVar
Gurobi variable object. Variables are always associated with a particular model. You create a variable object by adding a variable to a model (using @link GRBModel#addVar GRBModel.addVar), rather than by using a @code GRBVar constructor.
The methods on variable objects are used to get and set variable attributes. For example, solution information can be queried by calling @link GRBVar#get get(@code GRB.DoubleAttr.X). Note, however, that it is generally more efficient to query attributes for a set of variables at once. This is done using the attribute query method on the @code GRBModel object (@link GRBModel#get GRBModel.get).
Method Summary | |
---|---|
protected void |
finalize()
|
char |
get(GRB.CharAttr attr)
Query the value of a char-valued attribute. |
double |
get(GRB.DoubleAttr attr)
Query the value of a double-valued attribute. |
int |
get(GRB.IntAttr attr)
Query the value of an int-valued attribute. |
java.lang.String |
get(GRB.StringAttr attr)
Query the value of a string-valued attribute. |
int |
index()
This method returns the current index, or order, of the variable in the underlying constraint matrix. |
boolean |
sameAs(GRBVar otherVar)
Check whether two variable objects refer to the same variable. |
void |
set(GRB.CharAttr attr,
char newval)
Set the value of a char-valued attribute. |
void |
set(GRB.DoubleAttr attr,
double newval)
Set the value of a double-valued attribute. |
void |
set(GRB.IntAttr attr,
int newval)
Set the value of an int-valued attribute. |
void |
set(GRB.StringAttr attr,
java.lang.String newval)
Set the value of a string-valued attribute. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected void finalize()
finalize
in class java.lang.Object
public boolean sameAs(GRBVar otherVar)
otherVar
- The other variable.
public int index()
Note that the index of a variable may change after subsequent model modifications.
public int get(GRB.IntAttr attr) throws GRBException
attr
- The attribute being queried.
GRBException
public char get(GRB.CharAttr attr) throws GRBException
attr
- The attribute being queried.
GRBException
public double get(GRB.DoubleAttr attr) throws GRBException
attr
- The attribute being queried.
GRBException
public java.lang.String get(GRB.StringAttr attr) throws GRBException
attr
- The attribute being queried.
GRBException
public void set(GRB.IntAttr attr, int newval) throws GRBException
attr
- The attribute being modified.newval
- The desired new value of the attribute.
GRBException
public void set(GRB.CharAttr attr, char newval) throws GRBException
attr
- The attribute being modified.newval
- The desired new value of the attribute.
GRBException
public void set(GRB.DoubleAttr attr, double newval) throws GRBException
attr
- The attribute being modified.newval
- The desired new value of the attribute.
GRBException
public void set(GRB.StringAttr attr, java.lang.String newval) throws GRBException
attr
- The attribute being modified.newval
- The desired new value of the attribute.
GRBException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |