Skip to main content

pounce_algorithm/conv_check/
opt_error.rs

1//! Optimal-error convergence check — port of
2//! `Algorithm/IpOptErrorConvCheck.{hpp,cpp}`.
3//!
4//! Tolerance state machine over `(nlp_err, iter_count)` plus
5//! per-component infeasibilities pulled directly from
6//! [`IpoptCalculatedQuantities`]. The scalar
7//! [`Self::check_convergence`] entry point only gates on
8//! `nlp_err <= tol` (matching upstream when the per-component
9//! tolerances are at their `+∞` sentinels); the state-aware
10//! [`Self::check_convergence_with_state`] adds the
11//! `dual_inf_tol` / `constr_viol_tol` / `compl_inf_tol` gates that
12//! mirror upstream `OptimalityErrorConvergenceCheck::CheckConvergence`.
13
14use crate::conv_check::r#trait::{ConvCheck, ConvergenceStatus};
15use crate::ipopt_cq::IpoptCqHandle;
16use crate::ipopt_data::IpoptDataHandle;
17use pounce_common::types::{Index, Number};
18
19pub struct OptErrorConvCheck {
20    pub tol: Number,
21    pub dual_inf_tol: Number,
22    pub constr_viol_tol: Number,
23    pub compl_inf_tol: Number,
24    pub acceptable_tol: Number,
25    pub acceptable_dual_inf_tol: Number,
26    pub acceptable_constr_viol_tol: Number,
27    pub acceptable_compl_inf_tol: Number,
28    pub acceptable_obj_change_tol: Number,
29    pub acceptable_iter: Index,
30    pub max_iter: Index,
31    pub max_cpu_time: Number,
32    pub max_wall_time: Number,
33    pub acceptable_count: Index,
34    /// Objective value at the last iterate the main loop stashed via
35    /// `set_curr_acceptable_obj`. Used by the
36    /// `acceptable_obj_change_tol` cross-check. `None` until an
37    /// acceptable point has been recorded.
38    pub last_acceptable_obj: Option<Number>,
39    /// Tolerance on the scaled infeasibility stationarity
40    /// `‖Jᵀc‖/max(1,‖c‖)`. An iterate counts toward the infeasibility
41    /// streak when this ratio is at or below this value while the
42    /// constraint violation stays bounded away from zero. Rapid
43    /// infeasibility detection is disabled when this is non-positive.
44    pub infeas_stationarity_tol: Number,
45    /// Multiple of `constr_viol_tol` the constraint violation must
46    /// exceed before an iterate can count as infeasible-stationary —
47    /// keeps detection from firing on nearly-feasible flat spots.
48    pub infeas_viol_kappa: Number,
49    /// Consecutive infeasible-stationary iterations required before
50    /// terminating with `LocallyInfeasible`. Non-positive disables
51    /// rapid infeasibility detection.
52    pub infeas_max_streak: Index,
53    /// Running count of consecutive infeasible-stationary iterations.
54    pub infeas_streak: Index,
55}
56
57impl Default for OptErrorConvCheck {
58    fn default() -> Self {
59        // Defaults from `IpOptErrorConvCheck.cpp:RegisterOptions`.
60        Self {
61            tol: 1e-8,
62            dual_inf_tol: 1.0,
63            constr_viol_tol: 1e-4,
64            compl_inf_tol: 1e-4,
65            acceptable_tol: 1e-6,
66            acceptable_dual_inf_tol: 1e10,
67            acceptable_constr_viol_tol: 1e-2,
68            acceptable_compl_inf_tol: 1e-2,
69            acceptable_obj_change_tol: 1e20,
70            acceptable_iter: 15,
71            max_iter: 3000,
72            max_cpu_time: 1e6,
73            max_wall_time: 1e6,
74            acceptable_count: 0,
75            last_acceptable_obj: None,
76            infeas_stationarity_tol: 1e-8,
77            infeas_viol_kappa: 1e2,
78            infeas_max_streak: 5,
79            infeas_streak: 0,
80        }
81    }
82}
83
84impl OptErrorConvCheck {
85    pub fn new() -> Self {
86        Self::default()
87    }
88
89    /// Pure helper for the per-component upstream gate. Returns `true`
90    /// iff every supplied residual sits at or below its tolerance.
91    /// Factored out so tests can exercise the gating logic without
92    /// constructing a full `IpoptCq`.
93    fn passes_component_tols(
94        &self,
95        overall: Number,
96        dual_inf: Number,
97        constr_viol: Number,
98        compl_inf: Number,
99    ) -> bool {
100        overall <= self.tol
101            && dual_inf <= self.dual_inf_tol
102            && constr_viol <= self.constr_viol_tol
103            && compl_inf <= self.compl_inf_tol
104    }
105
106    /// Pure helper mirroring upstream
107    /// `OptimalityErrorConvergenceCheck::CurrentIsAcceptable`. Tests
108    /// the per-component `acceptable_*_tol` triplet plus the optional
109    /// `acceptable_obj_change_tol` stability cross-check.
110    fn passes_acceptable_tols(
111        &self,
112        overall: Number,
113        dual_inf: Number,
114        constr_viol: Number,
115        compl_inf: Number,
116        curr_f: Number,
117    ) -> bool {
118        // A point is never acceptable if the scaled error metric or the
119        // objective itself is non-finite. Without the `curr_f` guard a NaN/Inf
120        // objective with otherwise-small infeasibility (e.g. CUTE `himmelbj`,
121        // where f evaluates to NaN at a near-feasible point) would be recorded
122        // as the acceptable rollback point and reported under
123        // `Solved_To_Acceptable_Level` with a `nan` objective.
124        if !overall.is_finite() || !curr_f.is_finite() {
125            return false;
126        }
127        let component_ok = overall <= self.acceptable_tol
128            && dual_inf <= self.acceptable_dual_inf_tol
129            && constr_viol <= self.acceptable_constr_viol_tol
130            && compl_inf <= self.acceptable_compl_inf_tol;
131        if !component_ok {
132            return false;
133        }
134        // Upstream `IpOptErrorConvCheck.cpp:CurrentIsAcceptable` — when
135        // an acceptable point has already been recorded and the user
136        // tightened `acceptable_obj_change_tol` below the 1e20
137        // sentinel, the iterate is only re-acceptable if `f` has moved
138        // by less than `tol * max(1, |f|)` relative to the recorded
139        // value. Skipped when no prior point exists or the cross-check
140        // is disabled.
141        if self.acceptable_obj_change_tol < 1e20 {
142            if let Some(prev) = self.last_acceptable_obj {
143                let denom = curr_f.abs().max(1.0);
144                if (prev - curr_f).abs() >= self.acceptable_obj_change_tol * denom {
145                    return false;
146                }
147            }
148        }
149        true
150    }
151
152    /// Pure predicate for a single infeasible-stationary iterate: the
153    /// constraint violation is bounded away from zero
154    /// (`constr_viol > infeas_viol_kappa · constr_viol_tol`) and the
155    /// scaled infeasibility gradient `‖Jᵀc‖/max(1,‖c‖)` is at or below
156    /// `infeas_stationarity_tol`. Returns `false` when rapid
157    /// infeasibility detection is disabled (either knob non-positive).
158    fn is_infeasible_stationary(&self, constr_viol: Number, stationarity: Number) -> bool {
159        if self.infeas_stationarity_tol <= 0.0 || self.infeas_max_streak <= 0 {
160            return false;
161        }
162        constr_viol > self.infeas_viol_kappa * self.constr_viol_tol
163            && stationarity <= self.infeas_stationarity_tol
164    }
165
166    /// Advance the rapid-infeasibility-detection streak by one
167    /// iteration. An infeasible-stationary iterate (see
168    /// [`Self::is_infeasible_stationary`]) increments the streak; any
169    /// other iterate resets it to zero. Returns `true` once the streak
170    /// reaches `infeas_max_streak`, signalling the caller to terminate
171    /// with `ConvergenceStatus::LocallyInfeasible`. The streak guards
172    /// against firing on a transient flat spot.
173    fn note_infeasible_stationary(&mut self, constr_viol: Number, stationarity: Number) -> bool {
174        if self.is_infeasible_stationary(constr_viol, stationarity) {
175            self.infeas_streak += 1;
176            self.infeas_streak >= self.infeas_max_streak
177        } else {
178            self.infeas_streak = 0;
179            false
180        }
181    }
182}
183
184impl ConvCheck for OptErrorConvCheck {
185    fn check_convergence(&mut self, nlp_err: Number, iter_count: Index) -> ConvergenceStatus {
186        if nlp_err <= self.tol {
187            return ConvergenceStatus::Converged;
188        }
189        // `acceptable_iter == 0` disables acceptable-level termination,
190        // mirroring upstream `IpOptErrorConvCheck.cpp:241`
191        // (`if( acceptable_iter_ > 0 && CurrentIsAcceptable() )`). Without
192        // the `> 0` guard, a zero would make `acceptable_count >= 0` fire on
193        // the first acceptable iterate — the opposite of "disabled".
194        if self.acceptable_iter > 0 && nlp_err <= self.acceptable_tol {
195            self.acceptable_count += 1;
196            if self.acceptable_count >= self.acceptable_iter {
197                return ConvergenceStatus::ConvergedToAcceptable;
198            }
199        } else {
200            self.acceptable_count = 0;
201        }
202        if iter_count >= self.max_iter {
203            return ConvergenceStatus::MaxIterExceeded;
204        }
205        ConvergenceStatus::Continue
206    }
207
208    fn check_convergence_with_state(
209        &mut self,
210        nlp_err: Number,
211        iter_count: Index,
212        data: &IpoptDataHandle,
213        cq: &IpoptCqHandle,
214    ) -> ConvergenceStatus {
215        // Mirror upstream `IpOptErrorConvCheck.cpp::CheckConvergence`:
216        // the scaled scalar `nlp_err` must drop below `tol` AND each
217        // per-component value must sit under its own tolerance. Known
218        // deviation (M1, documented in the code-review notes): upstream
219        // gates the components on the *unscaled* residuals; the CQ layer
220        // exposes no unscaled per-component accessors yet, so these are
221        // the internally *scaled* values. The unscaled expansion is
222        // deferred until the scaling objects are threaded through.
223        let cq_ref = cq.borrow();
224        let dual_inf = cq_ref.curr_dual_infeasibility_max();
225        let constr_viol = cq_ref.curr_primal_infeasibility_max();
226        let compl_inf = cq_ref.curr_complementarity_max();
227        let curr_f = cq_ref.curr_f();
228        drop(cq_ref);
229
230        if self.passes_component_tols(nlp_err, dual_inf, constr_viol, compl_inf) {
231            return ConvergenceStatus::Converged;
232        }
233        // `acceptable_iter == 0` disables acceptable-level termination
234        // (upstream `IpOptErrorConvCheck.cpp:241`). See `check_convergence`.
235        if self.acceptable_iter > 0
236            && self.passes_acceptable_tols(nlp_err, dual_inf, constr_viol, compl_inf, curr_f)
237        {
238            self.acceptable_count += 1;
239            if self.acceptable_count >= self.acceptable_iter {
240                return ConvergenceStatus::ConvergedToAcceptable;
241            }
242        } else {
243            self.acceptable_count = 0;
244        }
245        if iter_count >= self.max_iter {
246            return ConvergenceStatus::MaxIterExceeded;
247        }
248        // Rapid infeasibility detection — recognise an iterate
249        // converging to a stationary point of the constraint
250        // violation with the violation bounded away from zero, and
251        // exit with `LocallyInfeasible` instead of grinding to
252        // `max_iter` or thrashing restoration. Gated behind an
253        // `infeas_max_streak`-iteration streak to avoid firing on a
254        // transient flat spot. The outer guard skips the two
255        // transpose-products when detection is disabled.
256        if self.infeas_stationarity_tol > 0.0 && self.infeas_max_streak > 0 {
257            let stationarity = cq.borrow().curr_infeasibility_stationarity();
258            if self.note_infeasible_stationary(constr_viol, stationarity) {
259                return ConvergenceStatus::LocallyInfeasible;
260            }
261        }
262        // Time-budget gates. Upstream
263        // `IpOptErrorConvCheck.cpp::CheckConvergence` reads the
264        // application-level start time; pounce piggybacks on
265        // `data.timing.overall_alg`, which `IpoptApplication` starts
266        // at the top of `optimize_constrained`. `live_*` returns the
267        // running elapsed without forcing a `start/end` cycle.
268        let timing = &data.borrow().timing;
269        if timing.overall_alg.live_cpu_time() >= self.max_cpu_time {
270            return ConvergenceStatus::CpuTimeExceeded;
271        }
272        if timing.overall_alg.live_wallclock_time() >= self.max_wall_time {
273            return ConvergenceStatus::WallTimeExceeded;
274        }
275        ConvergenceStatus::Continue
276    }
277
278    fn tol_or_default(&self) -> Number {
279        self.tol
280    }
281
282    fn set_tolerance(&mut self, name: &str, value: Number) -> bool {
283        match name {
284            "tol" => self.tol = value,
285            "dual_inf_tol" => self.dual_inf_tol = value,
286            "constr_viol_tol" => self.constr_viol_tol = value,
287            "compl_inf_tol" => self.compl_inf_tol = value,
288            "acceptable_tol" => self.acceptable_tol = value,
289            "acceptable_dual_inf_tol" => self.acceptable_dual_inf_tol = value,
290            "acceptable_constr_viol_tol" => self.acceptable_constr_viol_tol = value,
291            "acceptable_compl_inf_tol" => self.acceptable_compl_inf_tol = value,
292            "acceptable_obj_change_tol" => self.acceptable_obj_change_tol = value,
293            _ => return false,
294        }
295        true
296    }
297
298    fn current_is_acceptable(&self, nlp_err: Number) -> bool {
299        // Scalar fallback used when the caller has no `IpoptCq` handle
300        // (e.g. unit tests). The state-aware variant
301        // [`Self::current_is_acceptable_with_state`] mirrors upstream
302        // more faithfully by gating on the per-component
303        // `acceptable_*_tol` triplet plus the obj-change cross-check.
304        nlp_err.is_finite() && nlp_err <= self.acceptable_tol
305    }
306
307    fn current_is_acceptable_with_state(
308        &self,
309        nlp_err: Number,
310        _data: &IpoptDataHandle,
311        cq: &IpoptCqHandle,
312    ) -> bool {
313        let cq_ref = cq.borrow();
314        let dual_inf = cq_ref.curr_dual_infeasibility_max();
315        let constr_viol = cq_ref.curr_primal_infeasibility_max();
316        let compl_inf = cq_ref.curr_complementarity_max();
317        let curr_f = cq_ref.curr_f();
318        drop(cq_ref);
319        self.passes_acceptable_tols(nlp_err, dual_inf, constr_viol, compl_inf, curr_f)
320    }
321
322    fn set_curr_acceptable_obj(&mut self, obj: Number) {
323        self.last_acceptable_obj = Some(obj);
324    }
325}
326
327#[cfg(test)]
328mod tests {
329    use super::*;
330
331    #[test]
332    fn converges_at_tol() {
333        let mut c = OptErrorConvCheck::new();
334        assert_eq!(c.check_convergence(1e-9, 0), ConvergenceStatus::Converged);
335    }
336
337    #[test]
338    fn acceptable_iter_count_threshold() {
339        let mut c = OptErrorConvCheck {
340            acceptable_iter: 3,
341            ..Default::default()
342        };
343        // nlp_err between tol (1e-8) and acceptable (1e-6).
344        assert_eq!(c.check_convergence(1e-7, 0), ConvergenceStatus::Continue);
345        assert_eq!(c.check_convergence(1e-7, 1), ConvergenceStatus::Continue);
346        assert_eq!(
347            c.check_convergence(1e-7, 2),
348            ConvergenceStatus::ConvergedToAcceptable
349        );
350    }
351
352    #[test]
353    fn acceptable_iter_zero_disables_acceptable_termination() {
354        // Upstream `IpOptErrorConvCheck.cpp:241` gates the acceptable
355        // counter on `acceptable_iter_ > 0`, so a zero disables the
356        // acceptable-level exit entirely. Before the guard, `>= 0` made
357        // pounce fire on the FIRST acceptable iterate (the opposite).
358        let mut c = OptErrorConvCheck {
359            acceptable_iter: 0,
360            ..Default::default()
361        };
362        // Many iterates parked between tol (1e-8) and acceptable (1e-6)
363        // must never trigger ConvergedToAcceptable; the run continues
364        // until tol or max_iter.
365        for k in 0..50 {
366            assert_eq!(
367                c.check_convergence(1e-7, k),
368                ConvergenceStatus::Continue,
369                "acceptable_iter=0 must not stop at the acceptable level (iter {k})"
370            );
371        }
372        // tol is still honored regardless.
373        assert_eq!(c.check_convergence(1e-9, 51), ConvergenceStatus::Converged);
374    }
375
376    #[test]
377    fn streak_resets_when_above_acceptable() {
378        let mut c = OptErrorConvCheck {
379            acceptable_iter: 3,
380            ..Default::default()
381        };
382        assert_eq!(c.check_convergence(1e-7, 0), ConvergenceStatus::Continue);
383        // Above acceptable resets the counter.
384        assert_eq!(c.check_convergence(1e-3, 1), ConvergenceStatus::Continue);
385        assert_eq!(c.check_convergence(1e-7, 2), ConvergenceStatus::Continue);
386        assert_eq!(c.check_convergence(1e-7, 3), ConvergenceStatus::Continue);
387        assert_eq!(
388            c.check_convergence(1e-7, 4),
389            ConvergenceStatus::ConvergedToAcceptable
390        );
391    }
392
393    #[test]
394    fn passes_acceptable_tols_gates_on_per_component_triplet() {
395        let c = OptErrorConvCheck {
396            acceptable_tol: 1e-6,
397            acceptable_dual_inf_tol: 1e-3,
398            acceptable_constr_viol_tol: 1e-3,
399            acceptable_compl_inf_tol: 1e-3,
400            ..Default::default()
401        };
402        assert!(c.passes_acceptable_tols(1e-7, 1e-4, 1e-4, 1e-4, 0.0));
403        // dual_inf above its acceptable threshold blocks.
404        assert!(!c.passes_acceptable_tols(1e-7, 1.0, 1e-4, 1e-4, 0.0));
405        // overall above acceptable_tol blocks.
406        assert!(!c.passes_acceptable_tols(1e-5, 1e-4, 1e-4, 1e-4, 0.0));
407    }
408
409    #[test]
410    fn passes_acceptable_tols_honors_obj_change_tol() {
411        let mut c = OptErrorConvCheck {
412            acceptable_tol: 1e-6,
413            acceptable_dual_inf_tol: 1.0,
414            acceptable_constr_viol_tol: 1.0,
415            acceptable_compl_inf_tol: 1.0,
416            acceptable_obj_change_tol: 0.1,
417            ..Default::default()
418        };
419        // First call always acceptable (no prior obj).
420        assert!(c.passes_acceptable_tols(1e-7, 0.0, 0.0, 0.0, 10.0));
421        c.set_curr_acceptable_obj(10.0);
422        // Same f → change well under threshold → still acceptable.
423        assert!(c.passes_acceptable_tols(1e-7, 0.0, 0.0, 0.0, 10.0));
424        // f moved by 2.0 with threshold 0.1 * max(1, |11.0|) = 1.1 →
425        // absolute change 1.0 < 1.1: acceptable.
426        assert!(c.passes_acceptable_tols(1e-7, 0.0, 0.0, 0.0, 11.0));
427        // f moved by 5.0 — absolute change 5.0 > 1.5 = 0.1 * 15 →
428        // rejected (the stability cross-check fires).
429        assert!(!c.passes_acceptable_tols(1e-7, 0.0, 0.0, 0.0, 15.0));
430    }
431
432    use crate::conv_check::r#trait::ConvCheck;
433
434    #[test]
435    fn set_curr_acceptable_obj_records_for_cross_check() {
436        let mut c = OptErrorConvCheck::new();
437        assert!(c.last_acceptable_obj.is_none());
438        ConvCheck::set_curr_acceptable_obj(&mut c, 4.2);
439        assert_eq!(c.last_acceptable_obj, Some(4.2));
440    }
441
442    #[test]
443    fn passes_component_tols_requires_all_under_threshold() {
444        let c = OptErrorConvCheck {
445            tol: 1e-8,
446            dual_inf_tol: 1.0,
447            constr_viol_tol: 1e-4,
448            compl_inf_tol: 1e-4,
449            ..Default::default()
450        };
451        // All under threshold → converged.
452        assert!(c.passes_component_tols(1e-9, 0.5, 1e-5, 1e-5));
453        // dual_inf above its tolerance blocks even when nlp_err is tiny.
454        assert!(!c.passes_component_tols(1e-12, 2.0, 1e-5, 1e-5));
455        // compl_inf above its tolerance blocks.
456        assert!(!c.passes_component_tols(1e-12, 0.0, 0.0, 1e-2));
457        // constr_viol above its tolerance blocks.
458        assert!(!c.passes_component_tols(1e-12, 0.0, 1e-2, 0.0));
459    }
460
461    #[test]
462    fn infeasible_stationary_requires_violation_and_flat_gradient() {
463        let c = OptErrorConvCheck {
464            constr_viol_tol: 1e-4,
465            infeas_viol_kappa: 1e2, // violation threshold = 1e-2
466            infeas_stationarity_tol: 1e-8,
467            infeas_max_streak: 5,
468            ..Default::default()
469        };
470        // Violation well above 1e-2 and the infeasibility gradient
471        // essentially zero → counts as infeasible-stationary.
472        assert!(c.is_infeasible_stationary(1e-1, 1e-9));
473        // Violation above threshold but the gradient is not flat →
474        // still making feasibility progress, does not count.
475        assert!(!c.is_infeasible_stationary(1e-1, 1e-3));
476        // Gradient flat but violation below threshold → nearly
477        // feasible, does not count.
478        assert!(!c.is_infeasible_stationary(1e-3, 1e-9));
479    }
480
481    #[test]
482    fn infeasible_stationary_disabled_by_nonpositive_knobs() {
483        let off_tol = OptErrorConvCheck {
484            infeas_stationarity_tol: 0.0,
485            infeas_max_streak: 5,
486            ..Default::default()
487        };
488        assert!(!off_tol.is_infeasible_stationary(1e9, 0.0));
489        let off_streak = OptErrorConvCheck {
490            infeas_stationarity_tol: 1e-8,
491            infeas_max_streak: 0,
492            ..Default::default()
493        };
494        assert!(!off_streak.is_infeasible_stationary(1e9, 0.0));
495    }
496
497    #[test]
498    fn infeasible_stationary_streak_fires_only_after_max_streak() {
499        let mut c = OptErrorConvCheck {
500            constr_viol_tol: 1e-4,
501            infeas_viol_kappa: 1e2, // violation threshold = 1e-2
502            infeas_stationarity_tol: 1e-8,
503            infeas_max_streak: 3,
504            ..Default::default()
505        };
506        // Infeasible-stationary iterate: violation 1e-1 > 1e-2, flat
507        // gradient. Streak accrues but does not fire until the third.
508        assert!(!c.note_infeasible_stationary(1e-1, 1e-9));
509        assert!(!c.note_infeasible_stationary(1e-1, 1e-9));
510        assert!(c.note_infeasible_stationary(1e-1, 1e-9));
511    }
512
513    #[test]
514    fn infeasible_stationary_streak_resets_on_feasibility_progress() {
515        let mut c = OptErrorConvCheck {
516            constr_viol_tol: 1e-4,
517            infeas_viol_kappa: 1e2,
518            infeas_stationarity_tol: 1e-8,
519            infeas_max_streak: 3,
520            ..Default::default()
521        };
522        assert!(!c.note_infeasible_stationary(1e-1, 1e-9));
523        assert!(!c.note_infeasible_stationary(1e-1, 1e-9));
524        // A non-stationary iterate (gradient not flat) resets the streak.
525        assert!(!c.note_infeasible_stationary(1e-1, 1e-3));
526        assert_eq!(c.infeas_streak, 0);
527        // The streak must rebuild from scratch — no carry-over credit.
528        assert!(!c.note_infeasible_stationary(1e-1, 1e-9));
529        assert!(!c.note_infeasible_stationary(1e-1, 1e-9));
530        assert!(c.note_infeasible_stationary(1e-1, 1e-9));
531    }
532
533    #[test]
534    fn infeasible_stationary_streak_never_fires_when_disabled() {
535        let mut c = OptErrorConvCheck {
536            infeas_stationarity_tol: 0.0,
537            infeas_max_streak: 5,
538            ..Default::default()
539        };
540        for _ in 0..20 {
541            assert!(!c.note_infeasible_stationary(1e9, 0.0));
542        }
543        assert_eq!(c.infeas_streak, 0);
544    }
545
546    #[test]
547    fn max_iter_exceeded() {
548        let mut c = OptErrorConvCheck {
549            max_iter: 5,
550            ..Default::default()
551        };
552        assert_eq!(
553            c.check_convergence(1.0, 5),
554            ConvergenceStatus::MaxIterExceeded
555        );
556    }
557}