Skip to content

Commit 2a0d3d6

Browse files
committed
add job filter to control ruin strategies
1 parent 0c7224d commit 2a0d3d6

File tree

1 file changed

+2
-1
lines changed
  • jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin

1 file changed

+2
-1
lines changed

jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/ruin/RuinString.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes) {
9595
noStrings = Math.min(noStrings, vehicleRoutes.size());
9696
Set<Job> unassignedJobs = new HashSet<>();
9797
Set<VehicleRoute> ruinedRoutes = new HashSet<>();
98-
Job prevJob = RandomUtils.nextJob(vrp.getJobs().values(), random);
98+
Collection<Job> filteredJobs = filterJobs(vrp.getJobs().values());
99+
Job prevJob = RandomUtils.nextJob(filteredJobs, random);
99100
Iterator<Job> neighborhoodIterator = jobNeighborhoods.getNearestNeighborsIterator(kMax * lMax, prevJob);
100101
while (neighborhoodIterator.hasNext() && ruinedRoutes.size() <= noStrings) {
101102
if (!unassignedJobs.contains(prevJob)) {

0 commit comments

Comments
 (0)