d-krupke/cpsat-primer

Write a section on CP-SAT with C++ (potentially mixed with Python using PyBind11)

Opened this issue · 3 comments

Sometimes, the performance of Python is simply too slow to build larger models. In this case, parts of the code can be written in C++ and integrated into Python using PyBind11. My desk neighbor Phillip Keldenich actually wrote a conan package for CP-SAT, which can be automatically build in Python using my skbuild-conan.

Could be nice to have a tutorial on how to do that.

Do you have any examples/links for this issue? I might be interested in this for scheduling with circuit constraints. The Python model takes too long to construct the quadratic number of arc literals so moving that part into C++ would be nice to have.

This here is the package I have mentioned: https://github.com/d-krupke/skbuild-conan

It contains some examples on how to do such things with CGAL. I am checking with Phillip if there is a public version of the conanfile. I could then try to give you a small example that you could continue. However, likely not to happen within the next few days but maybe in a week or two.

It turns out that automatically building ortools via conan could be painfully slow. Of course, conan does cache the builds but it is not a beginner friendly solution. Will have to think about it a little more... 🤔