convexengineering / gpkit

Geometric programming for engineers
http://gpkit.readthedocs.org
MIT License
206 stars 40 forks source link

add SolSavingEnvironment, halving pickle size #1503

Closed bqpd closed 4 years ago

bqpd commented 4 years ago

Per #1497

@pgkirsch this halves pickle size without removing any solution information. Between this and the compression I'd expect that 110MB file to drop to less than 10MB.

bqpd commented 4 years ago

test models please

pgkirsch commented 4 years ago

@bqpd just curious: what do the "construction/solve attributes" allow you to do with an already-computed solution? Re-solve without needing the original model object?

bqpd commented 4 years ago

The following constraint attributes are removed: ["mfm", "pmap", "bounded", "meq_bounded", "v_ss", "unsubbed", "varkeys"].

mfm: maps how monomials simplified during substitution so that sensitivities can be properly mapped back pmap: maps how the constant term (if any) was taken to the <= 1 side and divided out bounded: which variables were upper or lower bounded by this constraint at its creation meq_bounded: which variables were conditionally upper or lower bounded through a monomial equality v_ss: the individual variable sensitivities in each constraint unsubbed: presubstitution polynomial representations of the constraint varkeys: set of varkeys in the constraint

All of these except for v_ss are recreatable by initing a new constraint with the left, oper, and right of the saved version.

pgkirsch commented 4 years ago

Ah awesome, thanks for the detailed explanation!