0

I am trying to solve a mathematical optimization model. I want to define a set in my model, say, i and I want it to be from 0 to 15. Is it possible? Or I have to define from 1 to 16? I am using the demo version of GAMS (General Algebraic Modeling System) available on the website.

Thanks

PS: Someone with enough reputation please create a GAMS tag!

Serj-Tm
  • 16,581
  • 4
  • 54
  • 61
Gobryas
  • 346
  • 2
  • 8

1 Answers1

1

You can define the set from 0 to 15 if you wish. For example,

set i 'plants' /i0*i9/
parameter a(i);
a(i)=uniformint(1,9);
display a;

Here are the results,

PARAMETER a  
i0 2.000,    i1 8.000,    i2 5.000,    i3 3.000,    i4 3.000,    i5 3.000
i6 4.000,    i7 8.000,    i8 1.000,    i9 5.000

Hope that helps. Sophia

Sophia Yao
  • 11
  • 1