Solves the knapsack problem using a genetic algorithm