How to Get the Reduced Cost of a VAR Before Optimizing the Model?

475 views
Skip to first unread message

H Pouya

unread,
Mar 9, 2016, 9:35:33 AM3/9/16
to Gurobi Optimization

Hi dears,

I am using column generation technique. I have a problem in my algorithm and to be sure that the objective function of the Pricing Problem is working, I need to access to the reduced cost of each column added in the Relaxed Master Problem before optimizing the model. The value of the objective function in Pricing Problem and the reduced cost must be the same. I follow this process:

1-  Adding the column generated in Pricing Problem to Master Problem
2- Relaxing Master Problem
3- Returning the RC attribute of the added VAR to Master.

To return the RC, I use the the following part of code:

Master.relax().getVarByName(vname.str()).get(GRB_DoubleAttr_RC);


I get this error

Error code = 10005
var :: get

Can you help me about what I am doing wrong? Is there another attribute except "RC" that returns the reduced cost before optimizing the model?

The best,
hmd

H Pouya

unread,
Mar 9, 2016, 10:07:05 AM3/9/16
to Gurobi Optimization
BTW, I should mention that the command works great after optimizing the model but I need it before optimizing! 

Renan Garcia

unread,
Mar 9, 2016, 10:24:17 AM3/9/16
to gur...@googlegroups.com
The RC attribute corresponds to the reduced cost in the *current solution* (see http://www.gurobi.com/documentation/6.5/refman/rc.html#attr:RC). Therefore, you must solve the model before querying for it.

Also, note that many model modifications invalidate the current solution, so you should query for all solution information before making subsequent modifications to the master problem.

On Mar 9, 2016, at 10:00 AM, H Pouya <hmd....@gmail.com> wrote:

BTW, I should mention that the command works great after optimizing the model but I need it before optimizing! 

--

---
You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

H Pouya

unread,
Mar 9, 2016, 12:11:17 PM3/9/16
to Gurobi Optimization
Thank you. I wonder if there is a way to get the reduced cost before optimizing. I need the reduced costs in the first tableau. I want to compare this value with the objective returned from the Pricing problem. 

hmad
Reply all
Reply to author
Forward
0 new messages