Vehicle break

This example demonstrates how to use vehicle break with omitted location and time window.

Problem

{
  "plan": {
    "jobs": [
      {
        "id": "job1",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.52599,
                  "lng": 13.45413
                },
                "duration": 300.0,
                "times": [
                  [
                    "2019-07-04T09:00:00Z",
                    "2019-07-04T12:00:00Z"
                  ]
                ]
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      },
      {
        "id": "job2",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5225,
                  "lng": 13.4095
                },
                "duration": 240.0,
                "times": [
                  [
                    "2019-07-04T12:00:00Z",
                    "2019-07-04T14:00:00Z"
                  ]
                ]
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      },
      {
        "id": "job3",
        "deliveries": [
          {
            "places": [
              {
                "location": {
                  "lat": 52.5165,
                  "lng": 13.3808
                },
                "duration": 300.0,
                "times": [
                  [
                    "2019-07-04T16:00:00Z",
                    "2019-07-04T18:00:00Z"
                  ]
                ]
              }
            ],
            "demand": [
              1
            ]
          }
        ]
      }
    ]
  },
  "fleet": {
    "vehicles": [
      {
        "typeId": "vehicle",
        "vehicleIds": [
          "vehicle_1"
        ],
        "profile": "normal_car",
        "costs": {
          "fixed": 22.0,
          "distance": 0.0002,
          "time": 0.004806
        },
        "shifts": [
          {
            "start": {
              "earliest": "2019-07-04T09:00:00Z",
              "location": {
                "lat": 52.5316,
                "lng": 13.3884
              }
            },
            "end": {
              "latest": "2019-07-04T18:00:00Z",
              "location": {
                "lat": 52.5316,
                "lng": 13.3884
              }
            },
            "breaks": [
              {
                "time": [
                  "2019-07-04T12:00:00Z",
                  "2019-07-04T14:00:00Z"
                ],
                "duration": 3600.0
              }
            ]
          }
        ],
        "capacity": [
          10
        ]
      }
    ],
    "profiles": [
      {
        "name": "normal_car",
        "type": "car"
      }
    ]
  }
}

Solution

{
  "statistic": {
    "cost": 101.964322,
    "distance": 13251,
    "duration": 16087,
    "times": {
      "driving": 2367,
      "serving": 840,
      "waiting": 9280,
      "break": 3600
    }
  },
  "tours": [
    {
      "vehicleId": "vehicle_1",
      "typeId": "vehicle",
      "shiftIndex": 0,
      "stops": [
        {
          "location": {
            "lat": 52.5316,
            "lng": 13.3884
          },
          "time": {
            "arrival": "2019-07-04T09:00:00Z",
            "departure": "2019-07-04T11:44:12Z"
          },
          "distance": 0,
          "load": [
            3
          ],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure"
            }
          ]
        },
        {
          "location": {
            "lat": 52.52599,
            "lng": 13.45413
          },
          "time": {
            "arrival": "2019-07-04T12:00:00Z",
            "departure": "2019-07-04T13:05:00Z"
          },
          "distance": 5112,
          "load": [
            2
          ],
          "activities": [
            {
              "jobId": "job1",
              "type": "delivery",
              "location": {
                "lat": 52.52599,
                "lng": 13.45413
              },
              "time": {
                "start": "2019-07-04T12:00:00Z",
                "end": "2019-07-04T12:05:00Z"
              }
            },
            {
              "jobId": "break",
              "type": "break",
              "location": {
                "lat": 52.52599,
                "lng": 13.45413
              },
              "time": {
                "start": "2019-07-04T12:05:00Z",
                "end": "2019-07-04T13:05:00Z"
              }
            }
          ]
        },
        {
          "location": {
            "lat": 52.5225,
            "lng": 13.4095
          },
          "time": {
            "arrival": "2019-07-04T13:15:09Z",
            "departure": "2019-07-04T13:19:09Z"
          },
          "distance": 8952,
          "load": [
            1
          ],
          "activities": [
            {
              "jobId": "job2",
              "type": "delivery"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5165,
            "lng": 13.3808
          },
          "time": {
            "arrival": "2019-07-04T13:25:20Z",
            "departure": "2019-07-04T16:05:00Z"
          },
          "distance": 11106,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "job3",
              "type": "delivery"
            }
          ]
        },
        {
          "location": {
            "lat": 52.5316,
            "lng": 13.3884
          },
          "time": {
            "arrival": "2019-07-04T16:12:19Z",
            "departure": "2019-07-04T16:12:19Z"
          },
          "distance": 13251,
          "load": [
            0
          ],
          "activities": [
            {
              "jobId": "arrival",
              "type": "arrival"
            }
          ]
        }
      ],
      "statistic": {
        "cost": 101.964322,
        "distance": 13251,
        "duration": 16087,
        "times": {
          "driving": 2367,
          "serving": 840,
          "waiting": 9280,
          "break": 3600
        }
      }
    }
  ],
  "unassigned": []
}