Description
Tests the CPLEX link option 'interactive' including the interactive trigger file and additional interactive solver option file. Contributor: Renke Kuhlmann, October 2020
Small Model of Type : GAMS
Category : GAMS Test library
Main file : cplex05.gms
$title 'CPLEX test suite - interactive' (CPLEX05,SEQ=830)
$if not '%GAMS.lp%' == '' $set solver %GAMS.lp%
$if not set solver $set solver cplex
$onText
Tests the CPLEX link option 'interactive' including the interactive trigger file
and additional interactive solver option file.
Contributor: Renke Kuhlmann, October 2020
$offText
$call gamslib -q 12
$call touch iatrigger.txt
$onEchoS > %solver%.opt
interactive 1
iatriggerfile iatrigger.txt
iatriggertime 1
iafile %solver%.op2
userincbcall incubemt_check_1
nodlim 20
$offEcho
$onEchoV > %solver%.op2
userincbcall incubemt_check_2
$offEcho
$onEchoV > %solver%.op3
nodlim 20
$offEcho
$onEchoV > incubemt_check_1.gms
display$sleep(1) 'sleep longer than trigger time';
abort 'accept incumbent';
$offEcho
$onEchoV > incubemt_check_2.gms
$offEcho
* check run of original model
$include magic.gms
option solver = %solver%;
solve william minimizing cost using mip;
abort$(william.modelstat <> %modelStat.optimal%) 'problems solving original model';
abort$(william.solvestat <> %solveStat.normalCompletion%) 'problems solving original model';
* check that models is solved within 20 nodes, hence nodlim=20 does not yield unsuccessful termination
william.optfile = 3;
option solver = %solver%;
solve william minimizing cost using mip;
abort$(william.modelstat <> %modelStat.optimal%) 'problems solving original model with nodlim';
abort$(william.solvestat <> %solveStat.normalCompletion%) 'problems solving original model with nodlim';
* apply solve with trigger
* First, the incumbent check accepts everything, the trigger option file updates
* the incumbent check to one that rejects everything. Hence, we expect unsuccessful
* termination with resource limit
william.optfile = 1;
option solver = %solver%;
solve william minimizing cost using mip;
abort$(william.modelstat = %modelStat.optimal%) 'problems with interactive trigger';
abort$(william.solvestat = %solveStat.normalCompletion%) 'problems with interactive trigger';
abort$(not (william.solvestat = %solveStat.resourceInterrupt% or william.solvestat = %solveStat.terminatedBySolver%)) 'problems with interactive trigger';