convert14.gms : CONVERT test suite - nonlinear expression reformulations

Description

Tests some nonlinear expression reformulations that improve the formatted code.

Contributor: Renke Kuhlmann


Small Model of Type : GAMS


Category : GAMS Test library


Main file : convert14.gms

$title CONVERT test suite - nonlinear expression reformulations (CONVERT14,SEQ=843)

$ontext
Tests some nonlinear expression reformulations that improve the formatted code.

Contributor: Renke Kuhlmann
$offtext

$onecho > gamsin.gms
Variables
  x, y, z, w, obj;

Equations
  e01, e02, e03, e04, e05, e06, e07, e08, e09, e10, e11, e12, e13, e14, e15, e16,
  e17, e18;

* clean formulas
e01.. obj + x + x*y + x**z =e= 2;
e02.. (-x) / (-y) =g= 0;
e03.. (-x) * (-y) =g= 0;
e04.. x / (-y) =g= 0;
e05.. -exp(x) * (-exp(y)) =g= 0;
e06.. x*(3*y)*4 =g= 0;
e07.. x*(3/y)*4 =g= 0;
e08.. (3*x)*y*4 =g= 0;
e09.. (3*x)/y*4 =g= 0;
e10.. x/(3*y)*4 =g= 0;
e11.. x/(3/y)*4 =g= 0;
e12.. (3/x)/y*4 =g= 0;
e13.. (3/x)*y*4 =g= 0;

* parenthesis
e14.. exp(x) * (-exp(y)) =g= 0;
e15.. x*y + (-(x*z + y*z)) =g= 0;
e16.. x*y + (-(-x*z + y*z)) =g= 0;
e17.. 3*x**(-1) + 4*y**(-0) =g= 0;

* sums and subs
e18.. -x + y - z + w =g= 0;

x.l = 1;
y.l = 1;
z.l = 1;

Model m / all /;
Solve m using DNLP minimizing obj;
$offecho

$onecho > gamswant.gms
e1..  x1 * x2 + x1 + x1**x3 + x5 =E= 2;
e2..  x1 / x2 =G= 0;
e3..  x1 * x2 =G= 0;
e4..  -x1 / x2 =G= 0;
e5..  exp(x1) * exp(x2) =G= 0;
e6..  12 * x1 * x2 =G= 0;
e7..  12 * x1 / x2 =G= 0;
e8..  12 * x1 * x2 =G= 0;
e9..  12 * x1 / x2 =G= 0;
e10..  1.3333333333333333 * x1 / x2 =G= 0;
e11..  1.3333333333333333 * x1 * x2 =G= 0;
e12..  12 / (x2 * x1) =G= 0;
e13..  12 * x2 / x1 =G= 0;
e14..  -exp(x1) * exp(x2) =G= 0;
e15..  x1 * x2 - x1 * x3 - x2 * x3 =G= 0;
e16..  x1 * x2 + x1 * x3 - x2 * x3 =G= 0;
e17..  3 * x1**(-1) + 4 * x2**0 =G= 0;
e18..  -x1 + x2 - x3 + x4 =G= 0;
$offecho

$call gams gamsin.gms lo=%GAMS.lo% solver=convert
$call grep "e[0-9]*\.\." gams.gms > gamsgot.gms
$call.checkErrorLevel =diff -b gamsgot.gms gamswant.gms