Network traversal algorithm using Anaplan

TristanS
edited October 21 in Modeling

Has anyone implemented a network traversal algorithm in Anaplan? To explain the problem, refer to screenshot below. What I want is to generate a path that goes through all the nodes, e.g. Node 1 to Node 3 then to Node 4 then to Node 2 that returns the path with the lowest weighting. So

  • Node 1 to Node 3 is 7 (as per screenshot)
  • Node 3 to Node 4 is 2
  • Node 4 to Node 2 is 4

Total is 7+2+4 = 13

What I need is an algorithm which will give the lowest value result

Node 4 ⇒ Node 2 ⇒ Node 3 ⇒ Node 1 = 4 + 5 + 2 = 11

Node 3 ⇒ Node 1 ⇒ Node 4 ⇒ Node 2 = 2 + 3 + 4 = 9

Node 1 ⇒ Node 2 ⇒ Node 3 ⇒ Node 4 = 1 + 5 + 2 = 8

With the simulations above, the last one which results in 8 is the best path.

If you did computer science in Uni you would have had to solution this using a recursive or structural language but using a multi dimensional language is a new challenge. They should include this question in an Anaplan Solutioning Challenge

Answers

  • Managed to solution this for 7 nodes … was a good mental challenge for me :) … it required 6 million cells in Classic … 4 modules … less than 40 line items … only 1 IF statement used … each additional node added will require 5 more line items … drawback is amount of cells consumed goes parabolic for each node added. If I attempted to do it for 9 nodes I would be looking a billion cells in Classic already … in Polaris it would be around 13 nodes before I get a billion populated cells

  • @TristanS

    This. Is. Epic.

    Do you realize this is the DAG (Directed Acyclic Graph)? You're a graph theory champion!

  • @JaredDolich First time I've heard of DAG … always knew it as Network traversal with various available algorithms such as Breadth First Search (BFS) and Depth First Search (DFS). I developed one ages ago but with C++ using recursion. Didn't think I'd have a need for it in Anaplan but there's some practical use for it in manufacturing. Fortunately, the number of nodes I needed was less than 10 otherwise I probably would have dropped implementing it Anaplan. I mean 13 nodes would have 6 billion potential permutations. So really workspace restrictive … but just the power of Anaplan calculating that in real time … idea of it just seems so awesome

  • JaredDolich
    edited October 23

    Yep. @TristanS Anaplan uses a DAG to auto-generate the dependent calculations. So, when you edit a line item Anaplan already knows the paths that must be traversed including up/down the hierarchies. Graph theory is at the heart of a lot of AI as well. While using an OLAP tool can be used, it's obviously not too scalable. Anaplan programmed the DAG using Java - not sure about Polaris though. (so, now you know why we get toaster time if you make an error in your formula).

    I have to say, I'm impressed. Not too many people know that Anaplan's calc engine is "old math", but in reality ALL OLAP planning solutions use a DAG. In fact, some planning solutions allow you to edit the DAG giving you the ability to edit both sides of an equation! The only problem with that is that you have to program the DAG and any time you want to change a calculation, you have to run it through a complete regression test. No thanks. I'd rather have Anaplan auto-calc the DAG.

  • @JaredDolich someone at work just told me I may be able to use optimiser. I haven't used it yet so not sure. do you know if I can use optimiser to generate the results I require above?