Currently each quadratic/bilinear approximation probably loops several times over names and time_steps.
In this branch I started to refactor it so that an inner function builds the approximation for just one (name, t) pair, and then an outer function with a single loop over names and time_steps builds each approximation individually: https://github.com/NREL-Sienna/InfrastructureOptimizationModels.jl/tree/ac/no-approx-inner-loops
Alternatively, there may be performance benefits to working with vectors of variables / constraints / expressions in JuMP, in which case the above approach is undesirable, and instead the approximations should be rewritten to use vectors.
Currently each quadratic/bilinear approximation probably loops several times over names and time_steps.
In this branch I started to refactor it so that an inner function builds the approximation for just one (name, t) pair, and then an outer function with a single loop over names and time_steps builds each approximation individually: https://github.com/NREL-Sienna/InfrastructureOptimizationModels.jl/tree/ac/no-approx-inner-loops
Alternatively, there may be performance benefits to working with vectors of variables / constraints / expressions in JuMP, in which case the above approach is undesirable, and instead the approximations should be rewritten to use vectors.