> ## 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.

# Fair Workload Distribution

> Distribute shifts evenly across employees within defined groups

Fairness buckets ensure equitable workload distribution among a specific group of employees for selected shifts during a defined period.

## Use Cases

* **Equal shift distribution** - Ensure all team members get similar hours
* **Weekend rotation** - Fairly distribute unpopular shifts
* **Skill-based teams** - Balance workload within specialized groups

## Basic Fairness

Define a fairness bucket with employees, shifts, and the evaluation period:

```json theme={null}
{
  "employees": [
    { "name": "Alice" },
    { "name": "Bob" },
    { "name": "Carol" }
  ],
  "shifts": [
    { "name": "shift-1", "from": "2024-01-01T08:00:00", "to": "2024-01-01T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-2", "from": "2024-01-02T08:00:00", "to": "2024-01-02T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-3", "from": "2024-01-03T08:00:00", "to": "2024-01-03T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-4", "from": "2024-01-04T08:00:00", "to": "2024-01-04T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-5", "from": "2024-01-05T08:00:00", "to": "2024-01-05T16:00:00", "min": 1, "max": 1 },
    { "name": "shift-6", "from": "2024-01-06T08:00:00", "to": "2024-01-06T16:00:00", "min": 1, "max": 1 }
  ],
  "fairnessBuckets": [
    {
      "employees": ["Alice", "Bob", "Carol"],
      "shifts": ["shift-1", "shift-2", "shift-3", "shift-4", "shift-5", "shift-6"],
      "period": {
        "from": "2024-01-01",
        "to": "2024-01-07"
      },
      "target": "PT16H"
    }
  ]
}
```

<Check>
  The solver distributes the 6 shifts evenly: each employee gets 2 shifts during the week.
</Check>

## Fairness Properties

<ParamField body="employees" type="array" required>
  List of employee names to include in this fairness group
</ParamField>

<ParamField body="shifts" type="array" required>
  List of shift names to distribute fairly among the employees
</ParamField>

<ParamField body="period" type="object">
  Time period during which fairness is evaluated
</ParamField>

<ParamField body="target" type="string (ISO 8601 duration)" required>
  Target workload per employee (e.g., `PT40H` for 40 hours)
</ParamField>

## Multiple Fairness Buckets

Create separate fairness groups for different teams or shift types:

```json theme={null}
{
  "fairnessBuckets": [
    {
      "employees": ["Alice", "Bob"],
      "shifts": ["morning-1", "morning-2", "morning-3"],
      "period": { "from": "2024-01-01", "to": "2024-01-07" },
      "target": "PT12H"
    },
    {
      "employees": ["Carol", "Dave"],
      "shifts": ["evening-1", "evening-2", "evening-3"],
      "period": { "from": "2024-01-01", "to": "2024-01-07" },
      "target": "PT12H"
    }
  ]
}
```

<Info>
  Each bucket operates independently. Morning shifts are distributed among Alice and Bob, while evening shifts go to Carol and Dave.
</Info>

## Target-Based Fairness

Set a specific workload target instead of equal distribution:

```json theme={null}
{
  "fairnessBuckets": [
    {
      "employees": ["Alice", "Bob", "Carol"],
      "shifts": ["shift-1", "shift-2", "shift-3"],
      "period": { "from": "2024-01-01", "to": "2024-01-07" },
      "target": "PT24H"
    }
  ]
}
```

<Tip>
  Use `target` when employees have different availability or contract types but should work toward the same weekly hours.
</Tip>

## Fairness vs Rules

| Approach     | Best For                                       |
| ------------ | ---------------------------------------------- |
| **Fairness** | Equal distribution of similar shifts           |
| **Rules**    | Hard limits on working days/hours              |
| **Combined** | Fair distribution within labor law constraints |
