Skip to content

Solving binary knapsack problem using genetic algorithm

Notifications You must be signed in to change notification settings

souvikshanku/bkga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Solving binary knapsack problem using genetic algorithm

Topics

Resources

Stars

Watchers

Forks

Languages