diff --git a/src/correctness.rs b/src/correctness.rs index 4db9925..9f46831 100644 --- a/src/correctness.rs +++ b/src/correctness.rs @@ -20,6 +20,8 @@ const TEST_ITERATIONS: usize = 1000; #[test] fn run_tests() { + // Seed fastrand + fastrand::seed(0); let setups: Vec> = vec![ Box::new(Subproblem6Setup::new()), Box::new(Subproblem5Setup::new()), diff --git a/src/inverse_kinematics/auxiliary.rs b/src/inverse_kinematics/auxiliary.rs index 5382a40..ad4a86b 100644 --- a/src/inverse_kinematics/auxiliary.rs +++ b/src/inverse_kinematics/auxiliary.rs @@ -152,7 +152,9 @@ pub fn search_1d Vector > ( if j == max_evals.len() - 1 { let best_result = last_results.iter() .min_by(|x, y| x.2.partial_cmp(&y.2).unwrap()).unwrap(); - results.push((best_result.0, best_result.1)) + if best_result.2.is_finite() { + results.push((best_result.0, best_result.1)); + } } } results @@ -235,7 +237,9 @@ pub fn search_2d Vector>( if j == max_evals.len() - 1 { let best_result = last_results.iter() .min_by(|x, y| x.3.partial_cmp(&y.3).unwrap()).unwrap(); - results.push((best_result.0, best_result.1, best_result.2)) + if (best_result.3.is_finite()) { + results.push((best_result.0, best_result.1, best_result.2)); + } } }