Skip to content

Am1rMahd1/Genetic-algorithm-for-0-1-Knapsack-Problem

Repository files navigation

Solve 0-1 Knapsack using Genetic Algorithm

This readme file provides an overview of a Python program that aims to solve the 0-1 Knapsack Problem using the Genetic Algorithm. The program follows the principles of SOLID to ensure clean and maintainable code.

Genetic Algorithm Components

The Genetic Algorithm in this scenario consists of the following components:

  1. Selection Operator: Tournament Selection is used as the selection operator.
  2. Crossover Operator: Single Point Crossover is used as the crossover operator.
  3. Mutation Operator: Bit Flip Mutation is used as the mutation operator.

Considered Attributes

In the 0-1 Knapsack problem implemented in this program, the following attributes are considered for each item:

  • Weight
  • Size
  • Value

Installation

To install the required dependencies, please use the package manager pip and run the following command:

pip install -r .\\requirements.txt

Contributing

Contributions in the form of pull requests are welcome. If you plan to make major changes, please open an issue first to discuss the proposed modifications.

License

This program is licensed under the MIT License.