[Gurobi] Heurisitics

316 views
Skip to first unread message

Stephen Hill

unread,
May 6, 2010, 1:09:14 AM5/6/10
to Gurobi Optimization
Hi

From the documentation the relationship between setting MIPFocus to 1,
to shift the focus to finding feasible solutions, or increasing the
Heurisitics parameter, to control the amount of time spent in MIP
heuristics, is not clear. Could you please explain how this works.

thanks
Stephen

Ed Rothberg

unread,
May 6, 2010, 2:21:15 AM5/6/10
to Gurobi Optimization

MIPFocus changes several of our strategies to improve the chances of
finding better feasible solutions. One of the things this setting
changes is the value of the Heuristics parameter. You are free to set
Heuristics to a non-default value if you'd like to try increasing or
decreasing the amount of effort devoted to heuristics. Your setting
will override the value normally chosen by MIPFocus (which is 0.2 in
this release, but can change in the future).

Ed

Ashutosh

unread,
Jan 25, 2011, 12:06:56 AM1/25/11
to gur...@googlegroups.com
Sorry for bringing up this old post, but I have some confusion regarding use of mipfocus.

The documentation ( http://www.gurobi.com/doc/40/refman/node575.html ) mentions use of MIPFocus and ImproveStartTime and ImproveStartGap to control solution strategy.  I re-read the two paragraphs but the explanation is a bit cryptic for me to break down into what I need to achieve.

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?

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.

regards,
Ashutosh

rlin...@gmail.com

unread,
Jan 25, 2011, 4:41:36 AM1/25/11
to gur...@googlegroups.com
Salve

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

Greg Glockner

unread,
Jan 25, 2011, 9:20:04 AM1/25/11
to gur...@googlegroups.com
> If you are more interested in good quality feasible solutions, you
> can select MIPFocus=

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:

http://www.gurobi.com/doc/40/refman/node571.html

Reply all
Reply to author
Forward
0 new messages