in reply to Brute force vs algorithm (PWC # 100)

The classic non-brute-force approach to search a tree for an optimal path is the branch-and-bound algorithm.

Basically, you try to continue a path only if it's "partial weight" is under the current minimum.

Once you reached the bottom line you can be sure you didn't miss any possible better solution, since all other partial path had higher weight.

Tho this "might" be easier when solved backwards by starting from the bottom line.

And the triangle structure might lead to more possible short-cuts.

DISCLAIMER: The given example is probably too small to show the benefits of BaB over brute-force, because the algorithm's overhead doesn't pay off with a tiny data set.

HTH!

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re: Brute force vs algorithm (PWC # 100)