Limiting Memory Usage

824 views
Skip to first unread message

Lee Junkyu

unread,
Jul 10, 2013, 2:58:37 AM7/10/13
to gur...@googlegroups.com
Hello,

I've been using GUROBI for a week.

Is there any way to limit memory usage, and time usage?

Currently, I am using callback function to limit time usage following the guides below.
It's quite useful though it does not actually interrupt GUROBI solver right time.

In addition, I can't see how to limit the memory usage, for example 2GB, 4GB, and etc.
Can I set the maximum value of available memory  to solve a problem?
Or is there any way to check what amount of memory was used by GUROBI?

Thanks,

Junkyu Lee

Jakob Sch.

unread,
Jul 11, 2013, 6:28:27 AM7/11/13
to gur...@googlegroups.com
Hi Junkyu,

you could use the parameter "TimeLimit" to stop the optimization process after a given time. See http://www.gurobi.com/documentation/5.5/reference-manual/node888#parameter:TimeLimit
As for the memory I am not aware that there is any parameter within gurobi (you can probably use some linux commands to do this - if you are working on linux). Note that the memory used is highly depends on the model size and "difficulty" of the problem...

Best regards,
Jakob

Lee Junkyu

unread,
Jul 11, 2013, 4:42:49 PM7/11/13
to gur...@googlegroups.com
Thank you for your answer Jakob.

Let me add one more question about memory usage.

I am using linux machine, and I can limit memory by some commands.
I could interrupt GUROBI when it reached memory limit.

The next question is that is there any way to trade memory for time?
The sizes of my LP files are about 0.5 GB to 2GB, and sizes of MPS files are roughly 2 times larger than LP files
Some problems exceeded the memory limit and terminated by linux commands.
Is there any way to spend more time to solve problems while limiting the memory usage?

Best regards,
Junkyu

Jakob Sch.

unread,
Jul 12, 2013, 9:48:07 AM7/12/13
to gur...@googlegroups.com
Hi Junkyu,

LP and MPS file are just some ways to save the problem data for exchanging them. As you have noticed the LP files might be a bit smaller than the MPS files. You can turn on compression by saving the files as ".lp.gz" or ".mps.gz". Gurobi handles the compression (and later the extraction when reading the files in) on the fly. During optimization the amount of memory depends on the raw data(matrix) of your problem and the algorithm that you are using.
The best thing to do would probably be thinking of some clever ways of preprocessing to reduce the problem size of your models. Also some other modelling techniques might yield a smaller problem. This is of course highly dependent on the type of you problem. You can also try to use gurobi for presolving (setting parameter "Presolve" to 2), but usually it is always better do think of some model specific reductions since gurobi just looks at the raw data and has no clue where the problem came from in the first place :)
You can also have a look at the following parameter: http://www.gurobi.com/documentation/5.5/reference-manual/node854#parameter:NodefileStart Also reducing the threads might yield some memory reductions.

You can try some different algorithms for solving your problem, see parameters section:
http://www.gurobi.com/documentation/5.5/reference-manual/node843#parameter:Method
http://www.gurobi.com/documentation/5.5/reference-manual/node856#parameter:NodeMethod

I hope this helps.

Best regards,

Jakob
Reply all
Reply to author
Forward
0 new messages