Search
The goal of this lab exercise is the implementation of an evolutionary algorithm and its application to optimization problems defined in previous lab exercises. The specification of individual EA parts is rather conceptual: they can be implemented in many different ways; use the following description as a specification of the abilities that the implementation should posses, rather than a direct specification of the implementation.
If you do not complete all parts during the lab time, finish the work at home.
The main difference between EA and local search is the fact that the algorithm state is represented by a whole set of candidate solutions, not by a single candidate solution. Think about the representation of the population. Evaluate pros and cons of the following options:
Implement a function that will create an initialized population of candidate solutions. The output, of course, depends on the chosen representation. The function may (and should) take advantage of the functions for a single solution initialization, that we implemented in the previous lab exercises.
If you will not manage to create a universal initialization function, that's OK. You will just have to create more of them, more specialized ones.
Implement a function for parent selection.
Choose one selection type and implement it first. The others can wait. You can try:
Implement a function for crossover. The crossover type will depend on the representation. Think about inputs and outputs (how many parents will enter the function, how many offspring will be generated).
Again, choose one type of crossover and implement it first. The others can wait. You can try
Do not bother with mutation. Perturbation functions we implemented in previous exercises can be directly used as mutation operators.
Implement a function for replacement strategy.
Choose one type of replacement strategy and implement it first. The others can be implemented as needed. You can try:
When choosing the parental selection and replacement strategy for your EA, at least one of these two functions should provide some selection pressure, i.e., prefer better individuals. Otherwise, your EA will work as a random search.
Implement a function/class that will represent the evolutionary algorithm.
Think whether it is better to provide many input parameters or whether it wouldn't be better to use some data structure representing an EA configuration that would be given to the solver as a single argument (almost).
Try to apply the visualization tools from previous exercises to the outputs of LS and EA and try to compare both types of algorithms when applied on the same optimization problem.
Try to compare both types of algorithms on various binary and real problems.