Page 1 of 1

Define a variable and parameters over dynamic sets

Posted: Wed May 20, 2020 7:53 pm
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.

Re: Define a variable and parameters over dynamic sets

Posted: Thu May 21, 2020 7:25 am
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

Re: Define a variable and parameters over dynamic sets

Posted: Thu May 21, 2020 8:34 am
by Parisa
Thanks a lot.