Note that there are some explanatory texts on larger screens.

plurals
  1. POMethods for scheduling
    text
    copied!<p>I am working on a PHP application for an at home care company. They have x amount of carers that are scheduled every week to attend the houses of x amount of service users (clients). Each service user has a set 'schedule' of when they are to be visited which includes periods plus the visit duration in minutes.</p> <p>So for example, a service user could have the following schedule.</p> <pre><code> AM Lunch Tea Late Night Respite Mon 30m - 30m 60m - - Tue 30m - - 60m - - Wed 20m 25m 30m 60m 120m - Thu - - 30m - - - Fri 30m 25m - - - - Sat - - - - - - Sun 20m 25m - - - - </code></pre> <p>These periods are currently stored in a database in the following format:</p> <pre><code>Table: Service_user_schedules id service_user_id day period duration </code></pre> <p>Every week, the carers fill out a table of what periods they are available to work. This data is then input into the system and is stored in the database in the following format:</p> <pre><code>Table: Carer_available_shifts id carer_id day period </code></pre> <p>Now the problem is, I need to create a controller that will take this data and automatically assign carers to service users based on the availability they have supplied. This needs to be editable so that in the event that nobody is available for a particular carer, the user can select one that isn't available and they will still be added to the database.</p> <p>At the moment, I have a mess of loops, functions and echo's to check if carers are available for a particular service user and to make it editable.</p> <p>Has anyone performed this sort of task before and if so, did you find a simple way to complete it. I would prefer to make it object orientated so I could reuse the same generic class but at the moment, I'm at a complete loss!</p> <p><em>EDIT: I have now added a bounty to this question. I am currently researching genetic algorithms (something that I have never even heard of let alone used!) as a solution to this problem based on some of the answers. I would like to know if any of you have used other methods of solving this type of problem or if you have used genetic algorithms, could you provide a less general explanation on how you applied them to this particular issue.</em></p> <p><em>I would assume that this hurdle would be fairly common in many "staffing" type applications and am surprised at how little discussion there is on this anywhere on the web!</em></p> <p><strong>UPDATE</strong></p> <p>For this particular project, I think I may end up using the database method as described by Tak but may possibly convert to the use of GA's in the future when I have more development time set aside.</p> <p>I am now at a bit of a loss as to who to award the bounty to. duedl0r put alot of effort into his (or her) answer. It has given me a great insight into the world of Genetic Algorithm's - a problem solving method that I had never come across before. However, the answer provided by Tak provides the solution that I will be using for this project. Therefore, I have awarded the bounty to Tak.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload