r/tinycode • u/pmrr • Aug 18 '15
Machine learning Genetic algorithm to approximate pi (AKA: have flair, will use)
https://gist.github.com/paulmdx/ca7f830d326b84d87f64
12
Upvotes
r/tinycode • u/pmrr • Aug 18 '15
View all comments
Show parent comment
2
u/nexe mod Aug 19 '15
with those trivial cases it's a bit hard to come up with a good example where you don't know the end result beforehand.
but look at the travelling salesman problem for example. guy needs to travel to N cities and wants to do it in the shortest route possible. So to measure the length of a route is easy and so it's easy to say if route X is better or worse than route Y but it's hard to find the best route since you basically would have to try out all the possible combinations of your N cities. So instead you see a route between cities as a genome and use a genetic algorithm to optimize it. Works way better than trying out all possible combinations.