optapy / optapy

OptaPy is an AI constraint solver for Python to optimize planning and scheduling problems.

Home Page:https://www.optapy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numba for performance improvement

Stanpol opened this issue · comments

commented

OptaPy runs all user code in Java. One way to accelerate OptaPy is to translate Python bytecode to Java bytecode when the ConstraintProvider is created. As I understand, the work on this is in progress here.

What do you thing about using Numba to translate python code into machine code and use it from Java instead?

Numba is a solid project and the translation part is already done. I'm not an expert on JVM, so if you believe this path is unfeasible, please ignore my question.

Numba is an interesting project. The python-to-java-bytecode project is fairly complete (all current quickstarts can be translated and see large improvements in execution speed). It might still be a while until the first release of it (testing, documentation, etc.)

I would need to do an experiment with Numba; in particular, the main cost for optapy was FFI calls between Java and Python, and Numba would replace that with FFI calls between Java and C(?). Additionally, most of OptaPlanner (and thus OptaPy) constraints deal with domain objects, not arrays of data. Thirdly, OptaPy need to work with ANY domain, not just NumPy domains. However, I will not know if it an improvement or not until I measure it.