Search code examples
optaplanner

How to model an operator-based planning problem with OptaPlanner


I'm new to OptaPlanner and I'm trying to model an operator-based planning problem. As shown in the figure below, I have an initial state of a problem and a goal state, as well as a repository of operators. The application of an operator transforms the properties of the problem state, such that the similarity of the state towards the goal state is increased. Operators can only be applied under certain conditions, so not all operators are applicable to every intermediate problem state. To find a solution, I need OptaPlanner to construct an optimal chain of applicable operators, such that the best possible transformation of the initial state towards the goal state is achieved. However, it is not known in advance how many of the operators in the repository will be applicable during the planning process as every operator alters the state and, thus, also has an impact on the subset of applicable operators. Further, it is also not known if the goal state can be reached completely, or whether there are no applicable operators left that would lead to an increase of similarity.

enter image description here

I tried to work myself through the provided use cases in the documentation, but it seems to me that the most prevalent examples of task or shift assignment do not fit my situation and I have a hard time modeling this planning problem. I would be very grateful for any hints how I could approach this or references to related projects that pursue a similar idea.


Solution

  • Probably VRP problem can be used as a basis. You initial problem state will be PlanningEntity with PlanningListVariable which contains operators applied.

    After that you can use either listener or constraint co calculate how close to your goal state will sequence of operators in the list will bring you. Not sure how do you calculate transformations. In case if algorithm is complex it will be easier IMHO to implement it as listener.