baron03.gms : BARON test suite - test all combinations of LP/NLP solvers

Description

Test of BARON.
This test uses the model nvs04 from minlplib, see http://www.minlplib.org/nvs04.html
We run the model with all combinations of LP and NLP solvers available in BARON.

Contributor: Michael Bussieck


Small Model of Type : GAMS


Category : GAMS Test library


Main file : baron03.gms

$title 'BARON test suite - test all combinations of LP/NLP solvers' (BARON03,SEQ=351)

$onText
Test of BARON.
This test uses the model nvs04 from minlplib, see http://www.minlplib.org/nvs04.html
We run the model with all combinations of LP and NLP solvers available in BARON.

Contributor: Michael Bussieck
$offText


$onEcho > test.gms
Variables  i1,i2,objvar;

Integer Variables  i1,i2;

Equations  e1;


e1.. -(100*sqr(0.5 - sqr(0.6 + i1) + i2) + sqr(0.4 - i1)) + objvar =E= 0;

* set non-default bounds
i1.up = 200;
i2.up = 200;

* set non-default levels
i1.l = 100;
i2.l = 100;

Model nvs04 / all /;

nvs04.limrow=0; nvs04.limcol=0;
nvs04.tolproj=0.0;

nvs04.optfile=1;
option solver=baron, optcr=0, optca=0, limrow=0, limcol=0, solprint=off;

Solve nvs04 using minlp minimizing objvar;

abort$(nvs04.modelstat <> %modelStat.optimal% and abs(objvar.l - nvs04.objest)>1e-5) 'wrong model status'
abort$(abs(objvar.l - 0.72)>1e-5) 'wrong objective';
$offEcho

set lpsol  / 3 ILOG CPLEX,
  7 XPRESS-MP,
  8 'CLP/CBC' /;
set nlpsol / 2 MINOS, 4 SNOPT, 6 'External NLP solver',
$if not %system.platform%==DAX 9 IPOPT,
  10 FILTERSD /;
file fopt / baron.opt /;
file fwanted / solwanted.txt /;
file fused   / solused.txt /;

loop((lpsol,nlpsol),
  putclose fopt 'lpsol ' lpsol.tl:0
              / 'nlpsol ' nlpsol.tl:0;
  putclose fwanted lpsol.te(lpsol)
                 / nlpsol.te(nlpsol);

  execute 'gams test.gms lo=2'
  if(errorlevel,
     execute 'cat baron.opt';
     abort 'failure for solver combination';
  );

  execute 'grep "^ For N*LP" test.log | tr -s " " | cut -d" " -f4- > solused.txt'
  execute '=diff -bw solwanted.txt solused.txt'
  abort$errorlevel 'solvers used not the chosen ones';
);

execute 'rm -f temp.gms temp.lst temp.log solwanted.txt solused.txt';