Lesson 15. Work Scheduling Models, Revisited

advertisement
SA305 – Linear Programming
Asst. Prof. Nelson Uhan
Spring 2015
Lesson 15. Work Scheduling Models, Revisited
1
The postal workers problem, revisited
Example 1. Postal employees in Simplexville work for 5 consecutive days, followed by 2 days off, repeated
weekly. Below are the minimum number of employees needed for each day of the week:
Day
Monday (1)
Tuesday (2)
Wednesday (3)
Thursday (4)
Friday (5)
Saturday (6)
Sunday (7)
Employees needed
7
8
7
6
6
4
5
We want to determine the minimum total number of employees needed.
Our original model:
Decision variables. Let
x1 = number of employees who start work on Monday and work though Friday
x2 = number of employees who start work on Tuesday and work though Saturday
⋮
x7 = number of employees who start work on Sunday and work through Thursday
Objective function and constraints.
min
s.t.
x1 + x2 + x3 + x4 + x5 + x6 + x7
+ x4 + x5 + x6 + x7 ≥ 7
x1
x1 + x2
+ x5 + x6 + x7 ≥ 8
x1 + x2 + x3
+ x6 + x7 ≥ 7
x1 + x2 + x3 + x4
+ x7 ≥ 6
x1 + x2 + x3 + x4 + x5
x2 + x3 + x4 + x5 + x6
≥6
≥4
x3 + x4 + x5 + x6 + x7 ≥ 5
x1 ,
x2 ,
x3 ,
x4 ,
x5 ,
x6 ,
x7 ≥ 0
● Left hand side of (Mon): add up the variables x i such that shift i covers Monday
● We need a way to specify elements of a set that meet certain characteristics
1
(Mon)
(Tue)
(Wed)
(Thu)
(Fri)
(Sat)
(Sun)
2
Some more set notation
● What if we only want certain elements of a set?
● “ ∶ ” notation
j ∈ S ∶ [condition]
⇔
j ∈ elements of S such that [condition] holds
● For example:
○ Define N = {1, 2, 3}, S1 = {a, b}, S2 = {b, c}, S3 = {a, c}
○ Then
◇ j∈N ∶ j≥2
◇ j ∈ N ∶ a ∈ Sj
⇔
⇔
● Some people use “ ∣ ” instead “:”
Describe the input parameters of Example 1 using sets and for statements.
Write a linear program for Example 1 using the symbolic input parameters you described above.
2
3
GMPL code
GMPL model file for this linear program:
# Model for postal employees problem in Lesson 13
## Input parameters ##
set days;
set shifts;
set shift_days{j in shifts};
param required{i in days};
#
#
#
#
days of the week
shifts
days worked for each shift
number of employees needed for each day
## Decision variables and variable bounds ##
var x{j in shifts} >= 0;
# number of employees assigned to each shift
## Objective function ##
# Minimize total number of employees
minimize total_employees: sum{j in shifts} x[j];
## General constraints ##
# Number of employees working on day i >= minimum required on day i
subject to employees_needed{i in days}:
sum{j in shifts: i in shift_days[j]} x[j] >= required[i];
end;
GMPL data file for this linear program:
# Days of the week
set days := Mon Tue Wed Thu Fri Sat Sun;
# Shifts
set shifts := 1 2 3 4 5 6 7;
# Days worked in each shift
set shift_days[1] := Mon Tue
set shift_days[2] := Tue Wed
set shift_days[3] := Wed Thu
set shift_days[4] := Thu Fri
set shift_days[5] := Fri Sat
set shift_days[6] := Sat Sun
set shift_days[7] := Sun Mon
Wed
Thu
Fri
Sat
Sun
Mon
Tue
Thu
Fri
Sat
Sun
Mon
Tue
Wed
Fri;
Sat;
Sun;
Mon;
Tue;
Wed;
Thu;
# Number of employees needed for each day
param required :=
Mon
7
Tue
8
Wed
7
Thu
6
Fri
6
Sat
4
Sun
5;
end;
3
Download