Job

A job is used to model customer demand, additionally, with different constraints, such as time, skills, etc. A job schema consists of the following properties:

  • id (required): an unique job id

  • pickups (optional): a list of pickup tasks

  • deliveries (optional): a list of delivery tasks

  • replacements (optional): a list of replacement tasks

  • services (optional): a list of service tasks

  • priority (optional): a job priority which makes preferable to serve some jobs before others. Priority is represented as integer in range [1, MAX_INT] where the lower value means higher priority. By default value is set to 1.

  • skills (optional): job skills defined by allOf, oneOf or noneOf conditions:

            "skills": {
          "allOf": [
            "fridge"
          ],
          "noneOf": [
            "washing_machine"
          ]
        }
    

    These conditions are tested against vehicle's skills.

A job should have at least one task property specified.

Tasks

A delivery, pickup, replacement and service lists specify multiple job tasks and at least one of such tasks has to be defined. Each task has the following properties:

  • places (required): list of possible places from which only one has to be visited
  • demand (optional/required): a task demand. It is required for all job types, except service
  • tag (optional): a job tag which will be returned within job's activity in result solution

Places

Each place consists of the following properties:

  • location (required): a place location
  • duration (required): service (operational) time to serve task here
  • times (optional): time windows

Multiple places on single task can help model variable job location, e.g. visit customer at different location depending on time of the day.

Pickup job

Pickup job is a job with job.pickups property specified, without job.deliveries:

      {
        "id": "job2",
        "pickups": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5225,
                  "lng": 13.4095
                },
                "duration": 240.0,
                "times": [
                  [
                    "2019-07-04T10:00:00Z",
                    "2019-07-04T16:00:00Z"
                  ]
                ]
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      },

The vehicle picks some good at pickup locations, which leads to capacity growth according to job.pickups.demand value, and brings it till the end of the tour. Each pickup task has its own properties such as demand and places.

Delivery job

Delivery job is a job with job.deliveries property specified, without job.pickups:

      {
        "id": "job1",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.52599,
                  "lng": 13.45413
                },
                "duration": 300.0,
                "times": [
                  [
                    "2019-07-04T09:00:00Z",
                    "2019-07-04T18:00:00Z"
                  ],
                  [
                    "2019-07-05T09:00:00Z",
                    "2019-07-05T18:00:00Z"
                  ]
                ]
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      },

The vehicle picks some goods at the start stop, which leads to initial capacity growth, and brings it to job's locations, where capacity is decreased based on job.deliveries.demand values. Each delivery task has its own properties such as demand and places.

Pickup and delivery job

Pickup and delivery job is a job with both job.pickups and job.deliveries properties specified:

      {
        "id": "job3",
        "pickups": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5225,
                  "lng": 13.4095
                },
                "duration": 300.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "p1"
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5165,
                  "lng": 13.3808
                },
                "duration": 300.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "d1"
          }
        ]
      }

The vehicle picks some goods at one or multiple job.pickups.location, which leads to capacity growth, and brings them to one or many job.deliveries.location. The job has the following rules:

  • all pickup/delivery tasks should be done or none of them.
  • assignment order is not defined except all pickups should be assigned before any of deliveries.
  • sum of pickup demand should be equal to sum of delivery demand

A good example of such job is a job with more than two places with variable demand:

      {
        "id": "multi_job1",
        "pickups": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5622847,
                  "lng": 13.4023099
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "p1"
          },
          {
            "places": [
              {
                "location": {
                  "lat": 52.5330881,
                  "lng": 13.3973059
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "p2"
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5252832,
                  "lng": 13.4188422
                },
                "duration": 240.0
              }
            ],
            "demand": [
              2
            ],
            "tag": "d1"
          }
        ]
      },

This job contains two pickups and one delivery. Interpretation of such job can be "bring two parcels from two different places to one single customer".

Another example is one pickup and two deliveries:

      {
        "id": "multi_job2",
        "pickups": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.52599,
                  "lng": 13.45413
                },
                "duration": 240.0
              }
            ],
            "demand": [
              2
            ],
            "tag": "p1"
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.4928,
                  "lng": 13.4597
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "d1"
          },
          {
            "places": [
              {
                "location": {
                  "lat": 52.4989,
                  "lng": 13.3917
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "d2"
          }
        ]
      }
    ]
  },

Replacement job

A replacement job is a job with job.replacement property specified:

      {
        "id": "simple_replacement_job",
        "replacements": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5622847,
                  "lng": 13.4023099
                },
                "duration": 3600.0,
                "times": [
                  [
                    "2019-07-04T09:00:00Z",
                    "2019-07-04T18:00:00Z"
                  ]
                ]
              }
            ],
            "demand": [
              3
            ]
          }
        ]
      },

It models an use case when something big has to be replaced at the customer's location. This task requires a new good to be loaded at the beginning of the journey and old replaced one brought to journey's end.

Service job

A service job is a job with job.service property specified:

      {
        "id": "simple_service_job",
        "services": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5330881,
                  "lng": 13.3973059
                },
                "duration": 3600.0,
                "times": [
                  [
                    "2019-07-04T08:00:00Z",
                    "2019-07-04T12:00:00Z"
                  ],
                  [
                    "2019-07-04T14:00:00Z",
                    "2019-07-04T18:00:00Z"
                  ]
                ]
              }
            ]
          }
        ]
      },

This job models some work without demand (e.g. handyman visit).

Mixing job tasks

You can specify multiple tasks properties to get some mixed job:

      {
        "id": "mixed_job",
        "pickups": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5252832,
                  "lng": 13.4188422
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "p1"
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.52599,
                  "lng": 13.45413
                },
                "duration": 240.0
              }
            ],
            "demand": [
              1
            ],
            "tag": "d1"
          }
        ],
        "replacements": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.4928,
                  "lng": 13.4597
                },
                "duration": 2400.0
              }
            ],
            "demand": [
              2
            ],
            "tag": "r1"
          }
        ],
        "services": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.4989,
                  "lng": 13.3917
                },
                "duration": 1800.0
              }
            ],
            "tag": "s1"
          }
        ]

Similar pickup and delivery job, all these tasks has to be executed or none of them. The order is not specified except pickups must be scheduled before any delivery, replacement or service.

Hint

Use tag property on each job task if you want to use initial solution or checker features.

Related errors

Examples

Please refer to basic job usage examples to see how to specify problem with different job types.