There are a couple of options. The simplest would be to pre-compute the set of indices that you are interested in:
using JuMP, DataFrames
S = Tuple{Int,Int,String}[]
for row in eachrows(df)
push!(S, (row.time, row.room_1, row.w_day))
push!(S, (row.time, row.room_2, row.w_day))
push!(S, (row.time, row.room_3, row.w_day))
end
model = Model()
@variable(model, x[S])
x[(10, 2, "Monday")]
Or you could do something like:
using JuMP, DataFrames
model = Model()
x = Dict(
(Int(r.time), r.w_day) => @variable(model, [Int[r.room_1, r.room_2, r.room_3]])
for r in eachrows(df)
)
x[(10, "Monday")][2]
It depends on what is in the rest of the data frame, and how you intend to use the variables.
A good part of JuMP is that it is flexible in how it lets you build data structures, but it’s also a bad part because there isn’t a single way to achieve things.