[yul-phaser] Population: Customizable chromosome length in makeRandom()

This commit is contained in:
Kamil Śliwak
2020-02-18 19:40:37 +01:00
parent e771f00971
commit 806891f494
4 changed files with 96 additions and 10 deletions
+6 -1
View File
@@ -28,6 +28,7 @@
#include <boost/program_options.hpp>
#include <iostream>
#include <functional>
#include <string>
using namespace std;
@@ -70,7 +71,11 @@ CharStream loadSource(string const& _sourcePath)
void runAlgorithm(string const& _sourcePath)
{
CharStream sourceCode = loadSource(_sourcePath);
auto population = Population::makeRandom(Program::load(sourceCode), 10);
auto population = Population::makeRandom(
Program::load(sourceCode),
10,
bind(Population::binomialChromosomeLength, Population::MaxChromosomeLength)
);
population.run(nullopt, cout);
}