The Doctor Rostering Problem - Asser Fahrenholz
The Doctor Rostering Problem - Asser Fahrenholz The Doctor Rostering Problem - Asser Fahrenholz
Appendix A. Implementation 73 33 } 34 return res ; 35 } 36 return null ; 37 } 38 39 public ArrayList < ArrayList < Doctor >> choose2 ( ArrayList < Doctor > b, int k) { 40 res = new ArrayList < ArrayList < Doctor > >(); 41 42 return enumerate2 (b, b. size () , k); 43 } 44 45 private void swap2 ( ArrayList < Doctor > b, int i, int j) { 46 Doctor temp = b. get (i); 47 b. set (i, b. get (j)); 48 b. set (j, temp ); 49 } 50 51 public ArrayList < ArrayList < Doctor >> getRes () { 52 return res ; 53 } 54 } A.5.3 Day assignments 1 /* * 2 * Returns the best doctor for a given shift on a given day . 3 * 4 * @param dayInt 5 * the day 6 * @param RCLsize 7 * the size the RCL 8 * @param minimizing 9 * @return The best doctor for the shift 10 */ 11 public Change getBestChange ( 12 int dayInt , RCLParameter RCLsize , boolean minimizing , Rules rules ) { 13 14 if ( rules != null ) { 15 this . myRules = rules ; 16 } 17 18 Vector >> bestChange = new Vector > >(); 20 Permutation t = new Permutation (); 21 22 ArrayList < Doctor > doc = new ArrayList < Doctor >() ; 23 doc . addAll ( docs ); 24 25 t. choose2 (doc , this . get ( dayInt ). getAllMiddayShifts (). size ()); 26 27 ArrayList < ArrayList < Doctor >> set = t. getRes ();
Appendix A. Implementation 74 28 Change c; 29 for ( int i = 0; i < set . size (); i ++) { 30 c = new Change (); 31 ArrayList < Doctor > subsetDoctors = set . get (i); 32 HashSet < Shift > shiftset = this . get ( dayInt ). getAllMiddayShifts (); 33 ArrayList < Shift > sSet = new ArrayList < Shift >() ; 34 sSet . addAll ( shiftset ); 35 36 for ( int j = 0; j < shiftset . size (); j ++) { 37 c. put ( sSet . get (j), subsetDoctors . get (j)); 38 } 39 40 Pair < Integer , Pair < HashMap < Shift , HashSet >>, HashMap < Shift , HashSet >>>> sol = this . getSolutionValue ( false , null ); 41 int oldScore = sol . getE (); 42 int oldVio = sol . getV (). getE (). size (); 43 44 this . performChange (c, false ); 45 46 Pair < Integer , Pair < HashMap < Shift , HashSet >>, HashMap < Shift , HashSet >>>> newSol = this . getSolutionValue ( false , null ); 47 int newScore = newSol . getE (); 48 int newvio = newSol . getV (). getE (). size (); 49 50 51 double scoreInc = newScore - oldScore ; 52 int vioInc = newvio - oldVio ; 53 // Undo the change : 54 this . performChange (c, true ); 55 // Sort by best change : 56 if ( bestChange . size () == 0) { 57 bestChange . add ( new Pair < Change , Pair < Double , Integer > >(c, new Pair < Double , Integer >( scoreInc , vioInc ))); 58 } else { 59 myFor : 60 for ( int k = 0; k < bestChange . size (); k ++) { 61 Pair < Change , Pair < Double , Integer >> changeScore = bestChange . get (k); 62 if ( changeScore . getV (). getV () > vioInc ) { 63 bestChange . add ( bestChange . indexOf ( changeScore ), 64 new Pair < Change , Pair < Double , Integer > >(c, new Pair < Double , Integer >( scoreInc , vioInc ))); 65 break myFor ; 66 } 67 if ( changeScore . getV (). getV () == vioInc ) { 68 if (( changeScore . getV (). getE () < scoreInc && ! minimizing ) || ( changeScore . getV (). getE () > scoreInc && minimizing )) { 69 bestChange . add ( bestChange . indexOf ( changeScore ), 70 new Pair < Change , Pair < Double , Integer > >(c, new Pair < Double , Integer >( scoreInc , vioInc ))); 71 break myFor ; 72 } 73
- Page 33 and 34: Chapter 4. Solving the DRP 22 Since
- Page 35 and 36: Chapter 4. Solving the DRP 24 1. Co
- Page 37 and 38: Chapter 4. Solving the DRP 26 decre
- Page 39 and 40: Chapter 4. Solving the DRP 28 This
- Page 41 and 42: Chapter 4. Solving the DRP 30 Simul
- Page 43 and 44: Chapter 5. Optimal solution 32 The
- Page 45 and 46: Chapter 6 The DRP Program Through t
- Page 47 and 48: Chapter 6. The DRP Program 36 Figur
- Page 49 and 50: Chapter 6. The DRP Program 38 of th
- Page 51 and 52: Chapter 6. The DRP Program 40 Figur
- Page 53 and 54: Chapter 7 Metaheuristic tests This
- Page 55 and 56: Chapter 7. Tests, results and discu
- Page 57 and 58: Chapter 7. Tests, results and discu
- Page 59 and 60: Chapter 7. Tests, results and discu
- Page 61 and 62: Chapter 7. Tests, results and discu
- Page 63 and 64: Chapter 7. Tests, results and discu
- Page 65 and 66: Chapter 8. Future considerations 54
- Page 67 and 68: Chapter 8. Future considerations 56
- Page 69 and 70: Chapter 9. Conclusion 58 The three
- Page 71 and 72: Appendix A. Implementation 60 27 //
- Page 73 and 74: 2 Appendix A. Implementation 62 3 i
- Page 75 and 76: Appendix A. Implementation 64 A.3 G
- Page 77 and 78: Appendix A. Implementation 66 97 wh
- Page 79 and 80: Appendix A. Implementation 68 27 su
- Page 81 and 82: Appendix A. Implementation 70 119 P
- Page 83: Appendix A. Implementation 72 64 br
- Page 87 and 88: Appendix B GAMS Model This chapter
- Page 89 and 90: Appendix B. GAMS Model 78 46 c(day
- Page 91 and 92: Appendix B. GAMS Model 80 109 B1( f
- Page 93 and 94: Appendix B. GAMS Model 82 **** REPO
- Page 95 and 96: Appendix B. GAMS Model 84 B.3 The s
- Page 97 and 98: Appendix B. GAMS Model 86 B.3.3 The
- Page 99 and 100: Appendix C. Tests 88 C.1.1 Instance
- Page 101 and 102: Appendix C. Tests 90 C.1.2 Instance
- Page 103 and 104: Appendix C. Tests 92 C.1.4 Instance
- Page 105 and 106: Appendix C. Tests 94 JST PZH HP SDA
- Page 107 and 108: Appendix C. Tests 96 JST PZH HP SDA
- Page 109 and 110: Appendix C. Tests 98 C.1.8 Instance
- Page 111 and 112: Appendix C. Tests 100 Cons 12 Imps
- Page 113 and 114: Appendix C. Tests 102 Test 3 RCL 1
- Page 115 and 116: Appendix C. Tests 104 Test 7 RCL 1
- Page 117 and 118: Appendix C. Tests 106 Test 1 RCL 1
- Page 119 and 120: Appendix C. Tests 108 Test 5 RCL 1
- Page 121 and 122: Appendix C. Tests 110 Test 9 RCL 1
- Page 123 and 124: Appendix C. Tests 112 Test 3 RCL 1
- Page 125 and 126: Appendix C. Tests 114 Test 7 RCL 1
- Page 127 and 128: Appendix C. Tests 116 160 140 120 1
- Page 129 and 130: Bibliography 118 [10] Michael R. Ga
Appendix A. Implementation 74<br />
28 Change c;<br />
29 for ( int i = 0; i < set . size (); i ++) {<br />
30 c = new Change ();<br />
31 ArrayList < <strong>Doctor</strong> > subset<strong>Doctor</strong>s = set . get (i);<br />
32 HashSet < Shift > shiftset = this . get ( dayInt ). getAllMiddayShifts ();<br />
33 ArrayList < Shift > sSet = new ArrayList < Shift >() ;<br />
34 sSet . addAll ( shiftset );<br />
35<br />
36 for ( int j = 0; j < shiftset . size (); j ++) {<br />
37 c. put ( sSet . get (j), subset<strong>Doctor</strong>s . get (j));<br />
38 }<br />
39<br />
40 Pair < Integer , Pair < HashMap < Shift , HashSet >>,<br />
HashMap < Shift , HashSet >>>> sol = this . getSolutionValue (<br />
false , null );<br />
41 int oldScore = sol . getE ();<br />
42 int oldVio = sol . getV (). getE (). size ();<br />
43<br />
44 this . performChange (c, false );<br />
45<br />
46 Pair < Integer , Pair < HashMap < Shift , HashSet >>,<br />
HashMap < Shift , HashSet >>>> newSol = this .<br />
getSolutionValue ( false , null );<br />
47 int newScore = newSol . getE ();<br />
48 int newvio = newSol . getV (). getE (). size ();<br />
49<br />
50<br />
51 double scoreInc = newScore - oldScore ;<br />
52 int vioInc = newvio - oldVio ;<br />
53 // Undo the change :<br />
54 this . performChange (c, true );<br />
55 // Sort by best change :<br />
56 if ( bestChange . size () == 0) {<br />
57 bestChange . add ( new Pair < Change , Pair < Double , Integer > >(c, new<br />
Pair < Double , Integer >( scoreInc , vioInc )));<br />
58 } else {<br />
59 myFor :<br />
60 for ( int k = 0; k < bestChange . size (); k ++) {<br />
61 Pair < Change , Pair < Double , Integer >> changeScore = bestChange .<br />
get (k);<br />
62 if ( changeScore . getV (). getV () > vioInc ) {<br />
63 bestChange . add ( bestChange . indexOf ( changeScore ),<br />
64 new Pair < Change , Pair < Double , Integer > >(c, new<br />
Pair < Double , Integer >( scoreInc , vioInc )));<br />
65 break myFor ;<br />
66 }<br />
67 if ( changeScore . getV (). getV () == vioInc ) {<br />
68 if (( changeScore . getV (). getE () < scoreInc && ! minimizing )<br />
|| ( changeScore . getV (). getE () > scoreInc && minimizing )) {<br />
69 bestChange . add ( bestChange . indexOf ( changeScore ),<br />
70 new Pair < Change , Pair < Double , Integer > >(c,<br />
new Pair < Double , Integer >( scoreInc , vioInc )));<br />
71 break myFor ;<br />
72 }<br />
73