I'm using Julia's JuMP solver to try to find an optimal path.
My problem is that the objective function is a sum of the elements of a matrix whose indices are variables from my optimization problem.
nb_dem, nb_prod, nb_mag, nb_noeuds, S, Q, R = read_data_24(inputfilepath, inputfilename)
@variable(model, produits[1:nb_mag,1:nb_prod,1:nb_dem] >= 0, Int)
@variable(model, chemins[1:nb_noeuds+1, 1:nb_mag], Int)
@variable(model, binaires[1:nb_mag,1:nb_dem], Bin)
# define objective function
@objective(model, Min, sum(sum(R[chemins[k,i],chemins[k+1,i]] for k in 1:nb_noeuds) for i in 1:nb_mag))
I've added some constraint but when I try to run, I get an error message telling me that I cannot use VariablesRef as indices.
ArgumentError: invalid index: chemins[1,1] of type VariableRef
Is there anyway of converting VariablesRef into useable index?