Skip to content

Commit 117fb75

Browse files
authored
Fix UnboundLocalError when stopping_criterion=None in convergence_plot (#659)
1 parent 54ca1bd commit 117fb75

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/optimagic/visualization/convergence_plot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def convergence_plot(
7272
runtime_measure: Literal[
7373
"n_evaluations", "walltime", "n_batches"
7474
] = "n_evaluations",
75-
stopping_criterion: Literal["x", "y", "x_and_y", "x_or_y"] | None = "y",
75+
stopping_criterion: Literal["x", "y", "x_and_y", "x_or_y"] = "y",
7676
x_precision: float = 1e-4,
7777
y_precision: float = 1e-4,
7878
combine_plots_in_grid: bool = True,
@@ -119,7 +119,8 @@ def convergence_plot(
119119
runtime_measure: This is the runtime until the desired convergence was reached
120120
by an algorithm.
121121
stopping_criterion: Determines how convergence is determined from the two
122-
precisions. If None, no convergence criterion is applied.
122+
precisions. To effectively disable convergence, set `x_precision` and/or
123+
`y_precision` to very small values (or 0).
123124
x_precision: how close an algorithm must have gotten to the true parameter
124125
values (as percent of the Euclidean distance between start and solution
125126
parameters) before the criterion for clipping and convergence is fulfilled.

0 commit comments

Comments
 (0)