The psuedo-code you have listed above is the basic principle of a genetic algorithm (GA) but to really go down the GA route you need to initially constuct MANY random solutions as follows...
- Define a way of encoding your solutions into a data set e.g. Binary, hex, tree...
- Create 20 random candidate solutions using your encoding.
- Measure how well each of these work (the 'fitness')
- Mutate the populations at random.
- Crossover different candidate solutions. (many different methods can be applied here to choose which to cross)
- Measure the new fitness of the new 20 candidate colutions.
- Is this fitness satisfactory? If not go back to step 4 (or stop if you are on the Nth itteration)