Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
get_current_iterate
andget_current_violations
methods to Problem class #182Add
get_current_iterate
andget_current_violations
methods to Problem class #182Changes from 6 commits
81971d0
c224638
f356322
7c82b25
bf7de5c
dfa93c4
60fcb04
444f0bc
5b32906
f2a0acf
77efa0d
0ad62e8
fd4356f
d4c7a7c
9752fb9
7cf21e1
4c0f4f0
02bd357
e91ceff
e74299b
5101bbd
5d08fed
f0dba5e
2aa23ab
29393b2
18d3812
55d833d
f502cee
ad973f5
7e5923f
8573c67
c1f1b63
f93733a
ff88aea
a19b114
54bd031
abef99c
01a776b
b7046e7
2a24f09
de52b8e
cc4efc0
27ebaf4
6614eaf
aba6c97
0a1af02
f78615d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
In
.solve()
we return a tuple of an ndarray (optimal solution) and a dict mapping to other arrays including the optimal solution again. I can't say that is the cleanest API. But maybe we should mimic it here, since it is similar information?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.
We could mimic this for
get_current_iterate
, but I don't see what the first ndarray should be forget_current_violations
, and I think it's more important for these to be consistent with each other than with solve. I'm currently returning dicts for both methods. Inget_current_iterate
, the keys are a subset of those in solve's returned dict. Inget_current_violations
, they match the GetIpoptCurrentIterate documentation, although I'm thinking about changing"nlp_constraint_violation" -> "g_violation"
.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.
If
ret
is 0, then we should return nan for the values. That is probably easiest to interpret for a Python users.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've raised a RuntimeError in this case. I don't like nan as it's unclear whether it came from Ipopt or us. Return
None
, raise an error, or includeret
in the returned object are all things I'd be okay with.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 was imagining that there could be cases where a problem could complete, but the values weren't returned from these new methods, so you could complete the solve. But maybe that doesn't occur and ret=0 means we should stop the solve.
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.
The only case I know of where this returns 0 is if it is called outside of a callback. There are other branches that return false in the Ipopt code, but I don't know how to reach them. I've updated to return
None
in this case so that it's a little easier for a user to handle (i.e. decide whether to complete solve or not).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.
Ok.