Home > genetic-knapsack

genetic-knapsack

Genetic-knapsack is a project mainly written in Common Lisp, it's free.

Computes estimates for the Knapsack Problem using a Genetic Algorithm.

Notes:

  • Run using "clisp ga_knapsack.lisp". I recommend a large terminal to see pretty-display for the output.

  • Tweaking parameters for num-generations, mutation-rate, ks-size, ks-pop-size, ks-overstuff-penalty should drastically change the results of the program. I found the current parameters to be fairly good.

Improvements:

  • Make global parameters into command line arguments. This would be really useful since tweaking all of these has such a big impact.

  • Create new knapsack item files, with different values to test with.

  • Parse a more human readable format for reading item files. Using a lisp file with item structs in it feels like cheating.

  • Create alternate solve- function for running until convergence in the population is detected.

  • Separate helper functions, genetic algorithm base, and knapsack problem into different modules. I don't understand the lisp module system very well.

Previous:stacks