Submission of solutions

Evolutionary algorithms are based on randomness, i.e. each run can have a slightly different outcome. Therefore, it is not possible to compare the results of only one run. Instead, we need to repeat the run a number of times and compare the performance in the average/best/worst case.

The submitted solution must contain the following:

  1. A short description of what you did and tried, what was the outcome. Around 5-10 sentences are enough.
  2. A plot showing the optimized criteria as a function of fitness evaluations. The plot must show the average (or median) value and first and third quartile. If you compare more algorithms, they all should be in a single plot.
  3. Do not zip the plots (unless there is a lot of them}. Upload them as pictures.

Scripts to create the plots

In the repository, you can find the plotting.py file. This can be used as a baseline to create your plots. The main function there is utils.plot_experiments that takes two arguments - the path to the directory with the logs of your runs, and a list of experiment IDs of the experiments you want to plot (The experiment ID can be set in each of the scripts you will get for each of the assignments in the variable EXP_ID.) Additionally, you can also add a rename_dict where you can specify more readable names for you experiments that will be displayed in the legend. For example, if you used EXP_ID = 'pop100m0.3' for your experiment with population size of 100 individuals and mutation rate of 0.3, you can add parameter rename_dict={'pop100m0.3': 'Population size = 100, Mutation rate = 0.3'}.

You may need to adapt the script slightly, if you want to change the scaling of the plot, or limit the ranges of the axis. You can always add additional matplotlib commands later, for example, if you want to change the scaling of the y-axis to logarithmic scaling, you can add plt.yscale('log') above the line with plt.show().

The following hints may help you to make better graphs

  • If both algorithms converge long before they are stopped, the plot contains long almost horizontal lines and most information is contained on the left side -> set a suitable limit for the x axis (plt.xlim), or use logarithmic scale on the y axis (see below)
  • If one of the algorithms converges much faster than the other, use logarithmic scale to emphasize the left part of the plot. (plt.xscale('log')).
  • If there is a large difference in the objective values in the beginning of the evolution and in the end, it can lead to almost vertical lines in the plot, again, use log scale.
Naposledy změněno: pondělí, 13. října 2025, 12.19