Reputation: 31
How can I access only to the value of the variable?
Example:
When I print forces[0,1], I obtain: gurobi.Var forces[0,1] (value -0.6)
How can access only to the value of the variable: -0.6?
Thanks in advance
Upvotes: 1
Views: 10540
Reputation: 33532
I assume you are using python?
If forces[0,1]
is a Gurobi variable-object, and a value is available, you can access the value (more precise: current solution) with:
forces[0,1].X
This is of course explained in the docs. Look for variable attributes! (.X)
(Above links are for Gurobi's Python-API; look up the corresponding docs for other APIs if needed)
Upvotes: 3