Opened 12 months ago

Last modified 12 months ago

#2901 assigned enhancement

Static methods for selection operators

Reported by: gkronber Owned by: fbaching
Priority: low Milestone: HeuristicLab 3.3.16
Component: Selection Version:
Keywords: Cc:


It would be great if selection operators also provide static methods so that selection can be called easily from a script.

Change History (6)

comment:1 Changed 12 months ago by abeham

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.

comment:2 Changed 12 months 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 12 months ago by gkronber

@mkommend: maybe Florian could work on this?

Last edited 12 months ago by gkronber (previous) (diff)

comment:4 Changed 12 months ago by gkronber

Created a branch with r15778.

comment:5 Changed 12 months 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 12 months ago by gkronber

  • Owner changed from mkommend to fbaching
Note: See TracTickets for help on using tickets.