The shift planning app is available in two modeling languages as a Mixed Integer Problem (MIP). You can also choose to make customizations to the model by instantiating the app first.
- OR-Tools
- Default solver:
SCIP
- Marketplace subscription app IDs
- Python:
nextmv-shift.plan.ortools
- Python:
- Default solver:
- Pyomo
- Default solver:
CBC
- Marketplace subscription app IDs
- Python:
nextmv-shift.plan.pyomo
- Python:
- Default solver:
Once you have the code locally, you can customize the model, run it locally and deploy it to Nextmv Platform.
Input
The format for timestamps should be RFC3339
, e.g.: "2023-01-01T00:00:00Z"
.
The input schema is a JSON payload defining the available workers and the required demand to satisfy for a shift scheduling problem. Nextmv's tools are designed to operate directly on business data (in JSON
) to produce decisions that are actionable by software systems. This makes decisions more interpretable and easier to test. It also makes integration with data warehouses and business intelligence platforms significantly easier. An input contains the following components:
Field name | Required | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
shifts | Yes | array of shift | NA | Possible shifts with additional properties to select from. | See shift |
demands | Yes | array of demand | NA | A predicted need of workers at certain times. | See demand |
options | No | array of option | NA | A set of options to solve the problem. | See option |
Here you can find a sample .json
with the input schema:
Shift
A shift is used in the input
schema.
Field name | Required | Data type | Description | Example |
---|---|---|---|---|
id | Yes | string | ID for the shift. | {"id": "1"} |
qualification | No | string | The qualification needed for the shift. | {"qualification": "1"} |
min_workers | No | int | The minimum number of workers for the shift. | {"min_workers": 1} |
max_workers | No | int | The maximum number of workers for the shift. | {"max_workers": 1} |
cost | No | int | The cost for the shift. | {"cost": 1} |
times | Yes | array of time | The time windows covered by this shift. | See time |
Time
Time is used in the shift
schema.
Field name | Required | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
id | Yes | string | ID for the time window. | {"id": "1"} | |
start_time | Yes | timestamp | NA | The start time of this time window. | {"start_time": "2023-01-01T00:00:00Z"} |
end_time | Yes | timestamp | NA | The end time of this time window. | {"end_time": "2023-01-01T00:00:00Z"} |
Demand
Demand is used in the input
schema.
Field name | Required | Data type | Description | Example |
---|---|---|---|---|
start_time | Yes | timestamp | NA | The start time of the predicted demand. |
end_time | Yes | timestamp | NA | The end time of the predicted demand. |
count | Yes | int | The amount of predicted demand. | {"count": 1} |
qualification | No | string | The qualification needed for the demand. | {"qualification": "1"} |
Option
Option is used in the input
schema.
Field name | Required | Data type | Description | Example |
---|---|---|---|---|
over_supply_cost | No | int | The cost for oversupplying a demand. | {"over_supply_cost": 1} |
under_supply_cost | No | int | The cost for shortfalling a demand. | {"under_supply_cost": 1} |
Output
The output schema defines the solution to the shift planning problem in JSON
format. The output schema contains the following components.
Field name | Always present | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
solutions | Yes | array of solution | NA | Solutions to the shift planning problem. | {"solutions": []} |
statistics | Yes | statistics | NA | Summary statistics of the solution. | {"statistics": {"total_cost": 123}} |
Solution
Field name | Always present | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
planned_shifts | Yes | array of planned_shift | NA | Solution to the shift scheduling problem. | {"planned_shifts": []} |
Planned shift
Field name | Always present | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
start_time | Yes | timestamp | NA | Start time of the worker's shift | {"start_time": "2023-01-01T00:00:00Z"} |
end_time | Yes | timestamp | NA | End time of the worker's shift | {"end_time": "2023-01-01T00:00:00Z"} |
id | Yes | string | NA | The ID of the planned shift. | {"id": "1"} |
shift_id | Yes | string | NA | The ID of the used shift. | {"shift_id": "1"} |
time_id | Yes | string | NA | The ID of used time of the shift. | {"time_id": "1"} |
qualification | Yes | string | NA | The needed qualification to work the shift. | {"qualification": "1"} |
count | Yes | int | NA | Count describes how of this shift/time combination is needed. | {"count": "1"} |
Statistics
Field name | Always present | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
result | No | result | NA | Final result of the solutions. | See result |
run | Yes | run | NA | Information about the run. | See run |
schema | Yes | string | NA | Schema of the statistics. | {"schema": "v1"} |
Here you can find additional definitions used in the statistics
schema:
result
Field name Always present Data type SI Unit Description Example duration
Yes float
seconds
Time duration to get to the final result. {"duration": 0.123}
value
Yes float
NA Value of the final result. {"value": 0.123}
custom
Yes any
NA Custom solver metrics. See custom
run
Field name Always present Data type SI Unit Description Example duration
Yes float
seconds
Time duration of the run. {"duration": 0.123}
custom
Field name Always present Data type SI Unit Description Example constraints
Yes int
NA Number of constraints. {"constraints": 123}
provider
Yes string
NA Solver provider. {"provider": "highs"}
status
Yes string
NA Solver status. {"status": "optimal"}
variables
Yes int
NA Number of variables. {"variables": 123}
Run options
These are the default options that are available with shift planning.