Class: MuLambda
- Inherits:
-
AlgorithmBase
- Object
- AlgorithmBase
- MuLambda
- Includes:
- Breed, Elitism
- Defined in:
- ../algorithm/mu_lambda.rb
Instance Attribute Summary (collapse)
-
- (Object) comma_or_plus
Returns the value of attribute comma_or_plus.
-
- (Object) lambda_size
Returns the value of attribute lambda_size.
Attributes included from Breed
Attributes included from Elitism
Attributes inherited from AlgorithmBase
#init, #population_size, #probabilities, #termination
Instance Method Summary (collapse)
Methods inherited from AlgorithmBase
Instance Attribute Details
- (Object) comma_or_plus
Returns the value of attribute comma_or_plus
11 12 13 |
# File '../algorithm/mu_lambda.rb', line 11 def comma_or_plus @comma_or_plus end |
- (Object) lambda_size
Returns the value of attribute lambda_size
11 12 13 |
# File '../algorithm/mu_lambda.rb', line 11 def lambda_size @lambda_size end |
Instance Method Details
- (Object) setup(config)
13 14 15 16 17 18 19 20 |
# File '../algorithm/mu_lambda.rb', line 13 def setup config super raise "MuLambda: lambda_size < population_size" if @comma_or_plus == 'comma' and @lambda_size < @population_size @population = load_or_init( @store, @population_size ) init_elitism @population_size @report.next return @report end |
- (Object) step
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File '../algorithm/mu_lambda.rb', line 22 def step @report.next @report << "--------- step #{@steps += 1}" @report.report @population lambda_population = breed_population( Util.permutate( @population ), @lambda_size ) elite_population = elite @population lambda_population.concat @population if @comma_or_plus == 'plus' @population = @selection.select( @population_size - elite_population.size, lambda_population ) @population.concat elite_population return @report end |