tbar0970 / jethro-pmm

Jethro Pastoral Ministry Manager
GNU General Public License v3.0
36 stars 26 forks source link

Automate roster planning #767

Open jefft opened 2 years ago

jefft commented 2 years ago

Now that Jethro knows about user unavailabilities (per #692), it would be rather excellent if Jethro could 'suggest' an optimal roster allocation, taking into account people's capabilities and availabilities. I.e. fill in all roster assignments for a given period (say the next 3 months), by filling each role with:

Perhaps this could be presented as a 'Pre-fill' or 'Auto-plan' button on the 'Edit Roster Assignments' page:

image

Optimal rostering is an interesting CS challenge for which there are libraries available (e.g. https://www.optaplanner.org/learn/useCases/employeeRostering.html).

tim-pearce commented 2 years ago

I've thought about this and am hopeful to be able to implement something before our current church roster comes to an end. Automated rostering is not dissimilar to the 'traveling salesman problem' so I am going to 'cheat'. When I create a roster in a spreadsheet I start with the previous roster and just change the dates so I was thinking of essentially doing the same with a roster in Jethro - if the mostly the same people are available and most people are available every week then that should populate most of the next roster period.

tbar0970 commented 2 years ago

It is an "interesting" CS challenge :) I still suspect that we don't capture the constraints well enough for alogirthmic assignment of people to work well. In my context, for example, we have things like:

tbar0970 commented 1 year ago

I realised recently this would be a good candidate of something to outsource to an AI engine. One way would be for Jethro to construct textual instructions for chatGPT. For example I just gave it this prompt and got decent results:

Help me create a roster. It's for every Sunday between now and 31 December. The roles are "preacher", "service leader" and "pianist". The available people for "preacher" are MrA, MrB, MrC. The available people for "service leader" are MrsD, MissE, MrF. The available people for "pianist" are MissG, MissH.

We'd need a way to read the results back into Jethro. If we refer to volunteers as Person31, Person45 etc, that would help match up to person records. Ditto with Role3, Role7 etc.

tbar0970 commented 1 year ago

Can also tell ChatGPT "give me the results in CSV format".

tim-pearce commented 1 year ago

I did a search for 'implement ai in php' and got a number of interesting results. AI relies on ML (machine learning). In this instance the best source to learn from would be previous rosters. I haven't looked further into it but it looks quite possible, in php, to create a system that learns from previous rosters. You then add in the constraints (unavailabilities, dates and possibly 'mutually exclusive roles') to generate a roster.