Closed JoannaBlatt closed 1 year ago
The code in the calculateFinalScore
method of MaximizeVolumeFitness
is wrong in several ways #871 .
First, if currentShapeBlockList
is empty, then don't do any calculations on it. This is the source of the crash above.
However, this also has other errors. You are simply replacing the min and max coordinates each time, not computing the min and max across the history of all shapes. For each current shape, get the min and max coordinates. Then use the other version of the min/max coordinate method (e.g. MinecraftCoordinates minCoordinates(MinecraftCoordinates c1, MinecraftCoordinates c2)
) to compare the min/max of one shape in the history to the next shape in the history. This will give you the min/max across all shapes.
However, if you do this, then initializing the min/max to (0,0,0) is incorrect. Start with the min/max coordinate of the shape at index 0 in the history
Possibly fixed. Need to test
Seems fixed. Need to keep monitoring
When calculating the minecraft coordinates the min coordinate creates an error that terminates the run.
Error cod:
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at edu.southwestern.tasks.evocraft.MinecraftUtilClass.minCoordinates(MinecraftUtilClass.java:131) at edu.southwestern.tasks.evocraft.fitness.MaximizeVolumeFitness.calculateFinalScore(MaximizeVolumeFitness.java:29) at edu.southwestern.tasks.evocraft.fitness.TimedEvaluationMinecraftFitnessFunction.multipleFitnessScores(TimedEvaluationMinecraftFitnessFunction.java:162) at edu.southwestern.tasks.evocraft.fitness.TimedEvaluationMinecraftFitnessFunction.fitnessScore(TimedEvaluationMinecraftFitnessFunction.java:33) at edu.southwestern.tasks.evocraft.MinecraftShapeTask.lambda$calculateFitnessScores$1(MinecraftShapeTask.java:403)