SimeMobileCity 0.1
  • API
  • Workflow
  • Site
    • Page
        • MC

    MC¶

    class simemobilecity.mc.MC(topo)¶

    This class runs the Monte Carlo simulation.

    Parameters:
    topo : Topology

    Topology object

    Examples

    Following example runs the MC simulation

    import simemobilecity as sec
    
    # Load topology of Munich
    topo = sec.Topology({"name": "Munich, Bavaria, Germany"}, tags={})
    
    # Create user with a probability of 0.5 to drive at any hour
    user = sec.User(0.5)
    
    # Load cafe POIs from OSM
    poi = sec.Poi(topo, tags, {"amenity": ["cafe"]})
    
    # Initialize MC object
    mc = sec.MC(topo)
    
    # Add 100 percent of the user
    mc.add_user(user, 100)
    
    # Add cafe poi
    mc.add_poi(poi)
    
    # Set number of drivers to 100 every hour
    mc.set_drivers(100)
    
    # Run MC simulation with 1 equilibration and 4 production weeks
    mc.run("output/traj.obj", weeks=4, weeks_equi=1)
    

    Methods

    _prepare(node_p, p_norm, max_dist) This helper function processes user and poi inputs into node list.
    add_poi(poi) Add POI to simulation system.
    add_user(user, percentage) Add User to simulation system.
    set_drivers(drivers) Add number of drivers.
    run(file_out, weeks, weeks_equi[, capacity, …]) Run Monte Carlo code.
    _run_helper(weeks, users, trials, is_equi) Run helper for processing weeks.

    Back to top

    © Copyright 2021, Hamzeh Kraus.
    Created using Sphinx 1.6.6.