I’m not sure if I had to make a new post or continue the old one, but as I have a new question I created a new topic.
I am solving an optimization problem with jump using the following table:
Row │ time room_1 room_2 room_3 w_day │ Float64 Float64 Float64 Float64 String ─────┼───────────────────────────────────────────── 1 │ 10.0 2.0 1.0 5.0 Monday 2 │ 11.0 3.0 1.0 6.0 Monday
I need to create a binary variable x[time,room,w_day], my problem is that for time 10 I can only have courses 2, 1 and 5. that would get me x[10,2,Monday], x[10,1,Monday] and x[10,5,Monday].
I am to make the variable like this:
@variable(model, x[10,[1,2,5],["Monday"]], Bin)
From the 2 lines table above I would have to iterate through time [10 , 11]
x[10,2,Monday], x[10,1,Monday] and x[10,5,Monday]
x[11,3,Monday], x[11,1,Monday] and x[11,6,Monday]
But as I loop I get the error of “same name variable” (I understand that it is to prevent errors ), is there a way to make all the variables under the same variable array?
I found the topic of Anonymous Variables, but I’m not sure how I can use it to make my variables.