Hi Sonja
Thank you for the reply.
Actually when I try to set UB and LB to 0 for a set of variables, it doesn't work. In my MIP model, first of all I collect variables with attribute VType == GRB.BINARY, then set then to GRB.CONTINUOUS with LB =0 and UB=1 in order to solve LP relaxation.
However, some variables keep giving me very small negative value (-2.5231141231e-17, something like this), and then cause my the other optimization problem infeasible. But I am pretty sure the formulation will be feasible anyway. That's why I think why I can't just modify the value by using round up or round down to force it to be zero.
I am aware that I can use model.relax() to get the LP relaxation objective value, however I can't retrieve solution value. For example, let's say I have a model called m, normally I will just do m.optimize() and then retrieve the value of a variable called "setup[(k,t)]" by using setup[(k,t)].X or setup[(k,t)].getAttr('X'). But when I use the relax method, suppose
n = m.relax()
n.optimize()
then I know n.objval is able to be queried, but what about retrieving value of setup[(k,t)]? Gurobi will tell me something like variables have not been added to model n yet.
Thank you so much for answering.
Sonja Mars於 2017年4月19日星期三 UTC-4上午3時36分32秒寫道: