Rebane's Ruminations
July 2025
S M T W T F S
 12345
6789101112
13141516171819
20212223242526
2728293031  

ARCHIVES


OUR LINKS


YubaNet
White House Blog
Watts Up With That?
The Union
Sierra Thread
RL “Bob” Crabb
Barry Pruett Blog

George Rebane

OK boys and girls, it’s time to take a break from our socio-political harangues and debates, and delve into something more intellectual yet delightfully accessible.  The figure contains a 10-by-10 network of nodes each identified by their blue numbers from 1 to 100.  The related red numbers denote the cost of traversing that node.

RandonArray

The problem to be solved is to identify the minimum cost path between a given starting node and a destination node.  Here, let’s arbitrarily say we wanted to start on node 19 and end on node 92.  What is the path or sequence of nodes to be traversed that minimizes the total cost of the trip when all the costs of the visited nodes are added up?  And as you puzzle on the solution, see if you can come up with an algorithm that can solve all such problems.

The rule for traversing is that allowable steps for any given node are the eight or fewer  of its neighboring nodes.  For example, from node 25 you can step to nodes 14, 24, 34, 15, 35, 16, 26, 36; and from node 31 you can step to 21, 41, 22, 32, 42.

This is a simplified yet still powerful version of a problem that I had to solve long ago on a contract to develop an interactive combat system for combined arms field operations.  The specific problem was to compute and display a minimum time feasible path across a region of complex terrains for a given make-up and size of a combat unit to get from their current location(s) to a selected location.  Today a version of the resulting algorithm is used in you car’s and cell phone’s route calculating apps.  Have fun and let us know your solution and algo.

Posted in

3 responses to “Getting from here to there”

  1. MikeL Avatar
    MikeL

    19-28-38-47-46-55-54-63-74–92. Is the least costly path. The general algorithm will take some more time.

    Like

  2. The Estonian Fox Avatar
    The Estonian Fox

    Unfortunately MikeL, you skipped node 83, giving your path a total of 416.
    My path.. MikeL path
    19.. 80.. 80 19
    28.. 40.. 40 28
    38.. 32.. 32 38
    47.. 45.. 45 47
    46.. 49.. 49 46
    55.. 12.. 12 55
    54.. 17.. 17 54
    63.. 51.. 51 63
    72.. 26.. 25 74
    81.. 36.. 59 83
    92… 6…. 6 92
    … 394 …..416
    nodes 63-72-81 are less than 63-74-83. Algorithms will be more difficult, since scanning must be done possibly up to 4 nodes away.
    But a 1st alternative – fold the matrix on itself.
    If folded around a vertical axis (column 1-10 matches up to column 91-100) can do 19 to 92 in 334.
    19 80
    8 55
    7 28
    6 10
    5 64
    94 78
    3 13
    92 6
    … 334
    But if folded about a horizontal axis (row 1-91 matches up to row 10-100), can do it in 268.
    19 80
    30 18
    40 4
    41 44
    51 28
    62 26
    72 26
    81 36
    92 6
    … 268
    So there are 3-dimensional advantages. George, you didn’t explicitly state this folding couldn’t be done, though the implication is that this is a 2-D matrix.

    Like

  3. gjrebane Avatar

    Gentlemen, thank you for your submittals. Yes, as described above for the allowed inter-node transitions, the space of this puzzle is explicitly two dimensional. My solution for the minimum cost path is given by the following address/cost tuples which yield a path cost of 387 (unless I blew my arithmetic).
    19-80
    28-40
    37-70
    46-49
    55-12
    54-17
    63-51
    72-26
    81-36
    92-6
    Please keep working on programmable algos to compute such minimum cost paths given arbitrary start and end nodes. We can then test them for correctness and compactness.

    Like

Leave a comment