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
  • 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.
  • value (optional): a value associated with the job. With maximize-value objective, it is used to prioritize assignment of specific jobs. The difference between value and order (see in Tasks below) is that order related logic tries to assign jobs with lower order in the beginning of the tour. In contrast, value related logic tries to maximize total solution value by prioritizing assignment value scored jobs in any position of a tour. See job priorities example.
  • group (optional): a group name. Jobs with the same groups are scheduled in the same tour or left unassigned.
  • compatibility (optional): compatibility class. Jobs with different compatibility classes cannot be assigned in the same tour. This is useful to avoid mixing cargo, such as hazardous goods and food.

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
  • order (optional): a job task assignment order which makes preferable to serve some jobs before others in the tour. The order property is represented as integer greater than 1, where the lower value means higher priority. By default its value is set to maximum.

Places

Each place consists of the following properties:

  • location (required): a place location
  • duration (required): service (operational) time to serve task here (in seconds)
  • times (optional): time windows
  • tag (optional): a job place tag which will be returned within job's activity in result solution.

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 consumption growth according to job.pickups.demand value, and brings it till the end of the tour (or next reload). 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 consumption growth, and brings it to job's locations, where capacity consumption 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,
                "tag": "p1"
              }
            ],
            "demand": [
              1
            ]
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5165,
                  "lng": 13.3808
                },
                "duration": 300.0,
                "tag": "d1"
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      }

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,
                "tag": "p1"
              }
            ],
            "demand": [
              1
            ]
          },
          {
            "places": [
              {
                "location": {
                  "lat": 52.5330881,
                  "lng": 13.3973059
                },
                "duration": 240.0,
                "tag": "p2"
              }
            ],
            "demand": [
              1
            ]
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5252832,
                  "lng": 13.4188422
                },
                "duration": 240.0,
                "tag": "d1"
              }
            ],
            "demand": [
              2
            ]
          }
        ]
      },

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,
                "tag": "p1"
              }
            ],
            "demand": [
              2
            ]
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.4928,
                  "lng": 13.4597
                },
                "duration": 240.0,
                "tag": "d1"
              }
            ],
            "demand": [
              1
            ]
          },
          {
            "places": [
              {
                "location": {
                  "lat": 52.4989,
                  "lng": 13.3917
                },
                "duration": 240.0,
                "tag": "d2"
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      }
    ]
  },

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,
                "tag": "p1"
              }
            ],
            "demand": [
              1
            ]
          }
        ],
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.52599,
                  "lng": 13.45413
                },
                "duration": 240.0,
                "tag": "d1"
              }
            ],
            "demand": [
              1
            ]
          }
        ],
        "replacements": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.4928,
                  "lng": 13.4597
                },
                "duration": 2400.0,
                "tag": "r1"
              }
            ],
            "demand": [
              2
            ]
          }
        ],
        "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 place if you want to use initial solution or checker features.

Examples

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