Skip to content

Commit

Permalink
Changes to show a crash in NearbyDistanceMatrix.getDestination()
Browse files Browse the repository at this point in the history
  • Loading branch information
asaveljevs committed Feb 16, 2021
1 parent 4ca97ce commit 7bf86b1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.optaplanner.examples.vehiclerouting.domain.solver;

import org.optaplanner.core.impl.heuristic.selector.common.decorator.SelectionFilter;
import org.optaplanner.core.impl.score.director.ScoreDirector;
import org.optaplanner.examples.vehiclerouting.domain.Customer;
import org.optaplanner.examples.vehiclerouting.domain.Vehicle;
import org.optaplanner.examples.vehiclerouting.domain.VehicleRoutingSolution;

public class CustomerChangeFilter implements SelectionFilter<VehicleRoutingSolution, Customer> {
@Override
public boolean accept(ScoreDirector<VehicleRoutingSolution> director, Customer customer) {
boolean result = !(customer.getPreviousStandstill() instanceof Vehicle);
System.out.println("CustomerChangeFilter.accept(director, " + customer + ") -> " + result);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public double getNearbyDistance(Customer origin, Standstill destination) {
// if (origin instanceof TimeWindowedCustomer && destination instanceof TimeWindowedCustomer) {
// distance += ((TimeWindowedCustomer) origin).getTimeWindowGapTo((TimeWindowedCustomer) destination);
// }
System.out.println("CustomerNearbyDistanceMeter.getNearbyDistance(" + origin + ", " + destination + ") -> " + distance);
return distance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@
</constructionHeuristic>
<localSearch>
<unionMoveSelector>
<changeMoveSelector/>
<swapMoveSelector/>
<subChainChangeMoveSelector>
<selectReversingMoveToo>true</selectReversingMoveToo>
</subChainChangeMoveSelector>
<subChainSwapMoveSelector>
<selectReversingMoveToo>true</selectReversingMoveToo>
</subChainSwapMoveSelector>
<!-- TODO use nearby selection to scale out -->
<changeMoveSelector>
<entitySelector id="entitySelector1">
<entityClass>org.optaplanner.examples.vehiclerouting.domain.Customer</entityClass>
<filterClass>org.optaplanner.examples.vehiclerouting.domain.solver.CustomerChangeFilter</filterClass>
</entitySelector>
<valueSelector>
<nearbySelection>
<originEntitySelector mimicSelectorRef="entitySelector1"/>
<nearbyDistanceMeterClass>org.optaplanner.examples.vehiclerouting.domain.solver.nearby.CustomerNearbyDistanceMeter</nearbyDistanceMeterClass>
<parabolicDistributionSizeMaximum>40</parabolicDistributionSizeMaximum>
</nearbySelection>
</valueSelector>
</changeMoveSelector>
</unionMoveSelector>
<acceptor>
<lateAcceptanceSize>200</lateAcceptanceSize>
Expand Down

0 comments on commit 7bf86b1

Please sign in to comment.