From 3fae941b892dc67b2e79b97b28ba84b9babeda6d Mon Sep 17 00:00:00 2001 From: Chad Baker Date: Thu, 12 Sep 2024 14:12:20 -0600 Subject: [PATCH 1/2] added some `log::debug` invocations --- rust/altrios-core/src/meet_pass/est_times/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/altrios-core/src/meet_pass/est_times/mod.rs b/rust/altrios-core/src/meet_pass/est_times/mod.rs index 741bb34a..1542d061 100644 --- a/rust/altrios-core/src/meet_pass/est_times/mod.rs +++ b/rust/altrios-core/src/meet_pass/est_times/mod.rs @@ -507,6 +507,8 @@ pub fn make_est_times>( #[cfg(feature = "logging")] log::debug!("{}", format_dbg!("Add origin estimated times.")); for orig in origs { + #[cfg(feature = "logging")] + log::debug!("{}", format_dbg!(orig)); ensure!( orig.offset == si::Length::ZERO, "Origin offset must be zero!" @@ -592,7 +594,11 @@ pub fn make_est_times>( // Iterate and process all saved sims #[cfg(feature = "logging")] log::debug!("{}", format_dbg!("Iterate and process all saved sims")); + #[cfg(feature = "logging")] + log::debug!("{}", format_dbg!(saved_sims.len())); while let Some(mut sim) = saved_sims.pop() { + #[cfg(feature = "logging")] + log::debug!("{}", format_dbg!(sim.est_alt.time_sched)); let mut has_split = false; ensure!( sim.train_sim.link_idx_last().unwrap().is_real(), From 5e43d9bca9b93294ef0d7914d7929e2884302ec8 Mon Sep 17 00:00:00 2001 From: Chad Baker Date: Mon, 16 Sep 2024 15:59:04 -0600 Subject: [PATCH 2/2] got rid of problematic while loop --- rust/altrios-core/src/meet_pass/est_times/mod.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rust/altrios-core/src/meet_pass/est_times/mod.rs b/rust/altrios-core/src/meet_pass/est_times/mod.rs index 1542d061..7a07ad4f 100644 --- a/rust/altrios-core/src/meet_pass/est_times/mod.rs +++ b/rust/altrios-core/src/meet_pass/est_times/mod.rs @@ -596,7 +596,7 @@ pub fn make_est_times>( log::debug!("{}", format_dbg!("Iterate and process all saved sims")); #[cfg(feature = "logging")] log::debug!("{}", format_dbg!(saved_sims.len())); - while let Some(mut sim) = saved_sims.pop() { + saved_sims.clone().iter_mut().try_for_each(|sim| { #[cfg(feature = "logging")] log::debug!("{}", format_dbg!(sim.est_alt.time_sched)); let mut has_split = false; @@ -632,7 +632,7 @@ pub fn make_est_times>( if perform_speed_join(&est_join_paths_save, &mut est_times, est_time_add) { est_join_paths_save.clear(); sim.join_paths.clear(); - break 'path; + break 'path Ok(()); } add_new_join_paths( @@ -656,11 +656,13 @@ pub fn make_est_times>( // If finished, add destination node to final processing (all links should be clear) if sim.train_sim.is_finished() { + #[cfg(feature = "logging")] + log::debug!("{}", format_dbg!(sim.train_sim.is_finished())); est_idxs_end.push((est_times.len() - 1).try_into().unwrap()); if consist_out.is_none() { - consist_out = Some(sim.train_sim.loco_con); + consist_out = Some(sim.train_sim.loco_con.clone()); } - break; + break Ok(()); } // Otherwise, append the next link options and continue simulating else { @@ -697,7 +699,7 @@ pub fn make_est_times>( sim.check_dests(dests); } } - } + })?; // Finish the estimated time network ensure!(est_times.len() < (EstIdx::MAX as usize) - est_idxs_end.len());