mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
extend interface TransportDistance - breaking change
This commit is contained in:
parent
3d84c714d2
commit
151754c79c
17 changed files with 188 additions and 174 deletions
|
|
@ -340,7 +340,7 @@ public class SolutionAnalyser {
|
|||
}
|
||||
|
||||
private double distance(TourActivity activity) {
|
||||
return distanceCalculator.getDistance(prevAct.getLocation(), activity.getLocation());
|
||||
return distanceCalculator.getDistance(prevAct.getLocation(), activity.getLocation(),prevActDeparture, route.getVehicle());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -381,7 +381,7 @@ public class SolutionAnalyser {
|
|||
|
||||
@Override
|
||||
public void visit(TourActivity activity) {
|
||||
double distance = distanceCalculator.getDistance(prevAct.getLocation(), activity.getLocation());
|
||||
double distance = distanceCalculator.getDistance(prevAct.getLocation(), activity.getLocation(), prevAct.getEndTime(), route.getVehicle());
|
||||
sum_distance += distance;
|
||||
stateManager.putActivityState(activity, distance_id, sum_distance);
|
||||
prevAct = activity;
|
||||
|
|
@ -389,7 +389,7 @@ public class SolutionAnalyser {
|
|||
|
||||
@Override
|
||||
public void finish() {
|
||||
double distance = distanceCalculator.getDistance(prevAct.getLocation(), route.getEnd().getLocation());
|
||||
double distance = distanceCalculator.getDistance(prevAct.getLocation(), route.getEnd().getLocation(),prevAct.getEndTime(), route.getVehicle());
|
||||
sum_distance += distance;
|
||||
stateManager.putRouteState(route, distance_id, sum_distance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package com.graphhopper.jsprit.core.problem.cost;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||
|
||||
/**
|
||||
* Created by schroeder on 23/12/14.
|
||||
*/
|
||||
public interface TransportDistance {
|
||||
|
||||
public double getDistance(Location from, Location to);
|
||||
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class CrowFlyCosts extends AbstractForwardVehicleRoutingTransportCosts im
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
|
||||
return calculateDistance(from, to);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class EuclideanCosts extends AbstractForwardVehicleRoutingTransportCosts
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
|
||||
return calculateDistance(from, to);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ public class FastVehicleRoutingTransportCostsMatrix extends AbstractForwardVehic
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
|
||||
return getDistance(from.getIndex(), to.getIndex());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class GreatCircleCosts extends AbstractForwardVehicleRoutingTransportCost
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
|
||||
return calculateDistance(from, to);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ManhattanCosts extends AbstractForwardVehicleRoutingTransportCosts
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
public double getDistance(Location from, Location to, double departureTime, Vehicle vehicle) {
|
||||
return calculateDistance(from, to);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue