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 63<br />

54 {<br />

55 Day day ;<br />

56 Shift s;<br />

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

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

59<br />

60 setProgress (100 * i / working . size ());<br />

61 oldScore = newScore ;<br />

62 workingSol = working . getSolutionValue ( false , getRules ());<br />

63 newScore = workingSol . getE ();<br />

64 newVio = workingSol . getV (). getE (). size ();<br />

65 newSoftVio = workingSol . getV (). getV (). size ();<br />

66 firePropertyChange (" score ", oldScore , newScore );<br />

67 firePropertyChange (" violations ", null , newVio );<br />

68 firePropertyChange (" violationsSoft ", null , newSoftVio );<br />

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

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

71<br />

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

73 Change c = working . getBestChange ( day . getDayID () ,<br />

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

74 working . performChange (c, false );<br />

75 continue ;<br />

76 }<br />

77<br />

78 Shift :<br />

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

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

81<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. getShiftInt<br />

() , false );<br />

85 }<br />

86 }<br />

87 }<br />

88 }<br />

89 }<br />

90 working . setConstructorID ( this . hashCode ());<br />

91 working . setRCL ( RCLsize );<br />

92 working . setDoS ( dos );<br />

93<br />

94 setBestSchedule ( working );<br />

95<br />

96 } catch ( Exception e) {<br />

97 System . out . println (" Caught e: " + e. getCause ());<br />

98 e. printStackTrace ();<br />

99 }<br />

100 return null ;<br />

101 }<br />

102 }

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

Saved successfully!

Ooh no, something went wrong!