The shift scheduling app is available in one modeling language as a Mixed Integer Problem (MIP). You can also choose to make customizations to the model by instantiating the app first.
- Nextmv Go SDK
- Default solver:
HiGHS
- Marketplace subscription app IDs
- Go:
nextmv-shift.scheduling
- Go:
- 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 |
---|---|---|---|---|---|
workers | Yes | array of worker | NA | Workers to assign. | See worker |
required_workers | Yes | array of required worker | NA | A predicted need of workers at certain times. | See required worker |
Here you can find a sample .json
with the input schema:
Worker
A worker is used in the input
schema.
Field name | Required | Data type | Description | Example |
---|---|---|---|---|
availability | Yes | array of availability | The availability times of the worker | See availability |
id | Yes | string | ID for the worker. | {"id": "1"} |
Availability
Availability is used in the worker
schema.
Field name | Required | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
start | Yes | timestamp | NA | The start of an availability time window for a worker. | {"start": "2023-01-01T00:00:00Z"} |
end | Yes | timestamp | NA | The end of an availability time window for a worker. | {"end": "2023-01-01T00:00:00Z"} |
Required Worker
A worker is used in the input
schema.
Field name | Required | Data type | Description | Example |
---|---|---|---|---|
start | Yes | timestamp | The start of a required worker time window. | {"start": "2023-01-01T00:00:00Z"} |
end | Yes | timestamp | The end of a required worker time window. | {"end": "2023-01-01T00:00:00Z"} |
count | Yes | int | The number of required workers for that time window. | {"count": 1} |
Output
The output schema defines the solution to the shift scheduling 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 scheduling problem. | {"solutions": []} |
statistics | Yes | statistics | NA | Summary statistics of the solution. | {"statistics": {"total_cost": 123}} |
version | Yes | string | NA | Version of the Nextmv SDK used to generate the solution. | {"version": {"sdk": "v1.2.3"}} |
options | No | object | NA | Arbitrary model and solver options that were used. | {"options": {"foo": "bar"}} |
Solution
Field name | Always present | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
assigned_shifts | Yes | array of assigned_shift | NA | Solution to the shift scheduling problem. | {"assigned_shifts": []} |
number_assigned_workers | Yes | int | NA | The number of assigned distinct workers. | {"number_assigned_workers": 1} |
Assigned shift
Field name | Always present | Data type | SI Unit | Description | Example |
---|---|---|---|---|---|
start | Yes | timestamp | NA | Start time of the worker's shift | {"start": "2023-01-01T00:00:00Z"} |
end | Yes | timestamp | NA | End time of the worker's shift | {"end": "2023-01-01T00:00:00Z"} |
worker_id | Yes | string | NA | The ID of the worker assigned to this shift. | {"id": "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 scheduling.
Valid time units for -solver.duration
are as follows, according to time.ParseDuration
from Go's standard library:
ns
(nanoseconds)us/µs
(microseconds)ms
(milliseconds)s
(seconds)m
(minutes)h
(hours)