mahf-opt / mahf

A framework for modular construction and evaluation of metaheuristics.
GNU General Public License v3.0
10 stars 0 forks source link

Add more swarm-based metaheuristics #194

Closed HeleNoir closed 9 months ago

HeleNoir commented 1 year ago

This PR relates to issue #182 and includes operators and heuristics for

The other swarm based algorithms will be implemented later on.

HeleNoir commented 1 year ago

And if you have time (@luleyleo or @Saethox), please take a look at what I did for the firefly algorithm. I'm pretty sure that this could be done much better. And it does not perform quite well, so I might have done something wrong...

Saethox commented 1 year ago

I really wasn't prepared for the firefly algorithm, it certainly looks... interesting. Let's hope the other ones are not as bad :/.

In general, I think this is a good time to split the swarm module further into pso, fa, gs, etc. submodules for the specific algorithms.

Also, evaluating individuals inside the nested loop is weird, but certainly possible with mahf. It makes parallelizations pretty much impossible, but oh well. This is also pretty much a case where generation and evaluation are inseparable. You can just get the state::common::Evaluator at the start and call from_mut with the individual[i] as argument to get a &mut [Individual] that you can feed into the evaluate method on the Evaluator. And don't forget to update the state::common::Evaluations after.