Shift Scheduling

Shift scheduling

A how-to guide for specifying the input and output schemas in shift scheduling.

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 community clone -a shift-scheduling-gosdk
Copy

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 nameRequiredData typeSI UnitDescriptionExample
workersYesarray of workerNAWorkers to assign.See worker
required_workersYesarray of required workerNAA predicted need of workers at certain times.See required worker

Here you can find a sample .json with the input schema:

{
  "workers": [
    {
      "availability": [
        {
          "start": "2023-12-10T19:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "ghastly-blobfish"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T17:59:00-05:00"
        }
      ],
      "id": "delirious-capuchin-monkey"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T18:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "effervescent-peacock"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T17:59:00-05:00"
        }
      ],
      "id": "ebullient-porcupine"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T11:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "mellifluous-lemur"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T15:00:00-05:00",
          "end": "2023-12-10T17:59:00-05:00"
        }
      ],
      "id": "ghastly-armadillo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T12:00:00-05:00",
          "end": "2023-12-10T14:59:00-05:00"
        }
      ],
      "id": "lugubrious-flying-squirrel"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "recalcitrant-ostrich"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T14:59:00-05:00"
        }
      ],
      "id": "hapless-giraffe"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T17:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "zany-walrus"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T14:59:00-05:00"
        }
      ],
      "id": "querulous-turtle"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T20:59:00-05:00"
        }
      ],
      "id": "perspicacious-flying-squirrel"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T09:59:00-05:00"
        }
      ],
      "id": "perspicacious-kakapo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T14:00:00-05:00",
          "end": "2023-12-10T15:59:00-05:00"
        }
      ],
      "id": "effervescent-dik-dik"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T20:59:00-05:00"
        }
      ],
      "id": "mellifluous-walrus"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T16:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "kaleidoscopic-meerkat"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "xenophilic-okapi"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T18:00:00-05:00",
          "end": "2023-12-10T20:59:00-05:00"
        }
      ],
      "id": "ghastly-proboscis-monkey"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T13:59:00-05:00"
        }
      ],
      "id": "whimsical-meerkat"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T18:00:00-05:00",
          "end": "2023-12-10T20:59:00-05:00"
        }
      ],
      "id": "gibbous-armadillo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T15:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "lachrymose-sugar-glider"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T18:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "whimsical-hippopotamus"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "rambunctious-narwhal"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T09:59:00-05:00"
        }
      ],
      "id": "yawning-sloth"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T18:59:00-05:00"
        }
      ],
      "id": "aberrant-otter"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "supercilious-hedgehog"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T19:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "kaleidoscopic-tarsier"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T14:59:00-05:00"
        }
      ],
      "id": "sesquipedalian-giraffe"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T19:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "obstreperous-pangolin"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "ghastly-meerkat"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T13:59:00-05:00"
        }
      ],
      "id": "cantankerous-jerboa"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T17:59:00-05:00"
        }
      ],
      "id": "supercilious-tapir"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T08:59:00-05:00"
        }
      ],
      "id": "yawning-okapi"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T20:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "rapscallion-sugar-glider"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T18:59:00-05:00"
        }
      ],
      "id": "lugubrious-otter"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T15:59:00-05:00"
        }
      ],
      "id": "pernicious-wombat"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T22:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "ghastly-tarsier"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T11:00:00-05:00",
          "end": "2023-12-10T13:59:00-05:00"
        }
      ],
      "id": "enigmatic-okapi"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "wanderlust-narwhal"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T18:59:00-05:00"
        }
      ],
      "id": "enigmatic-quokka"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T18:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "ebullient-dik-dik"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T17:59:00-05:00"
        }
      ],
      "id": "recalcitrant-narwhal"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T16:59:00-05:00"
        }
      ],
      "id": "lugubrious-toucan"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T21:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "flabbergasted-walrus"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "ghastly-fennec-fox"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T16:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "turbulent-sea-otter"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T17:59:00-05:00"
        }
      ],
      "id": "zealous-sugar-glider"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T20:59:00-05:00"
        }
      ],
      "id": "perspicacious-aardvark"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T11:00:00-05:00",
          "end": "2023-12-10T18:59:00-05:00"
        }
      ],
      "id": "cantankerous-red-panda"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "cacophonous-alpaca"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T18:59:00-05:00"
        }
      ],
      "id": "beneficent-flying-squirrel"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T13:59:00-05:00"
        }
      ],
      "id": "quixotic-sloth"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T20:59:00-05:00"
        }
      ],
      "id": "cacophonous-kakapo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T12:00:00-05:00",
          "end": "2023-12-10T14:59:00-05:00"
        }
      ],
      "id": "vainglorious-star-nosed-mole"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T11:00:00-05:00",
          "end": "2023-12-10T13:59:00-05:00"
        }
      ],
      "id": "ineffable-jerboa"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T11:00:00-05:00",
          "end": "2023-12-10T15:59:00-05:00"
        }
      ],
      "id": "cryptic-turtle"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T16:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "vainglorious-chameleon"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T14:00:00-05:00",
          "end": "2023-12-10T14:59:00-05:00"
        }
      ],
      "id": "munificent-narwhal"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T18:59:00-05:00"
        }
      ],
      "id": "farcical-proboscis-monkey"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "nebulous-hedgehog"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T09:59:00-05:00"
        }
      ],
      "id": "quixotic-platypus"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T20:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "querulous-flamingo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T17:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "farcical-flamingo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T13:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "zealous-capuchin-monkey"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T09:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "aberrant-peacock"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T19:00:00-05:00",
          "end": "2023-12-10T21:59:00-05:00"
        }
      ],
      "id": "pernicious-turtle"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T16:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "munificent-pangolin"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T19:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "dapper-alpaca"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T11:00:00-05:00",
          "end": "2023-12-10T15:59:00-05:00"
        }
      ],
      "id": "gibbous-binturong"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T14:00:00-05:00",
          "end": "2023-12-10T19:59:00-05:00"
        }
      ],
      "id": "delirious-aardvark"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T10:59:00-05:00"
        }
      ],
      "id": "cacophonous-star-nosed-mole"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T17:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "ubiquitous-sugar-glider"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "astonishing-flamingo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T08:00:00-05:00",
          "end": "2023-12-10T10:59:00-05:00"
        }
      ],
      "id": "zealous-binturong"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T07:00:00-05:00",
          "end": "2023-12-10T15:59:00-05:00"
        }
      ],
      "id": "delirious-armadillo"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T18:00:00-05:00",
          "end": "2023-12-10T22:59:00-05:00"
        }
      ],
      "id": "aberrant-toucan"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T15:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "cantankerous-pangolin"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T19:00:00-05:00",
          "end": "2023-12-10T23:59:00-05:00"
        }
      ],
      "id": "supercilious-alpaca"
    },
    {
      "availability": [
        {
          "start": "2023-12-10T10:00:00-05:00",
          "end": "2023-12-10T11:59:00-05:00"
        }
      ],
      "id": "sesquipedalian-capuchin-monkey"
    }
  ],
  "required_workers": [
    {
      "start": "2023-12-10T07:00:00-05:00",
      "end": "2023-12-10T10:59:00-05:00",
      "count": 13
    },
    {
      "start": "2023-12-10T11:00:00-05:00",
      "end": "2023-12-10T14:59:00-05:00",
      "count": 59
    },
    {
      "start": "2023-12-10T15:00:00-05:00",
      "end": "2023-12-10T18:59:00-05:00",
      "count": 78
    },
    {
      "start": "2023-12-10T19:00:00-05:00",
      "end": "2023-12-10T22:59:00-05:00",
      "count": 39
    }
  ]
}
Copy

Worker

A worker is used in the input schema.

Field nameRequiredData typeDescriptionExample
availabilityYesarray of availabilityThe availability times of the workerSee availability
idYesstringID for the worker.{"id": "1"}

Availability

Availability is used in the worker schema.

Field nameRequiredData typeSI UnitDescriptionExample
startYestimestampNAThe start of an availability time window for a worker.{"start": "2023-01-01T00:00:00Z"}
endYestimestampNAThe 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 nameRequiredData typeDescriptionExample
startYestimestampThe start of a required worker time window.{"start": "2023-01-01T00:00:00Z"}
endYestimestampThe end of a required worker time window.{"end": "2023-01-01T00:00:00Z"}
countYesintThe 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 nameAlways presentData typeSI UnitDescriptionExample
solutionsYesarray of solutionNASolutions to the shift scheduling problem.{"solutions": []}
statisticsYesstatisticsNASummary statistics of the solution.{"statistics": {"total_cost": 123}}
versionYesstringNAVersion of the Nextmv SDK used to generate the solution.{"version": {"sdk": "v1.2.3"}}
optionsNoobjectNAArbitrary model and solver options that were used.{"options": {"foo": "bar"}}
{
  "options": {
    "limits": {
      "day": {
        "max_duration": 36000000000000
      },
      "shift": {
        "max_duration": 28800000000000,
        "min_duration": 7200000000000,
        "recovery_time": 28800000000000
      },
      "week": {
        "max_duration": 144000000000000
      }
    },
    "penalty": {
      "over_supply": 1000,
      "under_supply": 500
    },
    "solve": {
      "control": {
        "bool": [],
        "float": [],
        "int": [],
        "string": []
      },
      "duration": 10000000000,
      "mip": {
        "gap": {
          "absolute": 0.000001,
          "relative": 0.0001
        }
      },
      "verbosity": "off"
    }
  },
  "solutions": [
    {
      "assigned_shifts": [
        {
          "end": "2023-12-10T14:59:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "delirious-capuchin-monkey"
        },
        {
          "end": "2023-12-10T16:59:00-05:00",
          "start": "2023-12-10T09:00:00-05:00",
          "worker_id": "ebullient-porcupine"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "mellifluous-lemur"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T18:30:00-05:00",
          "worker_id": "mellifluous-lemur"
        },
        {
          "end": "2023-12-10T14:59:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "recalcitrant-ostrich"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T12:00:00-05:00",
          "worker_id": "recalcitrant-ostrich"
        },
        {
          "end": "2023-12-10T14:59:00-05:00",
          "start": "2023-12-10T08:00:00-05:00",
          "worker_id": "querulous-turtle"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "perspicacious-flying-squirrel"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "mellifluous-walrus"
        },
        {
          "end": "2023-12-10T23:59:00-05:00",
          "start": "2023-12-10T16:00:00-05:00",
          "worker_id": "kaleidoscopic-meerkat"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "xenophilic-okapi"
        },
        {
          "end": "2023-12-10T19:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "lachrymose-sugar-glider"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T18:00:00-05:00",
          "worker_id": "whimsical-hippopotamus"
        },
        {
          "end": "2023-12-10T16:59:00-05:00",
          "start": "2023-12-10T10:00:00-05:00",
          "worker_id": "rambunctious-narwhal"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "rambunctious-narwhal"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "aberrant-otter"
        },
        {
          "end": "2023-12-10T14:59:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "supercilious-hedgehog"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T13:30:00-05:00",
          "worker_id": "supercilious-hedgehog"
        },
        {
          "end": "2023-12-10T14:59:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "sesquipedalian-giraffe"
        },
        {
          "end": "2023-12-10T23:59:00-05:00",
          "start": "2023-12-10T19:00:00-05:00",
          "worker_id": "obstreperous-pangolin"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "ghastly-meerkat"
        },
        {
          "end": "2023-12-10T13:59:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "cantankerous-jerboa"
        },
        {
          "end": "2023-12-10T15:59:00-05:00",
          "start": "2023-12-10T08:00:00-05:00",
          "worker_id": "supercilious-tapir"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "lugubrious-otter"
        },
        {
          "end": "2023-12-10T15:59:00-05:00",
          "start": "2023-12-10T08:00:00-05:00",
          "worker_id": "pernicious-wombat"
        },
        {
          "end": "2023-12-10T15:29:00-05:00",
          "start": "2023-12-10T10:30:00-05:00",
          "worker_id": "wanderlust-narwhal"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "wanderlust-narwhal"
        },
        {
          "end": "2023-12-10T12:29:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "enigmatic-quokka"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "enigmatic-quokka"
        },
        {
          "end": "2023-12-10T16:59:00-05:00",
          "start": "2023-12-10T10:00:00-05:00",
          "worker_id": "lugubrious-toucan"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "ghastly-fennec-fox"
        },
        {
          "end": "2023-12-10T20:59:00-05:00",
          "start": "2023-12-10T13:00:00-05:00",
          "worker_id": "perspicacious-aardvark"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "cantankerous-red-panda"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "cacophonous-alpaca"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "beneficent-flying-squirrel"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "cacophonous-kakapo"
        },
        {
          "end": "2023-12-10T15:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "cryptic-turtle"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "farcical-proboscis-monkey"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "nebulous-hedgehog"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T17:00:00-05:00",
          "worker_id": "farcical-flamingo"
        },
        {
          "end": "2023-12-10T20:59:00-05:00",
          "start": "2023-12-10T13:00:00-05:00",
          "worker_id": "zealous-capuchin-monkey"
        },
        {
          "end": "2023-12-10T17:59:00-05:00",
          "start": "2023-12-10T10:00:00-05:00",
          "worker_id": "aberrant-peacock"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "aberrant-peacock"
        },
        {
          "end": "2023-12-10T23:59:00-05:00",
          "start": "2023-12-10T19:00:00-05:00",
          "worker_id": "dapper-alpaca"
        },
        {
          "end": "2023-12-10T15:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "gibbous-binturong"
        },
        {
          "end": "2023-12-10T19:59:00-05:00",
          "start": "2023-12-10T14:00:00-05:00",
          "worker_id": "delirious-aardvark"
        },
        {
          "end": "2023-12-10T23:59:00-05:00",
          "start": "2023-12-10T17:00:00-05:00",
          "worker_id": "ubiquitous-sugar-glider"
        },
        {
          "end": "2023-12-10T18:59:00-05:00",
          "start": "2023-12-10T11:00:00-05:00",
          "worker_id": "astonishing-flamingo"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T16:00:00-05:00",
          "worker_id": "astonishing-flamingo"
        },
        {
          "end": "2023-12-10T14:59:00-05:00",
          "start": "2023-12-10T07:00:00-05:00",
          "worker_id": "delirious-armadillo"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T18:00:00-05:00",
          "worker_id": "aberrant-toucan"
        },
        {
          "end": "2023-12-10T22:59:00-05:00",
          "start": "2023-12-10T15:00:00-05:00",
          "worker_id": "cantankerous-pangolin"
        },
        {
          "end": "2023-12-10T23:59:00-05:00",
          "start": "2023-12-10T19:00:00-05:00",
          "worker_id": "supercilious-alpaca"
        }
      ],
      "number_assigned_workers": 45
    }
  ],
  "statistics": {
    "result": {
      "custom": {
        "constraints": 16192,
        "provider": "highs",
        "status": "optimal",
        "variables": 5378
      },
      "duration": 0.123,
      "value": 55500
    },
    "run": {
      "duration": 0.123
    },
    "schema": "v1"
  },
  "version": {
    "sdk": "VERSION"
  }
}
Copy

Solution

Field nameAlways presentData typeSI UnitDescriptionExample
assigned_shiftsYesarray of assigned_shiftNASolution to the shift scheduling problem.{"assigned_shifts": []}
number_assigned_workersYesintNAThe number of assigned distinct workers.{"number_assigned_workers": 1}

Assigned shift

Field nameAlways presentData typeSI UnitDescriptionExample
startYestimestampNAStart time of the worker's shift{"start": "2023-01-01T00:00:00Z"}
endYestimestampNAEnd time of the worker's shift{"end": "2023-01-01T00:00:00Z"}
worker_idYesstringNAThe ID of the worker assigned to this shift.{"id": "1"}

Statistics

Field nameAlways presentData typeSI UnitDescriptionExample
resultNoresultNAFinal result of the solutions.See result
runYesrunNAInformation about the run.See run
schemaYesstringNASchema of the statistics.{"schema": "v1"}

Here you can find additional definitions used in the statistics schema:

  • result

    Field nameAlways presentData typeSI UnitDescriptionExample
    durationYesfloatsecondsTime duration to get to the final result.{"duration": 0.123}
    valueYesfloatNAValue of the final result.{"value": 0.123}
    customYesanyNACustom solver metrics.See custom
  • run

    Field nameAlways presentData typeSI UnitDescriptionExample
    durationYesfloatsecondsTime duration of the run.{"duration": 0.123}
  • custom

    Field nameAlways presentData typeSI UnitDescriptionExample
    constraintsYesintNANumber of constraints.{"constraints": 123}
    providerYesstringNASolver provider.{"provider": "highs"}
    statusYesstringNASolver status.{"status": "optimal"}
    variablesYesintNANumber of variables.{"variables": 123}

Run options

These are the default options that are available with shift scheduling.

Nextmv Hybrid Optimization Platform VERSION
Usage:
  -limits.day.maxduration duration
    	maximum working time per day (env LIMITS_DAY_MAX_DURATION) (default 10h0m0s)
  -limits.shift.maxduration duration
    	maximum working time per shift (env LIMITS_SHIFT_MAX_DURATION) (default 8h0m0s)
  -limits.shift.minduration duration
    	minimum working time per shift (env LIMITS_SHIFT_MIN_DURATION) (default 2h0m0s)
  -limits.shift.recoverytime duration
    	minimum time between shifts (env LIMITS_SHIFT_RECOVERY_TIME) (default 8h0m0s)
  -limits.week.maxduration duration
    	maximum working time per week (env LIMITS_WEEK_MAX_DURATION) (default 40h0m0s)
  -penalty.oversupply float
    	penalty for over-supplying a demand (env PENALTY_OVER_SUPPLY) (default 1000)
  -penalty.undersupply float
    	penalty for under-supplying a demand (env PENALTY_UNDER_SUPPLY) (default 500)
  -runner.input.path string
    	The input file path (env RUNNER_INPUT_PATH)
  -runner.output.path string
    	The output file path (env RUNNER_OUTPUT_PATH)
  -runner.output.solutions string
    	{all, last} (env RUNNER_OUTPUT_SOLUTIONS) (default "last")
  -runner.profile.cpu string
    	The CPU profile file path (env RUNNER_PROFILE_CPU)
  -runner.profile.memory string
    	The memory profile file path (env RUNNER_PROFILE_MEMORY)
  -solve.control.bool string
    	List of solver-specific control options (configurations) with bool values. Example: "name1=value1,name2=value2", where value1 and value2 are bool values. (env SOLVE_CONTROL_BOOL)
  -solve.control.float string
    	List of solver-specific control options (configurations) with float values. Example: "name1=value1,name2=value2", where value1 and value2 are float values. (env SOLVE_CONTROL_FLOAT)
  -solve.control.int string
    	List of solver-specific control options (configurations) with int values. Example: "name1=value1,name2=value2", where value1 and value2 are int values. (env SOLVE_CONTROL_INT)
  -solve.control.string string
    	List of solver-specific control options (configurations) with string values. Example: "name1=value1,name2=value2", where value1 and value2 are string values. (env SOLVE_CONTROL_STRING)
  -solve.duration duration
    	Maximum duration of the solver. (env SOLVE_DURATION) (default 30s)
  -solve.mip.gap.absolute float
    	Absolute gap stopping value. If the problem is an integer problem the solver will stop if the gap between the relaxed problem and the best found integer problem is less than this value. (env SOLVE_MIP_GAP_ABSOLUTE) (default 1e-06)
  -solve.mip.gap.relative float
    	Relative gap stopping value. If the problem is an integer problem the solver will stop if the relative gap between the relaxed problem and the best found integer problem is less than this value. (env SOLVE_MIP_GAP_RELATIVE) (default 0.0001)
  -solve.verbosity value
    	{off, low, medium, high} Verbosity of the solver in the console. (env SOLVE_VERBOSITY)
Copy

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)

Page last updated

Go to on-page nav menu