diff --git a/pyomo/contrib/solver/ipopt.py b/pyomo/contrib/solver/ipopt.py index 48c314ffc79..534a9173d07 100644 --- a/pyomo/contrib/solver/ipopt.py +++ b/pyomo/contrib/solver/ipopt.py @@ -420,15 +420,17 @@ def solve(self, model, **kwds): if config.load_solution: results.incumbent_objective = value(nl_info.objectives[0]) else: - results.incumbent_objective = value(replace_expressions( - nl_info.objectives[0].expr, - substitution_map={ - id(v): val - for v, val in results.solution_loader.get_primals().items() - }, - descend_into_named_expressions=True, - remove_named_expressions=True, - )) + results.incumbent_objective = value( + replace_expressions( + nl_info.objectives[0].expr, + substitution_map={ + id(v): val + for v, val in results.solution_loader.get_primals().items() + }, + descend_into_named_expressions=True, + remove_named_expressions=True, + ) + ) results.solver_configuration = config results.solver_log = ostreams[0].getvalue()