Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/argmin/src/core/state/iterstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ where
/// # assert_eq!(state.last_best_iter, 0);
/// # assert_eq!(state.max_iters, u64::MAX);
/// # assert_eq!(state.counts.len(), 0);
/// # assert_eq!(state.time.unwrap(), Duration::ZERO);
/// # assert!(state.time.is_none());
/// # assert_eq!(state.termination_status, TerminationStatus::NotTerminated);
/// ```
fn new() -> Self {
Expand Down Expand Up @@ -1057,7 +1057,7 @@ where
max_iters: u64::MAX,
counts: HashMap::new(),
counting_enabled: false,
time: Some(Duration::ZERO),
time: None,
termination_status: TerminationStatus::NotTerminated,
}
}
Expand Down Expand Up @@ -1330,7 +1330,7 @@ where
/// # use argmin::core::{IterState, State, ArgminFloat};
/// # let mut state: IterState<Vec<f64>, (), (), (), (), f64> = IterState::new();
/// let time = state.get_time();
/// # assert_eq!(time.unwrap(), Duration::ZERO);
/// # assert!(time.is_none());
/// ```
fn get_time(&self) -> Option<Duration> {
self.time
Expand Down
4 changes: 2 additions & 2 deletions media/book/src/running_solver.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ let termination_status = res.state().get_termination_status();
// Optionally, check why the optimizer terminated (if status is terminated)
let termination_reason = res.state().get_termination_reason();

// Time needed for optimization
let time_needed = res.state().get_time().unwrap();
// Time needed for optimization (only available if timer was enabled)
let time_needed = res.state().get_time();

// Total number of iterations needed
let num_iterations = res.state().get_iter();
Expand Down
Loading