pumpkin_solver/propagators/cumulative/
options.rsuse std::fmt::Display;
use super::CumulativeExplanationType;
#[derive(Debug, Default, Clone, Copy)]
pub(crate) struct CumulativePropagatorOptions {
pub(crate) allow_holes_in_domain: bool,
pub(crate) explanation_type: CumulativeExplanationType,
pub(crate) generate_sequence: bool,
}
#[derive(Debug, Copy, Clone, Default)]
pub struct CumulativeOptions {
pub(crate) propagation_method: CumulativePropagationMethod,
pub(crate) propagator_options: CumulativePropagatorOptions,
}
impl CumulativeOptions {
pub fn new(
allow_holes_in_domain: bool,
explanation_type: CumulativeExplanationType,
generate_sequence: bool,
propagation_method: CumulativePropagationMethod,
) -> Self {
Self {
propagation_method,
propagator_options: CumulativePropagatorOptions {
allow_holes_in_domain,
explanation_type,
generate_sequence,
},
}
}
}
#[derive(Debug, Default, Clone, Copy)]
pub enum CumulativePropagationMethod {
TimeTablePerPoint,
TimeTablePerPointIncremental,
TimeTableOverInterval,
#[default]
TimeTableOverIntervalIncremental,
}
impl Display for CumulativePropagationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
CumulativePropagationMethod::TimeTablePerPoint => write!(f, "time-table-per-point"),
CumulativePropagationMethod::TimeTablePerPointIncremental => {
write!(f, "time-table-per-point-incremental")
}
CumulativePropagationMethod::TimeTableOverInterval => {
write!(f, "time-table-over-interval")
}
CumulativePropagationMethod::TimeTableOverIntervalIncremental => {
write!(f, "time-table-over-interval-incremental")
}
}
}
}