I have converted some PuLP code to Julia and have three vectors of Tuples.
supplylist: 149988-element Vector{Tuple{String15, String31}}
flowslist: 499572-element Vector{Tuple{String15, String15, String31}}
edgelist: 41631-element Vector{Tuple{String15, String15}}
I used the following code to create variables:
@variable(model, x[(i,j,k) = flowslist] >= 0.0)
@variable(model, y[(i,j) = edgelist] >= 0.0)
@variable(model, z[(i,j) = supplylist] >=0.0)
This seemed to work but then when I tried to use:
set_name(x, “massflowtype”)
I got this error:
MethodError: no method matching name(::JuMP.Containers.DenseAxisArray{VariableRef, 1, Tuple{Vector{Tuple{String15, String15, String31}}}, Tuple{JuMP.Containers._AxisLookup{Dict{Tuple{String15, String15, String31}, Int64}}}})
Any insights as to what is happening here? The lists are designed to be looped through and matched so that x[i,j,k] can be multiplied and matched according to values. Here is a piece of the mass balance equation for the PuLP model:
for item in supplylist:
cn_coal_problem += (supplyitembynode[item]+
lpSum([massflowtype[(i,j,ct)] for (i,j,ct) in flowslist if (j,ct) == item]) >=
lpSum([massflowtype[(i,j,ct)] for (i,j,ct) in flowslist if (i,ct) == item]))