Skip to main content

solverforge_solver/
model_support.rs

1use solverforge_core::domain::{PlanningSolution, SolutionDescriptor};
2
3use crate::builder::{ListVariableSlot, ScalarGroupBinding, ScalarVariableSlot};
4
5pub trait PlanningModelSupport: PlanningSolution + Sized + 'static {
6    fn attach_descriptor_hooks(descriptor: &mut SolutionDescriptor);
7
8    fn attach_runtime_scalar_hooks(slot: ScalarVariableSlot<Self>) -> ScalarVariableSlot<Self>;
9
10    fn attach_runtime_list_hooks<DM, IDM>(
11        slot: ListVariableSlot<Self, usize, DM, IDM>,
12    ) -> ListVariableSlot<Self, usize, DM, IDM> {
13        slot
14    }
15
16    fn list_element_owner(
17        _entity_type_name: &'static str,
18        _variable_name: &'static str,
19        _solution: &Self,
20        _element: &usize,
21    ) -> Option<usize> {
22        None
23    }
24
25    fn attach_scalar_groups(
26        _scalar_variables: &[ScalarVariableSlot<Self>],
27    ) -> Vec<ScalarGroupBinding<Self>> {
28        Vec::new()
29    }
30
31    fn validate_model(descriptor: &SolutionDescriptor);
32
33    fn update_entity_shadows(
34        solution: &mut Self,
35        descriptor_index: usize,
36        entity_index: usize,
37    ) -> bool;
38
39    fn update_all_shadows(solution: &mut Self) -> bool;
40}