I have following code that used to hardcode the param “pricecnt” as 20 and it worked well,
var R0 {i in 1..20} = value0[i]-value_z;
var R_1{i in 1..20} = (sum{j in insts} prices1[j,i]*pos[j])-value_z;
var avggain = sum{i in 1..20} R_1[i]*probs[i]-mids*2;
until I replaced the number into the param, when error occurs:
...
param pricecnt;
...
var R0 {i in 1..pricecnt} = value0[i]-value_z;
var R_1 {i in 1..pricecnt} = (sum{j in insts} prices1[j,i]*pos[j])-value_z;
var avggain = sum{i in 1..pricecnt} R_1[i]*probs[i]-mids*2;
the error message is:
> amplin, line 45 (offset 742):
pricecnt is not defined
context: var value0{i in >>> 1..pricecnt} <<< =sum{j in insts} prices0[j,i]*pos[j];
And I did see
param pricecnt := 20;
in the dat file.
What is the right way to define such range? Thanks!