evosynth 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +74 -0
- data/LICENSE +22 -0
- data/README +57 -0
- data/Rakefile +132 -0
- data/TODO +88 -0
- data/docs/FEATURES +111 -0
- data/docs/rdoc/classes/EvoSynth.html +2643 -0
- data/docs/rdoc/classes/EvoSynth/Adjustments.html +119 -0
- data/docs/rdoc/classes/EvoSynth/Adjustments/AdaptiveAdjustment.html +264 -0
- data/docs/rdoc/classes/EvoSynth/Adjustments/PredifinedAdjustment.html +235 -0
- data/docs/rdoc/classes/EvoSynth/ArrayGenome.html +313 -0
- data/docs/rdoc/classes/EvoSynth/BinaryGenome.html +518 -0
- data/docs/rdoc/classes/EvoSynth/Decoder.html +286 -0
- data/docs/rdoc/classes/EvoSynth/Evaluator.html +466 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers.html +469 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/AdaptiveES.html +448 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/BalancedCoevolutionary.html +439 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/DerandomizedES.html +450 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/Evolver.html +125 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/GeneticAlgorithm.html +467 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/Hillclimber.html +343 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/LocalSearch.html +422 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/LocalSearch/GreatDelugeAcceptance.html +287 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/LocalSearch/HillclimberAcceptance.html +197 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/LocalSearch/RecordToRecordTravelAcceptance.html +296 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/LocalSearch/SimulatedAnnealingAcceptance.html +286 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/LocalSearch/ThresholdAcceptance.html +287 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/MemeticAlgorithm.html +441 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/PopulationHillclimber.html +375 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/ProfileUsingEvolver.html +205 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/RoundRobinCoevolutionary.html +383 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/RunnableEvolver.html +279 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/RunnableEvolver/Goal.html +193 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/SelfAdaptiveES.html +394 -0
- data/docs/rdoc/classes/EvoSynth/Evolvers/SteadyStateGA.html +390 -0
- data/docs/rdoc/classes/EvoSynth/GlobalRecombinations.html +119 -0
- data/docs/rdoc/classes/EvoSynth/GlobalRecombinations/GlobalArithmeticCrossover.html +204 -0
- data/docs/rdoc/classes/EvoSynth/GlobalRecombinations/GlobalUniformCrossover.html +203 -0
- data/docs/rdoc/classes/EvoSynth/Individual.html +561 -0
- data/docs/rdoc/classes/EvoSynth/MaximizingIndividual.html +266 -0
- data/docs/rdoc/classes/EvoSynth/MetaOperators.html +149 -0
- data/docs/rdoc/classes/EvoSynth/MetaOperators/ConditionalCombinedOperator.html +278 -0
- data/docs/rdoc/classes/EvoSynth/MetaOperators/ProportionalCombinedOperator.html +285 -0
- data/docs/rdoc/classes/EvoSynth/MetaOperators/SequentialCombinedOperator.html +290 -0
- data/docs/rdoc/classes/EvoSynth/MinimizingIndividual.html +266 -0
- data/docs/rdoc/classes/EvoSynth/Mutations.html +251 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/BinaryMutation.html +336 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/EfficientBinaryMutation.html +345 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/ExchangeMutation.html +320 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/Functions.html +160 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/GaussMutation.html +311 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/Identity.html +220 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/InversionMutation.html +231 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/MixingMutation.html +233 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/OneGeneFlipping.html +295 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/SelfAdaptiveGaussMutation.html +347 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/ShiftingMutation.html +229 -0
- data/docs/rdoc/classes/EvoSynth/Mutations/UniformRealMutation.html +264 -0
- data/docs/rdoc/classes/EvoSynth/Output.html +212 -0
- data/docs/rdoc/classes/EvoSynth/Output/CSVExporter.html +211 -0
- data/docs/rdoc/classes/EvoSynth/Output/ConsoleWriter.html +194 -0
- data/docs/rdoc/classes/EvoSynth/Output/GnuPlotExporter.html +235 -0
- data/docs/rdoc/classes/EvoSynth/Output/GruffExporter.html +219 -0
- data/docs/rdoc/classes/EvoSynth/Output/Logger.html +345 -0
- data/docs/rdoc/classes/EvoSynth/Population.html +430 -0
- data/docs/rdoc/classes/EvoSynth/Problems.html +159 -0
- data/docs/rdoc/classes/EvoSynth/Problems/BinaryBenchmarkFuntions.html +258 -0
- data/docs/rdoc/classes/EvoSynth/Problems/FloatBenchmarkFuntions.html +406 -0
- data/docs/rdoc/classes/EvoSynth/Problems/GraphColouring.html +265 -0
- data/docs/rdoc/classes/EvoSynth/Problems/TSP.html +327 -0
- data/docs/rdoc/classes/EvoSynth/Profile.html +324 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations.html +251 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/ArithmeticCrossover.html +286 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/EdgeRecombination.html +203 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/Identity.html +192 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/KPointCrossover.html +286 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/OnePointCrossover.html +211 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/OrderedRecombination.html +206 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/PartiallyMappedCrossover.html +206 -0
- data/docs/rdoc/classes/EvoSynth/Recombinations/UniformCrossover.html +208 -0
- data/docs/rdoc/classes/EvoSynth/Selections.html +174 -0
- data/docs/rdoc/classes/EvoSynth/Selections/FitnessProportionalSelection.html +206 -0
- data/docs/rdoc/classes/EvoSynth/Selections/Identity.html +200 -0
- data/docs/rdoc/classes/EvoSynth/Selections/NStageTournamentSelection.html +273 -0
- data/docs/rdoc/classes/EvoSynth/Selections/RandomSelection.html +192 -0
- data/docs/rdoc/classes/EvoSynth/Selections/RouletteWheelSelection.html +212 -0
- data/docs/rdoc/classes/EvoSynth/Selections/SelectBest.html +206 -0
- data/docs/rdoc/classes/EvoSynth/Selections/TournamentSelection.html +274 -0
- data/docs/rdoc/classes/Examples.html +268 -0
- data/docs/rdoc/classes/Examples/Ants.html +198 -0
- data/docs/rdoc/classes/Examples/Ants/AntMutation.html +381 -0
- data/docs/rdoc/classes/Examples/Ants/Pheromon.html +256 -0
- data/docs/rdoc/classes/Examples/CCGAExample.html +305 -0
- data/docs/rdoc/classes/Examples/CCGAExample/CCGA2BenchmarkEvaluator.html +165 -0
- data/docs/rdoc/classes/Examples/CCGAExample/CCGABenchmarkEvaluator.html +242 -0
- data/docs/rdoc/classes/Examples/CCGAExample/CCGAIndividual.html +181 -0
- data/docs/rdoc/classes/Examples/CMBExample.html +215 -0
- data/docs/rdoc/classes/Examples/CMBExample/CMBEvaluator.html +212 -0
- data/docs/rdoc/classes/Examples/EsExample.html +270 -0
- data/docs/rdoc/classes/Examples/EsExample/BenchmarkEvaluator.html +162 -0
- data/docs/rdoc/classes/Examples/Exporter.html +208 -0
- data/docs/rdoc/classes/Examples/Exporter/ExporterEvaluator.html +196 -0
- data/docs/rdoc/classes/Examples/GraphColouring.html +199 -0
- data/docs/rdoc/classes/Examples/Hacking.html +147 -0
- data/docs/rdoc/classes/Examples/Hacking/HackingEvaluator.html +169 -0
- data/docs/rdoc/classes/Examples/LocalSearch.html +294 -0
- data/docs/rdoc/classes/Examples/LocalSearch/LocalSearchEvaluator.html +198 -0
- data/docs/rdoc/classes/Examples/MaxOnes.html +187 -0
- data/docs/rdoc/classes/Examples/MaxOnes/MaxOnesEvaluator.html +170 -0
- data/docs/rdoc/classes/Examples/Partitionproblem.html +201 -0
- data/docs/rdoc/classes/Examples/Partitionproblem/PartitionEvaluator.html +164 -0
- data/docs/rdoc/classes/Examples/Partitionproblem/PartitionIndividual.html +334 -0
- data/docs/rdoc/classes/Examples/Partitionproblem/PartitionMutation.html +199 -0
- data/docs/rdoc/classes/Examples/Partitionproblem/Testdata.html +294 -0
- data/docs/rdoc/classes/Examples/SPk.html +139 -0
- data/docs/rdoc/classes/Examples/SPk/SPkFitnessEvaluator.html +299 -0
- data/docs/rdoc/classes/Examples/TSP.html +187 -0
- data/docs/rdoc/created.rid +1 -0
- data/docs/rdoc/files/INSTALL.html +253 -0
- data/docs/rdoc/files/LICENSE.html +119 -0
- data/docs/rdoc/files/README.html +235 -0
- data/docs/rdoc/files/docs/FEATURES.html +428 -0
- data/docs/rdoc/files/examples/ants_rb.html +133 -0
- data/docs/rdoc/files/examples/ccga_example_rb.html +129 -0
- data/docs/rdoc/files/examples/cmb_example_rb.html +129 -0
- data/docs/rdoc/files/examples/evolution_strategies_rb.html +129 -0
- data/docs/rdoc/files/examples/exporter_rb.html +129 -0
- data/docs/rdoc/files/examples/graph_colouring_rb.html +129 -0
- data/docs/rdoc/files/examples/hacking_rb.html +129 -0
- data/docs/rdoc/files/examples/local_search_rb.html +129 -0
- data/docs/rdoc/files/examples/max_ones_rb.html +129 -0
- data/docs/rdoc/files/examples/partition_rb.html +131 -0
- data/docs/rdoc/files/examples/spk_rb.html +129 -0
- data/docs/rdoc/files/examples/tsp_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/core/array_genome_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/binary_genome_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/evaluator_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/core/individual_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/maximizing_individual_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/minimizing_individual_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/population_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/profile_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core/randomizer_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/core_rb.html +145 -0
- data/docs/rdoc/files/lib/evosynth/decoder/binary_to_real_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/decoder/gray_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/decoder_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/basic/genetic_algorithm_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/basic/hillclimber_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/basic/memetic_algorithm_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/basic/population_hillclimber_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/basic/steady_state_ga_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/coevolutionary/balanced_coevolutionary_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/coevolutionary/round_robin_coevolutionary_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/elitism_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/evolution_strategies/adaptive_es_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/evolution_strategies/derandomized_es_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/evolution_strategies/selfadaptive_es_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/evolver_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/local_search/acceptance_great_deluge_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/local_search/acceptance_hillclimber_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/local_search/acceptance_record_to_record_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/local_search/acceptance_simulated_annealing_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/local_search/acceptance_threshold_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/local_search/local_search_rb.html +137 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/profile_using_evolver_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/evolvers/runnable_evolver_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/evolvers_rb.html +153 -0
- data/docs/rdoc/files/lib/evosynth/operators/adjustments/adaptive_adjustment_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/adjustments/predefined_adjustment_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/adjustments_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/operators/global_recombinations/global_arithmetic_crossover_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/global_recombinations/global_uniform_crossover_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/global_recombinations_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/operators/meta_operators/conditional_combined_operator_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/meta_operators/proportional_combined_operator_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/meta_operators/sequential_combined_operator_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/meta_operators_rb.html +133 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/binary_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/efficient_binary_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/exchange_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/flip_functions_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/gauss_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/identity_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/inversion_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/mixing_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/one_gene_flipping_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/self_adaptive_gauss_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/shifting_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations/uniform_real_mutation_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/mutations_rb.html +151 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/arithmetic_crossover_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/edge_recombination_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/identity_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/k_point_crossover_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/one_point_crossover_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/ordered_recombination_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/partially_mapped_crossover_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations/uniform_crossover_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/recombinations_rb.html +143 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/best_selection_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/fitness_proportional_selection_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/identity_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/n_stage_tournament_selection_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/random_selection_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/roulette_wheel_selection_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections/tournament_selection_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/operators/selections_rb.html +141 -0
- data/docs/rdoc/files/lib/evosynth/operators_rb.html +139 -0
- data/docs/rdoc/files/lib/evosynth/output/console_writer_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/output/exporter/csv_exporter_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/output/exporter/gnuplot_exporter_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/output/exporter/gruff_exporter_rb.html +131 -0
- data/docs/rdoc/files/lib/evosynth/output/exporter_rb.html +133 -0
- data/docs/rdoc/files/lib/evosynth/output/factory_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/output/logger_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/output_rb.html +135 -0
- data/docs/rdoc/files/lib/evosynth/problems/binary_benchmark_functions_rb.html +119 -0
- data/docs/rdoc/files/lib/evosynth/problems/float_benchmark_functions_rb.html +1630 -0
- data/docs/rdoc/files/lib/evosynth/problems/graph_colouring_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/problems/tsp_rb.html +129 -0
- data/docs/rdoc/files/lib/evosynth/problems_rb.html +135 -0
- data/docs/rdoc/files/lib/evosynth_rb.html +139 -0
- data/docs/rdoc/fr_class_index.html +245 -0
- data/docs/rdoc/fr_file_index.html +233 -0
- data/docs/rdoc/fr_method_index.html +661 -0
- data/docs/rdoc/index.html +21 -0
- data/docs/rdoc/rdoc-style.css +299 -0
- data/examples/ants.rb +237 -0
- data/examples/ccga_example.rb +150 -0
- data/examples/cmb_example.rb +117 -0
- data/examples/evolution_strategies.rb +84 -0
- data/examples/exporter.rb +90 -0
- data/examples/graph_colouring.rb +72 -0
- data/examples/hacking.rb +62 -0
- data/examples/local_search.rb +109 -0
- data/examples/max_ones.rb +83 -0
- data/examples/partition.rb +172 -0
- data/examples/spk.rb +106 -0
- data/examples/tsp.rb +83 -0
- data/lib/evosynth.rb +32 -0
- data/lib/evosynth/core.rb +33 -0
- data/lib/evosynth/core/array_genome.rb +77 -0
- data/lib/evosynth/core/binary_genome.rb +156 -0
- data/lib/evosynth/core/evaluator.rb +109 -0
- data/lib/evosynth/core/individual.rb +92 -0
- data/lib/evosynth/core/maximizing_individual.rb +71 -0
- data/lib/evosynth/core/minimizing_individual.rb +71 -0
- data/lib/evosynth/core/population.rb +120 -0
- data/lib/evosynth/core/profile.rb +110 -0
- data/lib/evosynth/core/randomizer.rb +73 -0
- data/lib/evosynth/decoder.rb +33 -0
- data/lib/evosynth/decoder/binary_to_real.rb +57 -0
- data/lib/evosynth/decoder/gray.rb +54 -0
- data/lib/evosynth/evolvers.rb +41 -0
- data/lib/evosynth/evolvers/basic/genetic_algorithm.rb +92 -0
- data/lib/evosynth/evolvers/basic/hillclimber.rb +64 -0
- data/lib/evosynth/evolvers/basic/memetic_algorithm.rb +111 -0
- data/lib/evosynth/evolvers/basic/population_hillclimber.rb +69 -0
- data/lib/evosynth/evolvers/basic/steady_state_ga.rb +85 -0
- data/lib/evosynth/evolvers/coevolutionary/balanced_coevolutionary.rb +125 -0
- data/lib/evosynth/evolvers/coevolutionary/round_robin_coevolutionary.rb +87 -0
- data/lib/evosynth/evolvers/elitism.rb +108 -0
- data/lib/evosynth/evolvers/evolution_strategies/adaptive_es.rb +104 -0
- data/lib/evosynth/evolvers/evolution_strategies/derandomized_es.rb +120 -0
- data/lib/evosynth/evolvers/evolution_strategies/selfadaptive_es.rb +82 -0
- data/lib/evosynth/evolvers/evolver.rb +43 -0
- data/lib/evosynth/evolvers/local_search/acceptance_great_deluge.rb +60 -0
- data/lib/evosynth/evolvers/local_search/acceptance_hillclimber.rb +47 -0
- data/lib/evosynth/evolvers/local_search/acceptance_record_to_record.rb +69 -0
- data/lib/evosynth/evolvers/local_search/acceptance_simulated_annealing.rb +59 -0
- data/lib/evosynth/evolvers/local_search/acceptance_threshold.rb +60 -0
- data/lib/evosynth/evolvers/local_search/local_search.rb +74 -0
- data/lib/evosynth/evolvers/profile_using_evolver.rb +77 -0
- data/lib/evosynth/evolvers/runnable_evolver.rb +89 -0
- data/lib/evosynth/operators.rb +30 -0
- data/lib/evosynth/operators/adjustments.rb +26 -0
- data/lib/evosynth/operators/adjustments/adaptive_adjustment.rb +55 -0
- data/lib/evosynth/operators/adjustments/predefined_adjustment.rb +46 -0
- data/lib/evosynth/operators/global_recombinations.rb +26 -0
- data/lib/evosynth/operators/global_recombinations/global_arithmetic_crossover.rb +50 -0
- data/lib/evosynth/operators/global_recombinations/global_uniform_crossover.rb +49 -0
- data/lib/evosynth/operators/meta_operators.rb +36 -0
- data/lib/evosynth/operators/meta_operators/conditional_combined_operator.rb +65 -0
- data/lib/evosynth/operators/meta_operators/proportional_combined_operator.rb +84 -0
- data/lib/evosynth/operators/meta_operators/sequential_combined_operator.rb +73 -0
- data/lib/evosynth/operators/mutations.rb +47 -0
- data/lib/evosynth/operators/mutations/binary_mutation.rb +100 -0
- data/lib/evosynth/operators/mutations/efficient_binary_mutation.rb +105 -0
- data/lib/evosynth/operators/mutations/exchange_mutation.rb +107 -0
- data/lib/evosynth/operators/mutations/flip_functions.rb +45 -0
- data/lib/evosynth/operators/mutations/gauss_mutation.rb +65 -0
- data/lib/evosynth/operators/mutations/identity.rb +62 -0
- data/lib/evosynth/operators/mutations/inversion_mutation.rb +73 -0
- data/lib/evosynth/operators/mutations/mixing_mutation.rb +75 -0
- data/lib/evosynth/operators/mutations/one_gene_flipping.rb +89 -0
- data/lib/evosynth/operators/mutations/self_adaptive_gauss_mutation.rb +73 -0
- data/lib/evosynth/operators/mutations/shifting_mutation.rb +88 -0
- data/lib/evosynth/operators/mutations/uniform_real_mutation.rb +59 -0
- data/lib/evosynth/operators/recombinations.rb +48 -0
- data/lib/evosynth/operators/recombinations/arithmetic_crossover.rb +67 -0
- data/lib/evosynth/operators/recombinations/edge_recombination.rb +108 -0
- data/lib/evosynth/operators/recombinations/identity.rb +42 -0
- data/lib/evosynth/operators/recombinations/k_point_crossover.rb +81 -0
- data/lib/evosynth/operators/recombinations/one_point_crossover.rb +56 -0
- data/lib/evosynth/operators/recombinations/ordered_recombination.rb +75 -0
- data/lib/evosynth/operators/recombinations/partially_mapped_crossover.rb +102 -0
- data/lib/evosynth/operators/recombinations/uniform_crossover.rb +54 -0
- data/lib/evosynth/operators/selections.rb +31 -0
- data/lib/evosynth/operators/selections/best_selection.rb +54 -0
- data/lib/evosynth/operators/selections/fitness_proportional_selection.rb +83 -0
- data/lib/evosynth/operators/selections/identity.rb +48 -0
- data/lib/evosynth/operators/selections/n_stage_tournament_selection.rb +84 -0
- data/lib/evosynth/operators/selections/random_selection.rb +44 -0
- data/lib/evosynth/operators/selections/roulette_wheel_selection.rb +54 -0
- data/lib/evosynth/operators/selections/tournament_selection.rb +71 -0
- data/lib/evosynth/output.rb +28 -0
- data/lib/evosynth/output/console_writer.rb +45 -0
- data/lib/evosynth/output/exporter.rb +27 -0
- data/lib/evosynth/output/exporter/csv_exporter.rb +62 -0
- data/lib/evosynth/output/exporter/gnuplot_exporter.rb +81 -0
- data/lib/evosynth/output/exporter/gruff_exporter.rb +70 -0
- data/lib/evosynth/output/factory.rb +38 -0
- data/lib/evosynth/output/logger.rb +83 -0
- data/lib/evosynth/problems.rb +37 -0
- data/lib/evosynth/problems/binary_benchmark_functions.rb +74 -0
- data/lib/evosynth/problems/float_benchmark_functions.rb +99 -0
- data/lib/evosynth/problems/graph_colouring.rb +89 -0
- data/lib/evosynth/problems/tsp.rb +88 -0
- data/test/benchmark/decoder_benchmark.rb +75 -0
- data/test/benchmark/mutation_benchmark.rb +88 -0
- data/test/benchmark/recombination_benchmark.rb +58 -0
- data/test/benchmark/selection_benchmark.rb +52 -0
- data/test/core/tc_array_genome.rb +154 -0
- data/test/core/tc_binary_genome.rb +160 -0
- data/test/core/tc_population.rb +154 -0
- data/test/core/tc_profile.rb +75 -0
- data/test/core/tc_randomizer.rb +165 -0
- data/test/coverage.rb +43 -0
- data/test/decoder/tc_binary_to_real.rb +52 -0
- data/test/decoder/tc_gray.rb +107 -0
- data/test/operators/adjustments/tc_adaptive_adjustment.rb +63 -0
- data/test/operators/adjustments/tc_predefined_adjustment.rb +49 -0
- data/test/operators/global_recombinations/tc_global_arithmetic_crossover.rb +78 -0
- data/test/operators/global_recombinations/tc_global_uniform_crossover.rb +90 -0
- data/test/operators/meta_operators/tc_conditional_combined_operator.rb +66 -0
- data/test/operators/meta_operators/tc_proportional_combined_operator.rb +167 -0
- data/test/operators/meta_operators/tc_sequential_combined_operator.rb +98 -0
- data/test/operators/mutations/tc_binary_mutation.rb +73 -0
- data/test/operators/mutations/tc_efficient_binary_mutation.rb +73 -0
- data/test/operators/mutations/tc_exchange_mutation.rb +127 -0
- data/test/operators/mutations/tc_gauss_mutation.rb +130 -0
- data/test/operators/mutations/tc_identity_mutation.rb +64 -0
- data/test/operators/mutations/tc_inversion_mutation.rb +70 -0
- data/test/operators/mutations/tc_mixing_mutation.rb +73 -0
- data/test/operators/mutations/tc_one_gene_flipping.rb +109 -0
- data/test/operators/mutations/tc_self_adaptive_gauss_mutation.rb +72 -0
- data/test/operators/mutations/tc_shifting_muation.rb +73 -0
- data/test/operators/mutations/tc_uniform_real_mutation.rb +65 -0
- data/test/operators/recombinations/tc_arithmetic_crossover.rb +79 -0
- data/test/operators/recombinations/tc_edge_recombination.rb +76 -0
- data/test/operators/recombinations/tc_identity_recombination.rb +81 -0
- data/test/operators/recombinations/tc_k_point_crossover.rb +81 -0
- data/test/operators/recombinations/tc_one_point_crossover.rb +80 -0
- data/test/operators/recombinations/tc_ordered_recombination.rb +76 -0
- data/test/operators/recombinations/tc_partially_mapped_crossover.rb +91 -0
- data/test/operators/recombinations/tc_uniform_crossover.rb +84 -0
- data/test/operators/selections/tc_best_selection.rb +85 -0
- data/test/operators/selections/tc_fitness_proportional_selection.rb +78 -0
- data/test/operators/selections/tc_identity.rb +91 -0
- data/test/operators/selections/tc_n_stage_tournament.rb +78 -0
- data/test/operators/selections/tc_random_selection.rb +70 -0
- data/test/operators/selections/tc_roulette_wheel_selection.rb +78 -0
- data/test/operators/selections/tc_tournament_selection.rb +83 -0
- data/test/problems/tc_binary_benchmark_functions.rb +126 -0
- data/test/problems/tc_float_benchmark_functions.rb +100 -0
- data/test/test_util/test_helper.rb +128 -0
- data/test/ts_adjustments.rb +26 -0
- data/test/ts_core.rb +29 -0
- data/test/ts_decoder.rb +26 -0
- data/test/ts_global_recombinations.rb +26 -0
- data/test/ts_meta_operators.rb +27 -0
- data/test/ts_mutations.rb +35 -0
- data/test/ts_problems.rb +26 -0
- data/test/ts_recombinations.rb +32 -0
- data/test/ts_selections.rb +31 -0
- data/testdata/README +4 -0
- data/testdata/bays29.tsp +68 -0
- data/testdata/myciel4.col +77 -0
- metadata +552 -0
data/test/coverage.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
def add_path_to_load_path(path)
|
26
|
+
filename = File.dirname(__FILE__)
|
27
|
+
pathname = File.expand_path(File.join(filename, path))
|
28
|
+
$LOAD_PATH.unshift(pathname) unless $LOAD_PATH.include?(pathname)
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
add_path_to_load_path('../lib')
|
33
|
+
add_path_to_load_path('.')
|
34
|
+
|
35
|
+
|
36
|
+
require 'ts_adjustments'
|
37
|
+
require 'ts_core'
|
38
|
+
require 'ts_global_recombinations'
|
39
|
+
require 'ts_mutations'
|
40
|
+
require 'ts_mutations'
|
41
|
+
require 'ts_recombinations'
|
42
|
+
require 'ts_selections'
|
43
|
+
require 'ts_util'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
require 'shoulda'
|
26
|
+
|
27
|
+
require 'evosynth'
|
28
|
+
|
29
|
+
|
30
|
+
class BinaryToRealTest < Test::Unit::TestCase
|
31
|
+
|
32
|
+
should "decode [0,0,0,0,0] to lower bound" do
|
33
|
+
binary = [0,0,0,0,0]
|
34
|
+
assert_equal -5, EvoSynth::Decoder.binary_to_real(binary, -5.0, 5.0)
|
35
|
+
end
|
36
|
+
|
37
|
+
should "decode [1,1,1,1,1] to upper bound" do
|
38
|
+
binary = [1,1,1,1,1]
|
39
|
+
assert_equal 5, EvoSynth::Decoder.binary_to_real(binary, -5, 5)
|
40
|
+
end
|
41
|
+
|
42
|
+
should "decode [true,false,false,false,false] to lower bound" do
|
43
|
+
binary = [false,false,false,false,false]
|
44
|
+
assert_equal -5, EvoSynth::Decoder.binary_to_real(binary, -5.0, 5.0)
|
45
|
+
end
|
46
|
+
|
47
|
+
should "decode [true,true,true,true,true] to upper bound" do
|
48
|
+
binary = [true,true,true,true,true]
|
49
|
+
assert_equal 5, EvoSynth::Decoder.binary_to_real(binary, -5, 5)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
require 'shoulda'
|
26
|
+
|
27
|
+
require 'evosynth'
|
28
|
+
|
29
|
+
|
30
|
+
class GrayDecoderTest < Test::Unit::TestCase
|
31
|
+
|
32
|
+
should "decode gray to standard binary (on 1,0)" do
|
33
|
+
assert_equal [0,0,0,0], EvoSynth::Decoder.gray_to_binary([0,0,0,0])
|
34
|
+
assert_equal [0,0,0,1], EvoSynth::Decoder.gray_to_binary([0,0,0,1])
|
35
|
+
assert_equal [0,0,1,0], EvoSynth::Decoder.gray_to_binary([0,0,1,1])
|
36
|
+
assert_equal [0,0,1,1], EvoSynth::Decoder.gray_to_binary([0,0,1,0])
|
37
|
+
assert_equal [0,1,0,0], EvoSynth::Decoder.gray_to_binary([0,1,1,0])
|
38
|
+
assert_equal [0,1,0,1], EvoSynth::Decoder.gray_to_binary([0,1,1,1])
|
39
|
+
assert_equal [0,1,1,0], EvoSynth::Decoder.gray_to_binary([0,1,0,1])
|
40
|
+
assert_equal [0,1,1,1], EvoSynth::Decoder.gray_to_binary([0,1,0,0])
|
41
|
+
assert_equal [1,0,0,0], EvoSynth::Decoder.gray_to_binary([1,1,0,0])
|
42
|
+
assert_equal [1,0,0,1], EvoSynth::Decoder.gray_to_binary([1,1,0,1])
|
43
|
+
assert_equal [1,0,1,0], EvoSynth::Decoder.gray_to_binary([1,1,1,1])
|
44
|
+
assert_equal [1,0,1,1], EvoSynth::Decoder.gray_to_binary([1,1,1,0])
|
45
|
+
assert_equal [1,1,0,0], EvoSynth::Decoder.gray_to_binary([1,0,1,0])
|
46
|
+
assert_equal [1,1,0,1], EvoSynth::Decoder.gray_to_binary([1,0,1,1])
|
47
|
+
assert_equal [1,1,1,0], EvoSynth::Decoder.gray_to_binary([1,0,0,1])
|
48
|
+
assert_equal [1,1,1,1], EvoSynth::Decoder.gray_to_binary([1,0,0,0])
|
49
|
+
end
|
50
|
+
|
51
|
+
should "decode standard binary to gray (on 1,0)" do
|
52
|
+
assert_equal [0,0,0,0], EvoSynth::Decoder.binary_to_gray([0,0,0,0])
|
53
|
+
assert_equal [0,0,0,1], EvoSynth::Decoder.binary_to_gray([0,0,0,1])
|
54
|
+
assert_equal [0,0,1,1], EvoSynth::Decoder.binary_to_gray([0,0,1,0])
|
55
|
+
assert_equal [0,0,1,0], EvoSynth::Decoder.binary_to_gray([0,0,1,1])
|
56
|
+
assert_equal [0,1,1,0], EvoSynth::Decoder.binary_to_gray([0,1,0,0])
|
57
|
+
assert_equal [0,1,1,1], EvoSynth::Decoder.binary_to_gray([0,1,0,1])
|
58
|
+
assert_equal [0,1,0,1], EvoSynth::Decoder.binary_to_gray([0,1,1,0])
|
59
|
+
assert_equal [0,1,0,0], EvoSynth::Decoder.binary_to_gray([0,1,1,1])
|
60
|
+
assert_equal [1,1,0,0], EvoSynth::Decoder.binary_to_gray([1,0,0,0])
|
61
|
+
assert_equal [1,1,0,1], EvoSynth::Decoder.binary_to_gray([1,0,0,1])
|
62
|
+
assert_equal [1,1,1,1], EvoSynth::Decoder.binary_to_gray([1,0,1,0])
|
63
|
+
assert_equal [1,1,1,0], EvoSynth::Decoder.binary_to_gray([1,0,1,1])
|
64
|
+
assert_equal [1,0,1,0], EvoSynth::Decoder.binary_to_gray([1,1,0,0])
|
65
|
+
assert_equal [1,0,1,1], EvoSynth::Decoder.binary_to_gray([1,1,0,1])
|
66
|
+
assert_equal [1,0,0,1], EvoSynth::Decoder.binary_to_gray([1,1,1,0])
|
67
|
+
assert_equal [1,0,0,0], EvoSynth::Decoder.binary_to_gray([1,1,1,1])
|
68
|
+
end
|
69
|
+
|
70
|
+
should "decode gray to standard binary (on true,false)" do
|
71
|
+
assert_equal [false,false,false,false], EvoSynth::Decoder.gray_to_binary([false,false,false,false])
|
72
|
+
assert_equal [false,false,false,true], EvoSynth::Decoder.gray_to_binary([false,false,false,true])
|
73
|
+
assert_equal [false,false,true,false], EvoSynth::Decoder.gray_to_binary([false,false,true,true])
|
74
|
+
assert_equal [false,false,true,true], EvoSynth::Decoder.gray_to_binary([false,false,true,false])
|
75
|
+
assert_equal [false,true,false,false], EvoSynth::Decoder.gray_to_binary([false,true,true,false])
|
76
|
+
assert_equal [false,true,false,true], EvoSynth::Decoder.gray_to_binary([false,true,true,true])
|
77
|
+
assert_equal [false,true,true,false], EvoSynth::Decoder.gray_to_binary([false,true,false,true])
|
78
|
+
assert_equal [false,true,true,true], EvoSynth::Decoder.gray_to_binary([false,true,false,false])
|
79
|
+
assert_equal [true,false,false,false], EvoSynth::Decoder.gray_to_binary([true,true,false,false])
|
80
|
+
assert_equal [true,false,false,true], EvoSynth::Decoder.gray_to_binary([true,true,false,true])
|
81
|
+
assert_equal [true,false,true,false], EvoSynth::Decoder.gray_to_binary([true,true,true,true])
|
82
|
+
assert_equal [true,false,true,true], EvoSynth::Decoder.gray_to_binary([true,true,true,false])
|
83
|
+
assert_equal [true,true,false,false], EvoSynth::Decoder.gray_to_binary([true,false,true,false])
|
84
|
+
assert_equal [true,true,false,true], EvoSynth::Decoder.gray_to_binary([true,false,true,true])
|
85
|
+
assert_equal [true,true,true,false], EvoSynth::Decoder.gray_to_binary([true,false,false,true])
|
86
|
+
assert_equal [true,true,true,true], EvoSynth::Decoder.gray_to_binary([true,false,false,false])
|
87
|
+
end
|
88
|
+
|
89
|
+
should "decode standard binary to gray (on true,false)" do
|
90
|
+
assert_equal [false,false,false,false], EvoSynth::Decoder.binary_to_gray([false,false,false,false])
|
91
|
+
assert_equal [false,false,false,true], EvoSynth::Decoder.binary_to_gray([false,false,false,true])
|
92
|
+
assert_equal [false,false,true,true], EvoSynth::Decoder.binary_to_gray([false,false,true,false])
|
93
|
+
assert_equal [false,false,true,false], EvoSynth::Decoder.binary_to_gray([false,false,true,true])
|
94
|
+
assert_equal [false,true,true,false], EvoSynth::Decoder.binary_to_gray([false,true,false,false])
|
95
|
+
assert_equal [false,true,true,true], EvoSynth::Decoder.binary_to_gray([false,true,false,true])
|
96
|
+
assert_equal [false,true,false,true], EvoSynth::Decoder.binary_to_gray([false,true,true,false])
|
97
|
+
assert_equal [false,true,false,false], EvoSynth::Decoder.binary_to_gray([false,true,true,true])
|
98
|
+
assert_equal [true,true,false,false], EvoSynth::Decoder.binary_to_gray([true,false,false,false])
|
99
|
+
assert_equal [true,true,false,true], EvoSynth::Decoder.binary_to_gray([true,false,false,true])
|
100
|
+
assert_equal [true,true,true,true], EvoSynth::Decoder.binary_to_gray([true,false,true,false])
|
101
|
+
assert_equal [true,true,true,false], EvoSynth::Decoder.binary_to_gray([true,false,true,true])
|
102
|
+
assert_equal [true,false,true,false], EvoSynth::Decoder.binary_to_gray([true,true,false,false])
|
103
|
+
assert_equal [true,false,true,true], EvoSynth::Decoder.binary_to_gray([true,true,false,true])
|
104
|
+
assert_equal [true,false,false,true], EvoSynth::Decoder.binary_to_gray([true,true,true,false])
|
105
|
+
assert_equal [true,false,false,false], EvoSynth::Decoder.binary_to_gray([true,true,true,true])
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
require 'shoulda'
|
26
|
+
|
27
|
+
require 'evosynth'
|
28
|
+
require 'test/test_util/test_helper'
|
29
|
+
|
30
|
+
|
31
|
+
class AdaptiveAjustmentTest < Test::Unit::TestCase
|
32
|
+
|
33
|
+
ALPHA = 0.9
|
34
|
+
THETA = 0.2
|
35
|
+
|
36
|
+
context "a adaptive adjustment with alpha = #{ALPHA}, theta = #{THETA}" do
|
37
|
+
setup do
|
38
|
+
@adjustment = EvoSynth::Adjustments::AdaptiveAdjustment.new(ALPHA, THETA)
|
39
|
+
end
|
40
|
+
|
41
|
+
should "divide a value with #{ALPHA} when adjust is called without success_rate" do
|
42
|
+
sigma = 1
|
43
|
+
assert_equal sigma / ALPHA, @adjustment.adjust(sigma)
|
44
|
+
sigma = 3
|
45
|
+
assert_equal sigma / ALPHA, @adjustment.adjust(sigma)
|
46
|
+
end
|
47
|
+
|
48
|
+
should "divide a value with #{ALPHA} when adjust is called with a success_rate > #{THETA}" do
|
49
|
+
sigma = 1
|
50
|
+
assert_equal sigma * ALPHA, @adjustment.adjust(sigma, THETA*2)
|
51
|
+
sigma = 3
|
52
|
+
assert_equal sigma * ALPHA, @adjustment.adjust(sigma, THETA*2)
|
53
|
+
end
|
54
|
+
|
55
|
+
should "return the given value when success_rate == #{THETA}" do
|
56
|
+
sigma = 1
|
57
|
+
assert_equal sigma, @adjustment.adjust(sigma, THETA)
|
58
|
+
sigma = 3
|
59
|
+
assert_equal sigma, @adjustment.adjust(sigma, THETA)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
require 'shoulda'
|
26
|
+
|
27
|
+
require 'evosynth'
|
28
|
+
require 'test/test_util/test_helper'
|
29
|
+
|
30
|
+
|
31
|
+
class PredefinedAjustmentTest < Test::Unit::TestCase
|
32
|
+
|
33
|
+
ALPHA = 0.9
|
34
|
+
|
35
|
+
context "a predefined adjustment with alpha = #{ALPHA}" do
|
36
|
+
setup do
|
37
|
+
@adjustment = EvoSynth::Adjustments::PredifinedAdjustment.new(ALPHA)
|
38
|
+
end
|
39
|
+
|
40
|
+
should "multiply a value with #{ALPHA} when adjust is called" do
|
41
|
+
sigma = 1
|
42
|
+
assert_equal sigma * ALPHA, @adjustment.adjust(sigma)
|
43
|
+
sigma = 3
|
44
|
+
assert_equal sigma * ALPHA, @adjustment.adjust(sigma)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
require 'shoulda'
|
26
|
+
|
27
|
+
require 'evosynth'
|
28
|
+
require 'test/test_util/test_helper'
|
29
|
+
|
30
|
+
|
31
|
+
class GlobalArithmeticCrossoverTest < Test::Unit::TestCase
|
32
|
+
|
33
|
+
GENOME_SIZE = 100
|
34
|
+
TIMES = 1000
|
35
|
+
DELTA = 0.01
|
36
|
+
|
37
|
+
context "when run on binary genome (size=#{GENOME_SIZE})" do
|
38
|
+
setup do
|
39
|
+
@population = EvoSynth::Population.new
|
40
|
+
individual_one = TestArrayGenomeIndividual.new([1.0]*GENOME_SIZE)
|
41
|
+
individual_two = TestArrayGenomeIndividual.new([2.0]*GENOME_SIZE)
|
42
|
+
|
43
|
+
@population << individual_one << individual_two
|
44
|
+
end
|
45
|
+
|
46
|
+
context "before recombination is executed" do
|
47
|
+
should "all genes of individual one should be 1.0" do
|
48
|
+
@population[0].genome.each { |gene| assert_equal 1.0, gene }
|
49
|
+
end
|
50
|
+
|
51
|
+
should "all genes of individual two should be 2.0" do
|
52
|
+
@population[1].genome.each { |gene| assert_equal 2.0, gene }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "after recombination is executed #{TIMES} times" do
|
57
|
+
setup do
|
58
|
+
recombination = EvoSynth::GlobalRecombinations::GlobalArithmeticCrossover.new
|
59
|
+
@child = recombination.recombine(@population)
|
60
|
+
end
|
61
|
+
|
62
|
+
should "all genes of the parent one should (still) be 1.0" do
|
63
|
+
@population[0].genome.each { |gene| assert_equal 1.0, gene }
|
64
|
+
end
|
65
|
+
|
66
|
+
should "all genes of the parent two should (still) be 2.0" do
|
67
|
+
@population[1].genome.each { |gene| assert_equal 2.0, gene }
|
68
|
+
end
|
69
|
+
|
70
|
+
should "all genes of the child should equal 0.5" do
|
71
|
+
@child.genome.each { |gene| assert_equal 1.5, gene }
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# Copyright (c) 2009, 2010 Yves Adler <yves.adler@googlemail.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person
|
4
|
+
# obtaining a copy of this software and associated documentation
|
5
|
+
# files (the "Software"), to deal in the Software without
|
6
|
+
# restriction, including without limitation the rights to use,
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the
|
9
|
+
# Software is furnished to do so, subject to the following
|
10
|
+
# conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
|
25
|
+
require 'shoulda'
|
26
|
+
|
27
|
+
require 'evosynth'
|
28
|
+
require 'test/test_util/test_helper'
|
29
|
+
|
30
|
+
|
31
|
+
class GlobalUniformCrossoverTest < Test::Unit::TestCase
|
32
|
+
|
33
|
+
GENOME_SIZE = 100
|
34
|
+
TIMES = 1000
|
35
|
+
DELTA = 0.01
|
36
|
+
|
37
|
+
context "when run on binary genome (size=#{GENOME_SIZE})" do
|
38
|
+
setup do
|
39
|
+
@population = EvoSynth::Population.new
|
40
|
+
individual_one = TestArrayBinaryIndividual.new(GENOME_SIZE)
|
41
|
+
individual_one.genome.map! { |gene| true }
|
42
|
+
individual_two = TestArrayBinaryIndividual.new(GENOME_SIZE)
|
43
|
+
individual_two.genome.map! { |gene| false }
|
44
|
+
|
45
|
+
@population << individual_one << individual_two
|
46
|
+
end
|
47
|
+
|
48
|
+
context "before recombination is executed" do
|
49
|
+
should "all genes of individual one should be true" do
|
50
|
+
@population[0].genome.each { |gene| assert gene }
|
51
|
+
end
|
52
|
+
|
53
|
+
should "all genes of individual two should be false" do
|
54
|
+
@population[1].genome.each { |gene| assert !gene }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "after recombination is executed #{TIMES} times" do
|
59
|
+
setup do
|
60
|
+
recombination = EvoSynth::GlobalRecombinations::GlobalUniformCrossover.new
|
61
|
+
@count_false, @count_true = 0, 0
|
62
|
+
TIMES.times do
|
63
|
+
child = recombination.recombine(@population)
|
64
|
+
child.genome.each do |gene|
|
65
|
+
if gene == true
|
66
|
+
@count_true += 1
|
67
|
+
elsif gene == false
|
68
|
+
@count_false += 1
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
should "all genes of the parent one should (still) be true" do
|
75
|
+
@population[0].genome.each { |gene| assert gene }
|
76
|
+
end
|
77
|
+
|
78
|
+
should "all genes of the parent two should (still) be false" do
|
79
|
+
@population[1].genome.each { |gene| assert !gene }
|
80
|
+
end
|
81
|
+
|
82
|
+
should "around 50% of the genes should have mutated to false" do
|
83
|
+
assert_in_delta((GENOME_SIZE/2)*TIMES, @count_true, DELTA * (GENOME_SIZE/2) * TIMES)
|
84
|
+
assert_in_delta((GENOME_SIZE/2)*TIMES, @count_false, DELTA * (GENOME_SIZE/2) * TIMES)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|