AMPL: does the results after using the option “timelimit” for cplex meet all the constraints?

99封情书 提交于 2019-12-11 09:27:20

问题


I have a dummy question that I need to know its answer. I'm working on a project that requires AMPL and CPLEX as a solver. Now this problem normally takes more than 140 seconds to be solved. While I was searching, I came into an option called timelimit. I used this option with value option cplex_options 'timelimit=5'and the results were shown within 5 seconds. Now my questions is, does the output meet all the constraints and is within the boundaries I set in the code? Or did I just terminate the process and the results were the current "being processed" data? Thanks for helping.


回答1:


If you don't set the timelimit parameter, the run time is the time to get to a provably optimal solution within the relative tolerance (default is 1e-6). By setting a time limit, you are telling cplex to stop at 5 seconds. In that case, it will return the best solution it has found, regardless of the quality of the objective function. cplex will not, however, give you a solution that violates constraints. If it can't find a feasible solution in the time allotted, then you will not get a solution. You can check the exitcode suffix of the model to see if there was a solution found.



来源:https://stackoverflow.com/questions/25021603/ampl-does-the-results-after-using-the-option-timelimit-for-cplex-meet-all-the

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