Dear colleagues,
I am implementing a branch-and-check procedure in JuMP that requires to extract some variable values. For instance, I have to retrieve the values of decision variable X, that is defined as follows:
@variable(Master, 0 <= X[i in 1:m, j in 1:n+1, k in 1:n+1; j != k] <= 1)
After optimizing the Master model, this can be easily obtained:
XM = value.(Master[:X])
I pass XM as the argument of a function and i need to multiply its values by a certain amount :
function Master_Machine_Makespan(XM::JuMP.Containers.SparseAxisArray{Float64, 3, Tuple{Int64, Int64, Int64}},
YM::Matrix{Float64}, m::Int8, n::Int16, p::Matrix{Int16}, s::Vector{Matrix{Int16}})
#----- Calculate and return the makespan of each machine of the master problem
rlx_Cmax = zeros(Float64, m)
#----- Compute the sum of setup times of each machine
for i in eachindex(XM)
for j in eachindex(XM[i])
for k in eachindex(XM[i][j])
rlx_Cmax[i] += s[i][j, k] * XM[i][j][k]
end
end
end
return rlx_Cmax
end
If I use:
typeof(XM[i][j][k])
Julia returns me a variable of type Float64, however, I am getting the error message:
LoadError: ArgumentError: invalid index: (1, 1, 2) of type Tuple{Int64, Int64, Int64}
Anyone knows a way to fix this? I would really appreciate your help