> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solvice.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Break Management

> Configure mandatory and flexible breaks for drivers with location and timing constraints

# Break Management

Breaks are essential for driver safety, legal compliance, and operational efficiency. This guide covers how to configure various break types, locations, and timing constraints in your routing optimization.

## Break Configuration Basics

Breaks are defined within resource shifts:

```json theme={null}
{
  "resources": [
    {
      "name": "driver-1",
      "shifts": [{
        "from": "2024-03-15T08:00:00Z",
        "to": "2024-03-15T17:00:00Z",
        "breaks": [
          {
            "type": "WINDOWED",
            "from": "2024-03-15T12:00:00Z",
            "to": "2024-03-15T13:00:00Z",
            "duration": 3600  // 1 hour break
          }
        ]
      }]
    }
  ],
  "jobs": [
    {
      "name": "delivery-1",
      "duration": 1800
    }
  ]
}
```

## Break Types

### Windowed Breaks

Can occur flexibly within a time window:

<CodeGroup>
  ```json theme={null}
  {
    "breaks": [
      {
        "type": "WINDOWED",
        "from": "2024-03-15T12:00:00Z",
        "to": "2024-03-15T13:00:00Z",
        "duration": 3600  // Break duration in seconds
      }
    ]
  }
  ```
</CodeGroup>

### Flexible Windowed Breaks

Flexible timing within a wider window:

<CodeGroup>
  ```json theme={null}
  {
    "breaks": [
      {
        "type": "WINDOWED",
        "from": "2024-03-15T11:00:00Z",
        "to": "2024-03-15T14:00:00Z",
        "duration": 2700  // 45 minutes anytime in window
      }
    ]
  }
  ```
</CodeGroup>

### Drive Breaks

Reset continuous driving time:

<CodeGroup>
  ```json theme={null}
  {
    "breaks": [
      {
        "type": "DRIVE",
        "driveTime": 16200,  // After 4.5 hours driving
        "duration": 2700      // 45 minutes break
      }
    ]
  }
  ```
</CodeGroup>

### Duty Breaks

Trigger a break after cumulative **work time** — the combined total of driving time and service time. Unlike drive breaks which only count time behind the wheel, duty breaks account for all active work performed by the resource.

<CodeGroup>
  ```json theme={null}
  {
    "breaks": [
      {
        "type": "DUTY",
        "workTime": 19800,  // After 5.5 hours of total work
        "duration": 1800     // 30 minutes break
      }
    ]
  }
  ```
</CodeGroup>

<Info>
  **Work time calculation**: Work time includes driving time and service time (job durations). It does **not** include waiting time from time windows, break time, or synchronization delays.
</Info>

### Unavailability Breaks

Mark resource as unavailable:

<CodeGroup>
  ```json theme={null}
  {
    "breaks": [
      {
        "type": "UNAVAILABILITY",
        "from": "2024-03-15T14:00:00Z",
        "to": "2024-03-15T15:00:00Z"
      }
    ]
  }
  ```
</CodeGroup>

## Break Locations

### Location Options

<Tabs>
  <Tab title="Any Location">
    ```json theme={null}
    {
      "type": "WINDOWED",
      "from": "2024-03-15T11:00:00Z",
      "to": "2024-03-15T14:00:00Z",
      "duration": 1800
    }
    ```

    Break can be taken anywhere
  </Tab>

  <Tab title="Specific Location">
    ```json theme={null}
    {
      "type": "UNAVAILABILITY",
      "from": "2024-03-15T11:00:00Z",
      "to": "2024-03-15T14:00:00Z",
      "location": {
                    "latitude": 51.048,
                    "longitude": 3.696
                  }
    }
    ```

    Break at designated rest area
  </Tab>
</Tabs>

<Info>
  **Location Impact**:

  * `ANY`: No travel time, taken at current location
  * Specific location: Travel time to break location
</Info>

## Deducting Previous Breaks

When a shift includes multiple breaks, you can use `deductPreviousBreaks` to reduce a break's effective duration by the total time already spent on earlier breaks. This is useful when regulations require a total rest period that can be split across multiple shorter breaks throughout the shift.

<CodeGroup>
  ```json theme={null}
  {
    "breaks": [
      {
        "type": "WINDOWED",
        "from": "2024-03-15T10:00:00Z",
        "to": "2024-03-15T10:30:00Z",
        "duration": 900
      },
      {
        "type": "DUTY",
        "workTime": 21600,
        "duration": 2700,
        "deductPreviousBreaks": true
      }
    ]
  }
  ```
</CodeGroup>

In this example, the duty break has a base duration of 45 minutes (2700 seconds). Because `deductPreviousBreaks` is `true`, the 15-minute windowed break taken earlier is subtracted, resulting in an effective duty break of only 30 minutes.

<Info>
  **How deduction works**: When `deductPreviousBreaks` is `true`, the effective break duration is calculated as:

  `effective duration = max(0, break duration − sum of all prior break durations)`

  If prior breaks already meet or exceed the configured duration, the effective duration becomes zero — the break is still tracked but adds no extra idle time.
</Info>

The `deductPreviousBreaks` option is available on all trigger-based break types:

| Break type | Field                  | Default |
| ---------- | ---------------------- | ------- |
| `WINDOWED` | `deductPreviousBreaks` | `false` |
| `DRIVE`    | `deductPreviousBreaks` | `false` |
| `DUTY`     | `deductPreviousBreaks` | `false` |

## Break Timing Constraints

### Break Before Finish

Ensure breaks complete before shift end:

<CodeGroup>
  ```json theme={null}
  {
    "shifts": [{
      "from": "2024-03-15T08:00:00Z",
      "to": "2024-03-15T17:00:00Z",
      "breakBeforeFinish": 7200,  // 2 hours before shift end
      "breaks": [{
        "type": "WINDOWED",
        "from": "2024-03-15T11:00:00Z",
        "to": "2024-03-15T15:00:00Z",  // Must finish by 15:00
        "duration": 3600
      }]
    }]
  }
  ```
</CodeGroup>

### Multiple Breaks Example

<CodeGroup>
  ```json theme={null}
  {
    "shifts": [{
      "from": "2024-03-15T06:00:00Z",
      "to": "2024-03-15T18:00:00Z",
      "breaks": [
        {
          "type": "WINDOWED",
          "from": "2024-03-15T09:00:00Z",
          "to": "2024-03-15T10:30:00Z",
          "duration": 900,  // 15-minute morning break
          "location": "ANY"
        },
        {
          "type": "WINDOWED",
          "from": "2024-03-15T11:30:00Z",
          "to": "2024-03-15T13:30:00Z",
          "duration": 3600,  // 1-hour lunch
          "location": "DEPOT"
        },
        {
          "type": "WINDOWED",
          "from": "2024-03-15T15:00:00Z",
          "to": "2024-03-15T16:30:00Z",
          "duration": 900,  // 15-minute afternoon break
          "location": "ANY"
        }
      ]
    }]
  }
  ```
</CodeGroup>

## Integration with Resumable Jobs

Breaks can interrupt long service jobs:

<CodeGroup>
  ```json theme={null}
  {
    "jobs": [
      {
        "name": "installation",
        "duration": 14400,  // 4 hours
        "resumable": true   // Can be paused for breaks
      }
    ],
    "resources": [{
      "name": "driver-1",
      "shifts": [{
        "from": "2024-03-15T08:00:00Z",
        "to": "2024-03-15T17:00:00Z",
        "breaks": [{
          "type": "FIXED",
          "from": "2024-03-15T12:00:00Z",
          "to": "2024-03-15T13:00:00Z"
        }]
      }]
    }]
  }
  ```
</CodeGroup>

<Check>
  **Result**: Installation runs 8:00-12:00 (4 hours), break 12:00-13:00, resumes 13:00 to completion
</Check>

## Complex Break Scenarios

### Legal Compliance Example

EU driving regulations with both drive and duty breaks:

<CodeGroup>
  ```json theme={null}
  {
    "resources": [{
      "name": "long-haul-driver",
      "maxDriveTimeInSeconds": 16200,  // 4.5 hours
      "shifts": [{
        "from": "2024-03-15T06:00:00Z",
        "to": "2024-03-15T20:00:00Z",
        "breaks": [
          {
            "type": "DRIVE",
            "driveTime": 16200,  // After 4.5 hours driving
            "duration": 2700      // 45 minutes break
          },
          {
            "type": "DUTY",
            "workTime": 21600,    // After 6 hours total work
            "duration": 1800       // 30 minutes break
          },
          {
            "type": "WINDOWED",
            "from": "2024-03-15T11:00:00Z",
            "to": "2024-03-15T15:00:00Z",
            "duration": 3600  // Daily rest period
          }
        ]
      }]
    }],
    "jobs": [{
      "name": "long-distance-delivery",
      "duration": 1800
    }]
  }
  ```
</CodeGroup>

<Tip>
  **Combining DRIVE and DUTY breaks**: DRIVE and DUTY breaks trigger independently. A driver with long service stops may hit the DUTY threshold before the DRIVE threshold, or vice versa. Use both when regulations limit driving time and total work time separately. Consider using `deductPreviousBreaks` on the later breaks to avoid over-scheduling rest when earlier breaks already count toward the required rest period.
</Tip>

### Field Service with Breaks

<CodeGroup>
  ```json theme={null}
  {
    "resources": [{
      "name": "technician",
      "shifts": [{
        "from": "2024-03-15T08:00:00Z",
        "to": "2024-03-15T17:00:00Z",
        "start": {"latitude": 52.520, "longitude": 13.405},
        "breaks": [
          {
            "type": "WINDOWED",
            "from": "2024-03-15T10:00:00Z",
            "to": "2024-03-15T10:30:00Z",
            "duration": 900
          },
          {
            "type": "WINDOWED",
            "from": "2024-03-15T12:00:00Z",
            "to": "2024-03-15T14:00:00Z",
            "duration": 2700
          }
        ]
      }]
    }],
    "jobs": [{
      "name": "service-1",
      "duration": 3600
    }]
  }
  ```
</CodeGroup>

## Best Practices

<Steps>
  <Step title="Plan for Travel Time">
    Depot breaks require round-trip travel time - position routes accordingly
  </Step>

  <Step title="Use Flexible Windows">
    Windowed breaks give solver more optimization options than fixed breaks
  </Step>

  <Step title="Consider Job Locations">
    "ANY" location breaks avoid unnecessary travel
  </Step>

  <Step title="Account for Regulations">
    Implement legal break requirements as hard constraints
  </Step>
</Steps>

## Break Impact on Routes

The solver automatically:

* Schedules breaks within allowed windows
* Triggers duty breaks when cumulative work time exceeds the threshold
* Triggers drive breaks when cumulative driving time exceeds the threshold
* Adds travel time for depot/specific location breaks
* Splits resumable jobs around breaks
* Ensures breaks don't violate time windows
* Optimizes break placement to minimize disruption

<Warning>
  **Common Issues**:

  * Insufficient time for depot breaks including travel
  * Break windows conflicting with job time windows
  * Too many fixed breaks reducing flexibility
</Warning>

## Performance Considerations

<Accordion title="Break Complexity Impact">
  **Low Impact**:

  * Single break per shift
  * "ANY" location breaks
  * Wide time windows

  **Medium Impact**:

  * Multiple breaks per shift
  * Depot return requirements
  * Moderate time windows

  **High Impact**:

  * Many fixed-time breaks
  * Specific break locations
  * Tight break windows
  * Multiple driving and duty breaks combined
</Accordion>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Breaks Not Scheduled">
    **Causes**:

    * Break window too restrictive
    * Insufficient time in shift
    * Travel time to break location too long

    **Solutions**:

    * Widen break windows
    * Use "ANY" location when possible
    * Verify shift duration accommodates all breaks
  </Accordion>

  <Accordion title="Inefficient Break Placement">
    **Causes**:

    * Fixed breaks at suboptimal times
    * Depot breaks causing excessive travel

    **Solutions**:

    * Use windowed breaks for flexibility
    * Consider multiple smaller breaks
    * Place depot breaks strategically
  </Accordion>

  <Accordion title="Jobs Interrupted by Breaks">
    **Causes**:

    * Non-resumable jobs conflicting with breaks
    * Poor break window alignment

    **Solutions**:

    * Make long jobs resumable
    * Adjust break windows
    * Use job relations to control scheduling
  </Accordion>
</AccordionGroup>

## Related Features

<CardGroup cols={2}>
  <Card title="Shift Management" icon="calendar" href="/guides/vrp/features/resource-management">
    Configure shifts and working hours
  </Card>

  <Card title="Resumable Jobs" icon="pause" href="/guides/vrp/features/time-scheduling-advanced#resumable-jobs">
    Jobs that can be paused for breaks
  </Card>

  <Card title="Drive Time Limits" icon="car" href="/guides/vrp/features/advanced-constraints#drive-time-constraints">
    Legal driving time restrictions
  </Card>

  <Card title="Time Windows" icon="clock" href="/guides/vrp/features/time-scheduling-advanced">
    Coordinate breaks with job timing
  </Card>
</CardGroup>
