Genetic algorithm
In many problems, genetic algorithms have a tendency to converge towards local optima or even arbitrary points rather than the global optimum of the problem. This means that the algorithm does not "know how" to sacrifice short-term fitness to gain longer-term fitness. The likelihood of this occurring depends on the shape of the fitness function: certain problems make it easy to find the global optimum, others may make it easier for the function to find the local optima. This problem may be lessened by using a different fitness function, increasing the rate of mutation, or by using selection techniques that maintain a diverse population of solutions. A common technique to maintain diversity is to use a "niche penalty": any group of individuals of sufficient similarity (niche radius) have a penalty added, which will reduce the representation of that group in the following generations, permitting other (less similar) individuals to be kept in the population. This trick, however, may not be effective, depending on the landscape of the problem. Another possible technique would be to simply replace part of the population with randomly generated individuals, when most of the population is too similar to each other. Diversity is important in genetic algorithms (and genetic programming) because crossing over a homogeneous population does not yield new solutions. In evolution strategies and evolutionary programming, diversity is not essential because of a greater reliance on mutation.