Class: Selection::ParetoTourney

Inherits:
Object
  • Object
show all
Defined in:
../lib/pareto_tourney.rb

Overview

ParetoTourneySelect method (without replacement) as described in: www.evolved-analytics.com/selected_publications/pursuing_the_pareto_paradig.html

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ParetoTourney) initialize(tournament_size = 2)

Set the tournament_size (see the attribute) for selections.



12
13
14
15
# File '../lib/pareto_tourney.rb', line 12

def initialize tournament_size=2
  @tournament_size = tournament_size
  @random = Kernel
end

Instance Attribute Details

- (Object) population

The population to select from. The same as the argument of ParetoTourney#select_front and ParetoTourney#select_dominated methods.



21
22
23
# File '../lib/pareto_tourney.rb', line 21

def population
  @population
end

- (Object) random

The source of randomness, used for calling “random.rand( limit )”, defaulting to ‘Kernel’ class.



18
19
20
# File '../lib/pareto_tourney.rb', line 18

def random
  @random
end

- (Object) tournament_size

The number of randomly selected individuals for dominance evaluation.



24
25
26
# File '../lib/pareto_tourney.rb', line 24

def tournament_size
  @tournament_size
end

Instance Method Details

- (Object) select_dominated(population = self.population)

Select all dominated solutions from the random subset of the population.



32
33
34
# File '../lib/pareto_tourney.rb', line 32

def select_dominated population=self.population
  Moea::Pareto.dominated( random_select( population ) )
end

- (Object) select_front(population = self.population)

Select all nondominated solutions from the random subset of the population.



27
28
29
# File '../lib/pareto_tourney.rb', line 27

def select_front population=self.population
  Moea::Pareto.nondominated( random_select( population ) )
end