Aydin
Aydin

Reputation: 187

Defining a dynamic set in GAMS, General Algebraic Modeling System

I want to define a dynamic set in GAMS, General Algebraic Modeling System. For example, consider the next line:

Set i "Customers" /1*100/;

Sometimes it will be /1x50/ and sometimes /1x100/. For this aim, I wrote something like /1*I/ where I will be a parameter that will be defined later, but it is not accepted. What can I do about it?

Upvotes: 2

Views: 255

Answers (1)

Lutz
Lutz

Reputation: 2292

You can do this:

Set i "All Customers" /1*100/
    iAct(i) "Active Customers";

iAct(i)$(ord(i)<=50) = yes;
Display iAct;

iAct(i)$(ord(i)<=75) = yes;
Display iAct;

Upvotes: 2

Related Questions