27.07.2013 Views

The Doctor Rostering Problem - Asser Fahrenholz

The Doctor Rostering Problem - Asser Fahrenholz

The Doctor Rostering Problem - Asser Fahrenholz

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A. Implementation 65<br />

51 series3 = new XYSeries (" Working vio ");<br />

52 series4 = new XYSeries (" Working score ");<br />

53 seriesCol . addSeries ( series );<br />

54 seriesCol . addSeries ( series2 );<br />

55 seriesCol . addSeries ( series3 );<br />

56 seriesCol . addSeries ( series4 );<br />

57<br />

58<br />

59 startTime = System . currentTimeMillis ();<br />

60 boolean test = ( super . type . compareTo ( Type . Rounds ) == 0) ? (<br />

loopCounter < maxRounds ) : ( System . currentTimeMillis () - startTime ) <<br />

getTimeToRun ();<br />

61 while ( test ) {<br />

62 localLoopCounter = 0;<br />

63 int progress = ( super . type . compareTo ( Type . Rounds ) == 0) ? (100 *<br />

64<br />

loopCounter / maxRounds ) : ( int ) (100 * ( System . currentTimeMillis () -<br />

startTime ) / getTimeToRun ());<br />

65 setProgress ( progress );<br />

66 working = getInitialSchedule ();<br />

67 /* GREEDY */<br />

68 {<br />

69 Day day ;<br />

70 Shift s;<br />

71 <strong>Doctor</strong> d;<br />

72 for ( int i = 0; i < working . size (); i ++) {<br />

73 day = working . getDay (i);<br />

74 if (!( day . isWeekend () || day . isHoliday ())) {<br />

75 if ( getDoS (). compareTo ( DayOrShift . Day ) == 0) {<br />

76 Change change = working . getBestChange ( day .<br />

getDayID () , RCLsize , minimize , getRules ());<br />

77 working . performChange ( change , false );<br />

78 continue ;<br />

79 }<br />

80 for ( int j = 0; j < day . size (); j ++) {<br />

81 s = day . getShift (j);<br />

82 if (s. isMiddayShift ()) {<br />

83 d = working . getBest<strong>Doctor</strong> (day , s, RCLsize ,<br />

minimize , getRules ());<br />

84 working . assign<strong>Doctor</strong>2Shift (day , d, s.<br />

getShiftInt () , false );<br />

85 }<br />

86 }<br />

87 }<br />

88 }<br />

89 }<br />

90<br />

91 /* LOCAL SEARCH : */<br />

92 double timeToRunLocal = getTimeToRun () / 5;<br />

93 int newLocalScore ;<br />

94 {<br />

95 double startTimeLocal = System . currentTimeMillis ();<br />

96 boolean test2 = ( super . type . compareTo ( Type . Rounds ) == 0) ? (<br />

localLoopCounter < maxLocalLoops ) : ( System . currentTimeMillis () -<br />

startTimeLocal ) < timeToRunLocal ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!