Define a variable and parameters over dynamic sets Topic is solved

Problems with syntax of GAMS
Post Reply
Parisa
User
User
Posts: 12
Joined: 1 year ago

Define a variable and parameters over dynamic sets

Post by Parisa » 2 weeks ago

Hello,
I need to define the parameter "f" and variable "x" over the dynamic set "j", and the parameter "d" over the dynamic set "a". For this, I do as follows;

Code: Select all

Sets
         k        /0*24/
         i(k)    /0*24/
         q       /1*300/
         s       /0*23/
         t       /1*24/;

Set
         j(q,s,t)
/
$ondelim
$include A-ODPairs.csv
$offdelim
/;

Set
         a(s,t)
/
$ondelim
$include A.csv
$offdelim
/;

Parameters
         f(q,s,t)
/
$ondelim
$include A-ODPairs.csv
$offdelim
/;

Parameters
         d(s,t)
/
$ondelim
$include A.csv
$offdelim
/;

Binary Variables
         z(q,s,t);
If I define them as "y(j)", "f(j)", and "d(a)", I will receive error. Why does this happen? Is there any other convenient way to code them?
Thank you.

User avatar
bussieck
Moderator
Moderator
Posts: 465
Joined: 3 years ago

Re: Define a variable and parameters over dynamic sets

Post by bussieck » 2 weeks ago

No, you need to declare the parameter f and variable x over the dynamic sets q,s,t and use/reference them only with elements from j. Same with d(s,t) and a. Domain sets are always one-dimensional.

-Michael

Parisa
User
User
Posts: 12
Joined: 1 year ago

Re: Define a variable and parameters over dynamic sets

Post by Parisa » 2 weeks ago

Thanks a lot.

Post Reply