Giter Site home page Giter Site logo

multiagentallocationtransit.jl's Introduction

MultiAgentAllocationTransit

Accompanying code repository for the paper Efficient Multi-Drone Delivery Using Transit Networks (ICRA 2020 Best Multi-Robot Finalist, Journal of AI Research 2021). In this paper, we present a comprehensive algorithmic framework to operate a large fleet of drones to deliver packages in an urban area while using transit networks to enhance their effective range.

Illustrations

Below is a visualized scenario with 80 agents in San Francisco, using the bus network and other parameters as described in the paper. The black pentagons are depots, the grey rectangles are delivery locations, blue circles are drones flying, and red circles are drones riding on transit. We do not render the actual transit vehicles (buses) for clarity. Multiple drones may use a transit option simultaneously; we can only render one red circle in that case. Locations are randomly generated within a bounding box, and some of them may be slightly offshore.

SFMTA Example

Here is another example, with 110 agents, in the Washington DC Metropolitan Area:

WMATA Example

Setup and Notebook

For those of you familiar with the Julia package manager, I provide a Manifest.toml because there are two custom dependencies: my fork of Graphs.jl (which has various extensions to A* with an implicit graph representation) and my MultiAgentPathFinding.jl, which implements Enhanced CBS. You can also just add those repos directly and then dev this one, instead of instantiating the environment. Also, there are several moving parts to the code, and the two main units, graph search and multi-agent path finding have been tested themselves. Thus, I've been a bit lazy with testing here, but I might add some basic integration tests later.

The MultiAgentAllocationTransit repository is set up as a package with its own environment in Julia (version 1.3 or later). Look at Using someone else's project at the Julia package manager documentation for the basic idea. To get the code up and running (after having installed Julia), first cd into the MultiAgentAllocationTransit folder. Then start the Julia REPL and go into package manager mode by pressing ], followed by:

(v1.0) pkg> activate .
(MultiAgentAllocationTransit) pkg> instantiate

This will install the necessary dependencies and essentially reproduce the Julia environment required to make the package work. You can test this by exiting the package manager mode with the backspace key and then in the Julia REPL entering:

julia> using MultiAgentAllocationTransit

The full package should then pre-compile. AFTER this step, you can start IJulia (install it if you have not already) and open up the root folder:

julia> using IJulia
julia> notebook(dir="./")

You can then run the multi-drone-routing-example notebook to get an idea of how to use the code for a specific domain. An overview of the code package itself is given below, after the illustrations.

Code Overview

I've given a brief overview of the code in the src/ folder, and an even more brief outline of the scripts/ folder. Some of the important structs and methods in the various files have additional comments. The multi-drone-routing-example notebook is a good illustration of how the code is actually used.

  • src/gtfs_parser.jl: Various utilities for converting the GTFS files for the transit networks into a form usable by me
  • src/load_transit_env.jl: A handful of utilities for loading up the operation graph from the parsed GTFS files
  • src/preprocessing.jl: Implements the functions for the two main preprocessing steps - computing the surrogate travel time estimate and the admissible heuristic on the flight distance
  • src/task_allocation.jl: Implements the MergeSplitTours algorithm for the delivery sequence allocation layer.
  • src/mapf_transit.jl: Implements everything necessary to use the Enhanced CBS Solver from MultiAgentPathFinding.jl for the MAPF-TN layer.
  • scripts/test_*.jl: Hacked scripts for playing around. Ignore.
  • scripts/benchmark_*.jl: The various scripts used for the results in the paper. The benchmarks should be reproducible if you parse the GTFS files (not uploaded) to the corresponding JSON files, run preprocess_travel_time_estimates.jl to save the surrogate object that is the loaded by the benchmark scripts, and use the same MersenneTwister as mentioned in the script. The separate benchmark_mult_agents_light.jl script uses the direct flight time as the surrogate instead of the preprocessed estimate (this could have been an argument to benchmark_multi_agents.jl, but I got lazy). Finally, note that for the arguments to the benchmark_* scripts, you'll need some combination of the parsed GTFS files, preprocessing outputs, and parameter files (in param_files) for the various arguments.

Note on Reproducibility
The allocation and replanning benchmarks should be straightforward to reproduce. The one caveat is that for settings with l/m = 10, the trials would take very long much more often. Therefore, I reduced the env.threshold_global_conflicts from 10 to 5 while running benchmarks (the solver throws an exception after 5 high-level conflicts). At some point, I'll take a deeper dive into handling many high-level conflicts better, or just have more functionality for terminating easily.
In general, it is very important to me that anyone re-running this be able to reproduce numbers/results. Please file a Github issue if you need any assistance.

multiagentallocationtransit.jl's People

Contributors

rejuvyesh avatar shushman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multiagentallocationtransit.jl's Issues

Problems Checklist

  • Currently using half the max distance, and doing two shortest paths. Is that okay?
  • Need to integrate with a rolling-horizon GTFS feed
  • Not using depot_to_sites_dists
  • Using JuMP v0.21 and up breaks task allocation (the * operator - see jump-dev/JuMP.jl#2005)

Compatible Infiltrator package

I tried to re-run the code locally, however I can not pass the Precompiling step. Below is the error message: 

julia> using MultiAgentAllocationTransit
[ Info: Precompiling MultiAgentAllocationTransit [701b9ce8-be0e-11e9-3781-f7e4d5d97ed9]
ERROR: LoadError: LoadError: LoadError: LoadError: UndefVarError: @spawn not defined
Stacktrace:
 [1] #macroexpand#32 at ./expr.jl:92 [inlined]
 [2] macroexpand at ./expr.jl:91 [inlined]
 [3] docm(::LineNumberNode, ::Module, ::Any, ::Any, ::Bool) at ./docs/Docs.jl:509 (repeats 2 times)
 [4] @doc(::LineNumberNode, ::Module, ::String, ::Vararg{Any,N} where N) at ./boot.jl:451
 [5] include at ./boot.jl:317 [inlined]
 [6] include_relative(::Module, ::String) at ./loading.jl:1044
 [7] include at ./sysimg.jl:29 [inlined]
 [8] include(::String) at /home/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/src/MultiAgentAllocationTransit.jl:1
 [9] top-level scope at none:0
 [10] include at ./boot.jl:317 [inlined]
 [11] include_relative(::Module, ::String) at ./loading.jl:1044
 [12] include(::Module, ::String) at ./sysimg.jl:29
 [13] top-level scope at none:2
 [14] eval at ./boot.jl:319 [inlined]
 [15] eval(::Expr) at ./client.jl:393
 [16] top-level scope at ./none:3
in expression starting at /home/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/src/preprocessing.jl:201
in expression starting at /home/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/src/preprocessing.jl:183
in expression starting at /home/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/src/preprocessing.jl:183
in expression starting at /home/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/src/MultiAgentAllocationTransit.jl:116
ERROR: Failed to precompile MultiAgentAllocationTransit [701b9ce8-be0e-11e9-3781-f7e4d5d97ed9] to /home/dkuhlgatz/.julia/compiled/v1.0/MultiAgentAllocationTransit/NxpqA.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858
 [5] require(::Module, ::Symbol) at ./loading.jl:853

I assume this is due to the incompatible Infiltrator package installed. As I had problems instantiate the MultiAgentAllocationTransit previously (Error below), I removed the Infiltrator package and added it again later.

(MultiAgentAllocationTransit) pkg> instantiate
ERROR: `Infiltrator` is a direct dependency, but does not appear in the manifest. If you intend `Infiltrator` to be a direct dependency, run `Pkg.resolve()` to populate the manifest. Otherwise, remove `Infiltrator` with `Pkg.rm("Infiltrator")`. Finally, run `Pkg.instantiate()` again.

(MultiAgentAllocationTransit) pkg> rm Infiltrator
Updating `~/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/Project.toml`
  [5903a43b] - Infiltrator
No Changes to `~/dkuhlgatz/2020/MultiAgentAllocationTransit.jl/Manifest.toml`

Here is the final list of package versions:

julia> Pkg.API.installed()
Dict{String,Union{Nothing, VersionNumber}} with 27 entries:
  "CSV"                         => v"0.5.12"
  "GLPK"                        => v"0.11.4"
  "LightGraphs"                 => v"1.3.0"
  "Distributions"               => v"0.21.1"
  "Random"                      => nothing
  "JuMP"                        => v"0.20.0"
  "NearestNeighbors"            => v"0.4.3"
  "IterTools"                   => v"1.2.0"
  "Graphs"                      => v"0.10.3"
  "LinearAlgebra"               => nothing
  "MultiAgentPathFinding"       => v"0.1.0"
  "JSON"                        => v"0.21.0"
  "DataStructures"              => v"0.17.0"
  "Images"                      => v"0.23.0"
  "IJulia"                      => v"1.21.4"
  "Tables"                      => v"0.2.11"
  "Distances"                   => v"0.8.2"
  "Plots"                       => v"0.26.3"
  "GeometryTypes"               => v"0.7.6"
  "TravelingSalesmanHeuristics" => v"0.3.1"
  "SparseArrays"                => nothing
  "Infiltrator"                 => v"0.3.0"
  "StaticArrays"                => v"0.11.0"
  "JLD2"                        => v"0.1.14"
  "DataFrames"                  => v"0.19.4"
  "Parameters"                  => v"0.12.0"
  "TOML"                        => v"0.4.0"

Do you have an idea how to solve this?

Problem with Reproducing Code

Halo, thank you for your great work. I am interested in your work here.
I have a problem with Reproducing the code.
I want to run the multi-drone-routing-example notebook, but I stuck at env = MAPFTransitEnv..... i got a message

Field 'aug_trips_fws_dists' has no default, supply it with keyword.

do you have any idea?

Thank you

unable to setup

Hello

unfortunately i have problem with pkg> instantiate .
when i run instantiate command receive following error:
ERROR: Did not find path /home/shushman/.julia/dev/MultiAgentPathFinding for MultiAgentPathFinding [42a2a06c]

can you help me please?

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.