GithubHelp home page GithubHelp logo

fwdeng / trafficassignment.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chkwon/trafficassignment.jl

0.0 1.0 0.0 586 KB

Julia package for finding traffic user equilibrium flow

License: Other

Julia 100.00%

trafficassignment.jl's Introduction

TrafficAssignment.jl

TrafficAssignment TrafficAssignment TrafficAssignment

Build Status Build status Coverage Status

This package for the Julia Language does basically two tasks: (1) loading a network data and (2) finding a user equilibrium traffic pattern. See Traffic Assignment.

Install

julia> Pkg.add("TrafficAssignment")

This will install LightGraphs.jl and Optim.jl, if you don't have them already.

To check if works

julia> Pkg.test("TrafficAssignment")

load_ta_network

This function loads a network data available in this TNTP github repository. The network name must match with the directory name in the TNTP repository.

Example:

ta_data = load_ta_network("SiouxFalls")
# ta_data = load_ta_network("Anaheim")
# ta_data = load_ta_network("Barcelona")
# ta_data = load_ta_network("Winnipeg")

The return value is of the TA_Data type, which is defined as

type TA_Data
    network_name::String

    number_of_zones::Int
    number_of_nodes::Int
    first_thru_node::Int
    number_of_links::Int

    start_node::Array{Int,1}
    end_node::Array{Int,1}
    capacity::Array{Float64,1}
    link_length::Array{Float64,1}
    free_flow_time::Array{Float64,1}
    B::Array{Float64,1}
    power::Array{Float64,1}
    speed_limit::Array{Float64,1}
    toll::Array{Float64,1}
    link_type::Array{Int64,1}

    total_od_flow::Float64

    travel_demand::Array{Float64,2}
    od_pairs::Array{Tuple{Int64,Int64},1}

    toll_factor::Float64
    distance_factor::Float64

    best_objective::Float64
end

ta_frank_wolfe

This function implements methods to find traffic equilibrium flows: currently, Frank-Wolfe (FW) method, Conjugate FW (CFW) method, and Bi-conjugate FW (BFW) method.

References:

Example:

link_flow, link_travel_time, objective = ta_frank_wolfe(ta_data, log="off", tol=1e-2)

Available optional arguments:

  • method=:fw / :cfw / :bfw (default=:bfw)
  • step="exact" / "newton" : exact line search using golden section / a simple Newton-type step (default=:exact)
  • log=:on / :off : displays information from each iteration or not (default=:off)
  • max_iter_no=integer value : maximum number of iterations (default=2000)
  • tol=numeric value : tolerance for the Average Excess Cost (AEC) (default=1e-3)

For example, one may do:

ta_data = load_ta_network("SiouxFalls")
link_flow, link_travel_time, objective = ta_frank_wolfe(ta_data, method=:cfw, max_iter_no=50000, step=:newton, log=:on, tol=1e-5)

The total system travel time can be simply computed as

system_travel_time = dot(link_travel_time, link_flow)

Parallel Computing

During the all-or-nothing allocation procedure, this package supports parallel computing. If you want to start with two processes, use the following command to start Julia

julia -p 2

When you directly run your script, use the following command:

julia -p 2 your-script.jl

Contributor

This package is written and maintained by Changhyun Kwon.

trafficassignment.jl's People

Contributors

chkwon avatar sbromberger avatar staticfloat avatar tkelman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.