passing C model to Python

34 views
Skip to first unread message

shao

unread,
Jul 18, 2017, 8:30:50 AM7/18/17
to Gurobi Optimization
I'm creating a model in C.
Is there a way to pass the model to python?

The use case is the following:
Due to some complex logic for a model, it's best for performance to construct the model in C.
Once the model is created, it would be best to play with it in Python.
'writing the model to disk' then 'reading the model from disk' is ok but wastefull.

Michael Winkler

unread,
Jul 19, 2017, 8:16:38 AM7/19/17
to Gurobi Optimization
Hi Shao,

Actually no, except for what you already had in mind, like writing an reading it back in. Can you give more details about what is taking too long when creating a model in python?

Best,
Michael

shao

unread,
Jul 21, 2017, 7:07:01 AM7/21/17
to Gurobi Optimization
Hi Michael,

The model definition (objective coef, constraint coef, ...) is provided by some legacy code.
Calling the legacy code from C run fast, but from python not so.
The performance culprit is in the legacy code api.

I could extract all the info from the legacy code and them go to python,
but it was less work to directly call gurobi than to do this aggregation work.
Reply all
Reply to author
Forward
0 new messages