Description
Here we test that prescan routine is "smart enough" to realize that [parameter] > [positive constant] can be executed sparse without further input from the user. Contributor: Lutz Westermann, July 2025
Small Model of Type : GAMS
Category : GAMS Test library
Main file : assign3.gms
$title Test assignment with relop operator (ASSIGN3,SEQ=987)
$onText
Here we test that prescan routine is "smart enough" to realize that
[parameter] > [positive constant]
can be executed sparse without further input from the user.
Contributor: Lutz Westermann, July 2025
$offText
Set i /i1*i400/;
Alias (i,j,k);
Parameter p(i,j,k);
p(i,j,k)$(uniform(0,1)<0.01) = 1;
Set s1(i,j,k),
s2(i,j,k),
s3(i,j,k);
Scalar T0, T1, T2, T3;
T0 = TimeExec;
s1(i,j,k) = (p(i,j,k)>0) and (p(i,j,k)>1e-6);
T1 = TimeExec - T0;
T0 = TimeExec;
s2(i,j,k) = (p(i,j,k)>1e-6);
T2 = TimeExec - T0;
T0 = TimeExec;
s3(i,j,k) = (1e-6<p(i,j,k));
T3 = TimeExec - T0;
Set err2(i,j,k), err3(i,j,k);
err2(i,j,k) = s1(i,j,k) xor s2(i,j,k);
err3(i,j,k) = s1(i,j,k) xor s3(i,j,k);
abort$card(err2) 'S1 and S2 are not the same', err2;
abort$card(err3) 'S1 and S3 are not the same', err3;
abort$(T2>3*T1) 'S2 assignment too slow', T1, T2;
abort$(T3>3*T1) 'S3 assignment too slow', T1, T3;