Expand description
ProblemChange API for real-time planning.
This module provides the ability to dynamically add, remove, or modify planning entities and problem facts during solving.
§Architecture
Problem changes are queued and applied between solver moves. When a problem change is applied:
- The solver clones the current best solution
- The problem change is applied via the ProblemChangeDirector
- Variable listeners are triggered
- The score is recalculated
- Solving resumes from the modified state
§Example
ⓘ
use solverforge_core::solver::change::{ProblemChange, ProblemChangeDirector};
struct AddEntityChange {
entity_id: String,
entity_data: serde_json::Value,
}
impl ProblemChange for AddEntityChange {
fn do_change(&self, solution: &mut serde_json::Value, director: &mut dyn ProblemChangeDirector) {
director.add_entity(&self.entity_id, self.entity_data.clone(), |entities| {
entities.as_array_mut().unwrap().push(self.entity_data.clone());
});
}
}Structs§
- Default
Problem Change Director - Default implementation of ProblemChangeDirector for local use.
Enums§
- Change
Record - Record of a change made through the director.
- Problem
Change Dto - Serializable DTO for transmitting problem changes to the solver service.
- Problem
Change Error - Error type for problem change operations.
Traits§
- Problem
Change - A problem change represents a modification to the planning solution during solving.
- Problem
Change Director - Director for applying problem changes to the working solution.
Type Aliases§
- Change
Consumer - Type alias for consumer functions used by ProblemChangeDirector.