<commit_before>=DawinsLaw - Genetic Algorithm Gem

==!!VERY MUCH UNDER CONSTRUCTION!!


Darwins Law is a Genetic Algorithm gem with the aim of providing simple to use GA's that enable you to focus on the behaviour/characteristics you are trying to evolve.


  require 'darwins_law'
  ga = GA::Standard.new(:gene_length => 10, :popsize => 30, :fitness => Proc.new{|genome|
    #add code to evaluate genome and return fitness score (as int/float)
    genome.inject{|i,j| i + j} #the simplest fitness func ever!
  })
  ga.evolve

There are (currently) two GA classes <tt>GeneticAlgorithm::Standard</tt> and <tt>GeneticAlgorithm::Microbial</tt> which perform slightly different styles of evolution (class GA and GeneticAlgorithm are synonymous).
Both classes inherit <tt>GeneticAlgorithm::Base</tt> and are used (and extended) in the same way enabling more control.

===Options/Args

  ga = GA::Standard.new(
    :generations => 500,
    :gene_length => 10,
    :popsize => 30,
    :mutation_rate => 0.1,
    :cross_over_rate => 0.5
    :init_pop_with => Proc.new{ rand*2 - 1 }, #also can be symbol :rand or an int/float
    :mutation_function => Proc.new{|gene| gene + (rand -0.5) },
    :fitness => Proc.new{|genome| genome.inject{|i,j| i + j} }
    :verbose => false
  )
<commit_msg>lol typo<commit_after>=DarwinsLaw - Genetic Algorithm Gem

==!!VERY MUCH UNDER CONSTRUCTION!!


DarwinsLaw is a Genetic Algorithm gem with the aim of providing simple to use GA's that enable you to focus on the behaviour/characteristics you are trying to evolve.


  require 'darwins_law'
  ga = GA::Standard.new(:gene_length => 10, :popsize => 30, :fitness => Proc.new{|genome|
    #add code to evaluate genome and return fitness score (as int/float)
    genome.inject{|i,j| i + j} #the simplest fitness func ever!
  })
  ga.evolve

There are (currently) two GA classes <tt>GeneticAlgorithm::Standard</tt> and <tt>GeneticAlgorithm::Microbial</tt> which perform slightly different styles of evolution (class GA and GeneticAlgorithm are synonymous).
Both classes inherit <tt>GeneticAlgorithm::Base</tt> and are used (and extended) in the same way enabling more control.

===Options/Args

  ga = GA::Standard.new(   #or GA::Microbial
    :generations => 500,
    :gene_length => 10,
    :popsize => 30,
    :mutation_rate => 0.1,
    :cross_over_rate => 0.5
    :init_pop_with => Proc.new{ rand*2 - 1 }, #also can be symbol :rand or an int/float
    :mutation_function => Proc.new{|gene| gene + (rand -0.5) },
    :fitness => Proc.new{|genome| genome.inject{|i,j| i + j} }
    :verbose => false
  )

{'fraction_non_alphanumeric': 0.1221403644823575, 'fraction_numerical': 0.014734393175649476, 'mean_word_length': 4.029239766081871, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1586435', 'n_tokens_mistral': 903, 'n_tokens_neox': 799, 'n_words': 284}