CodeBullets amazing video on the subject.Genetic algorithm for machine learning. Inspired by
This is a work in progress
- Natural selection.
- Mutate babies.
- Rinse and repeat.
Geneinterface definitions. Users should implement
Genomeinterface and use
geneticdirectory contains genetic algorithm implementation
rocket for a demonstration on rocket stage optimization. Below is the output of said program
champHeight:101.619km champHeight:138.558km champHeight:141.474km champHeight:141.474km champHeight:141.474km champHeight:141.474km champHeight:141.474km champHeight:141.478km champHeight:141.478km champHeight:141.538km our champion: Stage 0: coast=135.2s, propMass=195.4kg, Δm=99.77kg/s, totalMass=395.4 Stage 1: coast=145.9s, propMass=1.2kg, Δm=0.14kg/s, totalMass=21.2
The following command will run an example of what genetic algorithm is possible of doing. It is solving CodeBullet's proposed problem of moving points towards a goal point.
go run ./examples/dotforces/
elitescore is the fitness or "score" of the best child in the generation. As you can see it gets larger.
gen 10: totalfitness=1032.37, elitescore=10.24671 gen 20: totalfitness=1325.90, elitescore=11.98153 gen 30: totalfitness=1374.32, elitescore=11.98153 ... ten seconds later... gen 300: totalfitness=2169.45, elitescore=16.26937
The score went from 10 to 16 with help of a genetic algorithm.