Description
Test that solvers that utilize subsolvers send the correct option file location to their subsolver in case the CLP OptDir is given. Contributor: Michael Bussieck, May 2025
Small Model of Type : GAMS
Category : GAMS Test library
Main file : optdir1.gms
$title Test option file location with CLP optDir and solvers that utilize subsolvers (OPTDIR1, SEQ=985)
$ontext
Test that solvers that utilize subsolvers send the correct option file location to their subsolver
in case the CLP OptDir is given.
Contributor: Michael Bussieck, May 2025
$offtext
$call.checkErrorLevel gamslib -q fuel
$call.checkErrorLevel gamslib -q pump
$call.checkErrorLevel gamslib -q nash
$call.checkErrorLevel gamslib -q trnsport
$call.checkErrorLevel gamslib -q gussex1
$call.checkErrorLevel sed s/"SkipBaseCase 1"/"SkipBaseCase 1, OptFileInit 1, OptFile 2, LogOption 2"/ gussex1.gms > gussex1mod.gms
$call.checkErrorLevel emplib -q ferris43
$call.checkErrorLevel emplib -q batchsp
$call.checkErrorLevel emplib -q simplechance
$call.checkErrorLevel testlib -q embrhp01
$call mkdir xxxoptdirxxx > %system.nullfile% 2>&1
$echo * this is cplex.opt in currentdir > cplex.opt
$echo * this is cplex.opt in xxxoptdirxxx > xxxoptdirxxx/cplex.opt
$echo * this is cplex.op2 in currentdir > cplex.op2
$echo * this is cplex.op2 in xxxoptdirxxx > xxxoptdirxxx/cplex.op2
$echo * this is xpress.op4 in currentdir > xpress.op4
$echo * this is xpress.op4 in xxxoptdirxxx > xxxoptdirxxx/xpress.op4
$echo * this is conopt.op2 in currentdir > conopt.op2
$echo * this is conopt.op2 in xxxoptdirxxx > xxxoptdirxxx/conopt.op2
$echo * this is snopt.op4 in currentdir > snopt.op4
$echo * this is snopt.op4 in xxxoptdirxxx > xxxoptdirxxx/snopt.op4
$echo * this is path.opt in currentdir > path.opt
$echo * this is path.opt in xxxoptdirxxx > xxxoptdirxxx/path.opt
$echo * this is path.op3 in currentdir > path.op3
$echo * this is path.op3 in xxxoptdirxxx > xxxoptdirxxx/path.op3
$echo * this is jams.op5 in xxxoptdirxxx > xxxoptdirxxx/jams.op5
$echo * this is jams.op5 in currentdir > jams.op5
$onecho > xxxoptdirxxx/alphaecp.opt
mipsolver cplex.1
miploglevel 1
nlpsolver conopt.2
nlploglevel 1
$offecho
$call.checkErrorLevel gams fuel minlp=alphaecp optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" fuel.log
$call grep -q "this is conopt.op2 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in fuel.log
*
$call.checkErrorLevel grep -q "this is cplex.opt in xxxoptdirxxx" fuel.log
$call grep -q "this is cplex.opt in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is cplex.opt in currentdir" in fuel.log
$onecho > xxxoptdirxxx/antigone.opt
nlp_solver conopt
conopt_optfile conopt.op2
cplex_optfile cplex.opt
$offecho
$call.checkErrorLevel gams fuel minlp=antigone optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" fuel.log
$call grep -q "this is conopt.op2 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in fuel.log
*
$call.checkErrorLevel grep -q "this is cplex.opt in xxxoptdirxxx" fuel.log
$call grep -q "this is cplex.opt in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is cplex.opt in currentdir" in fuel.log
$ifThen.baron exist "%gams.sysdir%optbaron.def"
$onecho > xxxoptdirxxx/baron.opt
nlpsol 6
extnlpsolver conopt.2
$offecho
$call mkdir baronscratch > %system.nullfile% 2>&1
$call.checkErrorLevel gams fuel minlp=baron optfile=1 procdir=baronscratch optdir=xxxoptdirxxx lo=2 keep=1 > %system.nullfile% 2>&1
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" baronscratch/gmsjjlog.dat
$call grep -q "this is conopt.op2 in currentdir" baronscratch/gmsjjlog.dat
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in baronscratch/gmsjjlog.dat
$endIf.baron
$onecho > xxxoptdirxxx/dicopt.opt
mipsolver cplex xpress
mipoptfile cplex.opt xpress.op4
nlpsolver conopt snopt
nlpoptfile conopt.op2 snopt.op4
$offecho
$call.checkErrorLevel gams fuel minlp=dicopt optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is cplex.opt in xxxoptdirxxx" fuel.log
$call grep -q "this is cplex.opt in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is cplex.opt in currentdir" in fuel.log
*
$call.checkErrorLevel grep -q "this is xpress.op4 in xxxoptdirxxx" fuel.log
$call grep -q "this is xpress.op4 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is xpress.op4 in currentdir" in fuel.log
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" fuel.log
$call grep -q "this is conopt.op2 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in fuel.log
*
$call.checkErrorLevel grep -q "this is snopt.op4 in xxxoptdirxxx" fuel.log
$call grep -q "this is snopt.op4 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is snopt.op4 in currentdir" in fuel.log
$onecho > xxxoptdirxxx/examiner.opt
subSolver conopt
subSolverOpt 2
$offecho
$call.checkErrorLevel gams trnsport lp=examiner optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" trnsport.log
$call grep -q "this is conopt.op2 in currentdir" trnsport.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in trnsport.log
$onecho > xxxoptdirxxx/examiner2.opt
subSolver conopt
subSolverOpt 2
$offecho
$call.checkErrorLevel gams trnsport lp=examiner2 optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" trnsport.log
$call grep -q "this is conopt.op2 in currentdir" trnsport.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in trnsport.log
$onecho > xxxoptdirxxx/gamschk.opt
solvername conopt
optfile 2
solve
$offecho
$call.checkErrorLevel gams trnsport lp=gamschk optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" trnsport.log
$call grep -q "this is conopt.op2 in currentdir" trnsport.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in trnsport.log
$onecho > xxxoptdirxxx/jams.opt
subsolver path
subsolveropt 3
$offecho
$call.checkErrorLevel gams ferris43 emp=jams optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is path.op3 in xxxoptdirxxx" ferris43.log
$call grep -q "this is path.op3 in currentdir" ferris43.log
$if not errorlevel 1 $abort Found unexpected "this is path.op3 in currentdir" in ferris43.log
$onecho > xxxoptdirxxx/nlpec.opt
subsolver conopt
subsolveropt 2
$offecho
$call.checkErrorLevel gams nash mpec=nlpec mcp=path optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" nash.log
$call grep -q "this is conopt.op2 in currentdir" nash.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in nash.log
$onecho > xxxoptdirxxx/sbb.opt
rootsolver conopt.2
subsolver snopt.4
loglevel 2
$offecho
$call.checkErrorLevel gams fuel minlp=sbb optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" fuel.log
$call grep -q "this is conopt.op2 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in fuel.log
*
$call.checkErrorLevel grep -q "this is snopt.op4 in xxxoptdirxxx" fuel.log
$call grep -q "this is snopt.op4 in currentdir" fuel.log
$if not errorlevel 1 $abort Found unexpected "this is snopt.op4 in currentdir" in fuel.log
$onecho > xxxoptdirxxx/shot.opt
Primal.FixedInteger.Solver=1
Subsolver.GAMS.NLP.Solver=conopt
Subsolver.GAMS.NLP.OptionsFilename=conopt.op2
Output.Console.PrimalSolver.Show=1
$offecho
$call.checkErrorLevel gams pump minlp=shot optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is conopt.op2 in xxxoptdirxxx" pump.log
$call grep -q "this is conopt.op2 in currentdir" pump.log
$if not errorlevel 1 $abort Found unexpected "this is conopt.op2 in currentdir" in pump.log
$onecho > xxxoptdirxxx/de.opt
subsolver cplex
subsolveropt 1
evsubsolver cplex
evsubsolveropt 1
$offecho
$call.checkErrorLevel gams batchsp emp=de mip=cplex optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is cplex.opt in xxxoptdirxxx" batchsp.log
$call grep -q "this is cplex.opt in currentdir" batchsp.log
$if not errorlevel 1 $abort Found unexpected "this is cplex.opt in currentdir" in batchsp.log
$onecho > xxxoptdirxxx/de.opt
jamsopt jams.op5
subsolver xpress
subsolveropt 4
$offecho
$call.checkErrorLevel gams simplechance emp=de optfile=1 optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is jams.op5 in xxxoptdirxxx" simplechance.log
$call grep -q "this is jams.op5 in currentdir" simplechance.log
$if not errorlevel 1 $abort Found unexpected "this is jams.op5 in currentdir" in simplechance.log
*
$call.checkErrorLevel grep -q "this is xpress.op4 in xxxoptdirxxx" simplechance.log
$call grep -q "this is xpress.op4 in currentdir" simplechance.log
$if not errorlevel 1 $abort Found unexpected "this is xpress.op4 in currentdir" in simplechance.log
$onecho > xxxoptdirxxx/reshop.opt
subsolveropt 3
$offecho
$call.checkErrorLevel gams embrhp01 emp=reshop optfile=1 optdir=xxxoptdirxxx lo=3 > embrhp01.log
*
$call.checkErrorLevel grep -q "this is path.op3 in xxxoptdirxxx" embrhp01.log
$call grep -q "this is path.op3 in currentdir" embrhp01.log
$if not errorlevel 1 $abort Found unexpected "this is path.op3 in currentdir" in embrhp01.log
$call.checkErrorLevel gams gussex1mod lp=cplex optdir=xxxoptdirxxx lo=2
*
$call.checkErrorLevel grep -q "this is cplex.opt in xxxoptdirxxx" gussex1mod.log
$call grep -q "this is cplex.opt in currentdir" gussex1mod.log
$if not errorlevel 1 $abort Found unexpected "this is cplex.opt in currentdir" in gussex1mod.log
*
$call.checkErrorLevel grep -q "this is cplex.op2 in xxxoptdirxxx" gussex1mod.log
$call grep -q "this is cplex.op2 in currentdir" gussex1mod.log
$if not errorlevel 1 $abort Found unexpected "this is cplex.op2 in currentdir" in gussex1mod.log