Open steinhauserc opened 6 months ago
I'm new to rust but am happy to work on adding this algorithm to argmin-rs. It's a bit of a small task to help me learn. I may have a question or two along the way. From reading the Particle Swarm Optimization, I think it will be relatively simple to use that as an example outline for how to implement the algorithm in the argmin-rs. framework.
I think I'm most of the way to having an initial implementation working but I'm getting hung up on the following. Part of the evolution step involves constructing a state vector where some of the elements come from vector x and others come from a "mutated" vector.
To borrow from the wikipedia page, here's a text description of what's happening.
If r_i < CR or i=R, then set y_i = ..., otherwise set y_i=x_i
This just requires being able to modify indexed values of each state vector which feels like it should be trivial, but I'm having trouble making it happen within the framework where type P
has a list of traits (like here).
I might be able to make it work for me individually, but part of my objective for this initial rust project is to make it compliant with the overall library.
Any help pointing me in the right direction would be greatly appreciated.
I am very sorry for the extremely late reply. I would love to see Differential Evolution in argmin, and I am happy to support this development as much as I can. I hope you are still interested, despite the long wait for my response!
This just requires being able to modify indexed values of each state vector which feels like it should be trivial, but I'm having trouble making it happen within the framework where type P has a list of traits (like here).
It is currently not possible to index vectors, but it would be very useful to be able to do so. Some initial work on this has been done a while ago in PR #225 which unfortunately wasn't finished and remains unmerged. What is essentially needed is a new trait in argmin_math
which is implemented on parameter vectors, something like this.
Again, I am very sorry for the delay and I hope you are still interested in continuing this work. It would be highly appreciated!
Thanks for the helpful response! I was side tracked with other life things but am getting interested in doing this again.
Since that PR is quite stale, I'll probably just grab the ArgminGet
and ArgminSet
components out of there that I need and if I'm remembering where I was correctly that should get me pretty close to an initial functional implementation.
Differential evolution would be an addition to the evolutionary algorithms implemented in argmin-rs. The only other I've seen so far is Particle Swarm Optimization. It's good that this algorithm implementation already exists because some things like PopulationState already exists.
A "full" implementation would have a relatively large list of different evolution strategies (see scipy.optimize.differential_evolution for examples). I think it would be reasonable for the initial implementation in argmin-rs to have a couple of different strategies available and to be implemented such that it's relatively simple to add additional strategies in the future.