Skip to content

traoremp/genetic_algorithm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Example

Cost and Current Legos

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$ models and prices

Models

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. models and prices

Possible solution

[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

Data Information by line

  1. Number of legos by type
  2. Current Legos
  3. Lego cost for each type
  4. Number of models
  5. From this line to the end is all possible model configurations

models and prices

How to run the the script

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.9%
  • Shell 2.1%