Now, I may have bitten off a bit more than I can chew with this promised program for my pops, but I am confident, with time, I can puzzle out a solution with some help!

Background Info: My father is a doctor responsible for monthly schedules, usually penciled painstakingly on a calendar and then typed up onto a computer calendar template- a frustrating process I hope to expedite by converting this manual monthly project to a few-clicks-of-a-button-computer-program.

The Assignment: Medical Employee Schedule/Calendar Generator

Ultimately the Program Should be Able to Generate a Monthly Calendar/Schedule following these rules:

Monday - Friday
Each Day: 2 Doctors must work the 8 hour morning; 1 Doctor must work the 16 hour evening

Saturday - Sunday
Each Day: 1 Doctor must work for a complete 24-hour day

**Note the 16 and 24 Hour timeframes = Employee "On Call"


Meet the Employees!

#1) Works 1 (16 hour) weekday & 1 (24 hour) weekend per week
Jesse --> Wednesdays & Saturdays OR Thursdays & Sundays

#2) Works 1 (16 hour) weekday per week
Daniel --> Mondays OR Tuesdays

#3) Works 1 (16 hour) weekday OR 1 (24 hour) weekend per week
Maria --> Wednesdays OR Sundays

#4,5,6) Works 1 (16 hour) weekday per week
Marty, Betty, Porto --> Each employee must work at least 1 Friday per month, responsible for most weekday mornings

#7) Employee "X" = "Leftovers"

The day an employee is working 16 or 24 hours, he/she cannot work the morning-of, or the day after!!


"The Math of the Program"

Now all this info may seem intimidating/confusing but I have figured out (I think?) how the program would go about creating each weeks schedule:

Program assigns each of the employees to each of the days in the following order:
Friday -> Saturday -> Sunday -> Weekdays

So...

Sample Month Schedule:

Week #1
Porto on call Friday
Jesse on call Saturday & Wednesday
Maria on call Sunday
Daniel on call Monday
Marty on call Tuesday
Betty on call Thursday

Marty & Betty work Monday Morning
Porto & Betty work Tuesday Morning
Porto & Betty work Wednesday Morning
Marty & Porto work Thursday Morning
Marty & X work Friday Morning


Week #2
Marty on call Friday
X on call Saturday
Jesse on call Sunday & Thursday
Daniel on call Tuesday
Maria on call Wednesday
Porto on call Monday

Betty & Marty work Monday Morning
Betty & Marty work Tuesday Morning
Porto & Betty work Wednesday Morning
Marty & Porto work Thursday Morning
Betty & Porto work Friday Morning


Week #3
Betty on call Friday
Jesse on call Saturday & Wednesday
Maria on call Sunday
Daniel on call Monday
Porto on call Tuesday
Marty on call Thursday

Marty & Betty work Monday Morning
Marty & Betty work Tuesday Morning
Marty & Betty work Wednesday Morning
Porto & Betty Work Thursday Morning
Porto & X Work Friday Morning


Week #4
Porto on call Friday
X on call Saturday
Jesse on call Sunday & Thursday
Daniel on call Tuesday
Maria on call Wednesday
Betty on call Monday

Marty & Porto work Monday Morning
Porto & Marty work Tuesday Morning
Betty & Porto work Wednesday Morning
Betty & Porto work Thursday Morning
Marty & Betty work Friday Morning


Really, I don't need any specific code written up for me in this thread, no handouts!
My primary question/request is some basic direction - how I should start coding?
Should I start by first creating/using a monthly calendar generator/program?
Is there one already out there?
If so, how would I then integrate/combine the above info into the calendar app?

Just need a push in the right direction!

Thanks in advance.

P.S. I am using python 3.1

I think you should not start with a complicated gui interface. You could use simple tables like in this google code project http://code.google.com/p/prettytable/ to display the monthly schedule (it can generate html to view the table in your browser too). With this simple output, concentrate on the math of the problem.

If number of permutations is not big - simply try to bruteforce. Otherwise try genetic algorithm - it is good for such sort of optimization problems.

thanks guys, this really helps - im going to look into prettytable & try and brute-force it (seeing as I can always allow for the user, at the start of the program, to insert any "exceptions" to the above rules, such as vacations etc.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.