Module: EvoSynth
- Defined in:
- lib/evosynth/operators/recombinations/identity.rb,
lib/evosynth/decoder.rb,
lib/evosynth/problems.rb,
lib/evosynth/core/profile.rb,
lib/evosynth/decoder/gray.rb,
lib/evosynth/problems/tsp.rb,
lib/evosynth/output/logger.rb,
lib/evosynth/core/evaluator.rb,
lib/evosynth/output/factory.rb,
lib/evosynth/core/individual.rb,
lib/evosynth/core/population.rb,
lib/evosynth/core/randomizer.rb,
lib/evosynth/evolvers/elitism.rb,
lib/evosynth/evolvers/evolver.rb,
lib/evosynth/core/array_genome.rb,
lib/evosynth/core/binary_genome.rb,
lib/evosynth/operators/mutations.rb,
lib/evosynth/output/console_writer.rb,
lib/evosynth/decoder/binary_to_real.rb,
lib/evosynth/operators/meta_operators.rb,
lib/evosynth/operators/recombinations.rb,
lib/evosynth/problems/graph_colouring.rb,
lib/evosynth/evolvers/runnable_evolver.rb,
lib/evosynth/core/maximizing_individual.rb,
lib/evosynth/core/minimizing_individual.rb,
lib/evosynth/evolvers/basic/hillclimber.rb,
lib/evosynth/operators/mutations/identity.rb,
lib/evosynth/output/exporter/csv_exporter.rb,
lib/evosynth/operators/selections/identity.rb,
lib/evosynth/evolvers/basic/steady_state_ga.rb,
lib/evosynth/evolvers/profile_using_evolver.rb,
lib/evosynth/output/exporter/gruff_exporter.rb,
lib/evosynth/evolvers/basic/genetic_algorithm.rb,
lib/evosynth/evolvers/basic/memetic_algorithm.rb,
lib/evosynth/output/exporter/gnuplot_exporter.rb,
lib/evosynth/evolvers/local_search/local_search.rb,
lib/evosynth/operators/mutations/flip_functions.rb,
lib/evosynth/operators/mutations/gauss_mutation.rb,
lib/evosynth/problems/float_benchmark_functions.rb,
lib/evosynth/operators/mutations/binary_mutation.rb,
lib/evosynth/operators/mutations/mixing_mutation.rb,
lib/evosynth/operators/selections/best_selection.rb,
lib/evosynth/problems/binary_benchmark_functions.rb,
lib/evosynth/evolvers/basic/population_hillclimber.rb,
lib/evosynth/operators/mutations/exchange_mutation.rb,
lib/evosynth/operators/mutations/one_gene_flipping.rb,
lib/evosynth/operators/mutations/shifting_mutation.rb,
lib/evosynth/operators/selections/random_selection.rb,
lib/evosynth/operators/mutations/inversion_mutation.rb,
lib/evosynth/evolvers/evolution_strategies/adaptive_es.rb,
lib/evosynth/operators/adjustments/adaptive_adjustment.rb,
lib/evosynth/operators/mutations/uniform_real_mutation.rb,
lib/evosynth/operators/selections/tournament_selection.rb,
lib/evosynth/evolvers/local_search/acceptance_threshold.rb,
lib/evosynth/operators/recombinations/k_point_crossover.rb,
lib/evosynth/operators/recombinations/uniform_crossover.rb,
lib/evosynth/operators/adjustments/predefined_adjustment.rb,
lib/evosynth/operators/recombinations/edge_recombination.rb,
lib/evosynth/evolvers/local_search/acceptance_hillclimber.rb,
lib/evosynth/operators/recombinations/one_point_crossover.rb,
lib/evosynth/evolvers/evolution_strategies/derandomized_es.rb,
lib/evosynth/evolvers/evolution_strategies/selfadaptive_es.rb,
lib/evosynth/evolvers/local_search/acceptance_great_deluge.rb,
lib/evosynth/operators/mutations/efficient_binary_mutation.rb,
lib/evosynth/operators/recombinations/arithmetic_crossover.rb,
lib/evosynth/operators/selections/roulette_wheel_selection.rb,
lib/evosynth/operators/recombinations/ordered_recombination.rb,
lib/evosynth/evolvers/coevolutionary/balanced_coevolutionary.rb,
lib/evosynth/operators/mutations/self_adaptive_gauss_mutation.rb,
lib/evosynth/evolvers/local_search/acceptance_record_to_record.rb,
lib/evosynth/operators/selections/n_stage_tournament_selection.rb,
lib/evosynth/evolvers/coevolutionary/round_robin_coevolutionary.rb,
lib/evosynth/operators/recombinations/partially_mapped_crossover.rb,
lib/evosynth/operators/selections/fitness_proportional_selection.rb,
lib/evosynth/evolvers/local_search/acceptance_simulated_annealing.rb,
lib/evosynth/operators/meta_operators/sequential_combined_operator.rb,
lib/evosynth/operators/meta_operators/conditional_combined_operator.rb,
lib/evosynth/operators/meta_operators/proportional_combined_operator.rb,
lib/evosynth/operators/global_recombinations/global_uniform_crossover.rb,
lib/evosynth/operators/global_recombinations/global_arithmetic_crossover.rb
Overview
Copyright © 2009, 2010 Yves Adler <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Defined Under Namespace
Modules: Adjustments, Decoder, Evolvers, GlobalRecombinations, MetaOperators, Mutations, Output, Problems, Recombinations, Selections Classes: ArrayGenome, BinaryGenome, Evaluator, Individual, MaximizingIndividual, MinimizingIndividual, Population, Profile
Class Method Summary collapse
-
.nrand(mu = 0.0, sigma = 1.0) ⇒ Object
:call-seq: EvoSynth.nrand #=> pseudo-random normal distributed random number EvoSynth.nrand(3.2) #=> pseudo-random normal distributed random number around 3.2 EvoSynth.nrand(2.4, 1.5) #=> pseudo-random normal distributed random number around 2.4 with sigma = 1.5.
-
.rand(*args) ⇒ Object
Uniform distributed (between 0.0 and 1.0) pseudo-random number generator of EvoSynth, overwrite this function if you want to change the uniform distributed random number generator of EvoSynth.
-
.rand_bool ⇒ Object
Returns a pseudo-random boolean value (true or false).
-
.srand(*args) ⇒ Object
Set the seed of the uniform distributed random number generator of EvoSynth.
Class Method Details
.nrand(mu = 0.0, sigma = 1.0) ⇒ Object
:call-seq: EvoSynth.nrand #=> pseudo-random normal distributed random number EvoSynth.nrand(3.2) #=> pseudo-random normal distributed random number around 3.2 EvoSynth.nrand(2.4, 1.5) #=> pseudo-random normal distributed random number around 2.4 with sigma = 1.5
Normal distributed pseudo-random number generator of EvoSynth. Uses the polar form of the Box-Mueller transformation to transform two Uniform distributed random numbers into one normal distributed random number (see: www.taygeta.com/random/gaussian.html=).
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/evosynth/core/randomizer.rb', line 52 def EvoSynth.nrand(mu = 0.0, sigma = 1.0) x1, x2, w, = 0.0, 0.0, 0.0, 0.0 begin x1 = 2.0 * EvoSynth.rand - 1.0 x2 = 2.0 * EvoSynth.rand - 1.0 w = x1 ** 2.0 + x2 ** 2.0; end while ( w >= 1.0 ) w = Math.sqrt( (-2.0 * Math.log( w ) ) / w ) mu + (x2 * w * sigma) end |
.rand(*args) ⇒ Object
Uniform distributed (between 0.0 and 1.0) pseudo-random number generator of EvoSynth, overwrite this function if you want to change the uniform distributed random number generator of EvoSynth.
This a fascade to Kernel.rand. For a complete documentation see the Ruby documentation of rand().
33 34 35 |
# File 'lib/evosynth/core/randomizer.rb', line 33 def EvoSynth.rand(*args) Kernel.rand(*args) end |
.rand_bool ⇒ Object
Returns a pseudo-random boolean value (true or false).
39 40 41 |
# File 'lib/evosynth/core/randomizer.rb', line 39 def EvoSynth.rand_bool EvoSynth.rand(2) > 0 end |
.srand(*args) ⇒ Object
Set the seed of the uniform distributed random number generator of EvoSynth.
This a fascade to Kernel.srand, for a complete documentation see the Ruby documentation of srand().
69 70 71 |
# File 'lib/evosynth/core/randomizer.rb', line 69 def EvoSynth.srand(*args) Kernel.srand(*args) end |