lp02.gms : Simple level and sign test

Description

In this test series we test if a solver gets the levels
and marginals right.


Small Model of Type : LP


Category : GAMS Test library


Main file : lp02.gms

$title Simple level and sign test (LP02,SEQ=67)
$onText
In this test series we test if a solver gets the levels
and marginals right.
$offText

$if not set MTYPE   $set MTYPE lp
$if not set MSMAX   $set MSMAX 1
$if not set TESTTOL $set TESTTOL 1e-6
$if not set SLOWOK $set SLOWOK 0
scalar slowOK 'slow solves are OK: just abort.noError in this case' / %SLOWOK% /;

sets
     i   canning plants   / seattle, san-diego /
     j   markets          / new-york, chicago, topeka / ;

parameters

     a(i)  capacity of plant i in cases
       /    seattle     350
            san-diego   600  /

     b(j)  demand at market j in cases
       /    new-york    325
            chicago     300
            topeka      275  / ;

table d(i,j)  distance in thousands of miles
                  new-york       chicago      topeka
    seattle          2.1           1.7          0.8
    san-diego        2.5           1.8          1.4  ;

variables
     x(i,j)  shipment quantities in cases
     z       total transportation costs in thousands of dollars ;

positive variable x ;

equations
   cost        define objective function
   supplyg(i)  observe supply limit at plant i
   supplyl(i)  observe supply limit at plant i
   demandg(j)  satisfy demand at market j
   demandl(j)  satisfy demand at market j ;


scalars signz
        signx
        const;

cost ..   signz*z =e=  signx*sum((i,j), d(i,j)*x(i,j)) + const;

supplyl(i) ..    sum(j, x(i,j))  =l=    a(i) ;
supplyg(i) ..  - sum(j, x(i,j))  =g=  - a(i) ;

demandg(j) ..   sum(i, x(i,j))  =g=    b(j) ;
demandl(j) .. - sum(i, x(i,j))  =l=  - b(j) ;



scalars  COST_l  /    0.0 /
         cost_m  /    1.0 /
         z_l     / 1542.50 /
         z_m     /    0.0  /

parameters
   supply_l(i) / seattle  350, san-diego 550 /
   supply_m(i) / seattle -0.4, san-diego 0.0 /
   demand_l(j) / new-york 325, chicago  300, topeka 275 /
   demand_m(j) / new-york 2.5, chicago  1.8, topeka 1.2 /
   x_l(i,j)    / SEATTLE  .NEW-YORK   75.000
                 SEATTLE  .CHICAGO     0.0
                 SEATTLE  .TOPEKA    275.000
                 SAN-DIEGO.NEW-YORK  250.000
                 SAN-DIEGO.CHICAGO   300.000
                 SAN-DIEGO.TOPEKA      0.0     /
   x_m(i,j)    / SEATTLE  .NEW-YORK    0.0
                 SEATTLE  .CHICAGO     0.3
                 SEATTLE  .TOPEKA      0.0
                 SAN-DIEGO.NEW-YORK    0.0
                 SAN-DIEGO.CHICAGO     0.0
                 SAN-DIEGO.TOPEKA      0.2     /

models lp02gg / cost,supplyg ,demandg  /
       lp02gl / cost,supplyg ,demandl  /
       lp02lg / cost,supplyl ,demandg  /
       lp02ll / cost,supplyl ,demandl  /

option limcol=0,limrow=0;
* option solprint=off;

scalar tol / %TESTTOL% /;

signz = 1; signx = 1; const = 0; solve lp02gg min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gg.solvestat] 'Solve too slow';
abort$( lp02gg.solvestat <> %solveStat.normalCompletion% or lp02gg.modelstat > %MSMAX%)
   'wrong status codes', lp02gg.solvestat, lp02gg.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz = 1; signx = 1; const = 0; solve lp02gl min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gl.solvestat] 'Solve too slow';
abort$( lp02gl.solvestat <> %solveStat.normalCompletion% or lp02gl.modelstat > %MSMAX%)
   'wrong status codes', lp02gl.solvestat, lp02gl.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz = 1; signx = 1; const = 0; solve lp02lg min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02lg.solvestat] 'Solve too slow';
abort$( lp02lg.solvestat <> %solveStat.normalCompletion% or lp02lg.modelstat > %MSMAX%)
   'wrong status codes', lp02lg.solvestat, lp02lg.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz = 1; signx = 1; const = 0; solve lp02ll min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02ll.solvestat] 'Solve too slow';
abort$( lp02ll.solvestat <> %solveStat.normalCompletion% or lp02ll.modelstat > %MSMAX%)
   'wrong status codes', lp02ll.solvestat, lp02ll.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz =-1; signx = 1; const = 0; solve lp02gg max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gg.solvestat] 'Solve too slow';
abort$( lp02gg.solvestat <> %solveStat.normalCompletion% or lp02gg.modelstat > %MSMAX%)
   'wrong status codes', lp02gg.solvestat, lp02gg.modelstat;
abort$( abs(z.l-signz*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signz*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-signz*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-signz*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signz*cost_m) > tol)                   'bad cost.m';

signz =-1; signx = 1; const = 0; solve lp02gl max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gl.solvestat] 'Solve too slow';
abort$( lp02gl.solvestat <> %solveStat.normalCompletion% or lp02gl.modelstat > %MSMAX%)
   'wrong status codes', lp02gl.solvestat, lp02gl.modelstat;
abort$( abs(z.l-signz*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signz*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-signz*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-signz*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signz*cost_m) > tol)                   'bad cost.m';

signz =-1; signx = 1; const = 0; solve lp02lg max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02lg.solvestat] 'Solve too slow';
abort$( lp02lg.solvestat <> %solveStat.normalCompletion% or lp02lg.modelstat > %MSMAX%)
   'wrong status codes', lp02lg.solvestat, lp02lg.modelstat;
abort$( abs(z.l-signz*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signz*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-signz*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-signz*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signz*cost_m) > tol)                   'bad cost.m';

signz =-1; signx = 1; const = 0; solve lp02ll max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02ll.solvestat] 'Solve too slow';
abort$( lp02ll.solvestat <> %solveStat.normalCompletion% or lp02ll.modelstat > %MSMAX%)
   'wrong status codes', lp02ll.solvestat, lp02ll.modelstat;
abort$( abs(z.l-signz*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signz*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-signz*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-signz*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signz*cost_m) > tol)                   'bad cost.m';

signz = 1; signx =-1; const = 0; solve lp02gg max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gg.solvestat] 'Solve too slow';
abort$( lp02gg.solvestat <> %solveStat.normalCompletion% or lp02gg.modelstat > %MSMAX%)
   'wrong status codes', lp02gg.solvestat, lp02gg.modelstat;
abort$( abs(z.l-signx*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signx*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-signx*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-signx*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz = 1; signx =-1; const = 0; solve lp02gl max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gl.solvestat] 'Solve too slow';
abort$( lp02gl.solvestat <> %solveStat.normalCompletion% or lp02gl.modelstat > %MSMAX%)
   'wrong status codes', lp02gl.solvestat, lp02gl.modelstat;
abort$( abs(z.l-signx*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signx*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-signx*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-signx*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz = 1; signx =-1; const = 0; solve lp02lg max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02lg.solvestat] 'Solve too slow';
abort$( lp02lg.solvestat <> %solveStat.normalCompletion% or lp02lg.modelstat > %MSMAX%)
   'wrong status codes', lp02lg.solvestat, lp02lg.modelstat;
abort$( abs(z.l-signx*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signx*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-signx*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-signx*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz = 1; signx =-1; const = 0; solve lp02ll max z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02ll.solvestat] 'Solve too slow';
abort$( lp02ll.solvestat <> %solveStat.normalCompletion% or lp02ll.modelstat > %MSMAX%)
   'wrong status codes', lp02ll.solvestat, lp02ll.modelstat;
abort$( abs(z.l-signx*z_l) > tol )                        'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-signx*x_m(i,j))) > tol)  'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-signx*supply_m(i))) > tol) 'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-signx*demand_m(j))) > tol)  'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';

signz =-1; signx =-1; const = 0; solve lp02gg min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gg.solvestat] 'Solve too slow';
abort$( lp02gg.solvestat <> %solveStat.normalCompletion% or lp02gg.modelstat > %MSMAX%)
   'wrong status codes', lp02gg.solvestat, lp02gg.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signx*cost_m) > tol)                   'bad cost.m';

signz =-1; signx =-1; const = 0; solve lp02gl min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02gl.solvestat] 'Solve too slow';
abort$( lp02gl.solvestat <> %solveStat.normalCompletion% or lp02gl.modelstat > %MSMAX%)
   'wrong status codes', lp02gl.solvestat, lp02gl.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs(-supplyg.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs(-supplyg.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signx*cost_m) > tol)                   'bad cost.m';

signz =-1; signx =-1; const = 0; solve lp02lg min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02lg.solvestat] 'Solve too slow';
abort$( lp02lg.solvestat <> %solveStat.normalCompletion% or lp02lg.modelstat > %MSMAX%)
   'wrong status codes', lp02lg.solvestat, lp02lg.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signx*cost_m) > tol)                   'bad cost.m';

signz =-1; signx =-1; const = 0; solve lp02ll min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02ll.solvestat] 'Solve too slow';
abort$( lp02ll.solvestat <> %solveStat.normalCompletion% or lp02ll.modelstat > %MSMAX%)
   'wrong status codes', lp02ll.solvestat, lp02ll.modelstat;
abort$( abs(z.l-z_l) > tol )                              'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs(-demandl.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs(-demandl.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-cost_l) > tol)                         'bad cost.l';
abort$( abs(cost.m-signx*cost_m) > tol)                   'bad cost.m';

scalar otol 'fudge for case where obj const is added';
* scalar xtol 'fudge for case where obj const is added';

otol = tol * 1000;
tol = tol * 100;
signz = 1; signx = 1; const = 1234; solve lp02lg min z use %MTYPE% ;
abort.noError$[slowOK and %solveStat.resourceInterrupt% = lp02lg.solvestat] 'Solve too slow';
abort$( lp02lg.solvestat <> %solveStat.normalCompletion% or lp02lg.modelstat > %MSMAX%)
   'wrong status codes', lp02lg.solvestat, lp02lg.modelstat;
abort$( abs(z.l-(z_l+const)) > otol )                     'bad z.l';
abort$( abs(z.m-z_m) > tol )                              'bad z.m';
abort$( smax((i,j), abs(x.l(i,j)-x_l(i,j))) > tol)        'bad x.l';
abort$( smax((i,j), abs(x.m(i,j)-x_m(i,j))) > tol)        'bad x.m';
abort$( smax(i, abs( supplyl.l(i)-supply_l(i))) > tol)    'bad supply.l';
abort$( smax(i, abs( supplyl.m(i)-supply_m(i))) > tol)    'bad supply.m';
abort$( smax(j, abs( demandg.l(j)-demand_l(j))) > tol)    'bad demand.l';
abort$( smax(j, abs( demandg.m(j)-demand_m(j))) > tol)    'bad demand.m';
abort$( abs(cost.l-(cost_l+const)) > tol)                 'bad cost.l';
abort$( abs(cost.m-cost_m) > tol)                         'bad cost.m';