souvikshanku / bkga

Solving binary knapsack problem using genetic algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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


Languages

Language:Python 100.0%