~?!i&32768 ~o=7 ~o|256 ~/**************************************************************************** ~/*** BELLMAN 1.1 - COMPUTE SHORTEST DISTANCES ON BASE NETWORK ***** ~/*** (95-05-24 Heinz Spiess, EMME/2 Support Center, CH-2558 Aegerten) ***** ~/ ~/Compute shortest paths on base network from node to node using Bellman's ~/label correcting algorithm. ~/ ~/Usage: bellman ~/where: : node from which to compute shortest distances ~/: link attribute used as distance (e.g. 'length') ~/ : link selection criterion (e.g. 'mode=b' or 'all') ~/ ~/Result: ui1 will contain the shortest distances from root node ~/Temporaries: ms90 is used to save the number of improvements ~/ ~x=%0% ~?x<2 / check if enough parameters are provided ~$end_of_macro ~/root: %1% dist-measure: %2% link-select: %3% ~/**************************************************************************** 2.41 c='staring macro: bellman %1% %2% %3%' 1 / initialize node labels y / labels will be stored in ui1 ui1 / set to infinity except for the root node which gets zero ~?e ~+XXqX~/ Scenario %s% is protected against modifications!X~$>end_of_macro 999999999*(i!=%1%) all / all nodes 5 r ~x=0 / initialize iteration counter ~:next_iteration ~x+1 / increment iteration counter 1 / compute the best paths with max %x% links 'y' uj1 / is it shorter to go to j via node i? uj1.min.(ui1+%2%).max.0 1 / take the minimum of all candidates %3% / define link subset to be used ~?q=0 5 / save summary information in scalar 7 / how many labels have been improved in iteration %x%? ms90 im%x% No. of improvements at iteration %x% r ~/%ms90.d%: %ms90% ~y=%ms90% ~?y>0 / do another iteration as long as some labels have improved ~$next_iteration q c='normal termination of macro: bellman %1% %2% %3%' ~o=2 ~/**************************************************************************** ~/UI1: shortest %2%-distances from node %1% on links '%3%' ~:end_of_macro ~/****************************************************************************