From c7b26fe5e4b83320ba5f02440f6be79079d32a3c Mon Sep 17 00:00:00 2001 From: Janos Gabler Date: Tue, 17 Sep 2024 13:39:15 +0200 Subject: [PATCH] Update processing of nag result objects. --- src/optimagic/optimizers/nag_optimizers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/optimagic/optimizers/nag_optimizers.py b/src/optimagic/optimizers/nag_optimizers.py index 5cff71a33..a83ac7900 100644 --- a/src/optimagic/optimizers/nag_optimizers.py +++ b/src/optimagic/optimizers/nag_optimizers.py @@ -876,8 +876,13 @@ def _process_nag_result(nag_result_obj, len_x): results (dict): See :ref:`internal_optimizer_output` for details. """ + if hasattr(nag_result_obj, "f"): + solution_fun = nag_result_obj.f + else: + solution_fun = nag_result_obj.obj + processed = { - "solution_criterion": nag_result_obj.f, + "solution_criterion": solution_fun, "n_fun_evals": nag_result_obj.nx, "message": nag_result_obj.msg, "success": nag_result_obj.flag == nag_result_obj.EXIT_SUCCESS,