lindgl05.gms : Test new functions added to GAMS/Lindo(Global)

Description

With GAMS 33 we added support for the functions round, trunc, log2 and div to the
GAMS/Lindo(Global) link. This is a simple test to ensure, that these functions get
evaluated by Lindo in the way expected by GAMS.

Contributor: Lutz Westermann, August 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : lindgl05.gms

$title Test new functions added to GAMS/Lindo(Global) (lindgl05,SEQ=828)

$onText
With GAMS 33 we added support for the functions round, trunc, log2 and div to the
GAMS/Lindo(Global) link. This is a simple test to ensure, that these functions get
evaluated by Lindo in the way expected by GAMS.

Contributor: Lutz Westermann, August 2020
$offText


Variable z, x, y, w, v, u;
Equation a, b, c, d      ;
Set      runs / r1*r10 / ;

a.. z =e= round(v);
b.. y =e= trunc(v);
c.. x =e= log2 (v);
d.. w =e= div(v,u);

Model m /all/;

$macro check1(var, func) abort$(abs(var.l - func(v.l)     ) > 1e-6) 'func: Wrong var', var.l
$macro check2(var, func) abort$(abs(var.l - func(v.l, u.l)) > 1e-6) 'func: Wrong var', var.l

loop(runs,
  v.fx = uniform(  1, 10);
  u.fx = uniform(-10, 10);

  solve m min z use dnlp;

  check1(z, round);
  check1(y, trunc);
  check1(x, log2 );
  check2(w, div  );
);