make vars to avoid toDouble() and getProp() all the time
@@ -493,10 +493,11 @@ public class Jsprit {
toInteger(properties.getProperty(Parameter.WORST_MAX_SHARE.toString())),
random)
);
+ double ruinWorstNoiseProb = toDouble(getProperty(Parameter.RUIN_WORST_NOISE_PROB.toString()));
+ double ruinWorstNoiseLevel = toDouble(getProperty(Parameter.RUIN_WORST_NOISE_LEVEL.toString()));
IterationStartsListener noise = (i, problem, solutions) -> worst.setNoiseMaker(() -> {
- if (random.nextDouble() < toDouble(getProperty(Parameter.RUIN_WORST_NOISE_PROB.toString()))) {
- return toDouble(getProperty(Parameter.RUIN_WORST_NOISE_LEVEL.toString()))
- * maxCosts * random.nextDouble();
+ if (random.nextDouble() < ruinWorstNoiseProb) {
+ return ruinWorstNoiseLevel * maxCosts * random.nextDouble();
} else return 0.;
});
