-
Notifications
You must be signed in to change notification settings - Fork 234
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
Add wrapper for pyomo.contrib.iis.compute_infeasibility_explanation
to diagnositics toolbox
#1405
Comments
Recently when simulating a model, I was ramping a model variable in an attempt to approach the known physical limits (maximum possible performance) of the system. The model became infeasible at a region before the anticipated physical limits in practice. Knowing this infeasibility was likely caused by something in the model structure, I initialized the model and first optimally solved it at the boundary of the feasible region, then took a small step into the infeasible region and applied the diagnostic tools available. Based on the approach the model took to attempt to optimally solve the infeasible problem, the tools available (such as |
I think this would be a valuable tool to include; the main issues I see right now are determining how best to integrate it and finding someone with the time to do so. Given my understanding of the tool, this is probably something that you would use if and when you get an infeasible solution returned by the solver (i.e. this is not a tool you use when you get an optimal solution but suspect you could get better performance). As such, it probably does not fit directly into the current The one other thing I see is that |
At first thought, advanced IDAES users already know to check
Maybe we should just change this in Pyomo? Given this was just merged into Pyomo/main, I don't foresee an issue with slightly modifying the API. |
|
I support adding |
On the stream front, it seems like we could wrap the pyomo.contrib version as follows (https://stackoverflow.com/questions/1383254/logging-streamhandler-and-standard-streams): import logging
from pyomo.contrib.iis import mis
def compute_infeasibility_explanation(model, solver, tee=False, tolerance=1e-6, stream=None):
h = logging.StreamHandler(stream)
h.setLevel(logging.INFO)
h.setFormatter(logging.Formatter(fmt=""))
l = logging.getLogger("compute_infeasibility_explanation")
l.setLevel(logging.INFO)
l.addHandler(h)
mis.compute_infeasibility_explanation(model, solver, tee=tee, tolerance=tolerance, logger=l)
If we're converged on this I can add the above method to the toolbox, and place the suggestion in the appropriate spot. |
Why do you need to set a formatter for the StreamHandler? |
Good question -- it isn't needed. import logging
from pyomo.contrib.iis import mis
def compute_infeasibility_explanation(model, solver, tee=False, tolerance=1e-6, stream=None):
h = logging.StreamHandler(stream)
h.setLevel(logging.INFO)
l = logging.Logger(name="compute_infeasibility_explanation")
l.setLevel(logging.INFO)
l.addHandler(h)
mis.compute_infeasibility_explanation(model, solver, tee=tee, tolerance=tolerance, logger=l) |
I think this plan sounds good - we can finish up any details in the PR. |
Sounds good to me too. |
The function
compute_infeasibility_explanation
computes sets of mutually infeasible constraints, which can be much more useful for diagnosing infeasibility than the current approach of checking constraint residuals after Ipopt converges to a point of local infeasibility. It was originally developed for WaterTAP (watertap-org/watertap#1289), but a Pyomo developer took the code and put it intopyomo.contrib.iis
(Pyomo/pyomo#3172).It seems like it would be a useful tool to add to the diagnostics toolbox so IDAES users more broadly are aware of is availability. @hunterbarber has successfully leveraged it to identify infeasibility explanations for WaterTAP models.
Below is a basic demo.
output:
The text was updated successfully, but these errors were encountered: