Define a variable and parameters over dynamic sets Topic is solved

Problems with syntax of GAMS
Post Reply
Parisa
User
User
Posts: 14
Joined: 5 years ago

Define a variable and parameters over dynamic sets

Post by Parisa »

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: 1033
Joined: 7 years ago

Re: Define a variable and parameters over dynamic sets

Post by bussieck »

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: 14
Joined: 5 years ago

Re: Define a variable and parameters over dynamic sets

Post by Parisa »

Thanks a lot.
Post Reply