Skip to content

Saving compiled DPP problem for reuse. #1333

@kmonson

Description

@kmonson

Is your feature request related to a problem? Please describe.
Based on issue #1332 it would be useful to save already compiled DPP problems to reload later. The idea is to make it possible to perform a long compilation of a problem ahead of time to shorten future load times by a large margin. If possible this should be generic with respect to the solver while still overcoming the majority of the compile time.

Describe the solution you'd like
A dump, dumps, (implies compilation if it hasn't happened already) load, and loads methods on the cvxpy.Problem class.

A compile method on the cvxpy.Problem object to force compilation without solving first.

dump(str | Path, *args from cvxpy.Problem.solve as needed) - dumps compiled problem to str | Path
dumps(str | Path, *args from cvxpy.Problem.solve as needed) - returns str rep of compiled problem.

load and loads - inverse of dump, dumps

compile(*args from cvxpy.Problem.solve as needed) - forces compile of the problem without solving.

Additional context
Dumped problems would retain info on which solver they are for if needed, gp, gpc, and any other settings that would need to be baked into the compiled result.

Not sure what the best approach is for loading a problem for a specific solver and then calling solve with a different solver specified. What is done with DPP problems when solve it called twice with different parameters? Raise an exception?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions