Slow python API for large problems

510 views
Skip to first unread message

Sergey Gerasimov

unread,
Apr 22, 2021, 7:19:06 PM4/22/21
to or-tools-discuss
Hi folks,

I use ortools from python for large MIP task with millions of variables.
It is funny situation that problem definition (variables, constraints, objective) through ortools python API takes more time than problem solving :-)

Maybe you have some working solution for this?

I do not want to completely move from python to c++ in my task.
But consider approaches like:
 (1) cython
 (2) parallelize problem definition through joblib

1st option I like more.. Maybe you have some example of cython function which takes pandas dataframe as input defines and solves MIP task inside and returns solution also as some pandas data structure?

I deal with XPRESS and SCIP if it matters.

Any ideas, tricks code samples will be highly appreciated.

Mizux Seiha

unread,
Apr 23, 2021, 3:49:22 AM4/23/21
to or-tools-discuss
You should take a look at https://github.com/google/or-tools/issues/1020 and cython support by Meyer89

Sergey Gerasimov

unread,
Apr 23, 2021, 4:23:30 PM4/23/21
to or-tools-discuss
thx a lot!

This code really helped me to "cythonize" my problem definition.


пятница, 23 апреля 2021 г. в 10:49:22 UTC+3, mizu...@gmail.com:
Reply all
Reply to author
Forward
0 new messages