mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[yul-phaser] main: Change the number of chromosomes preserved in every round of the algorithm to 1
This commit is contained in:
parent
4aac7d1673
commit
3aaca31c31
@ -71,6 +71,7 @@ CharStream loadSource(string const& _sourcePath)
|
|||||||
|
|
||||||
void runAlgorithm(string const& _sourcePath)
|
void runAlgorithm(string const& _sourcePath)
|
||||||
{
|
{
|
||||||
|
constexpr size_t populationSize = 10;
|
||||||
constexpr size_t minChromosomeLength = 12;
|
constexpr size_t minChromosomeLength = 12;
|
||||||
constexpr size_t maxChromosomeLength = 30;
|
constexpr size_t maxChromosomeLength = 30;
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ void runAlgorithm(string const& _sourcePath)
|
|||||||
shared_ptr<FitnessMetric> fitnessMetric = make_shared<ProgramSize>(Program::load(sourceCode), 5);
|
shared_ptr<FitnessMetric> fitnessMetric = make_shared<ProgramSize>(Program::load(sourceCode), 5);
|
||||||
auto population = Population::makeRandom(
|
auto population = Population::makeRandom(
|
||||||
fitnessMetric,
|
fitnessMetric,
|
||||||
10,
|
populationSize,
|
||||||
minChromosomeLength,
|
minChromosomeLength,
|
||||||
maxChromosomeLength
|
maxChromosomeLength
|
||||||
);
|
);
|
||||||
@ -86,7 +87,7 @@ void runAlgorithm(string const& _sourcePath)
|
|||||||
population,
|
population,
|
||||||
cout,
|
cout,
|
||||||
{
|
{
|
||||||
/* elitePoolSize = */ 0.5,
|
/* elitePoolSize = */ 1.0 / populationSize,
|
||||||
/* minChromosomeLength = */ minChromosomeLength,
|
/* minChromosomeLength = */ minChromosomeLength,
|
||||||
/* maxChromosomeLength = */ maxChromosomeLength,
|
/* maxChromosomeLength = */ maxChromosomeLength,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user