The choice of parent or parents which will participate in a genetic operation in the EA framework is made by a solution processor. Normally, a processor playing the role of a selector takes the population as input, and generates a requested number of solutions. (The number to be requested will depend on the exact type of genetic operator which requests the solutions.) Although a pool processor performs the selection of solutions, it is really only a shell which encapsulates an IloSelector<IloSolution,IloSolutionPool>
object which does the main work. The function IloSelectSolutions
produces a pool processor from such a selector. The IloSelectSolutions
function also takes a boolean parameter which dictates if solutions should be selected without duplicates. That is, is it valid for the same solution to appear more than once in the selection?
An example of a selector which is commonly used is the tournament selector, characterized by its tournament size k. This selector selects one solution from the population as follows. First, k different solutions are selected randomly, and without bias, from the input pool. Then, the highest quality solution from these k solution is chosen as the final selected solution. This process is repeated to produce the desired number of selections. When k=1, solutions are selected randomly. As the value of k is increased, the chances are increased that better solutions are selected. However, a balance should be struck, as a value of k that is too high will result in poorer quality solutions rarely being selected and in the context of a genetic algorithm could lead to limited diversity of generated solutions. Below is an example of the use of the tournament selector with tournament size 3.
IloTournamentSelector<IloSolution,IloSolutionPool> tsel(
env, 3, IloBestSolutionComparator(env)
);
IloPoolProc select = population >> IloSelectSolutions(env, tsel);
|
How the tournament selector compares solutions is determined by a solution comparator. A solution comparator is a simple object which determines if one solution is better than another according to some criterion. IloBestSolutionComparator
uses the IloSolution::isBetterThan
member function to compare solutions. You could equally have the following:
IloComparator<IloSolution> compare = IloWorstSolutionComparator(env);
IloTournamentSelector<IloSolution,IloSolutionPool> tsel(env, 3, compare);
IloPoolProc select = IloSelectSolutions(env, tsel);
|
This would tend to select poorer solutions with greater probability. You may inquire as to the usefulness of such a selector as it surely selects poor quality solutions. We will return to this in a following section on solution replacement.