Skip to content
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 more swarm-based metaheuristics #194

Merged
merged 13 commits into from
Dec 7, 2023
Merged

Add more swarm-based metaheuristics #194

merged 13 commits into from
Dec 7, 2023

Conversation

HeleNoir
Copy link
Collaborator

@HeleNoir HeleNoir commented Aug 31, 2023

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

The other swarm based algorithms will be implemented later on.

@HeleNoir HeleNoir added this to the Interesting Heuristics milestone Aug 31, 2023
@HeleNoir HeleNoir added heuristic Add/change metaheuristic algorithms operator Add/change operators labels Aug 31, 2023
@HeleNoir
Copy link
Collaborator Author

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
Copy link
Collaborator

Saethox commented Sep 10, 2023

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.

src/components/swarm.rs Outdated Show resolved Hide resolved
src/components/swarm.rs Outdated Show resolved Hide resolved
src/components/swarm.rs Outdated Show resolved Hide resolved
src/components/swarm.rs Outdated Show resolved Hide resolved
src/components/swarm.rs Outdated Show resolved Hide resolved
src/components/swarm/fa.rs Outdated Show resolved Hide resolved
@HeleNoir HeleNoir marked this pull request as ready for review October 13, 2023 07:22
Copy link
Collaborator

@Saethox Saethox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any deviations from the pseudo-code, just some small nitpicks.

src/utils.rs Outdated Show resolved Hide resolved
src/components/replacement/bh.rs Outdated Show resolved Hide resolved
src/components/replacement/bh.rs Outdated Show resolved Hide resolved
src/components/replacement/bh.rs Outdated Show resolved Hide resolved
src/components/swarm/bh.rs Outdated Show resolved Hide resolved
src/components/replacement/bh.rs Outdated Show resolved Hide resolved
@Saethox Saethox merged commit 30a1274 into master Dec 7, 2023
4 checks passed
@Saethox Saethox deleted the add-swarm-operators branch December 7, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
heuristic Add/change metaheuristic algorithms operator Add/change operators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants