Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved error message. #1412

Merged
merged 3 commits into from
May 30, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion watertap/core/plugins/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am forgetting- should nlp_scaling_method be what you have here or user-scaling? What happens if you don't specify gradient -based scaling?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option ensures watertap's own scaling gets skipped and the model gets handed directly to Ipopt. This is what we want to see the problematic constraint / expression.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought I remembered this working regardless of that option so maybe I'm not recalling correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It certainly does in IDAES or if you just use SolverFactory("ipopt").

"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")
Expand Down