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

feat: add stochastic universal sampling selection operator #74

Merged
merged 6 commits into from
Nov 11, 2022

Conversation

kkafar
Copy link
Collaborator

@kkafar kkafar commented Nov 11, 2022

Description

Should be merged only after

is merged.

Added SUS selection operator for GA.

Linked issues

Closes #40

Important implementation details

This implementation allows for multiple addition of single individual to the selected pool in case it spans over multiple pointer positions.

@kkafar kkafar self-assigned this Nov 11, 2022
@kkafar kkafar linked an issue Nov 11, 2022 that may be closed by this pull request
Base automatically changed from @kkafar/implement-tournament-selection to master November 11, 2022 23:28
@kkafar kkafar merged commit e50704b into master Nov 11, 2022
@kkafar kkafar deleted the @kkafar/impl-stochastic-universal-sampling branch November 11, 2022 23:29
kkafar added a commit that referenced this pull request Nov 11, 2022
## Description

Should be merged only after

* #74 

is merged.

So following up on [this
comment](#71 (comment))
I enclosed GA operators inside traits. Such approach allows for:

* Parameterization of operators
* Implementation overloading for different chromosome types
* Potentially having some internal mutable state inside operator

I've tried to use `Fn` / `FnMut` / `FnOnce` traits, but Rust [docs state
that implementing it for custom structs is considered
unstable](https://doc.rust-lang.org/stable/std/ops/trait.FnMut.html#required-methods),
thus I went with `apply` method convention (inspired by Scala).

## Linked issues

N/A

## Important implementation details

I did not use any of `Fn*` traits, because it is reported that
[implementing it for custom structs is
unstable](https://doc.rust-lang.org/stable/std/ops/trait.Fn.html#required-methods).
Thus I decided to go with `apply` method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GA] Stochastic Universal Sampling selection operator
1 participant