Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

feat: Add support for problem changes #34

Merged
merged 3 commits into from
Apr 16, 2024
Merged

feat: Add support for problem changes #34

merged 3 commits into from
Apr 16, 2024

Conversation

Christopher-Chianelli
Copy link
Collaborator

@Christopher-Chianelli Christopher-Chianelli commented Apr 16, 2024

  • 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.

- Use implement a ProblemChange by extending an
  abstract base class (which, among other things,
  raises an error if not all of its methods are
  implemented).
@Christopher-Chianelli Christopher-Chianelli merged commit fb72d9c into TimefoldAI:main Apr 16, 2024
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants