I would like, if possible, to parameterize the following set of constraints.
I would like to replace the fixed values 4 in 4:ng; 3 in g-3:g; and 1 in
… <=1
with parameters external to the function that define the model, so that I can more easily change them as needed.
#distance between N and N or NF >=4
[r in 1:nr, g in 4:ng], sum(x[r,i,"N"]+x[r,i,"NF"] for i in g-3:g) <= 1
If I use the following expression, I get the following error
funcion ()
...
[r in 1:nr, g in Nel_Mese["min_ng_tra_notti"]:ng], sum(x[r,i,"N"]+x[r,i,"NF"] for i in g-Nel_Mese["min_ng_tra_notti"]+1:g) <= 1
...
end
...
Nel_Mese=Dict{String, Int}()
Nel_Mese["min_ng_tra_notti"]=4
....
julia> x,nr,ng,turni,ops,res=sol_jump(mese,y, path*exc_input)
ERROR: At c:\Users\sprmn\.julia\envs\v1_10\J_turni_SG_10.jl:192: `@constraint(model, [r in 1:nr, g in Nel_Mese["min_ng_tra_notti"]:ng], sum((x[r, i, "N"] + x[r, i, "NF"] for i = (g - Nel_Mese["min_ng_tra_notti"]) + 1:g)) <= 1)`: unexpected error parsing reference set: Nel_Mese["min_ng_tra_notti"]:ng
Stacktrace:
[1] error(::String, ::String, ::Expr)