pumpkin_core/propagators/cumulative/
options.rs

1use super::CumulativeExplanationType;
2
3#[derive(Debug, Default, Clone, Copy)]
4pub(crate) struct CumulativePropagatorOptions {
5    /// Specifies whether it is allowed to create holes in the domain; if this parameter is set to
6    /// false then it will only adjust the bounds when appropriate rather than removing values from
7    /// the domain
8    pub(crate) allow_holes_in_domain: bool,
9    /// The type of explanation which is used by the cumulative to explain propagations and
10    /// conflicts.
11    pub(crate) explanation_type: CumulativeExplanationType,
12    /// Determines whether a sequence of profiles is generated when explaining a propagation.
13    pub(crate) generate_sequence: bool,
14    /// Determines whether to incrementally backtrack or to calculate from scratch
15    pub(crate) incremental_backtracking: bool,
16}
17
18#[derive(Debug, Copy, Clone, Default)]
19pub struct CumulativeOptions {
20    /// The propagation method which is used for the cumulative constraints; currently all of them
21    /// are variations of time-tabling. The default is incremental time-tabling reasoning over
22    /// intervals.
23    pub(crate) propagation_method: CumulativePropagationMethod,
24    /// The options which are passed to the propagator itself
25    pub(crate) propagator_options: CumulativePropagatorOptions,
26}
27
28impl CumulativeOptions {
29    pub fn new(
30        allow_holes_in_domain: bool,
31        explanation_type: CumulativeExplanationType,
32        generate_sequence: bool,
33        propagation_method: CumulativePropagationMethod,
34        incremental_backtracking: bool,
35    ) -> Self {
36        Self {
37            propagation_method,
38            propagator_options: CumulativePropagatorOptions {
39                allow_holes_in_domain,
40                explanation_type,
41                generate_sequence,
42                incremental_backtracking,
43            },
44        }
45    }
46}
47
48#[derive(Debug, Default, Clone, Copy)]
49#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
50pub enum CumulativePropagationMethod {
51    TimeTablePerPoint,
52    TimeTablePerPointIncremental,
53    TimeTablePerPointIncrementalSynchronised,
54    TimeTableOverInterval,
55    #[default]
56    TimeTableOverIntervalIncremental,
57    TimeTableOverIntervalIncrementalSynchronised,
58}