mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
remove redundant specifications
This commit is contained in:
parent
410cedb0e9
commit
25a3052a54
1 changed files with 18 additions and 19 deletions
|
|
@ -77,31 +77,29 @@ public class VehicleRoutingProblem {
|
||||||
|
|
||||||
private VehicleRoutingActivityCosts activityCosts = new WaitingTimeCosts();
|
private VehicleRoutingActivityCosts activityCosts = new WaitingTimeCosts();
|
||||||
|
|
||||||
private Map<String, Job> jobs = new LinkedHashMap<String, Job>();
|
private Map<String, Job> jobs = new LinkedHashMap<>();
|
||||||
|
|
||||||
private Map<String, Job> tentativeJobs = new LinkedHashMap<String, Job>();
|
private Map<String, Job> tentativeJobs = new LinkedHashMap<>();
|
||||||
|
|
||||||
private Map<String, Job> jobsInInitialRoutes = new HashMap<>();
|
private Map<String, Job> jobsInInitialRoutes = new LinkedHashMap<>();
|
||||||
|
|
||||||
private Map<String, Coordinate> tentative_coordinates = new HashMap<String, Coordinate>();
|
private Map<String, Coordinate> tentative_coordinates = new HashMap<>();
|
||||||
|
|
||||||
private FleetSize fleetSize = FleetSize.INFINITE;
|
private FleetSize fleetSize = FleetSize.INFINITE;
|
||||||
|
|
||||||
private Map<String, VehicleType> vehicleTypes = new HashMap<>();
|
private Map<String, VehicleType> vehicleTypes = new HashMap<>();
|
||||||
|
|
||||||
private Collection<VehicleRoute> initialRoutes = new ArrayList<VehicleRoute>();
|
private Collection<VehicleRoute> initialRoutes = new ArrayList<>();
|
||||||
|
|
||||||
private Set<Vehicle> uniqueVehicles = new LinkedHashSet<Vehicle>();
|
private Set<Vehicle> uniqueVehicles = new LinkedHashSet<>();
|
||||||
|
|
||||||
private Set<String> addedVehicleIds = new LinkedHashSet<String>();
|
private Set<String> addedVehicleIds = new LinkedHashSet<>();
|
||||||
|
|
||||||
private boolean hasBreaks = false;
|
|
||||||
|
|
||||||
private JobActivityFactory jobActivityFactory = new JobActivityFactory() {
|
private JobActivityFactory jobActivityFactory = new JobActivityFactory() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractActivity> createActivities(Job job) {
|
public List<AbstractActivity> createActivities(Job job) {
|
||||||
List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
|
List<AbstractActivity> acts = new ArrayList<>();
|
||||||
if( job instanceof Break){
|
if( job instanceof Break){
|
||||||
acts.add(BreakActivity.newInstance((Break) job));
|
acts.add(BreakActivity.newInstance((Break) job));
|
||||||
}
|
}
|
||||||
|
|
@ -122,9 +120,9 @@ public class VehicleRoutingProblem {
|
||||||
|
|
||||||
private int vehicleTypeIdIndexCounter = 1;
|
private int vehicleTypeIdIndexCounter = 1;
|
||||||
|
|
||||||
private Map<VehicleTypeKey, Integer> typeKeyIndices = new HashMap<VehicleTypeKey, Integer>();
|
private Map<VehicleTypeKey, Integer> typeKeyIndices = new HashMap<>();
|
||||||
|
|
||||||
private Map<Job, List<AbstractActivity>> activityMap = new HashMap<Job, List<AbstractActivity>>();
|
private Map<Job, List<AbstractActivity>> activityMap = new HashMap<>();
|
||||||
|
|
||||||
private final DefaultShipmentActivityFactory shipmentActivityFactory = new DefaultShipmentActivityFactory();
|
private final DefaultShipmentActivityFactory shipmentActivityFactory = new DefaultShipmentActivityFactory();
|
||||||
|
|
||||||
|
|
@ -138,7 +136,7 @@ public class VehicleRoutingProblem {
|
||||||
vehicleTypeIdIndexCounter++;
|
vehicleTypeIdIndexCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Location> allLocations = new HashSet<Location>();
|
private Set<Location> allLocations = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unmodifiable map of collected locations (mapped by their location-id).
|
* Returns the unmodifiable map of collected locations (mapped by their location-id).
|
||||||
|
|
@ -323,7 +321,7 @@ public class VehicleRoutingProblem {
|
||||||
private void registerJobAndActivity(AbstractActivity abstractAct, Job job) {
|
private void registerJobAndActivity(AbstractActivity abstractAct, Job job) {
|
||||||
if (activityMap.containsKey(job)) activityMap.get(job).add(abstractAct);
|
if (activityMap.containsKey(job)) activityMap.get(job).add(abstractAct);
|
||||||
else {
|
else {
|
||||||
List<AbstractActivity> actList = new ArrayList<AbstractActivity>();
|
List<AbstractActivity> actList = new ArrayList<>();
|
||||||
actList.add(abstractAct);
|
actList.add(abstractAct);
|
||||||
activityMap.put(job, actList);
|
activityMap.put(job, actList);
|
||||||
}
|
}
|
||||||
|
|
@ -454,6 +452,7 @@ public class VehicleRoutingProblem {
|
||||||
return new VehicleRoutingProblem(this);
|
return new VehicleRoutingProblem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public Builder addLocation(String locationId, Coordinate coordinate) {
|
public Builder addLocation(String locationId, Coordinate coordinate) {
|
||||||
tentative_coordinates.put(locationId, coordinate);
|
tentative_coordinates.put(locationId, coordinate);
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -531,7 +530,7 @@ public class VehicleRoutingProblem {
|
||||||
*
|
*
|
||||||
* @author sschroeder
|
* @author sschroeder
|
||||||
*/
|
*/
|
||||||
public static enum FleetSize {
|
public enum FleetSize {
|
||||||
FINITE, INFINITE
|
FINITE, INFINITE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -641,7 +640,7 @@ public class VehicleRoutingProblem {
|
||||||
* @return copied collection of initial vehicle routes
|
* @return copied collection of initial vehicle routes
|
||||||
*/
|
*/
|
||||||
public Collection<VehicleRoute> getInitialVehicleRoutes() {
|
public Collection<VehicleRoute> getInitialVehicleRoutes() {
|
||||||
Collection<VehicleRoute> copiedInitialRoutes = new ArrayList<VehicleRoute>();
|
Collection<VehicleRoute> copiedInitialRoutes = new ArrayList<>();
|
||||||
for (VehicleRoute route : initialVehicleRoutes) {
|
for (VehicleRoute route : initialVehicleRoutes) {
|
||||||
copiedInitialRoutes.add(VehicleRoute.copyOf(route));
|
copiedInitialRoutes.add(VehicleRoute.copyOf(route));
|
||||||
}
|
}
|
||||||
|
|
@ -718,7 +717,7 @@ public class VehicleRoutingProblem {
|
||||||
* @return a copy of the activities that are associated to the specified job
|
* @return a copy of the activities that are associated to the specified job
|
||||||
*/
|
*/
|
||||||
public List<AbstractActivity> copyAndGetActivities(Job job) {
|
public List<AbstractActivity> copyAndGetActivities(Job job) {
|
||||||
List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
|
List<AbstractActivity> acts = new ArrayList<>();
|
||||||
if (activityMap.containsKey(job)) {
|
if (activityMap.containsKey(job)) {
|
||||||
for (AbstractActivity act : activityMap.get(job)) acts.add((AbstractActivity) act.duplicate());
|
for (AbstractActivity act : activityMap.get(job)) acts.add((AbstractActivity) act.duplicate());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue