Genetic algorithm to solve the knapsack problem