A Greedy approach to the Knapsack problem (https://en.wikipedia.org/wiki/Knapsack_problem). For educational purposes only, don't use this if you care about performance.
This repository provides:
- A method (in ''greedy.py'') that implements a greedy algorithm to solve the 0/1 knapsack problem.
- A method (in ''bruteforce.py'') that finds the optimal solution to the 0/1 knapsack problem by exhaustive search (so we can compare how good the greedy solution is).
- Unit tests (in ''tests/'') for the two former methods for different problem instance types.
- A script (in ''optimality_tests.py'') that checks how close the greedy solution is to the optimum (in terms of how much value we take from the knapsack).