Defining problem

In general, expressing an arbitrary VRP problem in one simple and universal format is a challenging task. pragmatic format aims to do that and there are concept and example sections which describe multiple features it supports in great details. However, it might take some time to get a huge problem with a lot of jobs and vehicles converted into it.

A csv import feature might help here.

CSV import

vrp-cli supports importing jobs and vehicles into pragmatic json format by the following command:

    vrp-cli import csv -i jobs.csv -i vehicles.csv -o problem.json

As you can see from the command, you need to specify jobs and vehicles in two separate csv files in the exact order.

Jobs csv

Jobs csv defines a plan of the problem and should have the following columns:

  • ID (string): an id
  • LAT (float): a latitude
  • LNG (float): a longitude
  • DEMAND (integer): a single dimensional demand. Depending on the value, it models different job activities:
    • positive: pickup
    • negative: delivery
    • zero: service
  • DURATION (integer): job duration in minutes
  • TW_START (date in RFC3999): earliest time when job can be served
  • TW_END (date in RFC3999): latest time when job can be served

To model a job with more than one activity (e.g. pickup + delivery), specify same ID twice. Example:


job with job2 id specified twice with positive and negative demand, so it will be considered as pickup and delivery job.

Vehicles csv

Vehicles csv defines a fleet of the problem and should have the following columns:

  • ID (string): an unique vehicle type id
  • LAT (float): a depot latitude
  • LNG (float): a depot longitude
  • CAPACITY (unassigned integer): a single dimensional vehicle capacity
  • TW_START (date in RFC3999): earliest time when vehicle can start at depot
  • TW_END (date in RFC3999): latest time when vehicle should return to depot
  • AMOUNT (unassigned integer): a vehicle amount of this type
  • PROFILE (string): a routing profile

This is example of such csv:



Please note, to keep csv format simple and easy to use, it's limited to just a few, really basic features known as Capacitated Vehicle Routing Problem with Time Windows (CVRPTW). However, for a few jobs/vehices, you can modify the file manually as post-processing step.