Set limitation on gap tolerance and run time [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-13 09:25:03

问题


I have two questions:

  1. In IBM ILOG CPLEX, I wrote an OPL project. Because the code works with large scale data, it takes a lot of time to solve. What is the code for limitation the gap tolerance of MIP Problem and limitation the time?

  2. I want to have a CSV file containing my desired results. For example, I want to have an objective function and runtime and the facility variable in a CSV file. I got all these results but I want them to be written in a CSV file too.


回答1:


1) Add the following code before the minimize statement in your .mod file.

execute
{
   cplex.tilim=30; // 20 s time limt
   cplex.epgap=0.01 // 1% gep
}

You can confirm that it is taken into account by examining the engine log. It should have something like this at the very beginning:

CPXPARAM_TimeLimit                               30
CPXPARAM_MIP_Tolerances_MIPGap                   0.01

2) You may rely on IloOplOutputFile

See example in https://www.ibm.com/developerworks/community/forums/html/topic?id=3fd44d41-210b-4b81-a005-819530d6377b&ps=25



来源:https://stackoverflow.com/questions/56448457/set-limitation-on-gap-tolerance-and-run-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!