Skip to content

Commit 287c5ce

Browse files
committed
Improve variable names
1 parent 775e098 commit 287c5ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/SearchStrategyManager.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ private void updateSumWeights() {
103103
public SearchStrategy getRandomStrategy() {
104104
if (random == null)
105105
throw new IllegalStateException("randomizer is null. make sure you set random object correctly");
106-
double randomFig = random.nextDouble();
107-
double sumProbabilities = 0.0;
106+
double randomValue = random.nextDouble();
107+
double cumulativeProbability = 0.0;
108108
for (int i = 0; i < weights.size(); i++) {
109-
sumProbabilities += weights.get(i) / sumWeights;
110-
if (randomFig < sumProbabilities) {
109+
cumulativeProbability += weights.get(i) / sumWeights;
110+
if (randomValue < cumulativeProbability) {
111111
return strategies.get(i);
112112
}
113113
}
114-
throw new IllegalStateException("no search-strategy found");
114+
return strategies.get(strategies.size() - 1);
115115
}
116116

117117
public void addSearchStrategyListener(SearchStrategyListener strategyListener) {

0 commit comments

Comments
 (0)