emp34.gms : JAMS: test of flipping functions with VI

Description

Test to verify that the flip operator is working as expected when used
with the VI keyword and a VI function.  The expected behavior matches
what GAMS does for MCP when an equation is flipped in a model statement.

Contributor: Steve Dirkse, Dec 2023


Small Model of Type : GAMS


Category : GAMS Test library


Main file : emp34.gms

$TITLE 'JAMS: test of flipping functions with VI' (EMP34, SEQ=947)

$ontext
Test to verify that the flip operator is working as expected when used
with the VI keyword and a VI function.  The expected behavior matches
what GAMS does for MCP when an equation is flipped in a model statement.

Contributor: Steve Dirkse, Dec 2023
$offtext

scalar xL;
xL = exp(log(2.0) / 1.1);
variable x '1.5 <= x < INF' / LO 1.5 / ;
equations
      f    'x^1.1 >= 2'
      fNeg 'f times -1';

f..  x**1.1 =G= 2;
fNeg.. - x**1.1 =L= -2;

model m1 / f /;
model m2 / fNeg /;

file empinfo / '%emp.info%' /;

putclose empinfo 'vi f x';
solve m1 using emp;
abort$[m1.modelstat  > 2] 'bad model status', m1.modelstat;
abort$[abs(x.L - xL ) > 1e-6] 'expected x.L == xL', x.L, xL;
abort$[f.lo <> 2.0]           'expected f.lo == 2', f.lo;
abort$[abs(f.L - 2.0) > 1e-6] 'expected f.L == 2', f.L;
abort$[f.up <> inf]           'expected f.up == inf', f.up;
abort$[abs(f.m - x.L) > 1e-6] 'expected f.m == x.L', f.m, x.L;


putclose empinfo 'vi -fNeg x';
solve m2 using emp;
abort$[m2.modelstat  > 2] 'bad model status', m2.modelstat;
abort$[abs(x.L - xL ) > 1e-6] 'expected x.L == xL', x.L, xL;
abort$[fNeg.up <> -2.0]          'expected fNeg.up == -2', fNeg.up;
abort$[abs(fNeg.L + 2.0) > 1e-6] 'expected fNeg.L == -2', fNeg.L;
abort$[fNeg.lo <> -inf]          'expected fNeg.lo == -inf', fNeg.lo;
abort$[abs(fNeg.m - x.L) > 1e-6] 'expected fNeg.m == x.L', fNeg.m, x.L;