When looking at the last example in 5.3.2 working on a bimodal function, one might ask how to retrieve more than just one optimum of the target function. In EVA2 there are some optimizers implemented which are specialized on this task. Listing 9 shows an example using the clustering-based niching EA (CBN-EA) [7] and post-processing to identify both optima of the target function.
Notice that two post-processing cycles are performed (lines 26 and 33). Any repeated post-processing iteration performed on the OptimizerFactory uses the same initial state. This means that if there is no new optimization cycle, any new post-processing will work on the same set of solutions, namely the result population of the last optimization.
This is useful, for example, to search for optima using different resolutions iteratively. In our example, we however just demonstrate the different results without (line 26) and with clustering (line 33). If you run the example a few times, it will happen quite often that after the first post-processing with clustering only, more than the two optima are returned, while after the second step with hill climbing, this will happen rather seldomly. All in all, CBN locates the two optima in most of the cases and post-processing helps to identify the real hot spot. In Fig. 5.3.1, two graphs show the target function and the states of an exemplary CBN-run after 500 (left) and 1,500 evaluations (right).
The FM0Problem is of course very simple, 2-dimensional and having only two optima in the defined range. For harder problems, a few thousand evaluations will not suffice, and for highly multi-modal target functions, e.g. if there are thousands or tens of thousands of local optima, things get really tough. The current implementation of CBN is able to find more optima than the population size defined, because it is able to reinitialize a converged cluster during a run, saving a representative to an archive. But for problems with a lot of deceptive optima, it might also be a good strategy to concentrate on finding one global optimum, and, as it won't be found in most of the runs, look at the results of the single-run solution set.