victor-mlai / GeneticAlgorithm

solves the Knapsack problem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeneticAlgorithm

solves the Knapsack problem

The DNA

contains 0s and 1s.

0 means the object i is not included in the knapsack

Selection

uses the proportional roulette wheel selection

Cross-over

randomly choose the gene from parent0 or parent1

Mutation

randomly flip the bit ( 1->0 and 0->1 )

Repeat until I get the same result nr_tries times

About

solves the Knapsack problem


Languages

Language:C++ 100.0%