GRB.DoubleAttr.RC and GRB.DoubleAttr.Pi in MIP

899 views
Skip to first unread message

Fabio

unread,
Jul 20, 2010, 5:56:34 AM7/20/10
to Gurobi Optimization
Hello,

I'm experimenting with Gurobi by using a simple power plant dispatch
model (i.e. find the cost-optimal dispatch and meet a given demand).

To represent minimum output power (e.g. 0% or 40%-100%) I have to
introduce a binary variable in a constraint (not in the objective
function). The interesting result part in this model would be the
shadow price of the demand constraint. Shadow prices are not well
defined in mixed-integer problems but in many cases it makes sense to
solve the problem twice. In the second round, one keeps the integer
variables fixed at the optimal values (by fixing upper and lower
bound).

I tried to do this in Gurobi (Java Interface) but
constraint.get(GRB.DoubleAttr.Pi) always gives me:
"gurobi.GRBException: Error at GRBConstr.get"

Anything I have missed? Is constraint.get(GRB.DoubleAttr.Pi) generally
never available in a mixed-integer problem?

Best,
Fabio

Greg Glockner

unread,
Jul 20, 2010, 11:12:23 AM7/20/10
to gur...@googlegroups.com
You can't get dual values for an integer program. However, once you solve the MIP, you can create the fixed LP model, solve that, and get the dual values for that model. This is illustrated in the mip2 example, found in the examples subdirectories of Gurobi (ex: examples\java\Mip2.java).

Greg Glockner

unread,
Jul 26, 2012, 10:54:37 PM7/26/12
to gur...@googlegroups.com
There is no access to the duals via a callback. Additionally, things get tricky in terms of presolve. If you really need to do this, then follow these steps:

1. Copy model m to m1
2. Presolve m1
3. Relax m1
4. Set Presolve=0 on m1
5. Solve m1

Reply all
Reply to author
Forward
0 new messages