~o=40 ~?!i&32768 ~o=295 ~/*********************************************************************** ~/** MIMOLEG: LOGIT MODEL TO SPLIT MIXED MODE TRIPS IN 2 LEGS (1.1) ** ~/** (Copyright (C) 1996 - Heinz Spiess, Aegerten, Switzerland) ** ~/** ALPHA TEST VERSION - USE ON YOUR OWN RISK !!!! ** ~/*********************************************************************** ~$>skipnotice !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I herewith grant the right to use this macro to all EMME/2 users, provided the following conditions are met: 1) The macro cannot be sold for a fee (but it can be used and distributed within consulting projects). 2) The user is aware that this macro is not a part of the EMME/2 software licence and there is no explicit or implied warranty or support provided with this macro. 3) This notice and the comments in this macro must not be removed. 4) Any additions or modification made by anyone else but me must be clearly identified as such, including date, name and the reason of the modification. Aegerten, November 6, 1996 Heinz Spiess !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ~:skipnotice ~/*** ~/*** This EMME/2 macro implements logit intermediate destination choice ~/*** model, such as for Park&Ride or Kiss&Ride trips and produces as ~/*** output intermediate demand matrices for the first and second leg ~/*** of the trip. The demand using intermediate destination k for ~/*** a praticular O-D pair pq is computed as: ~/*** ~/*** U * A * V ~/*** pk k kq ~/*** G = G ----------------------------- ~/*** pkq pq ---- ~/*** \ U * A * V ~/*** / pk' k' k'q ~/*** ---- ~/*** k' ~/*** The mathematical details are described in the note "Computing Activity ~/*** Chain Based Trip Distribution Models", available from the author. ~/*** ~/*** Requirements: ~/*** - Macro is started from main menu and needs EMME/2 Release 7.0. ~/*** - Assignment reports are appended to the file mimoleg.rep ~/*** - Zone subset for origins, intermediate zones and destinations can ~/*** be specified in registers t1, t2 and t3 (default: all zones) ~/*** ~/*** Calling sequence: ~/*** ~ ~/*** where the first 4 parameters specify the input matrices: ~/*** Gpq total demand for mixed mode travel (mfXX) ~/*** Upk conductivity matrix for first leg travel (mfXX) ~/*** (for logit models usually exp(-const*upk)) ~/*** Ak Attractivity factor at intermediate zone k (moXX) ~/*** (1 can be specified if not needed) ~/*** Vkq conductivity matrix for second leg travel (mfXX) ~/*** (for logit models usually exp(-const*vkq)) ~/*** and the last 3 parameters specify the result matrices: ~/*** Gk intermediate destination demand (moXX) ~/*** Gpk first leg demand matrix (mfXX) ~/*** Gkq second leg demand matrix (mfXX) ~/*** ~/*** Notes: ~/*** 1) If zone subsets are used for intermediate (t2) and final (t3) ~/*** destinations, the resulting matrix Gkq contains only valid data ~/*** for those cells that correspond to valid second leg connections ~/*** (i.e. from to ) - all other cells contain temporary ~/*** data from intermediate computations. ~/*********************************************************************** ~x=%m% /test if started from main menu ~x+%q% ~?x>0 ~$stop ~x=%0% ~?x=0 ~$stop ~y=3 /test if enough parameters are provided ~?!x=7 ~$error c='START mimoleg %1% %2% %3% %4% %5% %6% %7%' ~p=2005 ~t8=%p% ~?t1= ~t1=1,999999 ~?t2= ~t2=1,999999 ~?t3= ~t3=1,999999 ~t7=%3% ~/================ MIMOLEG: MIXED MODE INTERMEDIATE DESTINATION CHOICE ======== ~/Input vectors: Gpq Mixed-mode demand matrix %1% ~/ Upk 1st leg conductivity matrix: %2% ~/ Ak Attractivity factors for intermediate zone: %3% ~/ Vkq 2nd leg conductivity matrix: %4% ~/Result matrices: Gk Intermediate zone totals (mo): %5% ~/ Gpk First leg demand matrix (mf): %6% ~/ Gkq Second leg demand matrix (mf): %7% ~/Zone selections: First leg origin zones: %t1% ~/ Intermediate zones (e.g. parking lots): %t2% ~/ Second leg destination zones: %t3% ~/ ~/Computations: ~x=0 reports=mimoleg.rep ~?t7=1 ~$skip1 ~+|~x+1|~/%%%x%%%) Compute product Upk * Ak in %7% 3.21 /#### multiply Upk*Ak if needed (Ak != 1) 1 ~+|y|%7%|y|Upk*Ak|Upk*Ak|n %2%*%t7%' ~+|y|%t1%||%t2%| ~?q=2 2 q ~:skip1 ~+|~x+1|~/%%%x%%%) Compute denominator matrix Tpq in %7% 3.23 /#### compute convolution S=UV 1 ~?t7=1 %2% ~?!t7=1 %7% * %4% n + ~+|%7%|y|UV|sumk Upk Vkq|n ~+|y|%t1%||%t2%||%t3%| y 2 q 3.21 /#### compute Tpq=Gpq/Spq 1 ~+|y|%7%|y|Tpq|OD-pair multipliers Tpq=Gpq/Spq|n %1%/%7% ~+|y|%t1%||%t3%| ~?q=2 2 q ~+|~x+1|~/%%%x%%%) First leg convolution in %6% 3.23 /#### compute convolution TV' 1 %7% * %4% y + ~+|%6%|y|TV'|first leg convolution TV'|~?q=1|y|0 ~+|y|%t1%||%t3%||%t2%| y 2 q ~+|~x+1|~/%%%x%%%) First leg demand matrix into %6% 3.21 /#### compute Gpk = Upk*(Tv')pk*Ak 1 ~+|y|%6%|y|Gpk|First leg demand matrix|n %2%*%6% ~?!t7=1 *%3%' ~+|y|%t1%||%t2%| ~?q=2 2 q ~+|~x+1|~/%%%x%%%) Transpose T->T' in %7% 3.12 /#### transpose T -> T' 4 3 %7% ~+|%7%|y|T'|O-D multipliers transposed|n q ~+|~x+1|~/%%%x%%%) Second leg convolution in %7% 3.23 /#### compute convolution T'U 1 %7% * %2% n + %7% ~+|y|TtU|second leg convolution T'U|n ~+|y|%t3%||%t1%||%t2%| y 2 q ~+|~x+1|~/%%%x%%%) Transpose T'U->U'T in %7% 3.12 /#### transpose (T'U) -> (T'U)' = U'T 4 3 %7% ~+|%7%|y|UtT|U'T|n q ~+|~x+1|~/%%%x%%%) Second leg demand matrix into %7% 3.21 /#### compute second leg matrix Gkq = Ak Vkq (U'T)kq 1 ~+|y|%7%|y|Gkq|Second leg demand matrix|n %4%*%7% ~?!t7=1 *%3% ~+|y|%t2%||%t3%| ~?q=2 2 q ~+|~x+1|~/%%%x%%%) Intermediate zone totals into %5% 3.21 /#### compute intermediate zone totals Gk = sumq Gkq 1 ~+|y|%5%|y|Gk|Intermediate zone totals|~?q=1|y|0 %7% ~+|y|%t2%||%t3%| + ~?q=2 2 q reports=^ c='END mimoleg %1% %2% %3% %4% %5% %6% %7%' ~+|~p=2005|~y=%%%p%%%|~y-%t8%|~y/10 ~/ ~/Macro MIMOLEG terminated normally using %y% CPU seconds ~/======================================================================= ~$stop ~:error ~/ ~?y=3 ~/Invalid number of macro parameters! ~:stop ~o=6