On Tue, Jan 25, 2011 at 6:06 AM, Ashutosh
<ashutosh.c...@gmail.com> wrote:
> The problem I want to solve has been modeled as an MILP whose objective I
> need to minimize. For me, it is of paramount importance is to get a
> solution that is valid i.e. satisfies all constraints (these are hard
> constraints just like non overlap of objects). I would like to get the
> optimal objective value that satisfies all the constraints, but something
> non-optimal is also OK. According to this requirement, what value of
> MIPFocus should I put?
If you are more interested in good quality feasible solutions, you
can select MIPFocus=
> Another related question: If I press Control-C or set timelimit in Gurobi,
> is it possible to know by looking at console messages (I am running
> gurobi.sh and read() and optimize() models), if the solution that is last
> saved in its memory is satisfying constraints or not.
In C++ you need add a callback with "where == GRB_CB_MIPSOL" and
store the solution
in python:
help(Model)
m.printQuality()
print m.ObjVal
vars = m.getVars()
help(Var)
print vars[0].VarName
print vars[0].X
for x in vars:
[tab] print xVarName
I think you mean MIPFocus=0 (default) or MIPFocus=1:
http://www.gurobi.com/doc/40/refman/node572.html
>> Another related question: If I press Control-C or set timelimit in Gurobi,
>> is it possible to know by looking at console messages (I am running
>> gurobi.sh and read() and optimize() models), if the solution that is last
>> saved in its memory is satisfying constraints or not.
You can check the log; if there's anything in the Incumbent column, then an integer feasible solution has been found:
http://www.gurobi.com/doc/40/refman/node592.html
Also, you can check that the SolCount model attribute is nonzero: