timefold-solver
timefold-solver copied to clipboard
Feat: A notification should be trigger when calculation terminated if solver with daemon
sourced from #555
In one of my scenarios, real-time planning was used for task scheduling. I set the solver to Daemon to receive new tasks or delete tasks at any time. I set the termination so that when a solver reaches the stopping condition, the results will be output, for example, to a file or database. But when a solver is configured as a Daemon and starts planning through SolverManager.solveAndListen method. When a new bestSolution is found, the bestSolutionConsumer is called, and the finalBestSolutionConsumer has never been called. I had to serialize the results in the bestSolutionConsumer, but when the solver finds bestSolution frequently, serializing the results becomes a bottleneck. I also tried to start another thread to check the SolverStatus regularly, but unfortunately, when the solver is Daemon, SolverStatus is always SOLVING_ACTIVE, regardless of whether the calculation is running or not. So, I sincerely recommended that a solver with Daemon could trigger an event, when its calculation terminated, to notify t the front-end thread.
Suggestion: So, I sincerely recommended that a solver with Daemon could trigger an event, when its calculation terminated, to notify t the front-end thread.