From a8e1517fd1ad2fa30b9fc68d3e7b58cf9b680e1f Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 22 Dec 2019 13:41:35 +0100 Subject: Remove ordering for SaveState --- src/solvers.rs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/solvers.rs') diff --git a/src/solvers.rs b/src/solvers.rs index a0845a1..e8cefb3 100644 --- a/src/solvers.rs +++ b/src/solvers.rs @@ -71,7 +71,7 @@ pub struct Solver { static mut COUNT: u32 = 0; /// Save the current state for each row -#[derive(Clone, Eq, Copy)] +#[derive(Clone, Copy)] pub struct SaveState { /// Mask of all currently used stones pub bitmask: T, @@ -81,22 +81,6 @@ pub struct SaveState { pub row: u32, } -impl std::cmp::Ord for SaveState { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.sum.cmp(&other.sum) - } -} -impl std::cmp::PartialOrd for SaveState { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.sum.cmp(&other.sum)) - } -} -impl std::cmp::PartialEq for SaveState { - fn eq(&self, other: &Self) -> bool { - self.sum.eq(&other.sum) - } -} - impl SaveState { pub fn new() -> Self { Self { @@ -141,6 +125,7 @@ impl Solver { let heap = permutohedron::Heap::new(&mut heap); let n_f = permutohedron::factorial(n as usize); let mut permutations = Vec::with_capacity(n_f); + println!("Generating permutations"); for data in heap { permutations.push(data.clone()); } @@ -157,7 +142,7 @@ impl Solver { //for (n, i) in self.permutations.iter().enumerate() { // println!("perm {}: {:?}", n, i); //} - self.check_perm(&[3, 16, 23]); + println!("calculate results"); self.permute( permutohedron::factorial(self.n as usize), 0, -- cgit v1.2.3-70-g09d2