
Genetic Algorithms in CoffeeScript - janmonschke
http://janmonschke.com/Genetic-Algorithms/presentation
======
jashkenas
Direct link to the code, which is nice and clear to read (Genome /
Population):

[https://github.com/janmonschke/Genetic-Algorithms/tree/gh-
pa...](https://github.com/janmonschke/Genetic-Algorithms/tree/gh-
pages/coffeescripts)

------
SeanLuke
Suggestion: TSP is a combinatorial optimization problem and isn't well suited
to GAs. You would be much better off using a method meant for combinatorial
optimization: notably ant colony optimization.

~~~
PeteBrighton
If you don't mind expanding a little, I'd be interested to know why they're
not suited to combinatorial optimization, and what they are in fact more
suited to?

~~~
jules
I have searched for a problem that they're more suited to, and I've come to
the conclusion that GAs are in fact not known to work on any problem. They do
"work" in the sense that sometimes they find an answer, but there are other
algorithms that are much simpler and consistently outperform them (notably
randomized hill climbing). Here is a paper that despite trying to prove the
opposite, clearly shows that GAs are NOT a good way to solve any problem:
<http://web.cecs.pdx.edu/~mm/nips93.pdf>

~~~
moconnor
That's not quite my understanding of the paper's results: "As can be seen, the
time to reach level one is comparable for the two algorithms, but the GA is
much faster at reaching levels 2 and 3. Further, the GA discovers level 3
approximately twice as often as RMHC [randomized hill climbing]"

I don't dispute that there are generally better optimization algorithms than
GAs, but this paper does present an artificial case in a GA outperforms hill
climbing.

~~~
jules
See my reply here for an explanation of how little that conclusion of the
paper means: <http://news.ycombinator.com/item?id=4561418>

In particular they tuned the GA but not he hill climber, so it's not clear
that GAs win even on this artificially designed problem.

~~~
Turing_Machine
Wait a minute. First you were citing the paper's conclusion as supporting your
position and now you're attacking the paper's conclusion?

~~~
jules
I never cited the paper's conclusion as my position. What the paper shows is
not what the paper concludes. The authors clearly didn't want to show that GAs
are inferior, though inadvertently they certainly did. BTW, the authors of the
paper conclude that further research is necessary to find cases where GAs
outperform hill climbing.

------
mck-
Everyone seems to claim a better way to do it (myself included).

Here's a TSP challenge for you to prove yourselves:
<http://www.tsp.gatech.edu/data/usa/index.html>

Deadline is July 4th, 2013 -- Price $500 & Honourable mention for finding the
shortest path to the world's largest TSP problem.

~~~
Turing_Machine
Anyone who came up with a radically superior solution to that problem could
use it to make significantly more than 500 bucks. :-)

------
domlebo70
Can't help this example could have been illustrated much more clearly in
something other then CoffeeScript.

~~~
Destroyer661
Out of all the languages to choose from it just _had_ to be coffescript...

~~~
janmonschke
It's my main language for almost two years now ;)

~~~
Destroyer661
I'm not saying that it being your main language is bad, it's just the syntax
is absolutely terrible to read and understand for those of us on C-style
languages. If the point was to _teach_ others, the vast majority of your
audience is not going to be reading coffeescript and learning much.

~~~
phpnode
that's funny because coffeescript is _meant_ to be all about readability in
code. I wonder if you really tried to read this or if you just commented based
on the title. If you did really read it, I wonder if you found it hard to read
_because_ your opinion is tainted by those C style languages? It's not
scientific of course but I just got my non coder, non technical girlfriend to
read through both the coffeescript and javascript versions of this and I
definitely had to explain a lot less to her with the coffeescript version, she
says it's easier to read because it's structured more like plain English.

~~~
jashkenas
Hurrah. That's a big part of the entire premise.

------
unix-dude
Just ran through this quickly, I don't know too much about algorithms, so I
can't judge GA's usefulness when compared to other methods, but it certainly
seems like a cool/fun thing to implement.

------
the_cat_kittles
This got me thinking- is there a use case for client-side ML?

~~~
dmix
The better question is would you even _want_ to do ML in javascript?

~~~
the_cat_kittles
for client side ML! hence my question...

~~~
dmix
Well, ML is almost always very CPU and memory intensive, I'm not sure how
running any data-heavy algorithms would make sense in a browser.

------
cbrandolino_
That's supernice!

You may want to fix the links in the readme though.

~~~
janmonschke
Thanks Claudio, I fixed them!

------
grendelt
What did you/he use to make the presentation?

~~~
janmonschke
I used reveal.js: <http://lab.hakim.se/reveal-js/>

------
abuiles
Nice talk Jan!

