Re:Genetic Algorithm for Knapsack Problem
by moron4hire on Wednesday June 19, 2013 @08:36AM
(#5905114)
Genetic Programming is a slightly different thing than a Genetic Algorithm, a subclass, really. I didn't read the code too closely on account that C++ template code makes me want to dig my eyes out, but he said he was doing a GA. A GP is a GA where the genes represent Abstract Syntax Trees and the alleles represent instructions.
[ Parent
| on HN ]
Nitpick: there's actually no template code except for passing a few type parameters to the GA library, no different from using ArrayList<MyClass> in Java. However, there's a massive overuse of namespaces and fully-qualified class names - a few using directives would make the code much more legible.
Re:Genetic Algorithm for Knapsack Problem
by tehwalrus on Wednesday June 19, 2013 @09:19AM
(#5905340)
Oh, so this blogger is misusing the term (I scanned a little way down the article and thought I'd concluded he was doing GP). In that case this is much less interesting!
Re:Genetic Algorithm for Knapsack Problem
by moron4hire on Wednesday June 19, 2013 @09:29AM
(#5905393)
I don't get the need for the GA library here. It doesn't seem to have simplified the problem at all. This code looks several orders of magnitude more complex (or at least just ugly) compared to a hand-written GA that just used std::vectors as the genes.