Description
In the past, the card operator did return 0 for scalar symbols when there was no data statement for that symbol but just an assignment - either explicity or trough a solve. Contributor: Lutz Westermann, January 2020
Small Model of Type : GAMS
Category : GAMS Test library
Main file : card03.gms
$title Test card operator for scalar symbols (card03,SEQ=811)
$onText
In the past, the card operator did return 0 for scalar symbols when there was
no data statement for that symbol but just an assignment - either explicity or
trough a solve.
Contributor: Lutz Westermann, January 2020
$offText
$macro assertCard1(x) abort$(card(x)<>1) 'x should have card=1';
Scalar s1 / 1 /, s2; s2 = 1;
assertCard1(s1)
assertCard1(s2)
Variable v1 / up 4 /, v2, v3; v2.lo = 3;
assertCard1(v1)
assertCard1(v2)
Equation e1 / l 4 /, e2, e3; e2.m = 3;
assertCard1(e1)
assertCard1(e2)
e3.. v3 =e= 1;
model m /e3/;
solve m min v3 use lp;
assertCard1(v3)
assertCard1(e3)