[Tutor] time-scheduling application
Erik Price
erikprice@mac.com
Mon, 2 Sep 2002 11:10:13 -0400
I have an idea for a program that I'm considering, and I was wondering
if anyone has any suggestions on how to go about one aspect of it.
I work in a restaurant, and my boss has lamented the trouble of trying
to schedule each shift based on each employee's availability. It's
like a jigsaw puzzle, since person A can work on Fridays but not on
Wednesdays before 5:00pm, whereas Person B can work any day of the week
before 4:00pm, etc. You get the idea.
I haven't written out a requirements description yet (I'll probably do
that later on tonight), but obviously the crux of the program will be
to determine who is available within certain time frames. But I'm
wondering if anyone has any advice on this part of the program. It
seems like a good idea to make each employee represented by an object,
and store the employees' availability within attributes of the Employee
object. Methods of the Employee can be used to determine availability,
assign shifts, etc. There could also be a Shift object (whose hours
are stored as attributes) that represents a given shift (a real-world
"shift" is something like "4:45pm to 11:30pm, bartending"). Some
employees, for instance, are not qualified to work certain Shifts (i.e.
not all waiters can work as bartenders). So the Shift object would
have its own information. The part of the program that I'm soliciting
advice on, however, is the part that actually determines the
availability. Here is some pseudocode:
for Shift in WorkDay:
for Employee in EmployeeList:
if Employee.available(Shift.startTime(), Shift.stopTime()):
assign Shift to Employee
Obviously this is really crude, but the idea is that a WorkDay is a
list or collection of Shift objects, and for each Shift object in that
list, check all employees to see if they are available. The methods
would be coded to be able to send these messages (so that the
Employee.available() method would accept a start time and an end time
argument, and determine whether the Employee was able to work for that
whole time period).
What do you think of this -- I have never written something like this
before. Is there a better paradigm that I should be using to think
about the relationship between Employees and Shifts?
I'd like to use Python for obvious reasons (it's cool), but also
because it's cross-platform (my boss uses Windows and I use MacOSX). I
will write it as a command-line app, and then if the model works well I
may try to come up with a simple GUI wrapper. Even though there are
probably shrinkwrapped software packages that do this kind of thing
much better than what I could write, I thought that this would be a
good exercise.
Any thoughts?
Thanks,
Erik
--
Erik Price
email: erikprice@mac.com
jabber: erikprice@jabber.org