julia-mpsge / MPSGE.jl

MPSGE for Julia
MIT License
14 stars 2 forks source link

Speed: Convert Implicit Variables/Constraints to @expressions #137

Closed EliLazarus closed 7 months ago

EliLazarus commented 11 months ago

We currently generate separate variables and constraint equations for the implicit Compensated Supply, Compensated Demand, and Final Demand. It's nice that they're all articulated and reported, but they are all passed to the Solver which assumedly makes it much slower. The alternative would be to turn them into something like JuMP @expression s, and then include them in the variable constraints instead of the implicit variables. My understanding is that that should be equivalent in the construction of the constriants, while generating a fraction of the # variables and constraints. Pluses: In theory much faster, assuming much fewer but long elaborate constraints are faster. Minuses: We would lose the nice simple printing of the variable expressions if they have everything in them; we would no longer automatically output all the elements, which can be quite useful.

mitchphillipson commented 9 months ago

I think this is the same as #136 .

This is possible and it's going to require a bit of a rethink on how these equations are generated. This is the idea we discussed earlier, having a tree structure that recursively builds an expression matrix. I believe all the compensated demand/supply information is encapsulated here.

I'm going to discuss this with Tom on Wednesday and form a concrete plan.

EliLazarus commented 7 months ago

145 merged