Pianificazione infermieristica

Prendiamo in considerazione un problema di pianificazione di un infermiere per un reparto di un determinato ospedale. Ogni giorno, ci sono tre turni di 12 ore a partire da 7 ore, 13 ore, 19 ore. L'orizzonte di pianificazione è di quattro giorni, a partire dal 01/05/2023, per un totale di 12 turni. Esistono quattro infermieri registrati che possono essere assegnati a questi turni, con l'obiettivo di avere due infermieri nel reparto in qualsiasi momento. La copertura è obbligatoria.

Tutti gli infermieri devono riposarsi tra un turno e l'altro per almeno 12 ore (720 minuti) e possono lavorare al massimo 36 ore (2160 minuti) durante l'orizzonte di pianificazione specificato. Questi vincoli hanno rispettivamente priorità alta e media.

Diverse variazioni al giorno

Tre turni al giorno sono rappresentati come tre turni indipendenti. Ad esempio, le variazioni per il primo giorno (su quattro giorni) nella sede del "reparto" sono rappresentate come:

  {
    "shifts": [{
      "id": "2023-05-01 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      }
    }, {
      "id": "2023-05-01 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 1
      }
    }, {
      "id": "2023-05-01 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 7
      }
    },
    ...
    ]
  }

Esempio con 12 turni (quattro giorni con tre turni al giorno)


    {
      "shifts": [{
      "id": "2023-05-01 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      }
    }, {
      "id": "2023-05-01 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 1
      }
    }, {
      "id": "2023-05-01 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 7
      }
    }, {
      "id": "2023-05-02 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 19
      }
    }, {
      "id": "2023-05-02 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 1
      }
    }, {
      "id": "2023-05-02 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 2,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 7
      }
    }, {
      "id": "2023-05-03 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 19
      }
    }, {
      "id": "2023-05-03 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 1
      }
    }, {
      "id": "2023-05-03 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 3,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 7
      }
    }, {
      "id": "2023-05-04 7hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 19
      }
    }, {
      "id": "2023-05-04 13hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 13
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 5,
        "hours": 1
      }
    }, {
      "id": "2023-05-04 19hr",
      "locationId": "department",
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 4,
        "hours": 19
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 5,
        "hours": 7
      }
    }]
  }
  

Riposo tra i turni

Per rappresentare il resto tra i turni per un dipendente, utilizza il campo minimumRestMinutes da un vincolo di pianificazione. Gli orari di inizio e fine del vincolo vengono utilizzati per determinare quali variazioni considerare e, di conseguenza, devono allinearsi a un orizzonte di pianificazione sovrapponendosi a tutti i cambiamenti. Il tempo di riposo è specificato in minuti (720) e la priorità è PRIORITY_HIGH, come indicato sopra. La prima infermiera (chiamata Adam) è rappresentata come:

  {
    "employees": [{
      "id": "Adam",
      "roleIds": ["Registered Nurse"],
      "schedulingConstraints": [{
        "priority": "PRIORITY_HIGH",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "minimumRestMinutes": 720
      }]
    }
  }

Tempo di lavoro massimo

Il periodo di tempo massimo in cui un dipendente può lavorare è rappresentato anche da un vincolo di pianificazione, che utilizza il campo maximumMinutes. Il tempo di lavoro massimo in questo esempio è di 2160 minuti. Le ore di inizio e fine del vincolo devono essere in linea con l'intero orizzonte di pianificazione. La rappresentazione corrispondente per la prima infermiera (Adam) può essere aggiornata a:

  {
    "employees": [{
      "id": "Adam",
      "roleIds": ["Registered Nurse"],
      "schedulingConstraints": [{
        "priority": "PRIORITY_HIGH",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "minimumRestMinutes": 720
      }, {
        "priority": "PRIORITY_MEDIUM",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "maximumMinutes": 2160
      }]
    }
  }

Esempio con tutti e quattro i dipendenti


  {
      "employees": [{
        "id": "Adam",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Grace",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "James",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Alonso",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }]
  }
  

Copertura per infermieri registrati

La copertura di due infermieri registrati in un dato momento è rappresentata da un requisito di copertura. In particolare, roleRequirements include un requisito del ruolo per cui roleId è impostato su "Infermiera/e diplomato", targetEmployeeCount è impostato su 2 e priority è impostato su PRIORITY_MANDATORY. I tempi di inizio e fine del requisito di copertura dovrebbero sovrapporsi a ogni cambiamento. Il campo locationId è impostato su "reparto" in modo che vengano considerati solo i turni in questa posizione.

  {
    "coverageRequirements": [{
      "startDateTime": {
        "year": 2023,
        "month": 5,
        "day": 1,
        "hours": 7
      },
      "endDateTime": {
        "year": 2023,
        "month": 5,
        "day": 5,
        "hours": 7
      },
      "locationId": "department",
      "roleRequirements": [{
        "roleId": "Registered Nurse",
        "targetEmployeeCount": 2,
        "priority": "PRIORITY_MANDATORY"
      }]
    }],
    "roleIds": ["Registered Nurse"],
    "locationIds": ["department"]
  }

Esempio di richiesta completa


    {
      "employees": [{
        "id": "Adam",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Grace",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "James",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }, {
        "id": "Alonso",
        "roleIds": ["Registered Nurse"],
        "schedulingConstraints": [{
          "priority": "PRIORITY_HIGH",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "minimumRestMinutes": 720
        }, {
          "priority": "PRIORITY_MEDIUM",
          "startDateTime": {
            "year": 2023,
            "month": 5,
            "day": 1,
            "hours": 7
          },
          "endDateTime": {
            "year": 2023,
            "month": 5,
            "day": 5,
            "hours": 7
          },
          "maximumMinutes": 2160
        }]
      }],
      "shifts": [{
        "id": "2023-05-01 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 19
        }
      }, {
        "id": "2023-05-01 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 1
        }
      }, {
        "id": "2023-05-01 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 7
        }
      }, {
        "id": "2023-05-02 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 19
        }
      }, {
        "id": "2023-05-02 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 1
        }
      }, {
        "id": "2023-05-02 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 7
        }
      }, {
        "id": "2023-05-03 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 19
        }
      }, {
        "id": "2023-05-03 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 1
        }
      }, {
        "id": "2023-05-03 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 7
        }
      }, {
        "id": "2023-05-04 7hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 19
        }
      }, {
        "id": "2023-05-04 13hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 13
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 1
        }
      }, {
        "id": "2023-05-04 19hr",
        "locationId": "department",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 19
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        }
      }],
      "coverageRequirements": [{
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 7
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 7
        },
        "locationId": "department",
        "roleRequirements": [{
          "roleId": "Registered Nurse",
          "targetEmployeeCount": 2,
          "priority": "PRIORITY_MANDATORY"
        }]
      }],
      "roleIds": ["Registered Nurse"],
      "locationIds": ["department"]
    }
    

Esempio di risposta

La risposta del risolutore contiene l'assegnazione di infermieri al turno e lo stato della procedura di ottimizzazione. Ad esempio, le variazioni assegnate al primo dipendente vengono restituite come:

  {
    "solutionStatus": "OPTIMAL",
    "shiftAssignments": [
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-01 7hr",
        "roleId": "Registered Nurse"
      },
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-02 7hr",
        "roleId": "Registered Nurse"
      },
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-03 7hr",
        "roleId": "Registered Nurse"
      },
      {
        "employeeId": "Adam",
        "shiftId": "2023-05-04 7hr",
        "roleId": "Registered Nurse"
      },
      ... ]
  }

Esempio di risposta completa


    {
      "solutionStatus": "OPTIMAL",
      "shiftAssignments": [
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-01 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-02 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-03 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Adam",
          "shiftId": "2023-05-04 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-01 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-02 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-03 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Grace",
          "shiftId": "2023-05-04 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-01 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-02 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-03 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "James",
          "shiftId": "2023-05-04 19hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-01 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-02 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-03 7hr",
          "roleId": "Registered Nurse"
        },
        {
          "employeeId": "Alonso",
          "shiftId": "2023-05-04 7hr",
          "roleId": "Registered Nurse"
        }
      ]
    }