Help needed with a prompt to create a complex schedule to avoid mistakes

Hello Everyone.

I have the prompt below to help create a staff schedule. The prompt is quite complex and has a lot of requirements that must be met.

How can the prompt be refined to increase accuracy?

Basically, so far, ChatGPT 4 can create a schedule, but it never meets all the requirements.

So, after it generates a schedule with mistakes, ChatGPT is then asked to update the schedule, based on what it was already told (meaning it didn’t seem to understand it all to start with).

It then does that (sometimes) but there are then other mistakes that it previously got right.

How can I teach ChatGPT 4 to get this task more correct?

It doesn’t have to be 100% correct, but at least pretty much there would be good.

Here is the prompt:

You will act as a shift scheduler.


You have a team of ten people to assign.


There are morning shifts, afternoon shifts and on-call shifts that you must assign the staff to.


When you assign a staff member to a shift you must always make sure that:


General Shift Rule:


A staff member scheduled for the morning shift cannot work the afternoon shift on the same day, and vice versa.
Public Holiday for April 2024 = 8,15,16 April

Morning Shift Rules:


Shift time: 7:30 AM to 4:00 PM.
Monday to Friday: Three staff members required.
Saturday, Sunday, and Public Holiday: Two staff members required.

Afternoon Shift Rules:


Shift time: 3:00 PM to 10:30 PM.
Monday to Friday: Three staff members required.
Saturday, Sunday, and Public Holiday: Two staff members required.


On-Call Shift Rules:


On-call staff must be different from those scheduled for morning or afternoon shifts on any given day.
A staff member can have up to four on-call shifts per month.
It’s okay if there are some shifts without on-call staff, as long as other rules are followed.
On-call shifts should be distributed throughout the month.
Staff members must stick to either morning or afternoon shifts for the whole month.
Each staff member should work either three or four regular shifts and one on-call shift per week, followed by two days off.


Given that April 2024 has 30 days, create a schedule that meets all the above requirements.


To do this, you will perform each requirement, one at a time, create a schedule, then check the requirement is met against your created schedule, once correct, you will use the created schedule and apply the next requirement and then generate an updated schedule and use that against the next requirement and so on until you have a final schedule that meets all the requirements that you will output as a CSV file.

What is the best way to approach and solve this issue or is ChatGPT not suitable?

Many thanks.

I’ve written here many times that people need to use the right tool for the job.

An LLM is not the right tool for this particular job.

There already exists several open source projects that can do this sort of thing.

I’m not overly familiar with them, as I didn’t have any reason to do any scheduling, but one you might consider is this,

Like I said, this isn’t an area I’m experienced with, so this one might not be the right tool for the job either, but somewhere out there there will be something much better suited for your task than a language model.

Edit: I’m just in the middle of putting a kid to bed. If no one else chimes in by the time I can circle back, I’ll look into it a little bit more for you.

There’s probably a work flow where a GPT takes natural language, converts it into a set of rules one of these schedules can understand, calls an API endpoint to get the schedule, and reports it back in a well-formatted manner.

3 Likes

Thank you very much @elmstedt , I appreciate your time and response. I’ll give this a look.

We currently do shift scheduling manually in the format that the Shifts application of MS Teams uses, I was just trying to see if ChatGPT could be used to do the same thing much faster.

Creating a Complex Staff Schedule to Avoid Mistakes

JS
complex schedule to avoid mistakes

Help needed with a prompt to create a complex schedule to avoid mistakes

Hello Everyone.

I have the prompt below to help create a staff schedule. The prompt is quite complex and has a lot of requirements that must be met.

How can the prompt be refined to increase accuracy?

Basically, so far, ChatGPT 4 can create a schedule, but it never meets all the requirements.

So, after it generates a schedule with mistakes, ChatGPT is then asked to update the schedule, based on what it was already told (meaning it didn’t seem to understand it all to start with).

It then does that (sometimes) but there are then other mistakes that it previously got right.

How can I teach ChatGPT 4 to get this task more correct?

Hello Everyone.

I have the prompt below to help create a staff schedule. The prompt is quite complex and has a lot of requirements that must be met.

How can the prompt be refined to increase accuracy?

Basically, so far, ChatGPT 4 can create a schedule, but it never meets all the requirements.

So, after it generates a schedule with mistakes, ChatGPT is then asked to update the schedule, based on what it was already told (meaning it didn’t seem to understand it all to start with).

It then does that (sometimes) but there are then other mistakes that it previously got right.

How can I teach ChatGPT 4 to get this task more correct?

It doesn’t have to be 100% correct, but at least 90% correct, with no hallucination.

It doesn’t have to be 100% correct, but at least pretty much there would be good.

Here is the prompt:

You will act as a shift scheduler.


You have a team of ten people to assign.


There are morning shifts, afternoon shifts and on-call shifts that you must assign the staff to.


When you assign a staff member to a shift you must always make sure that:


General Shift Rule:


A staff member scheduled for the morning shift cannot work the afternoon shift on the same day, and vice versa.

Here is the prompt:

You will act as a shift scheduler.


You have a team of ten people to assign.


There are morning shifts, afternoon shifts and on-call shifts that you must assign the staff to.


When you assign a staff member to a shift you must always make sure that:


General Shift Rule:


A staff member scheduled for the morning shift cannot work the afternoon shift on the same day, and vice versa.

Public Holiday for April 2024 = 8,15,16 April

Public Holiday for April 2024 = 8,15,16 April

Morning Shift Rules:


Shift time: 7:30 AM to 4:00 PM.

Monday to Friday: Three staff members required.

Morning Shift Rules:


Shift time: 7:30 AM to 4:00 PM.

Monday to Friday: Three staff members required.

**Saturday, Sunday, and Public Holiday: Two staff members required. **


Saturday, Sunday, and Public Holiday: Two staff members required.

Afternoon Shift Rules:


Shift time: 3:00 PM to 10:30 PM.

Monday to Friday: Three staff members required.

Saturday, Sunday, and Public Holiday: Two staff members required.


On-Call Shift Rules:


On-call staff must be different from those scheduled for morning or afternoon shifts on any given day.

A staff member can have up to four on-call shifts per month.

It’s okay if there are some shifts without on-call staff, as long as other rules are followed.

On-call shifts should be distributed throughout the month.

Staff members must stick to either morning or afternoon shifts for the whole month.

Each staff member should work either three or four regular shifts and one on-call shift per week, followed by two days off.


Given that April 2024 has 30 days, create a schedule that meets all the above requirements.


To do this, you will perform each requirement, one at a time, create a schedule, then check the requirement is met against your created schedule, once correct, you will use the created schedule and apply the next requirement and then generate an updated schedule and use that against the next requirement and so on until you have a final schedule that meets all the requirements that you will output as a CSV file.

What is the best way to approach and solve this issue or is ChatGPT not suitable?

Many thanks.

Afternoon Shift Rules:


Shift time: 3:00 PM to 10:30 PM.

Monday to Friday: Three staff members required.

Saturday, Sunday, and Public Holiday: Two staff members required.


On-Call Shift Rules:


On-call staff must be different from those scheduled for morning or afternoon shifts on any given day.

A staff member can have up to four on-call shifts per month.

It’s okay if there are some shifts without on-call staff, as long as other rules are followed.

On-call shifts should be distributed throughout the month.

Staff members must stick to either morning or afternoon shifts for the whole month.

Each staff member should work either three or four regular shifts and one on-call shift per week, followed by two days off.


Given that April 2024 has 30 days, create a schedule that meets all the above requirements.


To do this, you will perform each requirement, one at a time, create a schedule, then check the requirement is met against your created schedule, once correct, you will use the created schedule and apply the next requirement and then generate an updated schedule and use that against the next requirement and so on until you have a final schedule that meets all the requirements that you will output as a CSV file.

What is the best way to approach and solve this issue or is ChatGPT not suitable?

Many thanks.

​​

​​

To improve the accuracy of the schedule generated by ChatGPT, you can try the following approaches:

Break down the problem into smaller, more manageable steps:
Start by creating a schedule that meets the basic shift requirements (morning, afternoon, and on-call shifts).
Gradually add additional constraints, such as the number of staff members required per shift and the rules for public holidays.
Implement the remaining rules, such as the maximum number of on-call shifts per month and the distribution of shifts throughout the month.
Provide clear and concise instructions:
Ensure that each requirement is clearly stated and easy to understand.
Use bullet points or numbered lists to separate each requirement.
Avoid using ambiguous language or conflicting requirements.
Use a structured format for the output:
Ask ChatGPT to provide the schedule in a specific format, such as a table or a CSV file.
Provide an example of the desired output format to help ChatGPT understand your expectations.
Iterate and refine:
After receiving the initial schedule, review it carefully and identify any errors or inconsistencies.
Provide feedback to ChatGPT, specifying which requirements were not met and asking it to generate an updated schedule.
Repeat this process until the schedule meets all the requirements satisfactorily.
Consider using a different approach:
If ChatGPT consistently struggles to generate an accurate schedule, consider using a more specialized tool or library designed for scheduling problems, such as Google OR-Tools or Microsoft Solver Foundation.
Alternatively, you can break down the problem into smaller sub-problems and solve them individually using ChatGPT or other tools, then combine the results to create the final schedule.
Here’s an example of how you can refine the prompt to improve clarity and structure:

Copy code
You will act as a shift scheduler for a team of ten people. Your task is to create a schedule for April 2024 that meets the following requirements:

Shift Types:

  • Morning shifts: 7:30 AM to 4:00 PM
  • Afternoon shifts: 3:00 PM to 10:30 PM
  • On-call shifts

Staffing Requirements:

  • Monday to Friday:
    • Morning shifts: Three staff members required
    • Afternoon shifts: Three staff members required
  • Saturday, Sunday, and Public Holidays (April 8, 15, 16):
    • Morning shifts: Two staff members required
    • Afternoon shifts: Two staff members required

Additional Rules:

  1. A staff member scheduled for the morning shift cannot work the afternoon shift on the same day, and vice versa.
  2. On-call staff must be different from those scheduled for morning or afternoon shifts on any given day.
  3. A staff member can have up to four on-call shifts per month.
  4. It’s okay if there are some shifts without on-call staff, as long as other rules are followed.
  5. On-call shifts should be distributed throughout the month.
  6. Staff members must stick to either morning or afternoon shifts for the whole month.
  7. Each staff member should work either three or four regular shifts and one on-call shift per week, followed by two days off.

Output:
Please provide the schedule in a CSV file format, with columns for the date, shift type, and assigned staff members.

Approach:

  1. Create a basic schedule that meets the shift type and staffing requirements.
  2. Incrementally add the additional rules, updating the schedule after each rule is applied.
  3. Review the schedule for accuracy and consistency.
  4. If any errors are found, provide feedback and request an updated schedule.
  5. Repeat steps 3-4 until the schedule meets all requirements satisfactorily.
    By providing clear instructions, separating requirements into logical sections, and specifying the desired output format, you can help ChatGPT generate a more accurate schedule. Remember to review the output carefully and provide feedback for refinement until you achieve a satisfactory result
1 Like

Thank you very much for the very detailed help @justinsirotin , it is much appreciated. I’ll go over it and try this approach instead. I did think that breaking it down and iterating over the results could prove a better way to achieve this task.

Awesome used Cluade 3 Opus to write your prompts now it’s amazing. You might want to use the wolfram gpt for the complex schedule

1 Like

Thank you again @justinsirotin

I tried the Wolfram GPT and I also tried using Google OR-Tools and Python. Both could not find a satisfactory solution that met all the constraints and requirements so I guess I am asking a bit too much.

I’ll try to relax a few requirements and constraints, basically, the end result would be a custom GPT (or Python program) that would make shift schedule creation much faster.

@justinsirotin @elmstedt

I tried both Claude 3 and ChatGPT 4 for this and both failed to get it exactly right.

I also tried using Google OR Tools and Z Solver, they also failed.

I guess it’ s just too complex? That doesn’t seem right to me.