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

# Demand-Based Scheduling

> Define staffing requirements independent of shift structure

Demands let you specify coverage requirements without creating explicit shifts. The solver assigns employees to existing shifts that best satisfy the demand constraints.

<Frame caption="Demand-based scheduling optimizes the overlap between shift supply and staffing demand">
  <img src="https://mintcdn.com/solvice-68592f22/1KJ_2AIotizI1Bng/images/demand-supply.svg?fit=max&auto=format&n=1KJ_2AIotizI1Bng&q=85&s=edfa885b37b0c4c28ec39a0c6e8f1e2b" alt="Demand vs supply of shifts" width="600" height="440" data-path="images/demand-supply.svg" />
</Frame>

## Use Cases

* **Peak hour coverage** - Ensure minimum staffing during busy periods
* **Event staffing** - Temporary increased coverage for special events
* **Flexible scheduling** - Define needs without rigid shift boundaries

## Basic Demand

Define a demand period with minimum and maximum staffing levels:

```json theme={null}
{
  "employees": [
    { "name": "Alice" },
    { "name": "Bob" },
    { "name": "Carol" }
  ],
  "shifts": [
    {
      "name": "morning",
      "from": "2022-01-01T08:00:00",
      "to": "2022-01-01T14:00:00",
      "min": 0,
      "max": 2
    },
    {
      "name": "afternoon",
      "from": "2022-01-01T12:00:00",
      "to": "2022-01-01T18:00:00",
      "min": 0,
      "max": 2
    }
  ],
  "demands": [
    {
      "name": "lunch-rush",
      "from": "2022-01-01T11:00:00",
      "to": "2022-01-01T14:00:00",
      "skills": [{ "name": "general" }],
      "min": 2,
      "max": 3
    }
  ]
}
```

<Info>
  The solver assigns employees to shifts that overlap with the demand period, ensuring at least 2 people cover the lunch rush from 11:00-14:00.
</Info>

## Demand Properties

<ParamField body="name" type="string" required>
  Unique identifier for the demand period
</ParamField>

<ParamField body="from" type="datetime" required>
  Start time of the demand period (ISO 8601 format)
</ParamField>

<ParamField body="to" type="datetime" required>
  End time of the demand period (ISO 8601 format)
</ParamField>

<ParamField body="skills" type="array" required>
  Required skills for this demand period
</ParamField>

<ParamField body="min" type="integer" required>
  Minimum number of employees required during this period
</ParamField>

<ParamField body="max" type="integer" required>
  Maximum number of employees allowed during this period
</ParamField>

## Demand vs Shifts

| Approach         | Best For                                             |
| ---------------- | ---------------------------------------------------- |
| **Shifts only**  | Fixed schedules with predictable staffing            |
| **Demands only** | Flexible coverage requirements                       |
| **Combined**     | Complex scenarios with both fixed and variable needs |

<Tip>
  Use demands when you care about coverage during a time window but don't want to micromanage which specific shifts provide that coverage.
</Tip>
