solver:terminate_the_optimization_after_gams_cplex_reaches_a_certain_value_of_the_objective

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

solver:terminate_the_optimization_after_gams_cplex_reaches_a_certain_value_of_the_objective [2012/05/14 14:01] admin |
solver:terminate_the_optimization_after_gams_cplex_reaches_a_certain_value_of_the_objective [2021/03/05 16:04] Atharv Bhosekar removed |
||
---|---|---|---|

Line 1: | Line 1: | ||

====== Terminate the optimization after GAMS/CPLEX reaches a certain value of the objective ====== | ====== Terminate the optimization after GAMS/CPLEX reaches a certain value of the objective ====== | ||

- | The example model below shows how to interact with CPLEX that it stops pretty much after CPLEX found the solution value 21 (or larger). This is done in using the same mechanism as described in "[[http://www.gams.com/docs/bch.htm|The GAMS Branch-and-Cut-and-Heuristic Facility]]". | + | The example model below shows how to interact with CPLEX that it stops pretty much after CPLEX found the solution value 21 (or larger). This is done in using the same mechanism as described in "[[https://www.gams.com/latest/docs/UG_SolverUsage.html#ADVANCED_USAGE_BCHFacility|The GAMS Branch-and-Cut-and-Heuristic Facility]]". |

First we have userincbicall which is called every time we find a new incumbent. We are also in ”interactive” mode, meaning that we accept new options on the fly. The trigger for reading in new options is a trigger file called readop2. This is created by the incumbent checking routine only if we reached 21 or higher. The Cplex option sets a very large optca (Cplex name for it is epagap), so we should terminate immediately. The iatriggertime is set to 1 meaning that Cplex checks every second if there is a triggerfile. This should be set to larger values (60 seconds or so) for real models. This can be used effieciently, for example, in the case when a model is decomposed into sub-models. When a sub-model is solved then the solution can be used in the other sub-models to create a integer cut, hence the solution speed is improved. | First we have userincbicall which is called every time we find a new incumbent. We are also in ”interactive” mode, meaning that we accept new options on the fly. The trigger for reading in new options is a trigger file called readop2. This is created by the incumbent checking routine only if we reached 21 or higher. The Cplex option sets a very large optca (Cplex name for it is epagap), so we should terminate immediately. The iatriggertime is set to 1 meaning that Cplex checks every second if there is a triggerfile. This should be set to larger values (60 seconds or so) for real models. This can be used effieciently, for example, in the case when a model is decomposed into sub-models. When a sub-model is solved then the solution can be used in the other sub-models to create a integer cut, hence the solution speed is improved. | ||

Line 80: | Line 80: | ||

xdice.optfile=1; option mip=cplex; option optcr=0; | xdice.optfile=1; option mip=cplex; option optcr=0; | ||

+ | |||

+ | * Delete trigger file which might be around from a previous run | ||

+ | $call rm -rf readop2 | ||

+ | |||

+ | * Set dummy upper bound | ||

+ | * Note: This is actually not necessary, it is just done because of a bug in older versions | ||

+ | wnx.up=1000; | ||

solve xdice using mip max wnx; | solve xdice using mip max wnx; |