solverforge_solver/phase/partitioned/
child_phases.rs1use solverforge_core::domain::PlanningSolution;
4use solverforge_scoring::Director;
5
6use crate::phase::Phase;
7use crate::scope::SolverScope;
8
9pub trait ChildPhases<S, D>
13where
14 S: PlanningSolution,
15 D: Director<S>,
16{
17 fn solve_all(&mut self, solver_scope: &mut SolverScope<S, D>);
19}
20
21macro_rules! impl_child_phases_tuple {
23 ($($idx:tt: $P:ident),+) => {
24 impl<S, D, $($P),+> ChildPhases<S, D> for ($($P,)+)
25 where
26 S: PlanningSolution,
27 D: Director<S>,
28 $($P: Phase<S, D>,)+
29 {
30 fn solve_all(&mut self, solver_scope: &mut SolverScope<S, D>) {
31 $(
32 self.$idx.solve(solver_scope);
33 )+
34 }
35 }
36 };
37}
38
39impl_child_phases_tuple!(0: P0);
40impl_child_phases_tuple!(0: P0, 1: P1);
41impl_child_phases_tuple!(0: P0, 1: P1, 2: P2);
42impl_child_phases_tuple!(0: P0, 1: P1, 2: P2, 3: P3);
43impl_child_phases_tuple!(0: P0, 1: P1, 2: P2, 3: P3, 4: P4);
44impl_child_phases_tuple!(0: P0, 1: P1, 2: P2, 3: P3, 4: P4, 5: P5);
45impl_child_phases_tuple!(0: P0, 1: P1, 2: P2, 3: P3, 4: P4, 5: P5, 6: P6);
46impl_child_phases_tuple!(0: P0, 1: P1, 2: P2, 3: P3, 4: P4, 5: P5, 6: P6, 7: P7);