Skip to main content

A python framework for solving vehicle routing problems

Project description

VRPy is a python framework for solving Vehicle Routing Problems (VRP) including:

  • the Capacitated VRP (CVRP),
  • the CVRP with resource constraints,
  • the CVRP with time windows (CVRPTW),
  • the CVRP with simultaneous distribution and collection (CVRPSDC),
  • the CVRP with heterogeneous fleet (HFCVRP).

Check out the docs to find more variants and options.

Simple example

>>> from networkx import DiGraph
>>> from vrpy import VehicleRoutingProblem

# Define the network
>>> G = DiGraph()
>>> G.add_edge("Source",1,cost=1,time=2)
>>> G.add_edge("Source",2,cost=2,time=1)
>>> G.add_edge(1,"Sink",cost=0,time=2)
>>> G.add_edge(2,"Sink",cost=2,time=3)
>>> G.add_edge(1,2,cost=1,time=1)
>>> G.add_edge(2,1,cost=1,time=1)

# Define the customers demands
>>> G.nodes[1]["demand"] = 5
>>> G.nodes[2]["demand"] = 4

# Define the Vehicle Routing Problem
>>> prob = VehicleRoutingProblem(G, load_capacity=10, duration=5)

# Solve and display solution value
>>> prob.solve()
>>> print(prob.best_value)
3
>>> print(prob.best_routes)
{1: ["Source",2,1,"Sink"]}

Install

pip install vrpy

Requirements

cspy

NetworkX

numpy

PuLP

Documentation

Documentation is found here.

Running the tests

Unit Tests

cd tests
pytest unittests/

Bugs

Please report any bugs that you find in the issues section. Or, even better, fork the repository on GitHub and create a pull request. Any contributions are welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for vrpy, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size vrpy-0.2.0-py3-none-any.whl (39.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size vrpy-0.2.0.tar.gz (29.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page