Anaheim Traffic Optimization

Embed Size (px)

Citation preview

  • 8/10/2019 Anaheim Traffic Optimization

    1/20

  • 8/10/2019 Anaheim Traffic Optimization

    2/20

    Table of Contents:

    1. Executive Summary............................................... Page 2

    2. Objective and Overview......................................... Page 3

    3. Description of Frank Wolfe Algorithm.................. Page 5

    data collected

    methods used

    4. Results....................................................................Page 7

    5. Figures....................................................................Page 10

    6. References............................................................. Page 12

    7. Code....................................................................... Page 13

    Linesch 2

  • 8/10/2019 Anaheim Traffic Optimization

    3/20

    1. Executive Summary

    This report is an analysis of the Anaheim traffic network and a group of origin-destination (OD) pairs.

    With 38 nodes that are origins and destinations we have 38x37 OD pairs in the network or 1406 OD pairs.

    Each of these pairs has a certain demand allocated to it which we will be evaluating based on the user

    equilibrium (UE) as well as the system optimal (SO). The users of a system will want to optimize their

    own costs, which is evaluated using the user equilibrium function analysis. This contrasts with the SO

    analysis which optimizes the total travel time of the system, rather than the individual travel times. Using

    two different link performance functions we see that the BPR works well with Frank-Wolfe although

    Davidson's does not, based on this observation we decide to analyze the system using the BPR link

    performance function.

    Matlab code was developed to implement the shortest path algorithm which is called by Frank Wolfe

    when calculating the User Equilibrium and the System Optimal situations of the network. An assignment

    function contains Dijkstra's shortest path algorithm which is called within a loop in the Frank Wolfe

    algorithm. The objective function within Frank Wolfe is modified in order to acheive SO or UE total

    travel times.

    Linesch 3

  • 8/10/2019 Anaheim Traffic Optimization

    4/20

    2. Objective and Overview

    The main objective is to understand the differences between optimizing a traffic network based on

    different objective functions. In the case of the user equilibrium we use an objective function that gets

    slightly modified to become a system optimal problem.

    Functions that are involved in this particular optimization problem are:

    all-or-nothing assignment

    Frank-Wolfe

    Dijkstra's Algorithm

    The user equilibrium problem models traffic behavior more accurately than the theoretical system optimal

    answer we can get to solving a traffic problem. As users get to know a traffic network they will choose

    the route that they know will minimize their travel time; we can safely say that users of a network will not

    choose a route based on weather or not they will optimize the total system travel time because they will

    not be able to compute these route choices in their head or be willing to go out of their way for thebetterment of others. We find that users who know a system can optimize their travel time by taking less

    congested routes, resulting in something closer to the UE than the SO. The study of a SO of a network

    can help us understand how to build networks efficiently so that the natural tendency of the network leans

    toward optimizing the total system time, although as demand changes over decades, it is hard to plan for

    system optimality.

    Linesch 4

  • 8/10/2019 Anaheim Traffic Optimization

    5/20

    3. Description of Frank Wolfe AlgorithmThe experiment to find the user equilibrium traffic flow on the Anaheim network involves finding the

    shortest path between each OD pair and then allocating the traffic demand to those paths. Once the

    demand is placed upon each link that makes up the path of the network the flows are updated as the cost

    for each link has changed (the links with more flow placed upon them become more costly). This process

    continues to update over many iterations until the optimal flow pattern is reached.

    For the UE assessment we utilize the following BPR link performance function:

    ta= t

    a

    01+

    xa

    ca

    , = 0.15,= 4, ca = 0.9ca

    This function will be used to compute the link flow as we allocate traffic to each of the arcs involved in

    the traffic network. The general steps of the algorithm are as follows:

    1. Import the network

    2. Initialize the travel times and find the shortest path for all OD pairs

    3. Update the travel costs for each link in the network

    4. Find the auxiliary flow based on the new travel costs

    5. Use the line search to find an alpha which tells the program how far to move

    6. Update link flow and cost

    7. Test for convergence and repeat

    Also the Davidson link performance function can be used:

    ta= t

    a

    01+J

    xa

    ca x

    a

    , J = 0.25

    We will experiment with this link performance function and how it compares with BPR function.

    Variables that will be imported will be

    A (List of link numbers out of consecutive nodes)

    B (List of link numbers into consecutive nodes)

    Odnodes (List of nodes that are origins/destinations)

    capacity (array of capacity for each link)

    demand (array of demand for each OD pair) lastnode

    firstnode (first link out of each origin)

    m (number of nodes)

    n (number of arcs)

    t0 (Free flow travel time for each arc)

    Linesch 5

  • 8/10/2019 Anaheim Traffic Optimization

    6/20

    The SO computation uses a similar function as the UE computation although the difference is that the

    cost function t(a) is transformed to optimize the system cost rather than the individual user cost.

    i

    The optimization of the objective function Z will be a tool for allocating flow to each of the links on the

    paths between the OD pairs in order to find the UE and the SO traffic patterns and travel times of thesystems. The linear program is solved using the techniques of the Frank Wolfe algorithm as implemented

    in the matlab code. The objective function is modified from UE to SO.

    Linesch 6

  • 8/10/2019 Anaheim Traffic Optimization

    7/20

    Results:The code for the matlab algorithms uses the following commands to run, with the results from the After

    running the various algorithms to test for convergence we have found the following information:

    UE (A,B,ODnodes,capacity,demand,lastnode,firstnode,m,n,t0)

    Max_Velocity_Capacity =

    1.9401

    Average_Velocity_Capacity =

    0.3011

    User_Equilibrium_Total_Travel_Time =

    1.3278e+06

    SO (A,B,ODnodes,capacity,demand,lastnode,firstnode,m,n,t0)

    Max_Velocity_Capacity =

    1.6686

    Average_Velocity_Capacity =

    0.2960

    System_Optimal_Total_Travel_Time =

    1.3038e+06

    UE SO

    Total Travel Time 1.3278e+06 seconds 1.3038e+06 seconds

    Velocity/Capacity Ratio (avg) 0.3011 0.2960

    Velocity/Capacity Ratio (max) 1.9401 1.6686

    We find out from an analysis of congested nodes (velocity/capacity ratio > 1.25) that the following nodes

    are congested in the UE problem:

    congested_nodes =

    54 64 508 531 566 642 692 693 695 729 784 794 795 911

    Linesch 7

  • 8/10/2019 Anaheim Traffic Optimization

    8/20

    If we run the algorithm again with these nodes with increased capacity (+25%) we find the following

    result:

    Max_Velocity_Capacity =

    1.6948

    Average_Velocity_Capacity =

    0.2977

    User_Equilibrium_Total_Travel_Time =

    1.2901e+06

    With a 100% increase in capacity on the congested links we see that the total travel time for the UE

    network goes from 1.3278e+06 seconds to 1.2540e+06 seconds, a 6% decrease in total travel time. In

    Figure 1 we observe fifty random links on the network and their velocity/capacity ratios when the original

    data was taken compared to the new velocity/capacity ratios after the congested links are improved. We

    can see the that the majority of the ratios go up, while some stay constant and some drop.

    TTT=Total Travel Time (seconds)UE SO

    TTT (original) 1.3278e+06 1.3038e+06

    TTT(25% Improved Capacity on congested nodes) 1.2901e+06 1.3009e+06

    TTT (50% Improved Capacity on congested nodes) 1.2692e+06 1.3021e+06

    TTT (75% Improved Capacity on congested nodes) 1.2618e+06 1.3012e+06

    TTT(100% Improved Capacity on congested nodes) 1.2540e+06 1.3014e+06

    Figure 2 gives a plot of the table above, showing that the increased capacity for links with a

    velocity/capacity ratio higher than 1.25 by a variety of percentages helped the total travel time only for the

    UE system, but had little effect on the SO. The User Equilibrium quickly became faster with a number of

    nodes operating at increased capacity.

    Figure 3 shows a comparison of how the improved capacity system behaves in a UE environment versus a

    SO environment. We observe the change of the velocity capacity ratios between the original system and

    Linesch 8

  • 8/10/2019 Anaheim Traffic Optimization

    9/20

    the improved capacity system for both cases (UE and SO) and plot the absolute value of the difference.

    From this graph we can see that there are much greater differences in these ratios in the UE system where

    as the difference in the SO system was relatively slight.

    If we modify the performance function and use Davidsons link performance function:

    ta

    = ta

    01+J

    xa

    ca xa

    , J = 0.25

    we can see that the system does not converge. Davidson's link performance function uses the difference

    between the capacities and the flows which can make the updated flows negative. The fact that the flows

    would be seen as negative in the Davidson function would not be understood by Dijkstra's algorithm when

    finding the shortest path between two nodes. This contributes to the problem of a lack of convergence in

    the UE and the SO when using Davidson's link performance function to find the total travel times.

    Linesch 9

  • 8/10/2019 Anaheim Traffic Optimization

    10/20

    List of Figures

    Figure 1.

    Figure 2.

    Linesch 10

  • 8/10/2019 Anaheim Traffic Optimization

    11/20

    Figure 3.

    Linesch 11

  • 8/10/2019 Anaheim Traffic Optimization

    12/20

    Code:

    User Equilibrium Function:

    %Nicholas Linesch%ECI 257 Project 2

    function [vcratio]=UE (!"!#$noes!ca&acit'!ean!lastnoe!firstnoe!!n!t)*LP+=,-5"E.=/

    %0ollo1in for loo& use to increase ca&acit' on iven noesconeste3noes=[5/ 4/ 5) 56- 544 4/2 42 46 45 72 7/

    7/ 75 --]8for(i=-9-/* ca&acit'(coneste3noes(i**=ca&acit'(coneste3noes(i**:-8en

    % 0ran; uili?riu of a traffic net1or;% the follo1in are the in&uts to run the alorith, % free flo1 travel ties (t)* % corres&onin ca&acities (ca*,

    % the nu?er of lin;s (n* % the nu?er of noes (*%0irst ste& is to i&ort the roa net1or; an travel ean inforation%1e on@t 1ant the roas to ever ?e at full ca&acit' so 1e ta;e )% of the%total ca&acit',ca&acit'-=,:ca&acit'8

    %NeAt ste& is to initialiBe ta=ta()* an fin the shortest &ath ?et1een all%#$ Pairsta=t)8A=assinent(ta!!"!lastnoe!!#$noes!firstnoe!ean*8 %calculates the shortest &ath usin the etho of Dall or nothinD %A 1ill ?e a list of the flo1s alon a &ath

    ?in=)8count=-8

    Linesch 12

  • 8/10/2019 Anaheim Traffic Optimization

    13/20

    1hile(?in==)* (countF-)))* '=Beros(n!-*8 %initialiBe auA flo1

    for(i=-9n* ta(i*=t)(i*:(-GLP+:((A(i*Hca&acit'-(i**"E.**8 %co&utes the latest lin;flo1 &attern that results fro the fran; 1olf alorith assinent of the #$ &airsin the &revious oriin en

    '=assinent(ta!!"!lastnoe!!#$noes!firstnoe!ean*8

    irection='A8

    %line search tells ho1 far to ove! or the ste& siBe that 1e 1ill nee %to use al&ha=UElinesearch(ta!n!A!'!ca&acit'*8

    Ane1=AGal&ha:irection8

    Airec=Ane1A8

    ifference=(su(Airec,2**H(su(A**8

    if(ifferenceF),))))-*

    ?in=-8 en

    A=Ane18 %this line u&ates A count=countG-8en

    lin;flo1=A8for(i=-9n* .otal.ravel.ie(i*=t)(i*:(-G),-5:((A(i*Hca&acit'-(i**/**8

    ensiBe(A*8siBe(ca&acit'*8

    Jelocit'3Ca&acit'3Katio=A,Hca&acit'8vcratio=Jelocit'3Ca&acit'3Katio8%coneste3noes=[]8%for(i=-9-/*% if Jelocit'3Ca&acit'3Katio(i*-,25% coneste3noes=[coneste3noes!i]8

    % en%en%hist(Jelocit'3Ca&acit'3Katio*%coneste3noesMaA3Jelocit'3Ca&acit'=aA(Jelocit'3Ca&acit'3Katio*verae3Jelocit'3Ca&acit'=ean(Jelocit'3Ca&acit'3Katio*User3E>uili?riu3.otal3.ravel3.ie=su(lin;flo1,:.otal.ravel.ie*

    Linesch 13

  • 8/10/2019 Anaheim Traffic Optimization

    14/20

    System Optimal Function:

    %Nicholas Linesch%ECI 257 Project 2

    function [vcratio]=# (!"!#$noes!ca&acit'!ean!lastnoe!firstnoe!!n!t)*LP+=,-5"E.=/tic

    % 0ran; uili?riu of a trafffic net1or;% the follo1in are the in&uts to run the alorith, % free flo1 travel ties (t)*

    % corres&onin ca&acities (ca*,% the nu?er of lin;s (n*

    % the nu?er of noes (*%0irst ste& is to i&ort the roa net1or; an travel ean inforation

    %1e on@t 1ant the roas to ever ?e at full ca&acit' so 1e ta;e )% of the%total ca&acit',

    coneste3noes=[5/ 4/ 5) 56- 544 4/2 42 46 45 72 7/7/ 75 --]8for(i=-9-/* ca&acit'(coneste3noes(i**=ca&acit'(coneste3noes(i**:-8enca&acit'-=,:ca&acit'8

    %NeAt ste& is to initialiBe ta=ta()* an fin the shortest &ath ?et1een all%#$ Pairsta=t)8

    A=assinent(ta!!"!lastnoe!!#$noes!firstnoe!ean*8 %calculates the shorest &ath usin the etho of Dall or nothinD %A 1ill ?e a list of the flo1s alon a &ath

    ?in=)8count=-81hile(?in==)* (countF-)))*

    Linesch 14

  • 8/10/2019 Anaheim Traffic Optimization

    15/20

    '=Beros(n!-*8 %initialiBe auA flo1

    for(i=-9n* ta(i*=t)(i*:(-G(-G"E.*:LP+:((A(i*Hca&acit'-(i**"E.**8 %co&utes thelatest lin; flo1 &attern that results fro the fran; 1olf alorith assinent ofthe #$ &airs in the &revious oriin en

    %'=assinent6(ta!!"*8%(ta!!"!!n!lastnoe!ean!firstnoe*8 % %co&ute auA flo1s '=assinent(ta!!"!lastnoe!!#$noes!firstnoe!ean*8 irection='A8 al&ha=#linesearch(ta!n!A!'!ca&acit'*8 %usin the line search 1e fin thea&&ro&riate ste& siBe to use

    Ane1=AGal&ha:irection8

    Airec=Ane1A8

    ifference=(su(Airec,2**H(su(A**8

    if(ifferenceF),))))-* ?in=-8 en

    A=Ane18 %this line u&ates A count=countG-8en

    lin;flo1=A8for(i=-9n* .otal.ravel.ie(i*=t)(i*:(-GLP+:((A(i*Hca&acit'-(i**"E.**8en

    siBe(A*8siBe(ca&acit'*8

    Jelocit'3Ca&acit'3Katio=A,Hca&acit'8vcratio=Jelocit'3Ca&acit'3Katio8%coneste3noes=[]8%for(i=-9-/*% if Jelocit'3Ca&acit'3Katio(i*-,25% coneste3noes=[coneste3noes!i]8% en

    %en%hist(Jelocit'3Ca&acit'3Katio*%coneste3noesMaA3Jelocit'3Ca&acit'=aA(Jelocit'3Ca&acit'3Katio*verae3Jelocit'3Ca&acit'=ean(Jelocit'3Ca&acit'3Katio*'ste3#&tial3.otal3.ravel3.ie=su(lin;flo1,:.otal.ravel.ie*

    Linesch 15

  • 8/10/2019 Anaheim Traffic Optimization

    16/20

    Assignment Function:

    function 0lo1=assinent(ta!!"!lastnoe!!#$noes!firstnoe!ean*%.he first &art of this section 1ill solve for the shortest &ath fro each%oriin to the res&ective estinations

    flo1=Beros(-/!6*8%.his for loo& runs throuh ever &ossi?le oriinfor(root=679/-4*

    close=[root]8 % start 1ith just the root noe as close o&en=[-9]8 % all of the other noes are o&en to start off 1ith o&en(root*=[]8 % no1 ta;e the root noe out of the list of o&en noes,

    %initiall' the istances are all set to infinit' an the &@s are all set=%to the root

    =inf:ones(-!*8 (root*=)8 %settin the istance la?el of root noe to )

    &=root:ones(-!*8 &(root*=root8

    %no1 1e a&&l' the $ij;stra alorith to fin the shortest &ath! ain%noes to the close noe list as 1e eA&lore all of their &aths an then%scannin to ne1 o&en noes to loo; for the shortest &ath throuh the%net1or;

    %this neAt 1hile loo& is the ain ste& for the shortest &ath alorith

    1hile(lenth(o&en*)* i=lenth(close*8 j=close(i*8

    for(;=(j*9"(j**

    if((lastnoe(;**=(j*Glenth(;** (lastnoe(;**= (j*Gta(;*8

    &(lastnoe(;**=j8 en en

    in=(o&en(-**8 j?ar=-8 for(i=-9lenth(o&en**

    Linesch 16

  • 8/10/2019 Anaheim Traffic Optimization

    17/20

    if((o&en(i**Fin*

    in=(o&en(i**8 j?ar=i8 en en

    close=[close!o&en(j?ar*]8

    o&en(j?ar*=[]8 en i=-8 1hile(iF6* %if the root is a&&in to itself! o nothin if(root==#$noes(i**8 )8

    %other1ise the flo1 alon the shortest &ath for the &articular %#$&air nees to ?e u&ate in the flo1 atriA else

    %startin fro the first noe in the list of #$noes 1e

    %?ac;trac; alon the &ath an calculate the flo1 as 1e o &reecesor=#$noes(i*8 '=-8 &ath=root8 1hile(&reecesor=root* &ath('*=&(&reecesor*8 &reecesor=&(&reecesor*8 '='G-8 en &ath=[#$noes(i*!&ath]8 %calculate the shortest &ath fro the rootto the estination

    for(j=29lenth(&ath**

    %searchlin;s s&ans all of the lin;s that coe out of %noe j on the &ath

    searchlin;s=(&ath(j**9-9"(&ath(j**8 lin;nu?er=(&ath(j**-Gfin(lastnoe(searchlin;s*==&ath(j-**8

    NoeNu?er=#$noes(i*678 K##.=root678

    %loa each lin; in the shortest &ath >=firstnoe(K##.*G(NoeNu?er-*8

    flo1(lin;nu?er!K##.*=flo1(lin;nu?er!K##.*Gean(>*8

    en%ens the inner for loo&

    en%ens the if loo& i=iG-8 en%ens the 1hile loo&enfori=-9-/ 0lo1(i*=su(flo1(i!9**8 %sus the flo1 alon each lin; an returns the value tothe ain functionen

    Linesch 17

  • 8/10/2019 Anaheim Traffic Optimization

    18/20

    Line earch 0unction(UE*9

    functional&ha=UElinesearch(t)!n!A!'!ca&asit'*LP+=,-5"E.=/

    ca&asit'-=ca&asit':,8%.he initial interval 1e loo; at is (a!?*=()!-*a=)?=-8%1hile the interval lenth is less than ,)))- 1e 1ill narro1 in on the%esire &ointr=(5(-H2*-*H281hile(a?s(a?*,))))-*

    al&haleft=aG(-r*:(?a*8 al&hariht=aGr:(?a*8

    %no1 1e nee to calclulate the o?jective function for each al&ha %first calculate for the left

    Bal&haleft=)8 left=AGal&haleft:('A*8 left-=left,Hca&asit'-8 for(i=-9n*

    Bal&haleft(i*=t)(i*:left(i*:(-GLP+:(left-(i*"E.**8 en

    Bal&haleft=su(Bal&haleft*8

    %calculate for the riht Bal&hariht=)8 riht=AGal&hariht:('A*8 riht-=riht,Hca&asit'-8 for(i=-9n*

    Bal&hariht(i*=t)(i*:riht(i*:(-GLP+:(riht-(i*/**8 en Bal&hariht=su(Bal&hariht*8

    %.he line search no1 chooses the neAt interval to ?e use,

    if(Bal&haleftF=Bal&hariht* ?=al&hariht8 else a=al&haleft8 enenal&ha=(aG?*H28

    Linesch 18

  • 8/10/2019 Anaheim Traffic Optimization

    19/20

    Line earch 0unction(#*9functional&ha=#linesearch(ta!n!A!'!ca&acit'*LP+=,-58"E.=/8ca&acit'-=ca&acit':,8

    %.he initial interval 1e loo; at is (a!?*=()!-*a=)8?=-8%1hile the interval lenth is less than ,)))- 1e 1ill narro1 in on the%esire &oint

    r=(5(-H2*-*H281hile(a?s(a?*,))))-* al&haleft=aG(-r*:(?a*8

    al&hariht=aGr:(?a*8

    %no1 1e nee to calclulate the o?jective function for each al&ha %first calculate for the left

    Bal&haleft=)8 left=AGal&haleft:('A*8 left-=left,Hca&acit'-8 for(i=-9n* Bal&haleft(i*=ta(i*:left(i*:(-GLP+:(-G"E.*:(left-(i*/**8 en Bal&haleft=su(Bal&haleft*8

    %calculate for the riht Bal&hariht=)8 riht=AGal&hariht:('A*8 riht-=riht,Hca&acit'-8 for(i=-9n*

    Bal&hariht(i*=ta(i*:riht(i*:(-GLP+:(-G"E.*:(riht-(i*/**8 en Bal&hariht=su(Bal&hariht*8

    %.he line search no1 chooses the neAt interval to ?e use,

    if(Bal&haleftF=Bal&hariht* ?=al&hariht8 else a=al&haleft8 enenal&ha=(aG?*H28

    Linesch 19

  • 8/10/2019 Anaheim Traffic Optimization

    20/20

    i. R. Jayakrishnan, Wei K. Tsai. Event-based ATIS: Practical Implementation and Evaluation of Optimized Strategies

    University o California, Irvine. California PATH Research Report. UCB-ITS-PRR-2001-1