User Tools

Site Tools


solver:terminate_the_optimization_after_gams_cplex_reaches_a_certain_value_of_the_objective

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
solver:terminate_the_optimization_after_gams_cplex_reaches_a_certain_value_of_the_objective [2008/02/01 21:07]
Franz Nelissen
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 also 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.+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. 
 + 
 +Note: This approach requires distribution 22.6 ++. 
 + 
 +Option description:​ 
 + 
 +**iatriggertime (double)** 
 +The time interval in seconds when the solver checks for existence of the trigger file. This is comparable to the situation that  ctrl+c is pressed if the trigger file exist. The options iatriggertime,​ iatriggerfile and iafile enables an automated way to handle the interactive communication with the solver. ​  
 + 
 +**iatriggerfile (string)** 
 +The name of the trigger file. When the solver checks and finds the trigger file a secondary option file (iafile) is processed and the trigger file is removed. Note that the trigger file works as an indicator and only the existence of the file is checked. 
 + 
 +**iafile (string)** 
 +The secondary option file consists of CPLEX options to be used during the remaining part of the solution procedure. Hence, the secondary option file, iafile, is dedicated to be used during the interactive communication with the solver. Processing of the iafile is triggered by existence of the iatriggerfile
  
 ===== Example Model ===== ===== Example Model =====
Line 67: 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;