This project was done in order to learn how we can use a genetic algorithm to solve complex problems.
The problem we face in this project is that we want to get rid of our legos by building models. However, it's impossible to get rid of them without having to buy other parts.
The first row represents the price of each type of lego and the second row represents the current total we have for each type of lego. For example, for the first lego we have 4 parts and the cost of each piece of the first lego is 8$
This table represents the models we can construct. For each model, we have an array of numbers that represents the number of parts of each lego needed in order to construct this model. For example, the model [1, 0, 1] means that we need 1 of the first type of lego, 0 of the second type of lego and 1 of the third type of lego.
[4, 6, 7] - [2, 4, 4] = [2, 2, 3]
[2, 2, 3] - [2, 4, 4] = [0, -2, -1]
[0, -2, -1] * [8, 2, 3] = -7
Therefore, we need to spend 7$ in order to construct twice the third model
Data Information by line
- Number of legos by type
- Current Legos
- Lego cost for each type
- Number of models
- From this line to the end is all possible model configurations
In order to start the algorithm you need to entrer this command :
./run.sh -e /home/ayoub/Desktop/genetic_algorithm/exemplaires/LEGO_50_50_100
after -e you need to provide the path of the data.