The Doctor Rostering Problem - Asser Fahrenholz
The Doctor Rostering Problem - Asser Fahrenholz The Doctor Rostering Problem - Asser Fahrenholz
Appendix A. Implementation 63 54 { 55 Day day ; 56 Shift s; 57 Doctor d; 58 for ( int i = 0; i < working . size (); i ++) { 59 60 setProgress (100 * i / working . size ()); 61 oldScore = newScore ; 62 workingSol = working . getSolutionValue ( false , getRules ()); 63 newScore = workingSol . getE (); 64 newVio = workingSol . getV (). getE (). size (); 65 newSoftVio = workingSol . getV (). getV (). size (); 66 firePropertyChange (" score ", oldScore , newScore ); 67 firePropertyChange (" violations ", null , newVio ); 68 firePropertyChange (" violationsSoft ", null , newSoftVio ); 69 day = working . getDay (i); 70 if (!( day . isWeekend () || day . isHoliday ())) { 71 72 if ( getDoS (). compareTo ( DayOrShift . Day ) == 0) { 73 Change c = working . getBestChange ( day . getDayID () , RCLsize , minimize , getRules ()); 74 working . performChange (c, false ); 75 continue ; 76 } 77 78 Shift : 79 for ( int j = 0; j < day . size (); j ++) { 80 s = day . getShift (j); 81 82 if (s. isMiddayShift ()) { 83 d = working . getBestDoctor (day , s, RCLsize , minimize , getRules ()); 84 working . assignDoctor2Shift (day , d, s. getShiftInt () , false ); 85 } 86 } 87 } 88 } 89 } 90 working . setConstructorID ( this . hashCode ()); 91 working . setRCL ( RCLsize ); 92 working . setDoS ( dos ); 93 94 setBestSchedule ( working ); 95 96 } catch ( Exception e) { 97 System . out . println (" Caught e: " + e. getCause ()); 98 e. printStackTrace (); 99 } 100 return null ; 101 } 102 }
Appendix A. Implementation 64 A.3 GRASP metaheuristic 1 package heuristic . meta ; 2 3 import basic . RCLParameter ; 4 import basic . Rules ; 5 import changes . Change ; 6 import changes . RotationInt ; 7 import ds.Day ; 8 import ds. Doctor ; 9 import ds. Pair ; 10 import ds. Schedule ; 11 import ds. Shift ; 12 import heuristic . Metaheuristic ; 13 import java . util . HashMap ; 14 import java . util . HashSet ; 15 import org . jfree . data .xy. XYDataItem ; 16 import org . jfree . data .xy. XYSeries ; 17 import org . jfree . data .xy. XYSeriesCollection ; 18 19 /* * 20 * A GRASP ( Greedy Randomised Adaptive Search Procedure ) class 21 * @author Asser Fahrenholz 22 * 23 */ 24 public class GRASP extends Metaheuristic { 25 26 private final RCLParameter RCLsize ; 27 private int localLoopCounter ; 28 private int counter = 0; 29 private boolean minimize ; 30 31 public GRASP ( double timeToRun , int maxRotation , Rules myRules , RotationInt rotationInt , RCLParameter RCLsize , Schedule s, Type t, int rounds , boolean diagram , DayOrShift dos , boolean minimize ) { 32 super ( timeToRun , maxRotation , myRules , rotationInt , s, t, rounds , RCLsize , dos ); 33 this . RCLsize = RCLsize ; 34 this . minimize = minimize ; 35 } 36 37 public RCLParameter getRCL () { 38 return this . RCLsize ; 39 } 40 41 @Override 42 public Void doInBackground () throws Exception { 43 XYDataItem point4 ; 44 XYDataItem point3 ; 45 XYDataItem point ; 46 XYDataItem point2 ; 47 try { 48 seriesCol = new XYSeriesCollection (); 49 series = new XYSeries (" Best vio "); 50 series2 = new XYSeries (" Best score ");
- Page 23 and 24: Chapter 3. The model and design 12
- Page 25 and 26: Chapter 3. The model and design 14
- Page 27 and 28: Chapter 4. Solving the DRP 16 it in
- Page 29 and 30: Chapter 4. Solving the DRP 18 4.3.1
- Page 31 and 32: Chapter 4. Solving the DRP 20 Given
- 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: 2 Appendix A. Implementation 62 3 i
- 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 and 84: Appendix A. Implementation 72 64 br
- Page 85 and 86: Appendix A. Implementation 74 28 Ch
- 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
Appendix A. Implementation 64<br />
A.3 GRASP metaheuristic<br />
1 package heuristic . meta ;<br />
2<br />
3 import basic . RCLParameter ;<br />
4 import basic . Rules ;<br />
5 import changes . Change ;<br />
6 import changes . RotationInt ;<br />
7 import ds.Day ;<br />
8 import ds. <strong>Doctor</strong> ;<br />
9 import ds. Pair ;<br />
10 import ds. Schedule ;<br />
11 import ds. Shift ;<br />
12 import heuristic . Metaheuristic ;<br />
13 import java . util . HashMap ;<br />
14 import java . util . HashSet ;<br />
15 import org . jfree . data .xy. XYDataItem ;<br />
16 import org . jfree . data .xy. XYSeries ;<br />
17 import org . jfree . data .xy. XYSeriesCollection ;<br />
18<br />
19 /* *<br />
20 * A GRASP ( Greedy Randomised Adaptive Search Procedure ) class<br />
21 * @author <strong>Asser</strong> <strong>Fahrenholz</strong><br />
22 *<br />
23 */<br />
24 public class GRASP extends Metaheuristic {<br />
25<br />
26 private final RCLParameter RCLsize ;<br />
27 private int localLoopCounter ;<br />
28 private int counter = 0;<br />
29 private boolean minimize ;<br />
30<br />
31 public GRASP ( double timeToRun , int maxRotation , Rules myRules , RotationInt<br />
rotationInt , RCLParameter RCLsize , Schedule s, Type t, int rounds , boolean<br />
diagram , DayOrShift dos , boolean minimize ) {<br />
32 super ( timeToRun , maxRotation , myRules , rotationInt , s, t, rounds , RCLsize<br />
, dos );<br />
33 this . RCLsize = RCLsize ;<br />
34 this . minimize = minimize ;<br />
35 }<br />
36<br />
37 public RCLParameter getRCL () {<br />
38 return this . RCLsize ;<br />
39 }<br />
40<br />
41 @Override<br />
42 public Void doInBackground () throws Exception {<br />
43 XYDataItem point4 ;<br />
44 XYDataItem point3 ;<br />
45 XYDataItem point ;<br />
46 XYDataItem point2 ;<br />
47 try {<br />
48 seriesCol = new XYSeriesCollection ();<br />
49 series = new XYSeries (" Best vio ");<br />
50 series2 = new XYSeries (" Best score ");