-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
[DRAFT] Powell's algorithm #234
base: main
Are you sure you want to change the base?
Conversation
Hi @Trombach, thanks a lot for this PR! :) At first glance it looks already quite good. Admittedly, I'm not familiar with this method. Could you provide a reference (paper, code you were following, ...) so that I can have a look, please?
I haven't seen anything that is obviously aweful, but after posting this comment I'll start a review and give some pointers where I think things could be done differently. You can also have a look at the results of the failed CI piplines, where clippy complained about a few minor things.
Do you mean as a replacement for the line search? It would be great to support both Golden-section search and Brent's method. One option would be to implement
I'll think about this when I'm more familiar with the method itself :) |
@@ -0,0 +1,97 @@ | |||
use crate::core::{ |
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.
Minor: Copyright notice is missing
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.
Thanks will add this before the PR is final. Leaving this unresolved as a reminder for myself :)
|
||
impl<O, P, F, L> Solver<O, IterState<P, (), (), (), F>> for PowellLineSearch<P, L> | ||
where | ||
O: CostFunction<Param = P, Output = F>, |
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.
Since the problem is passed to a line search as well, you'll probably also require O
to implement Gradient
. But I'm not a 100% sure how these requirements of the LS are passed along. Maybe we just need to give it a try.
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 believe one of the advantages of Powell's method is that it doesn't need gradients. I thought that as long as the linesearch method is given a direction to search along it doesn't need gradients to be computed, i.e. the calculation of gradients should be independent from the linesearch algorith, which only searches along a provided search direction. However, I could be wrong, but I can just write tests and see if it works. I will also implement a version of this using golden section search and brent's method.
Hi @stefan-k, thanks for the feedback! Sorry for being slow to respond, but I'm doing this as a little weekend side project :) I will go through your review suggestions as soon as I can! I have mainly followed Wikipedia for now, but I will got through Powell's paper as well to get a more nuanced understanding. As far as I can tell it's a gradient free method where you search along provided search directions and update your list of search directions until you converge onto a minimum.
|
There's no rush, take your time :)
Thanks, I'll have a look at these. Makes sense that it works with any 1D method, but when using linesearches, it is not really a gradient free method anymore (for most line searches at least). That's fine, we just need to make that clear in the documentation :) |
Hi @Trombach, Is there any news regarding this PR? Feel free to get in touch if there is anything I can help you with :) |
Hi @stefan-k, |
No worries :)
This is indeed very helpful :) |
How did you get access to the paper? I haven't found a publicly accessible version and also cannot access it through my research institution. I would like to take a look at it, too. |
I have some remarks regarding some of the statements regarding the line search used internally.
That should be correct. Powell's method is a gradient free optimization algorithm, meaning the linesearch used should also not need gradient information. A typical choice according to wikipedia for such line search algorithms would be Golden-section-search or Brent's method. Another important characteristic the line search method has to fullfill is that it needs to be a bi-directional line search, meaning the coefficient of the search direction can also be negative. Considering these points maybe it would make sense to hard code a specific line search method or make a new trait |
Did you manage to get hold of it? I was able to access it via my institution.
Thanks for the clarification. I like the idea of a
That's great! I don't know what @Trombach's plans are regarding this PR, but it seems as if this PR has gone stale. I'm therefore happy to consider another PR by you. |
Sadly not, but I think following the scipy implementation shouldn't be to bad for now. The algorithm can still be modified later after all.
I have to see how much time I can invest at the moment, but will try my best. Unfortunately I can't compile the test suite at the moment. I get the following error in a dependency named
I don't know yet what to do to solve this issue. |
I found a workaround for now. It seems the issue is with a ndarray-linalg feature on windows activated with this line in the Cargo.toml from argmin-math:
The README from the ndarray-linalg repo say on windows only the Intel MKL backend is supported. Changing the cited line to
as well as deleting the |
Feel free to get in touch with me via stefan.kroboth AT gmail.com. I may have a solution.
Oh, yes, that won't work on windows. In the past, netlib was the only thing I could get to work reliably in the CI, but things may have changed for the better in the meantime. If you choose to open a PR we will see if MKL works. |
Hi @stefan-k,
I'm opening this PR to seek some guidance and feedback on my first draft to implement Powell's algorithm (#222).
Currently, this code is completely untested as I am only trying to gauge whether my attempt on implementing this solver is going in the right direction.
Here are some questions I have:
Thanks!