Set limitation on gap tolerance and run time [clos

2019-09-23 00:55发布

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条回答
我命由我不由天
2楼-- · 2019-09-23 01:30

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

查看更多
登录 后发表回答