From 3aaca31c31e80151f4b3208194a76a329f38e79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 5 Feb 2020 19:25:15 +0100 Subject: [PATCH] [yul-phaser] main: Change the number of chromosomes preserved in every round of the algorithm to 1 --- tools/yulPhaser/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/yulPhaser/main.cpp b/tools/yulPhaser/main.cpp index d3ea9d713..26a2ea005 100644 --- a/tools/yulPhaser/main.cpp +++ b/tools/yulPhaser/main.cpp @@ -71,6 +71,7 @@ CharStream loadSource(string const& _sourcePath) void runAlgorithm(string const& _sourcePath) { + constexpr size_t populationSize = 10; constexpr size_t minChromosomeLength = 12; constexpr size_t maxChromosomeLength = 30; @@ -78,7 +79,7 @@ void runAlgorithm(string const& _sourcePath) shared_ptr fitnessMetric = make_shared(Program::load(sourceCode), 5); auto population = Population::makeRandom( fitnessMetric, - 10, + populationSize, minChromosomeLength, maxChromosomeLength ); @@ -86,7 +87,7 @@ void runAlgorithm(string const& _sourcePath) population, cout, { - /* elitePoolSize = */ 0.5, + /* elitePoolSize = */ 1.0 / populationSize, /* minChromosomeLength = */ minChromosomeLength, /* maxChromosomeLength = */ maxChromosomeLength, }