The class TestResult
Before explaining the new Fitnessfunction I want to introduce the Class TestResult which supplies all necessary data for the calculation of a fitness-value.The idea of creating TestResult was to provide the results of multiple testbattles in a neutral way. Programs using the test results should be able to decide on their own how to interpret them.
Here the source code:
case class TestResult (
relWinCount: Double, relUndecidedCount: Double, relLossCount: Double,
relDurationMeanOnWin: Double, relDurationMeanOnLoss: Double) {
For details see Design of a Fitnessfunction
The new Fitnessfunction
Here the code for the new Fitnessfunction: def fitness(result: TestResult): Double = {
// Duration makes only sense if any match was lost or won. Otherwise take fixed value
val relDurationMeanOnLoss = if (almostZero(result.relLossCount)) 1.0 else result.relDurationMeanOnLoss
val relDurationMeanOnWin = if (almostZero(result.relWinCount)) 1.0 else result.relDurationMeanOnWin
// Increasing fitness function
val inc = 2.0 + winLossFactor -
(result.relLossCount * winLossFactor + (1.0 - relDurationMeanOnLoss)) +
(result.relWinCount * winLossFactor + (1.0 - relDurationMeanOnWin))
// Invert to get a decreasing fitness
(1.0 / inc) * 1000
}
This function also creates (reasonable) results in the case of winning games.
Here are the resuts.
A WinnLossFactor smaller than 5 seems not to make sense because it would probably get stuck in situations where all matches are lost, but the loss of matches is deferred as long as possible.
Problems with winning and loosing games during the same test
The statistics above show only the (simplified) situation that all matches are weather undecided/winning or undecided/loosing. For the case that e.g. most games are lost and some are won, the fitness value is much lower than for 'all matches undecided'. This leads to the problem of getting stuck in 'all matches undecided'To overcome that situation I am planning to introduce some kind of winFactor that increases the priority of won games to lost games.
Details see future posts
No comments:
Post a Comment