2015-11-06 65 views
0

我正在使用Java中的ILOG CPLEX庫來解決ILP問題。我使用的是默認設置,並沒有調整任何參數。我使用的示例代碼,我在網上找到的樣品我的主循環:Ubuntu內核因內存不足而殺死CPLEX ILP進程

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

我推出了具有24GB RAM一個Ubuntu 14系統上我的罐子,讓它解決更大的問題。當我的問題變得太大而無法用24GB RAM解決時,我希望CPLEX從解決方法返回false。相反,我的CPLEX不斷運行,直到我的內核殺死進程。我通過檢查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 

這是我第一次與CPLEX工作,我不知道我怎樣才能讓這個CPLEX將返回false的解決方法時,它運行的內存與(而不是捱餓系統資源)工作?

我試着在網上查找,發現了一些有關WorkMem和TreeLimit參數的C++線程,但我無法找到如何使用Java庫配置這些線程。

有人能幫我進一步嗎?謝謝。

編輯:這裏是CPLEX日誌

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% 

如此下去,直到內核殺死它。

+0

最佳答案取決於cplex耗盡內存的過程。你可以在日誌中看到這個。它能夠啓動並解決初始LP嗎? –

+0

嗨大衛,不,它一直試圖解決,似乎並沒有放棄,這就是爲什麼我認爲內核跳入並殺死它。在一段時間左右之後有沒有辦法讓ILP迴歸? – Piet

+0

我已經添加了日誌,我希望這有助於爲我的問題找到解決方案。 – Piet

回答

0

要改變WorkMem參數,你會做這樣的事情:

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

查看文檔TreeLimitMIP.Strategy.File。在研究這個時,我在TreeLimit文檔中發現了一個小問題。它提到了128MB(WorkMem的舊默認值),但它應該是2048MB。這個問題正在解決。

您可以在CPLEX附帶的示例中找到許多關於如何更改參數的示例(例如,可在示例子目錄中找到的MIPex3.java等)。

欲瞭解更多信息,請參閱running out of memory

此處的所有鏈接均適用於CPLEX 12.6.2,但如果您安裝了其他軟件,則應該可以爲知識中心中的不同版本選擇文檔。

+0

謝謝,現在我可以開始擺弄參數了。您有任何建議,哪些參數會影響CPLEX在放棄和返回之前嘗試解決的時間量? – Piet

+0

如果我理解正確,可以設置[TimeLimit](http://www-01.ibm.com/support/knowledgecenter/SSSA5P_12.6.2/ilog.odms.cplex.help/CPLEX/Parameters/topics/TiLim .html?lang = en)或[DetTimeLimit](http://www-01.ibm.com/support/knowledgecenter/SSSA5P_12.6.2/ilog.odms.cplex.help/CPLEX/Parameters/topics/DetTiLim.html? lang = en)參數。 – rkersh

+0

是的,謝謝,這正是我需要保證它會在一段時間後返回。與Java語法的鏈接也非常有用。 – Piet