From 1669e2b2549bf5d4c8ed0458f0f8429462f59060 Mon Sep 17 00:00:00 2001 From: "Jip J. Dekker" Date: Tue, 29 Oct 2024 12:56:18 +1100 Subject: [PATCH] Increase size of activation list to hold 2^32 propagators Resolves #130 --- crates/huub/src/solver/engine/activation_list.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/huub/src/solver/engine/activation_list.rs b/crates/huub/src/solver/engine/activation_list.rs index f34bd63f..78fe770e 100644 --- a/crates/huub/src/solver/engine/activation_list.rs +++ b/crates/huub/src/solver/engine/activation_list.rs @@ -17,10 +17,10 @@ use crate::solver::engine::PropRef; /// of the Bound condition to the end of the list. pub(crate) struct ActivationList { activations: Vec, - lower_bound_idx: u16, - upper_bound_idx: u16, - bounds_idx: u16, - domain_idx: u16, + lower_bound_idx: u32, + upper_bound_idx: u32, + bounds_idx: u32, + domain_idx: u32, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] @@ -65,9 +65,8 @@ impl ActivationList { /// Add a propagator to the list of propagators to be enqueued based on the /// given condition. pub(crate) fn add(&mut self, mut prop: PropRef, condition: IntPropCond) { - assert!(self.activations.len() < u16::MAX as usize, "Unable to add more than u16::MAX propagators to the activation list of a single variable."); - // TODO: Optimize insertion using swapping - let mut cond_swap = |idx: u16| { + assert!(self.activations.len() < u32::MAX as usize, "Unable to add more than u32::MAX propagators to the activation list of a single variable."); + let mut cond_swap = |idx: u32| { let idx = idx as usize; if idx < self.activations.len() { mem::swap(&mut prop, &mut self.activations[idx]);