Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 529 Bytes

README.md

File metadata and controls

18 lines (12 loc) · 529 Bytes

Solving Binary Knapsack Problem using Genetic Algorithm

Problem Statement

Given a set of $n$ items with weights $\{ w_1, w_2, ..., w_n \}$ and values $\{ v_1, v_2, ..., v_n \}$ with maximum capacity $W$,

maximize $$\sum_{i=1}^n v_ix_i$$

subject to, $$\sum_{i=1}^n w_ix_i \le W,$$ where $x_i \in \{ 0, 1 \} \forall i$ and $x_i$ represents the number of instances of item $i$ to include in the knapsack.

Usage

$ git clone https://github.com/souvikshanku/bkga.git
$ cd bkga
$ python population.py