edervishaj / genetic-knapsack

A genetic algorithm implementation of the binary Knapsack problem.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implementation of the binary Knapsack Problem with a genetic algorithm approach.

The input to the solver (KnapSackGA.java) is a file called init.txt which contains in each line the followings:

  1. number of items (e.g. 7)
  2. value of each item (space separated) (e.g. 1 2 3 4 5 6 7)
  3. weight of each item (space separated) (e.g. 14 11 10 13 12 9 8)
  4. knapsack maximum size (e.g. 70)
  5. population size (e.g. 50)
  6. number of generations (e.g. 100)
  7. crossover probability (e.g. 0.6)
  8. mutation probability (e.g. 0.015)

About

A genetic algorithm implementation of the binary Knapsack problem.


Languages

Language:Java 100.0%