Small project for the "Fundamentals of AI" course at Politecnico di Milano.
The project consists of the following files:
Report.pdf(In italian): This document provides an overview of the project, explaining the code implemented inmastermind.cppand the concepts of genetic algorithms. It also presents the application by hand of a genetic algorithm to optimize the parameters ofmastermind.cpp.mastermind.cpp: This C++ file contains the implementation of the game of Mastermind, which utilizes a genetic algorithm to solve itself. It prints out the number of generations required to find the correct solution.
The main objective of this project was to gain an understanding of genetic algorithms and their application. The mastermind.cpp file serves as a self-solving version of the game of Mastermind, providing the number of generations required for convergence.
In the report.pdf file, a genetic algorithm was manually applied to optimize the parameters used in mastermind.cpp. This optimization process involved adjusting variables such as the probability of mutation, type of crossover, type of fitness function and so on. The number of generations taken by mastermind.cpp served as the fitness function for the genetic algorithm described in the report.