-
Notifications
You must be signed in to change notification settings - Fork 19
Add ifail enum
#4275
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
base: main
Are you sure you want to change the base?
Add ifail enum
#4275
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,35 @@ | |||||||
| import numpy as np | ||||||||
|
|
||||||||
|
|
||||||||
| class SolverOutputCondition(IntEnum): | ||||||||
| """Enum for the possible conditions that can be returned by the solvers. | ||||||||
| This is for the `ifail` condition | ||||||||
| """ | ||||||||
|
Comment on lines
+8
to
+11
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copilot comment is worth doing - some instances of |
||||||||
|
|
||||||||
| USER_TERMINATED = -1 | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While self-explanatory, a short description here would be good for consistency |
||||||||
|
|
||||||||
| IMPROPER_INPUT = 0 | ||||||||
| """Solver failed due to improper input (e.g. invalid parameters, or failure to | ||||||||
| satisfy solver preconditions)""" | ||||||||
| CONVERGED = 1 | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| """Solver converged successfully""" | ||||||||
|
|
||||||||
| MAX_ITERATIONS = 2 | ||||||||
| """Solver failed to converge within the maximum number of iterations""" | ||||||||
|
|
||||||||
| MAX_LINE_SEARCHES = 3 | ||||||||
| """Line search required 10 function calls without finding a better solution""" | ||||||||
|
|
||||||||
| UPHILL_SEARCH = 4 | ||||||||
| """Uphill search direction was calculated""" | ||||||||
|
Comment on lines
+24
to
+28
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth noting that these are solver specific and won't always be raised (e.g. using fsolve or some custom solver) |
||||||||
|
|
||||||||
| NO_SOLUTION = 5 | ||||||||
| """No feasible solution or bad approximation of Hessian""" | ||||||||
|
|
||||||||
| SINGLE_MATRIX_OR_BOUNDS = 6 | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| """Singular matrix in quadratic subproblem or restriction by artificial bounds""" | ||||||||
|
Comment on lines
+15
to
+34
|
||||||||
|
|
||||||||
|
|
||||||||
| class PROCESSRunMode(IntEnum): | ||||||||
| """Enumeration of the available PROCESS run modes, which determine the behaviour | ||||||||
| of the code in various places. This is controlled by the `ioptimz` variable | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the copilot suggestion on this line, as all the checks now use
SolverOutputConditionwhich means comments referencingifail != 1etc aren't as clear any more so should be updated where this occurs