Real-Time Planning
Handle changes while the solver is running.
Real-world planning problems often require more than basic optimization. This section covers patterns for common scenarios.
Handle dynamic changes during solving:
from solverforge_legacy.solver import ProblemChange
class AddLessonChange(ProblemChange[Timetable]):
def __init__(self, lesson: Lesson):
self.lesson = lesson
def do_change(self, working_solution: Timetable, score_director):
# Add the new lesson to the working solution
working_solution.lessons.append(self.lesson)
score_director.after_entity_added(self.lesson)
# Apply change while solver is running
solver.add_problem_change(AddLessonChange(new_lesson))
For problems that span long time periods, use a rolling horizon:
| Scenario | Pattern |
|---|---|
| New orders arrive during planning | Real-Time Planning |
| Plan extends into the future | Continuous Planning |
| Daily/weekly batch optimization | Repeated Planning |
| Vehicle breakdowns, cancellations | Real-Time Planning |
| Rolling weekly schedules | Continuous Planning |
Handle changes while the solver is running.
Rolling horizon and replanning strategies.
Batch optimization and periodic replanning.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.