module Evolvable
Constants
- VERSION
Attributes
genes[RW]
population[RW]
population_index[RW]
Public Class Methods
included(base)
click to toggle source
# File lib/evolvable.rb, line 22 def self.included(base) def base.new_population(keyword_args = {}) keyword_args[:evolvable_class] = self Population.new(**keyword_args) end def base.new_instance(population: nil, genes: [], population_index: nil) evolvable = initialize_instance evolvable.population = population evolvable.genes = genes evolvable.population_index = population_index evolvable.initialize_instance evolvable end def base.initialize_instance new end def base.new_gene_space GeneSpace.build(gene_space) end def base.gene_space {} end def base.before_evaluation(population); end def base.before_evolution(population); end def base.after_evolution(population); end end
Public Instance Methods
find_gene(key)
click to toggle source
# File lib/evolvable.rb, line 66 def find_gene(key) @genes.detect { |g| g.key == key } end
find_genes(key)
click to toggle source
# File lib/evolvable.rb, line 70 def find_genes(key) @genes.select { |g| g.key == key } end
initialize_instance()
click to toggle source
# File lib/evolvable.rb, line 56 def initialize_instance; end
value()
click to toggle source
# File lib/evolvable.rb, line 62 def value raise Errors::UndefinedMethod, "#{self.class.name}##{__method__}" end