-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug description
Passing stopping_criterion = None to convergence_plot() or process_benchmark_results() raises
UnboundLocalError: local variable 'is_converged' referenced before assignment, even though the API mentions that None can be passed.
To Reproduce
import plotly.io as pio
import optimagic as om
problems = om.get_benchmark_problems("example")
optimizers = [
"nag_dfols",
"scipy_neldermead",
"scipy_truncated_newton",
]
results = om.run_benchmark(
problems,
optimizers,
)
fig = om.convergence_plot(
problems=problems,
results=results,
n_cols=2,
problem_subset=["rosenbrock_good_start", "box_3d"],
stopping_criterion=None,
)
fig.show()Expected behavior
The figure should be generated without any error. I am not sure whether the implementation is incorrect, or whether the docstring is outdated.
Additional Information
The error occurs in the _process_one_result() function in process_benchmark_results.py, due to the absence of logic to handle the case when stopping_criterion = None
Proposed Fix
This could be fixed by one of:
- The case of
stopping_criterion = Noneshould be handled in the_process_one_result(), - The documentation should be updated to reflect that
stopping_criterioncan not be 'None'.
timmens
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working