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 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 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 boolean hasBreaks = false;
|
||||
private Set<String> addedVehicleIds = new LinkedHashSet<>();
|
||||
|
||||
private JobActivityFactory jobActivityFactory = new JobActivityFactory() {
|
||||
|
||||
@Override
|
||||
public List<AbstractActivity> createActivities(Job job) {
|
||||
List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
|
||||
List<AbstractActivity> acts = new ArrayList<>();
|
||||
if( job instanceof Break){
|
||||
acts.add(BreakActivity.newInstance((Break) job));
|
||||
}
|
||||
|
|
@ -122,9 +120,9 @@ public class VehicleRoutingProblem {
|
|||
|
||||
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();
|
||||
|
||||
|
|
@ -138,7 +136,7 @@ public class VehicleRoutingProblem {
|
|||
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).
|
||||
|
|
@ -323,7 +321,7 @@ public class VehicleRoutingProblem {
|
|||
private void registerJobAndActivity(AbstractActivity abstractAct, Job job) {
|
||||
if (activityMap.containsKey(job)) activityMap.get(job).add(abstractAct);
|
||||
else {
|
||||
List<AbstractActivity> actList = new ArrayList<AbstractActivity>();
|
||||
List<AbstractActivity> actList = new ArrayList<>();
|
||||
actList.add(abstractAct);
|
||||
activityMap.put(job, actList);
|
||||
}
|
||||
|
|
@ -439,7 +437,7 @@ public class VehicleRoutingProblem {
|
|||
addJobToFinalJobMapAndCreateActivities(job);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int jobIndexCounter = 1;
|
||||
for (Job job : jobs.values()) {
|
||||
((AbstractJob)job).setIndex(jobIndexCounter++);
|
||||
|
|
@ -447,13 +445,14 @@ public class VehicleRoutingProblem {
|
|||
for (Job job : jobsInInitialRoutes.values()) {
|
||||
((AbstractJob)job).setIndex(jobIndexCounter++);
|
||||
}
|
||||
|
||||
|
||||
boolean hasBreaks = addBreaksToActivityMap();
|
||||
if (hasBreaks && fleetSize.equals(FleetSize.INFINITE))
|
||||
throw new UnsupportedOperationException("Breaks are not yet supported when dealing with infinite fleet. Either set it to finite or omit breaks.");
|
||||
return new VehicleRoutingProblem(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Builder addLocation(String locationId, Coordinate coordinate) {
|
||||
tentative_coordinates.put(locationId, coordinate);
|
||||
return this;
|
||||
|
|
@ -531,7 +530,7 @@ public class VehicleRoutingProblem {
|
|||
*
|
||||
* @author sschroeder
|
||||
*/
|
||||
public static enum FleetSize {
|
||||
public enum FleetSize {
|
||||
FINITE, INFINITE
|
||||
}
|
||||
|
||||
|
|
@ -641,7 +640,7 @@ public class VehicleRoutingProblem {
|
|||
* @return copied collection of initial vehicle routes
|
||||
*/
|
||||
public Collection<VehicleRoute> getInitialVehicleRoutes() {
|
||||
Collection<VehicleRoute> copiedInitialRoutes = new ArrayList<VehicleRoute>();
|
||||
Collection<VehicleRoute> copiedInitialRoutes = new ArrayList<>();
|
||||
for (VehicleRoute route : initialVehicleRoutes) {
|
||||
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
|
||||
*/
|
||||
public List<AbstractActivity> copyAndGetActivities(Job job) {
|
||||
List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
|
||||
List<AbstractActivity> acts = new ArrayList<>();
|
||||
if (activityMap.containsKey(job)) {
|
||||
for (AbstractActivity act : activityMap.get(job)) acts.add((AbstractActivity) act.duplicate());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue