codenameyau / hello-evolution

String matching genetic algorithm with fitness+diversity
MIT License
0 stars 0 forks source link

Improve selection algorithm #1

Open codenameyau opened 8 years ago

codenameyau commented 8 years ago

Right now, fitness seems perpetually stuck at 1 or 2 even after several generations. Here are some ways to improve the algorithm.

codenameyau commented 8 years ago

As of 9b7d6b677c23c28a8592cf4747274bc58f561c67:

Target String: "Hello World!"
Population Size: 100

Number of Trials: 50
Mean Generations: 75.42
Standard Deviation: 35.33864739912947
codenameyau commented 8 years ago

Fixing numSurvived to 2 parents seems to yield better results. Perhaps not statistically significant.

Target String: "Hello World!"
Population Size: 100

Number of Trials: 50
Mean Generations: 68.42
Standard Deviation: 32.514417524211865
codenameyau commented 8 years ago

Results of study:

Population size and diversity has a significant impact on the time it takes to reach the target fitness.

Target String: "Hello World!"
Number of Trials: 25

---

Population Size: 20
Mean Generations: 435.4
Standard Deviation: 287.02003414396006

Population Size: 100
Mean Generations: 50.84
Standard Deviation: 19.79410686711241

Population Size: 200
Mean Generations: 22.32
Standard Deviation: 4.905099387372289

Population Size: 400
Mean Generations: 18.84
Standard Deviation: 3.423935357645254

Target String: "Hello World!"
Population Size: 100

# Rank by fitness.
Number of Trials: 25
Mean Generations: 78.52
Standard Deviation: 31.687431788223755

# Rank by score (fitness + diversity).
Number of Trials: 25
Mean Generations: 42.52
Standard Deviation: 17.10535978380266