An implementation of genetic algorithm