Author | Message |
---|---|
rabbott
Posts: 1649
|
Posted 13:25 Nov 27, 2019 |
The GA GitHub repo now includes the three original examples along with a Population_and_Utils.py file. The latter factors out the Population and Utils classes from the others. To write your own GA you can usually write only an Individual.py file. If you want to define your own crossover or mutation operators you can include them in the Individual.py file--although there is no harm in adding them to your copy of the Population_and_Utils.py file. For best printing results include a "\n" at the start of the definition of an individual's __str__ function. (The __str__ function is equivalent to Java's toString function. It converts an object to a string, typically to be used for printing.) Last edited by rabbott at
16:28 Nov 27, 2019.
|