-
Notifications
You must be signed in to change notification settings - Fork 51
Make pyprima update constraints when eliminating fixed variables and bring the code to python bindings #251
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
Conversation
|
@nbelakovski Thank you. @OptHuang Please review this. The code is copied from COBYQA. Please compare with the corresponding code in PDFO. Any difference is suspicious and hence needs justification. Thank you. |
OptHuang
left a comment
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.
Two typos in comments.
5ed33b1 to
2acd3a7
Compare
|
|
@OptHuang do you have any further comments? |
It's good so far. But I haven't found time to compare the corresponding code with that in pdfo. |
|
@OptHuang Do you think you'll get time to do so in the coming week? |
Hi, Nickolai @nbelakovski . Sorry for waiting. I checked the code in pdfo about preprocessing fixed variables. I have a few suggestions or questions, which may be wrong since I am not too familiar with the code in prima.
That's all my observations and suggestions. Thanks, |
|
Hi @OptHuang, thank you for taking a look. Below are my responses.
Yes, see the relevant code in cobyla.f90 and cobyla.py
No. I propose adding the following code to the end of the This code is slightly different from what's in PDFO but I think it's clearer. PDFO uses
At the moment we only handle this in the special case where x0 is a scalar. Here's one proposed way we can handle this for the general case, by inserting the following code just before
This would be too large of a refactor for right now. We should address the first 3 points first and then work on #252 to consolidate the Python interface code before we think of something like that. |
This was suggested in libprima#251.
Hi Nickolai @nbelakovski , Thank you for the detailed explanation and proposed changes. I completely agree with your reasoning on all three points. I’m happy to proceed with your proposal and will leave the final decision about merging this PR to @zaikunzhang. Thanks again! |
|
@zaikunzhang Any further comments on this? I believe all the issues raised have been addressed. If you think it would simplify review to split this into two separate PRs (one for pyprima and one for the Python bindings) I could do that. |
When we eliminate fixed bounds, we need to update not only the objective function, but also the linear constraints and the nonlinear constraint function. Tests have been added to ensure the added code works, and the tests have been demonstrated to fail when the new code is removed. Ref: libprima#249
Some minor modifications needed to be made. Notably pyprima's Result object uses 'f' for the function value whereas the bindings use 'fun'. Secondly, with the bindings we try to maintain the type that was provided, and so we made to make a minor modification as we changed the x0 that was provided to eliminate the fixed bounds. Ref: libprima#250
This was suggested in libprima#251.
59f1c20 to
328b7cc
Compare
This was suggested in libprima#251.
328b7cc to
15ed0f6
Compare
This was suggested in libprima#251.
Also evalaute the objective and nonlinear constraint functions A 'bug' in pyprima was found and fixed, in which it was returning both linear and nonlinear constraint evaluations. It has been fixed to return only nonlinear constraint evaluations, to be consistent with the Fortran implementation.
15ed0f6 to
affd6d3
Compare
This was suggested in #251.
|
Thank you @nbelakovski , and @OptHuang ! |
This PR covers both #249 and #250. The first commit is for #249 and the second is for #250.