Download presentation
Presentation is loading. Please wait.
Published byGilbert Waters Modified over 9 years ago
1
Integrating a Real-World Scheduling Problem into the Basic Algorithms Course Yana Kortsarts Computer Science Department Widener University, Chester, PA
2
The SAP Problem The shifts assignment problem (SAP) is a scheduling problem that commonly arises in work-force management activities Input: A collection of shifts and work-force requirements Output: The number of workers to assign to each shift in order to fulfill a pre-specified staff requirements at every hour.
3
Definitions Working hours are denoted by 1, 2,.., n The [i, i + 1] hour is called the i-th hour of the day. The staffing requirement for the i-th hour is b i - the number of persons needed at work from time i until time i + 1. A shift I i is a consecutive integral subinterval [s i, s i + 1,..., f i ] of [1,..., n], s i < f i Shift I i covers a time j: the shift starts at time j or earlier and ends at time j +1 or later. If I i covers j we say that j I i (time j belongs to shift i)
4
The SAP Problem Solution Defines how many persons x i are going to work in each shift I i. A solution is feasible if the number of workers present at time j is b j - the load bound for hour j (1 j n, 1 i m, m is a number of shifts) : A feasible solution might not exist.
5
Example First hour is 08 : 00 to 09 : 00 and n = 5. I 1 =[8:00, 9:00, 10:00] = [1, 2] I 2 = [11 : 00, 12 : 00] = [4] I 3 =[10:00, 11:00, 12:00, 13:00] = [3, 4, 5] The load requirements: 4, 4, 5, 8, 5 Solution: x 1 = 4, x 2 = 3, x 3 = 5 x 2 + x 3 = 8
6
SAP – Integer Linear Programming Problem Consider shifts I i as column vectors A shift I i (from s i to f i ) is represented by a vector that has all 0 entries except the s i to f i entries that are 1 Create a 0, 1 matrix A out of all column vectors I i. A is consecutive 1’s matrix. Let The problem is to find a solution for: or determine that no such solution exists.
7
Example I 1 =[8:00, 9:00, 10:00] = [1, 2] I 2 = [11 : 00, 12 : 00] = [ 4] I 3 =[10:00, 11:00, 12:00, 13:00] = [3, 4, 5] The load requirements: 4, 4, 5, 8, 5
8
SAP – Integer Linear Programming Problem SAP is an example of an integer linear programming (ILP) problem. The integer linear programming problem is NP-hard. Special case of integer linear programming over a consecutive 1’s matrix admits a simple solution by reduction to the max- flow problem
9
From SAP to Max Flow Problem Add an all-0 row before the first row to the shifts matrix A and vector b A is (n + 1) m matrix. n+1 is the number of hours (including hour 0), the number of columns is m which is the number of shift types. M is (n+1) (n+1) matrix. M has 1 in the main diagonal, and (−1) in the diagonal immediately above the main diagonal. Other entries are 0.
10
Multiply the equality Ax = b from the left by matrix M For 0 i < n row i in A is replaced by the row A i − A i+1 and row n does not change. A is a consecutive 1’s matrix. Matrix M A has exactly two non-zero entries in every column. M b = B = (-b 1, b 1 - b 2, … b n-1 - b n, b n ) T B = (B 1, B 2, …B n ), B i = b i – b i+1 The matrix M is invertible M Ax = B is equivalent to Ax = b
11
EXAMPLE n = 5 (start: 8:00, finish: 12:00) Shifts: I 1 =[10:00, 11:00, 12:00], I 2 =[9:00, 10:00, 11:00, 12:00], I 3 =[8:00, 9:00, 10:00, 11:00, 12:00], I 4 =[12:00, 13:00], I 5 = [8:00, 9:00, 10:00, 11:00], I 6 = [8:00, 9:00, 10:00] Work load: 3, 3, 5, 2, 5
12
Network Flows A flow network is a weighted connected directed graph N(V,E) in which each edge (v i, v j ) has a nonnegative capacity c(v i, v j ) We also distinguish two vertices in N, a source s and a destination (sink) t A legal flow f in N is an assignment of a nonnegative real numbers f(e) to each edge e of N that satisfies two conditions: Capacity constraints: For each edge e, 0 f(e) c(e) Flow conservation: For each vertex v in N other than s and t, the flow into v equals the flow out of it
13
Define the flow network N(A, b) The vertices of the network are v i, 0 i n v i corresponds to row (hour) i in the matrix Add a source s and a sink t. The connection of the vertices to the source/sink are defined via the signs and values of B: B i < 0: add an edge of capacity -B i from s to v i B i > 0: add an edge of capacity B i from v i to t
14
The shifts define the edges between vertices. If shift starts at time q and ends at time p we add an edge from v q−1 to v p. The edge has infinite capacity. Each column j of the matrix M·A is represented by the edge e j Each e j with (M·A) kj = -1 and (M·A) ij =1 goes out of v k into v i
15
s v4v4 v2v2 v5v5 v0v0 v3v3 tv1v1 3 2 3 3 5
16
SAP admits a feasible solution if and only if there is a saturating flow in N(A, b): there is a legal flow so that the flow along all edges entering t equals their capacity. The flow along edges gives the values to be given to shifts: a flow value f(e j ) on edge e j corresponds to the choice of x j = f(e j ) and vice-versa
17
s v4v4 v2v2 v5v5 v0v0 v3v3 tv1v1 3/3 2/2 3/3 5/5 Solution 2 0 0 0 5 3
18
Teaching SAP One of the arguments raised at times by students of the basic algorithms classes is that the material taught seems to be “detached” from real-world applications. This claim has some foundation. It seems useful and encouraging to illustrate for the students the power of the algorithms taught in the basic algorithms course through a real-world problem. A concrete application that is important enough for commercial companies to actually write a code for it.
19
Teaching SAP Solving the SAP problem is indeed a component in some real-world software applications, such as the OPA software designed by Ximes Inc. corporation, located in Vienna Could be integrated into content conventionally taught in the basic algorithms course which includes polynomial time algorithms for the maximum flow problem. Illustrates practical application of flow algorithms
20
Teaching SAP Illustrates the importance of the seemingly abstract topic of linear algebra in real-world problems Allows to introduce a fundamental problem: integer linear programming, which is a central problem in combinatorial optimization SAP is an excellent programming project. The students gain experience in important things such as constructing graphs, multiplying matrices, and programming classic algorithms for maximum flow.
21
References [1] N. Balakrishnan and R.T. Wong, A network model for the rotating workforce scheduling problem, Networks, 20:25–42, 1990. [2] J.J. Bartholdi, J.B. Orlin, and H.D. Ratliff, Cyclic scheduling via integer programs with circular ones, Operations Research, 28:110–118, 1980. [3] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, Introduction to Algorithms, Second Edition. MIT press, 2001. [4] T.G. Crainic, M. Gendreau, and J.M. Farvolden, A simplex-based tabu search for capacitated network design, INFORMS Journal on Computing, 12(3), 2000. [5] J. R. Driscoll, H. N. Gabow, R. Shrairman, and R. E. Tarjan, Relaxed heaps: An alternative to fibonacci heaps with applications to parallel computation, Communications of the ACM, 31(11):1343–1354, 1988. [6] Michael R. Garey and David S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, Freeman and Co., 1979. [7] Johannes G¨artner, Nysret Musliu, and Wolfgang Slany, Rota: a research project on algorithms for workforce scheduling and shift design optimization, AI Communications: The European Journal on Artificial Intelligence, 14(2):83–92, 2001. [8] Fred Glover and Manuel Laguna, Tabu search, Kluwer Academic Publishers, 1997.
22
References [9] V. Klee and G. Minty, How good is the simplex algorithm? Academic Press, 1972. In Shisha, O., ed.: Inequalities, Volume III. [10] S. R. Kosaraju and A. L. Delcher, Large-scale assembly of DNA strings and space-efficient construction of suffix trees, In Proceedings of the twenty- seventh annual ACM symposium on Theory of computing, pages 169 – 177, 1995. [11] G. Laporte, The art and science of designing rotating schedules, Journal of the Operational Research Society, 50:1011–1017, 1999. [12] Nysret Musliu, Johannes G¨artner, and Wolfgang Slany, Efficient generation of rotating workforce schedules, Discrete Applied Mathematics, 118(1-2):85– 98, 2002. [13] Nysret Musliu, Andrea Schaerf, and Wolfgang Slany, Local search for shift design, European Journal of Operational Research (to appear). [14] Nysret Musliu, Andrea Schaerf, and Wolfgang Slany, Local search for shift design, Technical Report DBAI-TR-2001-45, Technische Universit ¨at Wien, 2001, http://www.dbai.tuwien.ac.at/proj/Rota/DBAI-TR-2001-45.ps. [15] G.M. Thompson, A simulated-annealing heuristic for shift scheduling using non-continuously available employees, Comput. Oper. Res., 23(3):275–288, 1996.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.