JuMP design question

Yes. Exactly this.

Don’t build subcomponents as JuMP models. Build them as function which add components to an existing JuMP model, and use either a naming convention, or an external data structure to manage the relevant variables and connections between components.

If you’re building an energy system model, take a look at the design of PowerSimulations.jl, and read through (and watch the videos) of Open Energy Modeling at JuMP-dev | JuMP

I’ll point you particularly to:

1 Like