You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a large MILP model in JuMP.jl, which was previously built by the Pyomo package in Python. However, I found that JuMP performs so slowly when building some expressions with complex indexes and conditions. An expression is shown below.
@expression(mod, Disp[z in ZONES, t in POINTS], sum(D1[(p, t)] + D2[(p, t)] for p in GENS[z] if (((p, t) in G_PS) & (is1[p] ==false))) -sum(D1[(p, t)] * enerload[p] for p in GENS[z] if (((p, t) in G_PS) & (is1[p] ==false))))
I'd like to know whether there are any performance suggestions on building the expressions and whether the model can be saved in a file so that I can re-run the model with revised inputs without spending too much time building the expressions.
The text was updated successfully, but these errors were encountered:
z_to_p_list =Dict([p for p in GENS[z] if!is1[p]] for z in ZONES)
@expression(
mod,
Disp[z in ZONES, t in POINTS],
sum(D1[(p, t)] + D2[(p, t)] - D1[(p, t)] * enerload[p] for p in z_to_p_list[z] if (p, t) in G_PS)
)
But it depends on what G_PS is.
Even something like
z_to_p_list =Dict([p for p in GENS[z] if!is1[p]] for z in ZONES)
t_to_p_set =Dict() # Could be Dict{typeof(t),Set{typeof(p)}} if types are knownfor (p, t) in G_PS
if!haskey(t_to_p_set, t)
t_to_p_set[t] =Set()
endpush!(t_to_p_set[t], p)
end@expression(
mod,
Disp[z in ZONES, t in POINTS],
sum(D1[(p, t)] + D2[(p, t)] - D1[(p, t)] * enerload[p] for p in z_to_p_list[z] if p in t_to_p_set[t])
)
I am building a large MILP model in JuMP.jl, which was previously built by the Pyomo package in Python. However, I found that JuMP performs so slowly when building some expressions with complex indexes and conditions. An expression is shown below.
I'd like to know whether there are any performance suggestions on building the expressions and whether the model can be saved in a file so that I can re-run the model with revised inputs without spending too much time building the expressions.
The text was updated successfully, but these errors were encountered: