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
``````
GAMS Development Corp.
GAMS Software GmbH

General Information and Sales
U.S. (+1) 202 342-0180
Europe: (+49) 221 949-9170