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 with HiGHS as default solver).
Once you have the code locally, you can customize the model, 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:
resultField name Always present Data type SI Unit Description Example durationYes floatsecondsTime duration to get to the final result. {"duration": 0.123}valueYes floatNA Value of the final result. {"value": 0.123}customYes anyNA Custom solver metrics. See customrunField name Always present Data type SI Unit Description Example durationYes floatsecondsTime duration of the run. {"duration": 0.123}customField name Always present Data type SI Unit Description Example constraintsYes intNA Number of constraints. {"constraints": 123}providerYes stringNA Solver provider. {"provider": "highs"}statusYes stringNA Solver status. {"status": "optimal"}variablesYes intNA 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)
Run visualization
The Shift Scheduling Marketplace app includes a default visualization for the run input and output when viewing the details of a run in Nextmv Console (this same visualization is applied to the create new run view in Nextmv Console as well).
The minimum schema requirements to activate this visualization are outlined below. Also, note that the visualization for input and output is activated independently, you do not need to adhere both your input and output files to the minimum schema requirement to activate the visual in Nextmv Console.
Input minimum schema
Example of shift scheduling visualization in Nextmv Console for run input.
To activate the shift scheduling visualization for run input, all of the required properties as outlined in the Input schema section must be present. An example of the minimum schema requirement in JSON form is given below.
Output minimum schema
Example of shift scheduling visualization in Nextmv Console for run output.
To activate the shift scheduling visualization for run output, all of the required properties as outlined in the Output solution schema section must be present. An example of the minimum schema requirement in JSON form is given below.