How to code a complex indexed variable in Gams?

Problems with modeling
Post Reply
bbeyza
User
User
Posts: 1
Joined: 3 years ago

How to code a complex indexed variable in Gams?

Post by bbeyza »

Hello all,

I have diffuculties to code the equation in the image attached, I will appreciate if someone can help me.:)

My sets are:

I set of nodes
K set of all transportation modes
T set of time units
Alias (i, j, h)
Alias (k, m)

Parameter

𝛕ijk travel time(hour) from node i to node j with mode k

y and Iy are decision variables.

image.png
image.png (4.08 KiB) Viewed 1382 times
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: How to code a complex indexed variable in Gams?

Post by abhosekar »

I don't understand which variable you are referring to but you can add multiple indices to a variable
In your case

Code: Select all

variable 
y(i, i, k, t)
Iy(i, k, t)
;
should work since you have defined alias.

While defining summation, you have to index equation with i and the summation operator with some alias. For example,

Code: Select all

constraint(i).. sum(h,...)
- Atharv
Post Reply