I previously discussed the need for optimization in a trading system and the simple, efficient hill climbing algorithm to automate the optimization. Here's a diagram which shows the "path" a hill climbing algorithm might take and also a problem it can encounter:
A "local" maximum [in contrast to a "global" maximum] is a point that's higher than what's around it but not actually the highest. For example with a simple moving average crossover indicator: lengths of 7 and 20 days work pretty well, even better than 8 and 21 day MAs but in fact 22 and 55 weeks is more profitable. The hill climbing would not go past 7 and 20.
Simulated Annealing improves on hill climbing. First, here is some background to help with the intuition-
Sim. annealing is hill climbing plus the addition of random jumps. Hill climbing will do this, for example: test 5-day then 6-day then 7-day then 8-day moving averages and finally going back to 7-days. Sim annealing might do this, for example: test 5-day then 7-day then 6-day then 7-day [again] then 10-day then 14-day then 15-day and finally go back and settle on a 14-day MA. In this case we imagine that the 14-day MA is the global maximum (or at least a better local maximum). Here's a visual explanation of how sim. annealing follows from hill climbing:
The inspiration for simulated annealing is the ancient process of forging iron. Instead of optimizing profits, it optimized the metal's hardness. The blacksmith's hammer guided the iron into the desired shape and density while the heat made the iron more malleable and responsive to the hammer. Essentially hill climbing is equivalent to a blacksmith hammering without heat. Annealing is the word for heating a metal and then cooling it slowly.

Simulated annealing will outperform hill climbing when the local maximum is near the global maximum. In this case one of the jumps may get far enough from the local max to reach the ascending slope of the global max:
We can see in that example visual that the first hypothetical jump did not escape the local max but the second one did. Now we can expect to make the most profit this system is capable of.Keep in mind as I continue through various optimization schemes (genetic algorithms soon), is that not every problem needs to be solved with the most powerful algorithm. One would not hire a PhD to install a lightbulb. Similarly, the hill climber will be more efficient than sim. annealing in many cases- random jumps can take you further from a maximum and can be computationally expensive to calculate (i.e. waste CPU power). Naive developers always seem eager to apply genetic algorithms (or ant colony/swarm optimization) when they are actually very very slow and complex to properly configure.

8 comments:
Hi Max Dama,
I'd like to use the diagram of hill climbing for one of my lectures, and I'd like to ask your permission.
Thanks
Nil Geisweiller
http://sites.google.com/site/ngeiswei/Home
ngeiswei you know what gmail.com
Nil,
I send you an email. In case you didn't get it, the answer is yes- feel free to use it without restriction.
Regards,
Max
Hi Max, like Nil, I would be interested to use your hill-climbing, and simulated annealing figures in my PhD thesis... Is it a problem for you ?
It's an honor Emmanuel, please use them.
Regards,
Max
Hi Max,
like everyone else, can I use your great figures for a.i. recitation ?
Thanks,
-- Liron.
Liron,
This is you? http://www.cs.huji.ac.il/~lirchi/
Please feel free to use the images however you'd like.
Regards,
Max
Hi Max Dama,
Same as Nil, I 'd like to use the diagram of hill climbing for my thesis and I'd like to ask your permission. how can I reference it to you? to this site?
Thanks,
Nioosha Madani
Niooshi,
Thanks for asking. You may use the diagram however you'd like without worrying about a reference, or feel free to reference it however you feel is appropriate.
Regards,
Max
Post a Comment