GithubHelp home page GithubHelp logo

sarrasor / logistics_envs Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 4.88 MB

Gym environments for logistics tasks that can be described as "Move something from A to B"

License: MIT License

Python 98.88% Makefile 1.12%
gym-environment gymnasium logistics q-commerce reinforcement-learning rl operations-research ride-hailing ridehailing ridesharing routing vrp

logistics_envs's Introduction

Logistics Envs

Gym environments for logistics tasks that can be described as "Move something from A to B"

Environments

Each environment can be used in two modes:

  • CARTESIAN - locations are constrained to be on a unit square lat ∈ [0.0, 1.0], lon ∈ [0.0, 1.0]. This mode uses straight-line routing and L2 distances
  • GEOGRAPHIC - locations are considered to be valid coordinates lat ∈ [-90.0, 90.0], lon ∈ [-180.0, 180.0]. This mode uses real routes from Openstreetmap. Please, check the Geographic mode section below for more information

Q Commerce Environment

Environment that models Q-commerce services

Q-commerce visualization

Ride-hailing Environment

Environment that models Ride-hailing services

Ride-hailing visualization

How to install

pip install git+https://github.com/Sarrasor/logistics_envs.git@main

Geographic mode

Geographic mode uses Valhalla or OSRM routing engines to create routes for workers. One can create local Valhalla/OSRM server with Docker

  • Valhalla is recommended for dynamic maps and different types of workers
  • OSRM is recommended for static maps and large time/distance matrices

Make sure to set PBF_FILE and DOWNLOAD_LINK in the Makefile to your geographic region

Valhalla

make download_valhalla_graph
make start_valhalla

It will take some time on the first launch, you can check whether it is up by going to http://localhost:8002/status

Once the container is ready, you can check whether everything is ok by going to:

http://localhost:8002/route?json={"locations":[{"lat": 40.7824, "lon": -73.9557},{"lat": 40.8211, "lon": -73.9547}],"costing":"auto"}

In addition, you may want to modify service_limits in valhalla_files/valhalla.json to increase the maximum allowed time/distance matrix size. For example:

"service_limits": {
    "auto": {
      "max_distance": 500000,
      "max_locations": 1000,
      "max_matrix_distance": 500000,
      "max_matrix_location_pairs": 1000000
    },
    ...
}

Restart the the server for changes to be applied:

make restart_routing

OSRM

OSRM has two algorithms:

  • Multi-Level Dijkstra (MLD)
  • Contraction Hierarchies (CH)

The latter is recommended for large distance matrices

make download_osrm_graph
make extract_osrm

# For CH algorithm
make contract_osrm

# For MLD algorithm
make partition_osrm
make customize_osrm

# CH algorithm is set by default
make start_osrm

Once the container is up and running, you can check whether everything is ok with:

curl "http://localhost:5000/route/v1/car/-73.9557,40.7824;-73.9547,40.8211"

Visualization in geographic mode

You can use Logviz

logistics_envs's People

Contributors

sarrasor avatar

Watchers

 avatar  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.