As I’m creating my model in JuMP, I’m creating many
AffExprs (~100k) but only a small fraction of them actually get used in constraints (I’m using interval arithmetic via ConditionalJuMP.jl to determine that the rest of the
AffExprs would not be relevant).
AffExprs possibly causing model creation to slow down, and if so, is there any way to indicate to JuMP that these
AffExprs are unused?
Of course creating them takes some time (which I recommend profiling). However, after they’re created they are never directly referenced when JuMP generates the data structures for the underlying solver. They will be garbage collected normally if there are no dangling references to them. If you can provide a standalone benchmark where JuMP model creation time is too slow we may be able to take a look.
The story for nonlinear expressions is different, but that’s not relevant to your question.