From cc018bf1c8ebbd2bff4af256da008135a8bbee07 Mon Sep 17 00:00:00 2001 From: Kinshuk Date: Tue, 28 May 2024 13:48:24 -0600 Subject: [PATCH 1/2] improved error message. --- watertap/core/plugins/solvers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/watertap/core/plugins/solvers.py b/watertap/core/plugins/solvers.py index dad04a7780..dadba8d812 100644 --- a/watertap/core/plugins/solvers.py +++ b/watertap/core/plugins/solvers.py @@ -158,8 +158,9 @@ def _scale_constraints(self, blk): self._cleanup() raise RuntimeError( "Error in AMPL evaluation.\n" - "Run ipopt with halt_on_ampl_error=yes and symbolic_solver_labels=True to see the affected function." - ) + "Re-run ipopt with:\n" + "1. solver options = {\"halt_on_ampl_error\" : \"yes\", \"nlp_scaling_method\" : \"gradient-based\"\n" + "2. set keyword argument symbolic_solver_labels=True in the pyomo solve function call to see the affected function.\n" ) else: print("Error in constraint_autoscale_large_jac") self._cleanup() From df9b4b747ea70ddd7eaf6f5a5d89cbf1ff99c502 Mon Sep 17 00:00:00 2001 From: Kinshuk Date: Tue, 28 May 2024 13:52:41 -0600 Subject: [PATCH 2/2] run black. --- watertap/core/plugins/solvers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/watertap/core/plugins/solvers.py b/watertap/core/plugins/solvers.py index dadba8d812..463c0af44a 100644 --- a/watertap/core/plugins/solvers.py +++ b/watertap/core/plugins/solvers.py @@ -159,8 +159,9 @@ def _scale_constraints(self, blk): raise RuntimeError( "Error in AMPL evaluation.\n" "Re-run ipopt with:\n" - "1. solver options = {\"halt_on_ampl_error\" : \"yes\", \"nlp_scaling_method\" : \"gradient-based\"\n" - "2. set keyword argument symbolic_solver_labels=True in the pyomo solve function call to see the affected function.\n" ) + '1. solver options = {"halt_on_ampl_error" : "yes", "nlp_scaling_method" : "gradient-based"\n' + "2. set keyword argument symbolic_solver_labels=True in the pyomo solve function call to see the affected function.\n" + ) else: print("Error in constraint_autoscale_large_jac") self._cleanup()