Inspyred is another way to go if you don't want to fork over the dough to Mathworks. Just type `pip install inspyred` and follow the instructions on the tutorial below:
GA is particularly for optimization (called as fitness function in GA). Define an objective function, GA algorithm will generate decision variables (random number approach as it does). Then value of obj fun will be determined. It will go on for several generations as specified by you. Finally, based on the fitness final optimum will be obtained.