Skip to content
Advertisement

Ubuntu kernel kills CPLEX ILP process due to out of memory

I’m working with the ILOG CPLEX library in Java to solve an ILP problem. I’m using the default settings and did not adjust any parameters. I used the example code which I found online in samples for my main loop:

if (cplex.solve()) {
    Log.printLine("CPLEX solved successfully");
} else {
    Log.printLine("probably insufficient memory or some other weird problem.");
}

I launched my jar on an Ubuntu 14 system with 24GB RAM and let it solve larger problems. When my problem becomes too big to solve with 24GB RAM I expect CPLEX to return false from the solve method. Instead, my CPLEX keeps running endlessly until my kernel kills the process. I verified this by checking kern.log:

Nov  6 00:21:47 node0 kernel: [3779722.641458] Out of memory: Kill process 3600 (java) score 980 or sacrifice child
Nov  6 00:21:47 node0 kernel: [3779722.641476] Killed process 3600 (java) total-vm:36562768kB, anon-rss:23969732kB, file-rss:688kB

This is my first time working with CPLEX and I was wondering how I can make it so that CPLEX will return false to the solve method when it runs out of memory to work with (rather than starving the system resources)?

I tried looking this up online and found some C++ threads about the WorkMem and TreeLimit parameters but I am unable to find how I can configure these with the Java library.

Is anyone able to help me out further please? Thanks.

EDIT: Here is the CPLEX log

Found incumbent of value 5000.000000 after 0.09 sec. (48.51 ticks)
Tried aggregator 1 time.
MIP Presolve eliminated 600000 rows and 1 columns.
MIP Presolve modified 156010 coefficients.
Reduced MIP has 171010 rows, 770000 columns, and 3170000 nonzeros.
Reduced MIP has 770000 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 5.54 sec. (2155.22 ticks)
Probing time = 5.51 sec. (186.83 ticks)
Tried aggregator 1 time.
Reduced MIP has 171010 rows, 770000 columns, and 3170000 nonzeros.
Reduced MIP has 770000 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 3.68 sec. (1438.46 ticks)
Probing time = 3.45 sec. (181.50 ticks)
Clique table members: 263821.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 4 threads.
Root relaxation solution time = 43.34 sec. (14019.88 ticks)

Nodes                                         Cuts/
Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

0+    0                         5000.0000        0.0000           100.00%
0     0     4547.0452 14891     5000.0000     4547.0452       20    9.06%
0     0     4568.6089 12066     5000.0000    Cuts: 6990   318432    8.63%

It goes on until the kernel kills it.

Advertisement

Answer

To change the WorkMem parameter, you’d do something like this:

IloCplex cplex = new IloCplex();
cplex.setParam(IloCplex.Param.WorkMem, 2048);

See the documentation for TreeLimit and MIP.Strategy.File. While looking into this, I spotted a minor problem in the TreeLimit documentation. It mentions 128MB there (the old default value of WorkMem), but it should be 2048MB instead. This is being fixed.

You can find many examples of how to change parameters in the examples shipped with CPLEX (e.g., MIPex3.java, etc., which can be found in the examples sub-directory).

For more information see running out of memory.

All of the links here are for CPLEX 12.6.2, but you should be able to select the documentation for different versions in the knowledge center if you have something else installed.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement