Tweak Chromosome mutation probability
This commit is contained in:
parent
359acd4b10
commit
e7a51448c2
1 changed files with 3 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ std::mt19937_64* Chromosome::re;
|
||||||
Chromosome::Chromosome()
|
Chromosome::Chromosome()
|
||||||
{
|
{
|
||||||
// this->genes is already empty
|
// this->genes is already empty
|
||||||
this->circle.setPointCount(100);
|
this->circle.setPointCount(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,9 +60,9 @@ Chromosome::Chromosome(Chromosome& father, Chromosome& mother) :
|
||||||
|
|
||||||
void Chromosome::mutate()
|
void Chromosome::mutate()
|
||||||
{
|
{
|
||||||
std::uniform_int_distribution<> booldist(0, 1);
|
std::uniform_int_distribution<> mutatedist(0, 1); // 1/2 of the time, it mutates everytime!
|
||||||
std::uniform_int_distribution<> choicedist(0, 12);
|
std::uniform_int_distribution<> choicedist(0, 12);
|
||||||
while (booldist(*Chromosome::re)) {
|
while (mutatedist(*Chromosome::re)) {
|
||||||
int choice = choicedist(*Chromosome::re);
|
int choice = choicedist(*Chromosome::re);
|
||||||
|
|
||||||
if (choice < 1) { // add
|
if (choice < 1) { // add
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue