Intro to Genetic Algorithms in Javascript Part 2
burakkanber.com
burakkanber.com
That being said, GA's are a great starting point to get into the world of non-convex optimization. I actually wrote a version of GA's that run on the GPU using WebGL -- the demo runs in the browser:
http://petercottle.com/GeneticGPU/index.html
It's also distributed, so you can send the link to a friend and both browsers will divide up the search space and optimize over their half (and compare minimums). Very hacky but fun project for a grad class at Berkeley.
You limit to gradient based techniques but why emphasize convex optimization? That leaves out neural nets and places where SGD can do very well.
Machine learning is basically the combination of statistics and optimization where you can work with a lot of data and the output of your computation is more important than the model. Here GA and other heuristics such as tabu and annealing are just search/optimization techniques for gradient free or NP-Complete problems.
That said, isn't it usually best to use GA algorithms only where a simpler algorithm does not exist? Or does the GA version actually produce better results than dynamic programming?
The knapsack problem does have an excellent dynamic programming solution. And of course, where there's a simpler algorithm, you should use it.
This article isn't about the knapsack problem; it's about learning GAs. The knapsack problem is just an easy-to-visualize and easy-to-implement problem to solve in order to demonstrate features of genetic algorithms.
I once used genetic algorithms for path planning where A* would do. While it was fun to implement, the scoring was based on "goodness of path found in time X" ... I didn't get a very high score on that homework.
On the other hand, I got a surprisingly high score for what was essentially "random guessing until you run out of time".
Edit: the greedy algorithm gives you a solution with a total value of $4,901. So far, the best observed GA solution yields $5,968. 20% or so is a big difference!