merr1.gms : Matrix Errors

Description

This model checks if Cmex creates an matrix error as expected. The errors we
want to get are:
- fixed variables have to have finite bounds
- illegal level value
- lower bound > upper bound
- bounds on discrete variables have to be integer
- binary variable need lower bound of zero or one
- binary variable needs upper bound of zero or one
- semicont/semiint require lower bound >= 0
- illegal value (PRIOR)

Contributor: Lutz Westermann


Small Model of Type : GAMS


Category : GAMS Test library


Main file : merr1.gms

$title Matrix Errors (merr1,SEQ=496)
$onText

This model checks if Cmex creates an matrix error as expected. The errors we
want to get are:
- fixed variables have to have finite bounds
- illegal level value
- lower bound > upper bound
- bounds on discrete variables have to be integer
- binary variable need lower bound of zero or one
- binary variable needs upper bound of zero or one
- semicont/semiint require lower bound >= 0
- illegal value (PRIOR)

Contributor: Lutz Westermann

$offText

$onEcho > err.gms
Variables x,z;
x.fx = +inf;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using lp;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of fixed variables without finite bounds

$onEcho > err.gms
Variables x,z;
x.l = +inf;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using lp;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of variable level with special value

$onEcho > err.gms
Variables x,z;
x.lo = 2;
x.up = 1;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using lp;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of lower bound > upper bound

$onEcho > err.gms
Variables x,z;
integer variable x;
x.lo = 1.1;
x.up = 2.2;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of non integer bounds on discrete variables

$onEcho > err.gms
Variables x,z;
binary variable x;
x.lo = -1;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of lower bound on binary variable <> 0/1

$onEcho > err.gms
Variables x,z;
binary variable x;
x.up = 2;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of upper bound on binary variable <> 0/1

$onEcho > err.gms
Variables x,y,z;
semiint variable x;
semicont variable y;
x.lo = -2;
y.lo = -1;
Equations obj;
obj.. z =e= x + y;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of negative lower bound on semiint/semicont variable

$onEcho > err.gms
Variables x,z;
integer variable x;
x.prior = -inf;
Equations obj;
obj.. z =e= x;

model m  /all/;
m.prioropt = 1;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of special value for priority

* The following tests make sure, that tests are also performed as expected for fixed variables
$onEcho > err.gms
Variables x,z;
integer variable x;
x.fx = 1.1;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of discrete variables fixed at non integer value

$onEcho > err.gms
Variables x,z;
binary variable x;
x.lo = 1;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using mip;

x.fx=0;
solve m min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if errorlevel 1 $abort Fixing a binary variable should be fine

$onEcho > err.gms
Variables x,z;
binary variable x;
x.fx = 2;
Equations obj;
obj.. z =e= x;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of binary variable fixed <> 0/1

$onEcho > err.gms
Variables x,y,z;
semiint variable x;
semicont variable y;
x.fx = -2;
y.fx = -1;
Equations obj;
obj.. z =e= x + y;

model m  /all/;
solve m  min z using mip;
$offEcho

$call =gams err.gms lo=%GAMS.lo%
$if not errorlevel 1 $abort should get error because of semiint/semicont variable fixed at negative value