Here is a method that I thought of. I wrote this to be as general purpose as possible, 
envisioning situations where some people work for more shifts then others and 
different shifts 
require different numbers of people. If you need the same number of people for each 
shift, or if 
everyone works the same number of shifts you can do some shortcuts in the algorithm. 
You take a period, say a month or a week, and categorize all the shifts for that 
month(or week)
by say, day, evening  and night.
So create a two dimensional array (or database table) with one column being the list 
of shifts, 
the next column should be the corresponding category that it falls in, and the third 
column 
should be the number of people that you need working in that shift. Additional 
columns(as many 
as the maximum number of people that you can have on one shift) should be added to 
hold the 
names of the people working in that particular shift.
Create another table, the exception table. The columns should be a list of employees 
and the 
rows should be the list of shifts. Use this table to hold a severity number for any 
exceptions 
that a employee canīt work in.
Calculate the total numbers of people you need for each type of shift for the period 
by going 
through the database. So now, you will have for your given period a total number of 
persons 
employed for the night shifts, day shifts and evening shifts(or however you decided to 
categorize the shifts). 
Calculate the ratios of different types of shifts. Do this by adding  up the totals 
that you got 
in the previous step. Calculate a ration for each category by dividing the total for 
that 
category by the grand total that you just received.
Multiply the ratio number for each category by the total number of shifts for each 
employee by 
the number of shifts that that employee has to work for that period. This will tell 
you how many 
shifts of each category the employee must work in that period. Add or subtract from 
any 
particular category for any particular employee to compensate if there were shifts 
added or 
taken off from the previous period.
Now we will start putting people on shifts. Look up for the first shift what category 
it is and 
get the number of people needed that shift. Find the people who have been assigned the 
least 
number shifts for that category(if you have a situation where different people work 
different 
numbers of shifts, the way to do this is to divide the number of shifts assigned for 
that 
category for that person by the number of shifts for that category for that person 
still 
remaining still remaining - and use the guy who scores lowest) check to make sure it 
does not 
conflict with the table of exceptions(also, make sure that person wasnīt assigned in 
the past x 
shifts- or perhaps as a shift is assigned, the next x shifts in the exception table 
should be 
marked off for that guy) , and then assign him. Do this process for each shift.
If there is a conflict in the exception table, set it up so that some difference 
between the 
number of shifts he did for that category and the average will cause an override , 
depending on 
the level of the severity (You can have different overrides for different severities).


-Yossie

--------------------------------------
FREE ANONYMOUS EMAIL!  Sign up now.
http://www.subdimension.com/freemail

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to