Opened 7 years ago
Last modified 6 years ago
#2901 assigned enhancement
Static methods for selection operators
Reported by: | gkronber | Owned by: | gkronber |
---|---|---|---|
Priority: | low | Milestone: | HeuristicLab 3.3.x Backlog |
Component: | Selection | Version: | branch |
Keywords: | Cc: |
Description
It would be great if selection operators also provide static methods so that selection can be called easily from a script.
Change History (7)
comment:1 Changed 7 years ago by abeham
comment:2 Changed 7 years ago by gkronber
- Owner set to mkommend
- Status changed from new to assigned
I agree that we should definitely not implement them for IScopes.
Intuitively, I'd argue against extension methods because most of the selection operators are rather specific to evolutionary methods (proportional selection is probably an exception). I'd not want to see all kinds of extensions for selection on the auto-complete drop-down (xs.SampleGeneralizedRank(...). If we put the extension methods in the HL.Selection namespace it might be ok.
Not all the selection methods need to be implemented. The following would suffice:
- CrowdedTournament
- Tournament
- LinearRank
- NoSameMates (?)
- Random
- GeneralizedRank
comment:3 Changed 7 years ago by gkronber
@mkommend: maybe Christian could work on this?
comment:4 Changed 7 years ago by gkronber
Created a branch with r15778.
comment:5 Changed 7 years ago by gkronber
r15779: I implemented an example for TournamentSelection. Probably, this needs to be adapted so that we can implement a method with similar interface for most of the selection operations.
comment:6 Changed 7 years ago by gkronber
- Owner changed from mkommend to fbaching
comment:7 Changed 6 years ago by gkronber
- Milestone changed from HeuristicLab 3.3.16 to HeuristicLab 3.3.x Backlog
- Owner changed from fbaching to gkronber
- Version set to branch
Agreed! Still, I think it's rather unsatisfying to implement them only as static methods in selection operators because they'd probably be defined to work with scopes and are thus not generally useful.
I would suggest to implement them as extension methods to IEnumerable<T>. Actually, we'd need a tournament-based selection and the generalized rank selection. We already have proportional selection implemented as such an extension method in HeuristicLab.Random which can also handle linear rank selection.