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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix A. Implementation 69<br />

73 if (( newLocalScore > bestScore && ! minimize ) || (<br />

newLocalScore < bestScore && minimize )) {<br />

74 setBestSchedule ( working );<br />

75 localImprovements ++;<br />

76 acceptedSolutions ++;<br />

77 }<br />

78 } else {<br />

79 if ( rand < ( Math . exp (( solutionValue_increase ) / temp ))) {<br />

80 acceptedSolutions ++;<br />

81 } else {<br />

82 working . performChange (c, true );<br />

83 rejectedSolutions ++;<br />

84 }<br />

85 }<br />

86 } else {<br />

87 rejectedSolutions ++;<br />

88 working . performChange (c, true );<br />

89 }<br />

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

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

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

91 setProgress ( progress );<br />

92 firePropertyChange (" score ", null , bestScore );<br />

93 firePropertyChange (" violations ", null , bestVio );<br />

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

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

95 temp = alpha * temp ;<br />

96 point = new XYDataItem ( super . type . compareTo ( Type . Rounds ) == 0 ?<br />

loopCounter : ( System . currentTimeMillis () - startTime ), bestVio );<br />

97 point2 = new XYDataItem ( super . type . compareTo ( Type . Rounds ) == 0 ?<br />

loopCounter : ( System . currentTimeMillis () - startTime ), bestScore );<br />

98 point3 = new XYDataItem ( super . type . compareTo ( Type . Rounds ) == 0 ?<br />

loopCounter : ( System . currentTimeMillis () - startTime ), newLocalVio );<br />

99 point4 = new XYDataItem ( super . type . compareTo ( Type . Rounds ) == 0 ?<br />

loopCounter : ( System . currentTimeMillis () - startTime ), newLocalScore );<br />

100 tempPoint = new XYDataItem ( loopCounter ++ , temp );<br />

101 series . add ( point );<br />

102 series2 . add ( point2 );<br />

103 series3 . add ( point3 );<br />

104 series4 . add ( point4 );<br />

105 tempSeries . add ( tempPoint );<br />

106 }<br />

107 printSAStatsToConsole ();<br />

108 printMetaStatsToConsole ();<br />

109 getBestSchedule (). setOptimizer ( this );<br />

110<br />

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

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

113 e. printStackTrace ();<br />

114 }<br />

115 return null ;<br />

116 }<br />

117<br />

118 public void printSAStatsToConsole () {

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

Saved successfully!

Ooh no, something went wrong!