Hi @Justine, welcome!
In general, I wouldn’t expect JuMP to have this performance difference compared to Pyomo.
I couldn’t run your code because you didn’t provide read_data
for the JuMP code.
Did you try this formulation for the constraint?
@constraint(
model,
[i in I],
sum(x[k] for k in x_list if k[1] == i) >= 0
)
You should also try timing how long it takes for the solver to start solving the problem, not just how long it takes to build without the solver. JuMP and Pyomo access solvers very differently, so it might be that Pyomo is quicker to build this part, but slower to get the actual problem to the solver.
but I will recommend a few general things to consider
@Christopher_Fisher provides good advice for general Julia programs, but they’re not relevant in this particular case. JuMP and Pyomo always use int64
, and neither build the problem with multithreading.