Skip to content

A genetic algorithm (Local search) approach to solve the 0/1 Knapsack Problem.

License

Notifications You must be signed in to change notification settings

pratikgl/KnapSack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KnapSack

A genetic algorithm (Local search) approach to solve the 0/1 Knapsack Problem.

The genetic algorithm is implemented in the header file utility.hpp. The program after solving Knapsack using genetic algorithm compares the result with the optimal answer calculated using dynamic programming. This dynamic programming algorithm is implemented in dp.hpp.

Installation

  1. Clone the whole repo on your local machine using
git clone https://github.com/pratikgl/KnapSack.git
  1. The project is tested on g++ (GCC) 9.3.0. Check your GCC version using
g++ --version
  1. Compile main.cpp
g++ -o KnapSack.exe main.cpp
  1. Run the compiled program
./KnapSack.exe

Contributing

The implementation is simple and straightforward. However, the efficiency of the implementation can be improved. Please feel free to contribute.

License

MIT

About

A genetic algorithm (Local search) approach to solve the 0/1 Knapsack Problem.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages