Skip to content

Commit 58e3e38

Browse files
committed
allow negative noise
1 parent 11fb30e commit 58e3e38

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/box/InsertionNoiseMaker.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,17 @@ class InsertionNoiseMaker implements SoftActivityConstraint, IterationStartsList
5050
this.noiseLevel = noiseLevel;
5151
this.noiseProbability = noiseProbability;
5252
this.maxCosts = maxCosts;
53-
// randomArray = new Random[vrp.getNuActivities() + 2];
54-
// for (int i = 0; i < randomArray.length; i++) {
55-
// Random r = new Random();
56-
// r.setSeed(random.nextLong());
57-
// randomArray[i] = r;
58-
// }
5953
}
6054

6155
@Override
6256
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
63-
if (random.nextDouble() < noiseProbability) {
64-
makeNoise = true;
65-
} else makeNoise = false;
57+
6658
}
6759

6860
@Override
6961
public double getCosts(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {
70-
if (makeNoise) {
71-
return noiseLevel * maxCosts * random.nextDouble();
62+
if (random.nextDouble() < noiseProbability) {
63+
return noiseLevel * maxCosts * random.nextGaussian();
7264
}
7365
return 0;
7466
}

0 commit comments

Comments
 (0)