Timefold Solver is an AI constraint solver for Python to optimize the Vehicle Routing Problem, Employee Rostering, Maintenance Scheduling, Task Assignment, School Timetabling, Cloud Optimization, Conference Scheduling, Job Shop Scheduling, Bin Packing and many more planning problems.
Since the methods in ProblemChangeDirector take interfaces, ProblemChange as a whole cannot be translated to pure Java (since that requires supporting casting an arbitary callable to any Java interface, which is not suported yet (nor planned to be supported)).
Thus we goes for a more ugly approach: the ProblemChange runs in Python, and when a problem change director method is called, we compile/translate the supplied function to Java.
We do a trick where we replace the Python working solution clone with the actual Java working solution in the closure before compiling the function so changes are applied to the right object. After the method is called, we then update the Python working solution from the java working solution so changes are reflected in it too.
Users implement a ProblemChange by extending an abstract base class (which, among other things, raises an error if not all of its methods are implemented).
Since the methods in ProblemChangeDirector take interfaces, ProblemChange as a whole cannot be translated to pure Java (since that requires supporting casting an arbitary callable to any Java interface, which is not suported yet (nor planned to be supported)).
Thus we goes for a more ugly approach: the ProblemChange runs in Python, and when a problem change director method is called, we compile/translate the supplied function to Java.
We do a trick where we replace the Python working solution clone with the actual Java working solution in the closure before compiling the function so changes are applied to the right object. After the method is called, we then update the Python working solution from the java working solution so changes are reflected in it too.
Users implement a ProblemChange by extending an abstract base class (which, among other things, raises an error if not all of its methods are implemented).