I am translating an electricity production cost model from GAMS to JuMP and am struggling to get reasonable model generation times. Generally these models consist of running 365 single-day optimisations to run a full year.
One of the things I am trying to do to improve model generation times is to identify which constraints don’t change and which need to be regenerated in each loop. The idea is then to delete the changed constraints and re-generate them. However, deleting the constraints is taking much more time than regenerating the full model.
Most constraints are containerized and generated similarly to this:
@constraint(model, con[i = 1:2, j = 2:3], i * x <= j + 1)
To delete all of these, I have to do something lke this:
for c in con delete(model,c) end
Some constraints are dimensioned by time and transmission node (48 x 500) and so this is taking a very long time. Is there a way better way of doing what I’m trying to do?
edit: just to add, I know there is
set_coefficient and the hack with
.fix to change the RHS… but what’s the point of a high level modeling language if I need to aggregate up the coefficients and constants myself - I may as well generate the MPS file from scratch in that case…