();
- try {
- problem = makeVrpSeries(routes, labels);
- } catch (NoLocationFoundException e) {
- log.warn("cannot plot vrp, since coord is missing");
- return;
- }
- XYSeriesCollection solutionColl = makeSolutionSeries(routes,locations);
- XYPlot plot = createPlot(problem, solutionColl, labels);
- JFreeChart chart = new JFreeChart(title, plot);
- save(chart,filename);
- }
-
- /**
- * Plots problem and solution to pngFile.
- *
- * This can only plot if vehicles and jobs have locationIds and coordinates (@see Coordinate). Otherwise a warning message is logged
- * and method returns but does not plot.
- *
- * @param vrp
- * @param solution
- * @param pngFile target path with filename.
- * @see VehicleRoutingProblem, VehicleRoutingProblemSolution
- * @deprecated use Plotter.java instead (this plotter is not maintained anymore and might plot incorrectly)
- */
- @Deprecated
- public static void plotSolutionAsPNG(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, String pngFile, String title){
- String filename = pngFile;
- if(!pngFile.endsWith(".png")) filename += ".png";
- log.info("plot solution to " + filename);
- XYSeriesCollection problem;
- XYSeriesCollection solutionColl;
- Map labels = new HashMap();
- try {
- problem = makeVrpSeries(vrp, labels);
- solutionColl = makeSolutionSeries(vrp, solution);
- } catch (NoLocationFoundException e) {
- log.warn("cannot plot vrp, since coord is missing");
- return;
- }
- XYPlot plot = createPlot(problem, solutionColl, labels);
- JFreeChart chart = new JFreeChart(title, plot);
- save(chart,filename);
-
- }
-
-
-
- private static XYPlot createPlot(final XYSeriesCollection problem, final Map labels) {
- XYPlot plot = new XYPlot();
- plot.setBackgroundPaint(Color.LIGHT_GRAY);
- plot.setRangeGridlinePaint(Color.WHITE);
- plot.setDomainGridlinePaint(Color.WHITE);
-
- XYItemRenderer problemRenderer = new XYLineAndShapeRenderer(false, true); // Shapes only
-// problemRenderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() {
-//
-// @Override
-// public String generateLabel(XYDataset arg0, int arg1, int arg2) {
-// XYDataItem item = problem.getSeries(arg1).getDataItem(arg2);
-// return labels.get(item);
-// }
-// });
- problemRenderer.setBaseItemLabelsVisible(true);
- problemRenderer.setBaseItemLabelPaint(Color.BLACK);
-
- NumberAxis xAxis = new NumberAxis();
- xAxis.setRangeWithMargins(problem.getDomainBounds(true));
-
- NumberAxis yAxis = new NumberAxis();
- yAxis.setRangeWithMargins(problem.getRangeBounds(false));
-
- plot.setDataset(0, problem);
- plot.setRenderer(0, problemRenderer);
- plot.setDomainAxis(0, xAxis);
- plot.setRangeAxis(0, yAxis);
-
- return plot;
- }
-
- private static XYPlot createPlot(final XYSeriesCollection problem, XYSeriesCollection solutionColl, final Map labels) {
- XYPlot plot = new XYPlot();
- plot.setBackgroundPaint(Color.LIGHT_GRAY);
- plot.setRangeGridlinePaint(Color.WHITE);
- plot.setDomainGridlinePaint(Color.WHITE);
-
- XYItemRenderer problemRenderer = new XYLineAndShapeRenderer(false, true); // Shapes only
-// problemRenderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() {
-//
-// @Override
-// public String generateLabel(XYDataset arg0, int arg1, int arg2) {
-// XYDataItem item = problem.getSeries(arg1).getDataItem(arg2);
-// return labels.get(item);
-// }
-// });
- problemRenderer.setBaseItemLabelsVisible(true);
- problemRenderer.setBaseItemLabelPaint(Color.BLACK);
-
-
- NumberAxis xAxis = new NumberAxis();
- xAxis.setRangeWithMargins(problem.getDomainBounds(true));
-
- NumberAxis yAxis = new NumberAxis();
- yAxis.setRangeWithMargins(problem.getRangeBounds(true));
-
- plot.setDataset(0, problem);
- plot.setRenderer(0, problemRenderer);
- plot.setDomainAxis(0, xAxis);
- plot.setRangeAxis(0, yAxis);
-
-
- XYItemRenderer solutionRenderer = new XYLineAndShapeRenderer(true, false); // Lines only
-// for(int i=0;i routes, Locations locations){
- XYSeriesCollection coll = new XYSeriesCollection();
- int counter = 1;
- for(VehicleRoute route : routes){
- if(route.isEmpty()) continue;
- XYSeries series = new XYSeries(counter, false, true);
-
- Coordinate startCoord = locations.getCoord(route.getStart().getLocationId());
- series.add(startCoord.getX(), startCoord.getY());
-
- for(TourActivity act : route.getTourActivities().getActivities()){
- Coordinate coord = locations.getCoord(act.getLocationId());
- series.add(coord.getX(), coord.getY());
- }
-
- Coordinate endCoord = locations.getCoord(route.getEnd().getLocationId());
- series.add(endCoord.getX(), endCoord.getY());
-
- coll.addSeries(series);
- counter++;
- }
- return coll;
- }
-
- private static XYSeriesCollection makeVrpSeries(Collection vehicles, Collection services, Map labels) throws NoLocationFoundException{
- XYSeriesCollection coll = new XYSeriesCollection();
- XYSeries vehicleSeries = new XYSeries("depot", false, true);
- for(Vehicle v : vehicles){
- Coordinate coord = v.getStartLocationCoordinate();
- if(coord == null) throw new NoLocationFoundException();
- vehicleSeries.add(coord.getX(),coord.getY());
- }
- coll.addSeries(vehicleSeries);
-
- XYSeries serviceSeries = new XYSeries("service", false, true);
- XYSeries pickupSeries = new XYSeries("pickup", false, true);
- XYSeries deliverySeries = new XYSeries("delivery", false, true);
- for(Job job : services){
- if(job instanceof Pickup){
- Pickup service = (Pickup)job;
- Coordinate coord = service.getCoord();
- XYDataItem dataItem = new XYDataItem(coord.getX(), coord.getY());
- pickupSeries.add(dataItem);
- labels.put(dataItem, String.valueOf(service.getCapacityDemand()));
- }
- else if(job instanceof Delivery){
- Delivery service = (Delivery)job;
- Coordinate coord = service.getCoord();
- XYDataItem dataItem = new XYDataItem(coord.getX(), coord.getY());
- deliverySeries.add(dataItem);
- labels.put(dataItem, String.valueOf(service.getCapacityDemand()));
- }
- else if(job instanceof Service){
- Service service = (Service)job;
- Coordinate coord = service.getCoord();
- XYDataItem dataItem = new XYDataItem(coord.getX(), coord.getY());
- serviceSeries.add(dataItem);
- labels.put(dataItem, String.valueOf(service.getCapacityDemand()));
- }
- else{
- throw new IllegalStateException("job instanceof " + job.getClass().toString() + ". this is not supported.");
- }
-
- }
- if(!serviceSeries.isEmpty()) coll.addSeries(serviceSeries);
- if(!pickupSeries.isEmpty()) coll.addSeries(pickupSeries);
- if(!deliverySeries.isEmpty()) coll.addSeries(deliverySeries);
- return coll;
- }
-
- private static XYSeriesCollection makeVrpSeries(Collection routes, Map labels) throws NoLocationFoundException{
- Set vehicles = new HashSet();
- Set jobs = new HashSet();
- for(VehicleRoute route : routes){
- vehicles.add(route.getVehicle());
- jobs.addAll(route.getTourActivities().getJobs());
- }
- return makeVrpSeries(vehicles, jobs, labels);
- }
-
- private static XYSeriesCollection makeVrpSeries(VehicleRoutingProblem vrp, Map labels) throws NoLocationFoundException{
- return makeVrpSeries(vrp.getVehicles(), vrp.getJobs().values(), labels);
- }
-
- private static Locations retrieveLocations(VehicleRoutingProblem vrp) throws NoLocationFoundException {
- final Map locs = new HashMap();
- for(Vehicle v : vrp.getVehicles()){
- String startLocationId = v.getStartLocationId();
- if(startLocationId == null) throw new NoLocationFoundException();
- Coordinate coord = v.getStartLocationCoordinate();
- if(coord == null) throw new NoLocationFoundException();
- locs.put(startLocationId, coord);
- }
- for(Job j : vrp.getJobs().values()){
- if(j instanceof Service){
- String locationId = ((Service) j).getLocationId();
- if(locationId == null) throw new NoLocationFoundException();
- Coordinate coord = ((Service) j).getCoord();
- if(coord == null) throw new NoLocationFoundException();
- locs.put(locationId, coord);
- }
- else{
- throw new IllegalStateException("job is not a service. this is not supported yet.");
- }
- }
- return new Locations() {
-
- @Override
- public Coordinate getCoord(String id) {
- return locs.get(id);
- }
- };
- }
-
-}
diff --git a/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java b/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java
index 5dd3c363..4ad0ff69 100644
--- a/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java
+++ b/jsprit-analysis/src/main/java/jsprit/analysis/toolbox/SolutionPrinter.java
@@ -140,39 +140,4 @@ public class SolutionPrinter {
return new Jobs(nServices,nShipments);
}
-// /**
-// * Prints the details of the solution according to a print-level, i.e. Print.CONCISE or PRINT.VERBOSE.
-// *
-// * CONCISE prints total-costs and #vehicles.
-// *
VERBOSE prints the route-details additionally. If the DefaultVehicleRouteCostCalculator (which is the standard-calculator)
-// * is used in VehicleRoute, then route-costs are differentiated further between transport, activity, vehicle, driver and other-costs.
-// *
-// * @param solution
-// * @param level
-// *
-// * @deprecated is not going to work anymore
-// */
-// @Deprecated
-// public static void print(VehicleRoutingProblemSolution solution, Print level){
-// if(level.equals(Print.CONCISE)){
-// print(solution);
-// }
-// else{
-// print(solution);
-// System.out.println("routes");
-// int routeCount = 1;
-// for(VehicleRoute route : solution.getRoutes()){
-// System.out.println("[route="+routeCount+"][departureTime="+route.getStart().getEndTime()+"[total=" + route.getCost() + "]");
-// if(route.getVehicleRouteCostCalculator() instanceof DefaultVehicleRouteCostCalculator){
-// DefaultVehicleRouteCostCalculator defaultCalc = (DefaultVehicleRouteCostCalculator) route.getVehicleRouteCostCalculator();
-// System.out.println("[transport=" + defaultCalc.getTpCosts() + "][activity=" + defaultCalc.getActCosts() +
-// "][vehicle=" + defaultCalc.getVehicleCosts() + "][driver=" + defaultCalc.getDriverCosts() + "][other=" + defaultCalc.getOther() + "]");
-// }
-// routeCount++;
-// }
-// }
-//
-//
-// }
-
}
diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/VehicleRoutingAlgorithm.java b/jsprit-core/src/main/java/jsprit/core/algorithm/VehicleRoutingAlgorithm.java
index 213fe831..eec2300b 100644
--- a/jsprit-core/src/main/java/jsprit/core/algorithm/VehicleRoutingAlgorithm.java
+++ b/jsprit-core/src/main/java/jsprit/core/algorithm/VehicleRoutingAlgorithm.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.Collection;
import jsprit.core.algorithm.SearchStrategy.DiscoveredSolution;
-import jsprit.core.algorithm.acceptor.SolutionAcceptor;
import jsprit.core.algorithm.listener.AlgorithmEndsListener;
import jsprit.core.algorithm.listener.AlgorithmStartsListener;
import jsprit.core.algorithm.listener.IterationEndsListener;
@@ -29,7 +28,6 @@ import jsprit.core.algorithm.listener.SearchStrategyListener;
import jsprit.core.algorithm.listener.SearchStrategyModuleListener;
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener;
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners;
-import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
import jsprit.core.algorithm.termination.PrematureAlgorithmTermination;
import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
@@ -121,20 +119,10 @@ public class VehicleRoutingAlgorithm {
}
/**
- * Sets premature break.
- *
- *
This breaks the algorithm prematurely after the assigned number of iterations without improvement (see input parameter).
- * Improvement is what {@link SolutionAcceptor} understands about improvement. Or to put it in other words, the algo breaks prematurely after
- * the assigned number of iterations without solution-acceptance.
- *
- * @deprecated use setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(int nuIterationsWithoutImprovement));
- * @param nuIterationsWithoutImprovement
+ * Sets premature termination.
+ *
+ * @param prematureAlgorithmTermination
*/
- @Deprecated
- public void setPrematureBreak(int nuIterationsWithoutImprovement){
- prematureAlgorithmTermination = new IterationWithoutImprovementTermination(nuIterationsWithoutImprovement);
- }
-
public void setPrematureAlgorithmTermination(PrematureAlgorithmTermination prematureAlgorithmTermination){
this.prematureAlgorithmTermination = prematureAlgorithmTermination;
}
diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java b/jsprit-core/src/main/java/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java
index c3ae89be..21e4f4a4 100644
--- a/jsprit-core/src/main/java/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java
+++ b/jsprit-core/src/main/java/jsprit/core/algorithm/io/AlgorithmConfigXmlReader.java
@@ -40,8 +40,9 @@ public class AlgorithmConfigXmlReader {
/**
* @param schemaValidation the schemaValidation to set
*/
- public void setSchemaValidation(boolean schemaValidation) {
+ public AlgorithmConfigXmlReader setSchemaValidation(boolean schemaValidation) {
this.schemaValidation = schemaValidation;
+ return this;
}
public AlgorithmConfigXmlReader(AlgorithmConfig algorithmConfig){
diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java b/jsprit-core/src/main/java/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java
index af8793a6..59d2920e 100644
--- a/jsprit-core/src/main/java/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java
+++ b/jsprit-core/src/main/java/jsprit/core/algorithm/io/VehicleRoutingAlgorithms.java
@@ -397,11 +397,6 @@ public class VehicleRoutingAlgorithms {
return createAlgo(vrp,algorithmConfig.getXMLConfiguration(),0, null);
}
- @Deprecated
- public static VehicleRoutingAlgorithm readAndCreateAlgorithm(final VehicleRoutingProblem vrp, final XMLConfiguration config){
- return createAlgo(vrp,config,0, null);
- }
-
/**
* Read and creates a {@link VehicleRoutingAlgorithm} from an url.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/state/StateManager.java b/jsprit-core/src/main/java/jsprit/core/algorithm/state/StateManager.java
index fc23cf9d..a8a15e2f 100644
--- a/jsprit-core/src/main/java/jsprit/core/algorithm/state/StateManager.java
+++ b/jsprit-core/src/main/java/jsprit/core/algorithm/state/StateManager.java
@@ -44,7 +44,6 @@ import jsprit.core.problem.solution.route.activity.ReverseActivityVisitor;
import jsprit.core.problem.solution.route.activity.TourActivity;
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
import jsprit.core.problem.solution.route.state.StateFactory;
-import jsprit.core.problem.solution.route.state.StateFactory.State;
import jsprit.core.problem.solution.route.state.StateFactory.StateId;
/**
@@ -114,17 +113,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
private boolean updateTWs = false;
- /**
- * @deprecated use StateManager(VehicleRoutingTransportCosts tpcosts) instead.
- * @param vrp
- */
- @Deprecated
- public StateManager(VehicleRoutingProblem vrp) {
- super();
- this.routingCosts = vrp.getTransportCosts();
- addDefaultStates();
- }
-
private void addDefaultStates() {
defaultActivityStates_.put(StateFactory.LOAD, Capacity.Builder.newInstance().build());
defaultActivityStates_.put(StateFactory.COSTS, 0.);
@@ -171,16 +159,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
return null;
}
- /**
- * @deprecated use the generic methode addDefaultRouteState(StateId stateId, Class type, T defaultState) instead.
- * @param stateId
- * @param defaultState
- */
- @Deprecated
- public void addDefaultRouteState(StateId stateId, State defaultState){
- addDefaultRouteState(stateId, State.class, defaultState);
- }
-
/**
* Generic method to add a default route state.
*
@@ -197,16 +175,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
defaultRouteStates_.put(stateId, type.cast(defaultState));
}
- /**
- * @deprecated use generic method addDefaultActivityState(StateId stateId, Class type, T defaultState)
- * @param stateId
- * @param defaultState
- */
- @Deprecated
- public void addDefaultActivityState(StateId stateId, State defaultState){
- addDefaultActivityState(stateId, State.class, defaultState);
- }
-
/**
* Generic method to add default activity state.
*
@@ -229,23 +197,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
problemStates_.clear();
}
- /**
- * @Deprecated use generic method instead getActivityState(TourActivity act, StateId stateId, Class type)
- */
- @Deprecated
- @Override
- public State getActivityState(TourActivity act, StateId stateId) {
- if(!activityStates_.containsKey(act)){
- return getDefaultTypedActivityState(act,stateId,State.class);
- }
- States_ actStates = activityStates_.get(act);
- State state = actStates.getState(stateId, State.class);
- if(state == null){
- return getDefaultTypedActivityState(act,stateId,State.class);
- }
- return state;
- }
-
/**
* Returns activity state of type 'type'.
*
@@ -305,18 +256,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
return null;
}
- /**
- *
- * @param act
- * @param stateId
- * @param state
- * @deprecated use generic method putTypedActivityState(TourActivity act, StateId stateId, Class type, T state) instead
- */
- @Deprecated
- public void putActivityState(TourActivity act, StateId stateId, State state){
- putTypedActivityState(act, stateId, State.class, state);
- }
-
/**
* Generic method to memorize state 'state' of type 'type' of act and stateId.
*
@@ -336,11 +275,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
putInternalTypedActivityState(act, stateId, type, state);
}
- @Deprecated
- void putInternalActivityState(TourActivity act, StateId stateId, State state){
- putInternalTypedActivityState(act, stateId, State.class, state);
- }
-
void putInternalTypedActivityState(TourActivity act, StateId stateId, Class type, T state){
if(!activityStates_.containsKey(act)){
activityStates_.put(act, new States_());
@@ -349,11 +283,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
actStates.putState(stateId, type, state);
}
- @Deprecated
- void putInternalRouteState(VehicleRoute route, StateId stateId, State state){
- putTypedInternalRouteState(route, stateId, State.class, state);
- }
-
void putTypedInternalRouteState(VehicleRoute route, StateId stateId, Class type, T state){
if(!vehicleRouteStates_.containsKey(route)){
vehicleRouteStates_.put(route, new States_());
@@ -362,11 +291,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
routeStates.putState(stateId, type, state);
}
- @Deprecated
- public void putRouteState(VehicleRoute route, StateId stateId, State state){
- putTypedRouteState(route, stateId, State.class, state);
- }
-
/**
* Generic method to memorize state 'state' of type 'type' of route and stateId.
*
@@ -386,20 +310,6 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
putTypedInternalRouteState(route, stateId, type, state);
}
- @Deprecated
- @Override
- public State getRouteState(VehicleRoute route, StateId stateId) {
- if(!vehicleRouteStates_.containsKey(route)){
- return getDefaultTypedRouteState(stateId,State.class);
- }
- States_ routeStates = vehicleRouteStates_.get(route);
- State state = routeStates.getState(stateId,State.class);
- if(state == null){
- return getDefaultTypedRouteState(stateId, State.class);
- }
- return state;
- }
-
/**
* Adds state updater.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java
index 52295c39..404184ff 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java
@@ -42,7 +42,6 @@ import jsprit.core.problem.vehicle.VehicleTypeKey;
import jsprit.core.util.Coordinate;
import jsprit.core.util.CrowFlyCosts;
import jsprit.core.util.Locations;
-import jsprit.core.util.Neighborhood;
import org.apache.log4j.Logger;
@@ -64,20 +63,6 @@ import org.apache.log4j.Logger;
*/
public class VehicleRoutingProblem {
- /**
- * Overall problem constraints.
- *
- * DELIVERIES_FIRST corresponds to the vehicle routing problem with back hauls, i.e. before a vehicle is not entirely unloaded, no pickup can be made.
- *
- * @deprecated define and add constraint directly with .addConstraint(...) - since constraints are too diverse to put them in an enum
- * @author stefan
- *
- */
- @Deprecated
- public enum Constraint {
- DELIVERIES_FIRST
- }
-
/**
* Builder to build the routing-problem.
*
@@ -109,49 +94,27 @@ public class VehicleRoutingProblem {
};
- private Map jobs;
+ private Map jobs = new HashMap();
private Map tentativeJobs = new HashMap();
private Set jobsInInitialRoutes = new HashSet();
- private Collection services;
+ private Collection services = new ArrayList();
- private Map coordinates;
+ private Map coordinates = new HashMap();
private Map tentative_coordinates = new HashMap();
private FleetSize fleetSize = FleetSize.INFINITE;
-
- /**
- * @deprecated is not going to be used anymore
- */
- private FleetComposition fleetComposition = FleetComposition.HOMOGENEOUS;
- private Collection vehicleTypes;
+ private Collection vehicleTypes = new ArrayList();
private Collection initialRoutes = new ArrayList();
private Set uniqueVehicles = new HashSet();
- /**
- * @deprecated is not going to be used anymore
- */
- private Collection problemConstraints;
-
- private Collection constraints;
-
- /**
- * by default all locations are neighbors
- * @deprecated is not going to be used anymore
- */
- private Neighborhood neighborhood = new Neighborhood() {
-
- @Override
- public boolean areNeighbors(String location1, String location2) {
- return true;
- }
- };
+ private Collection constraints = new ArrayList();
private boolean addPenaltyVehicles = false;
@@ -159,20 +122,6 @@ public class VehicleRoutingProblem {
private Double penaltyFixedCosts = null;
- /**
- * @deprecated use static method .newInstance() instead
- */
- @Deprecated
- public Builder() {
- jobs = new HashMap();
- new ArrayList();
- coordinates = new HashMap();
- vehicleTypes = new ArrayList();
- services = new ArrayList();
- problemConstraints = new ArrayList();
- constraints = new ArrayList();
- }
-
/**
* Create a location (i.e. coordinate) and returns the key of the location which is Coordinate.toString().
*
@@ -517,43 +466,15 @@ public class VehicleRoutingProblem {
return Collections.unmodifiableCollection(tentativeJobs.values());
}
- /**
- * Gets an unmodifiable collection of already added services.
- *
- * @return collection of services
- * @deprecated use .getAddedJobs() instead
- */
- @Deprecated
- public Collection getAddedServices(){
- return Collections.unmodifiableCollection(services);
- }
-
- /**
- * Sets the fleetComposition.
- *
- * FleetComposition is either FleetComposition.HETEROGENEOUS or FleetComposition.HOMOGENEOUS
- *
- * @deprecated has no effect
- * @param fleetComposition
- * @return
- */
- @Deprecated
- public Builder setFleetComposition(FleetComposition fleetComposition){
- this.fleetComposition = fleetComposition;
- return this;
- }
-
/**
* Adds a service to jobList.
*
*
If jobList already contains service, a warning message is printed, and the existing job will be overwritten.
*
- * @deprecated use addJob(...) instead
* @param service
* @return
*/
- @Deprecated
- public Builder addService(Service service){
+ private Builder addService(Service service){
coordinates.put(service.getLocationId(), service.getCoord());
if(jobs.containsKey(service.getId())){ logger.warn("service " + service + " already in job list. overrides existing job."); }
jobs.put(service.getId(),service);
@@ -561,41 +482,7 @@ public class VehicleRoutingProblem {
return this;
}
- /**
- * Adds a vehicleType.
- *
- * @deprecated use add vehicle instead
- * @param type
- * @return builder
- */
- @Deprecated
- public Builder addVehicleType(VehicleType type){
- vehicleTypes.add(type);
- return this;
- }
-
- /**
- * Sets the neighborhood.
- *
- * @deprecated use HardRoute- or ActivityLevelConstraint instead
- * @param neighborhood
- * @return
- */
- @Deprecated
- public Builder setNeighborhood(Neighborhood neighborhood){
- this.neighborhood = neighborhood;
- return this;
- }
-
- /**
- *
- * @deprecated use .addConstraint(new ServiceDeliveriesFirstConstraint())
- * @param constraint
- */
- @Deprecated
- public void addProblemConstraint(Constraint constraint){
- if(!problemConstraints.contains(constraint)) problemConstraints.add(constraint);
- }
+
}
/**
@@ -664,33 +551,14 @@ public class VehicleRoutingProblem {
private final Locations locations;
- /**
- * @deprecated not used anymore
- */
- private Neighborhood neighborhood;
-
- /**
- * An enum that indicates fleetSizeComposition. By default, it is HOMOGENOUS.
- * @deprecated
- */
- private FleetComposition fleetComposition;
-
- /**
- * @deprecated
- */
- private Collection problemConstraints;
-
private VehicleRoutingProblem(Builder builder) {
this.jobs = builder.jobs;
- this.fleetComposition = builder.fleetComposition;
this.fleetSize = builder.fleetSize;
this.vehicles=builder.uniqueVehicles;
this.vehicleTypes = builder.vehicleTypes;
this.initialVehicleRoutes = builder.initialRoutes;
this.transportCosts = builder.transportCosts;
this.activityCosts = builder.activityCosts;
- this.neighborhood = builder.neighborhood;
- this.problemConstraints = builder.problemConstraints;
this.constraints = builder.constraints;
this.locations = builder.getLocations();
logger.info("initialise " + this);
@@ -776,37 +644,5 @@ public class VehicleRoutingProblem {
public Locations getLocations(){
return locations;
}
-
- /**
- * Returns fleet-composition.
- *
- * @return fleetComposition which is either FleetComposition.HETEROGENEOUS or FleetComposition.HOMOGENEOUS
- * @deprecated it is not used and thus has no effect
- */
- @Deprecated
- public FleetComposition getFleetComposition() {
- return fleetComposition;
- }
-
- /**
- * @deprecated see builder.setNeighborhood(...). addConstraint(...) instead.
- * @return the neighborhood
- */
- @Deprecated
- public Neighborhood getNeighborhood() {
- return neighborhood;
- }
-
- /**
- * Returns unmodifiable collection of problem-constraints.
- *
- * @deprecated use .getConstraints() and builder.add
- * @return
- */
- @Deprecated
- public Collection getProblemConstraints(){
- return Collections.unmodifiableCollection(problemConstraints);
- }
-
}
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/constraint/ConstraintManager.java b/jsprit-core/src/main/java/jsprit/core/problem/constraint/ConstraintManager.java
index e9d3b806..7669efe4 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/constraint/ConstraintManager.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/constraint/ConstraintManager.java
@@ -6,7 +6,6 @@ import java.util.Collections;
import java.util.List;
import jsprit.core.problem.VehicleRoutingProblem;
-import jsprit.core.problem.VehicleRoutingProblem.Constraint;
import jsprit.core.problem.misc.JobInsertionContext;
import jsprit.core.problem.solution.route.activity.TourActivity;
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
@@ -19,7 +18,6 @@ import org.apache.log4j.Logger;
* @author schroeder
*
*/
-@SuppressWarnings("deprecation")
public class ConstraintManager implements HardActivityStateLevelConstraint, HardRouteStateLevelConstraint, SoftActivityConstraint, SoftRouteConstraint{
public static enum Priority {
@@ -91,9 +89,6 @@ public class ConstraintManager implements HardActivityStateLevelConstraint, Hard
public void addLoadConstraint(){
if(!loadConstraintsSet){
- if(vrp.getProblemConstraints().contains(Constraint.DELIVERIES_FIRST)){
- addConstraint(new ServiceDeliveriesFirstConstraint(),Priority.HIGH);
- }
addConstraint(new PickupAndDeliverShipmentLoadActivityLevelConstraint(stateManager),Priority.CRITICAL);
addConstraint(new ServiceLoadRouteLevelConstraint(stateManager));
addConstraint(new ServiceLoadActivityLevelConstraint(stateManager),Priority.LOW);
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLReader.java b/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLReader.java
index ac1e7422..f07c1531 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLReader.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLReader.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Set;
import jsprit.core.problem.VehicleRoutingProblem;
-import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
import jsprit.core.problem.driver.Driver;
import jsprit.core.problem.driver.DriverImpl;
@@ -56,8 +55,6 @@ import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-
-@SuppressWarnings("deprecation")
public class VrpXMLReader{
public interface ServiceBuilderFactory {
@@ -69,15 +66,15 @@ public class VrpXMLReader{
@Override
public jsprit.core.problem.job.Service.Builder createBuilder(String serviceType, String id, Integer size) {
if(serviceType.equals("pickup")){
- if(size != null) return Pickup.Builder.newInstance(id, size);
+ if(size != null) return Pickup.Builder.newInstance(id).addSizeDimension(0, size);
else return Pickup.Builder.newInstance(id);
}
else if(serviceType.equals("delivery")){
- if(size != null) return Delivery.Builder.newInstance(id, size);
+ if(size != null) return Delivery.Builder.newInstance(id).addSizeDimension(0, size);
else return Delivery.Builder.newInstance(id);
}
else{
- if(size != null) return Service.Builder.newInstance(id, size);
+ if(size != null) return Service.Builder.newInstance(id).addSizeDimension(0, size);
else return Service.Builder.newInstance(id);
}
@@ -367,14 +364,6 @@ public class VrpXMLReader{
if(fleetSize == null) vrpBuilder.setFleetSize(FleetSize.INFINITE);
else if(fleetSize.toUpperCase().equals(FleetSize.INFINITE.toString())) vrpBuilder.setFleetSize(FleetSize.INFINITE);
else vrpBuilder.setFleetSize(FleetSize.FINITE);
-
- String fleetComposition = vrpProblem.getString("problemType.fleetComposition");
- if(fleetComposition == null) vrpBuilder.setFleetComposition(FleetComposition.HOMOGENEOUS);
- else if(fleetComposition.toUpperCase().equals(FleetComposition.HETEROGENEOUS.toString())){
- vrpBuilder.setFleetComposition(FleetComposition.HETEROGENEOUS);
- }
- else vrpBuilder.setFleetComposition(FleetComposition.HOMOGENEOUS);
-
}
private void readShipments(XMLConfiguration config){
@@ -394,7 +383,7 @@ public class VrpXMLReader{
Shipment.Builder builder;
if(capacityString != null){
- builder = Shipment.Builder.newInstance(id, Integer.parseInt(capacityString));
+ builder = Shipment.Builder.newInstance(id).addSizeDimension(0, Integer.parseInt(capacityString));
}
else {
builder = Shipment.Builder.newInstance(id);
@@ -563,7 +552,7 @@ public class VrpXMLReader{
VehicleTypeImpl.Builder typeBuilder;
if(capacityString != null){
- typeBuilder = VehicleTypeImpl.Builder.newInstance(typeId, Integer.parseInt(capacityString));
+ typeBuilder = VehicleTypeImpl.Builder.newInstance(typeId).addCapacityDimension(0, Integer.parseInt(capacityString));
}
else {
typeBuilder = VehicleTypeImpl.Builder.newInstance(typeId);
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLWriter.java b/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLWriter.java
index 711105f2..cfbd6c6d 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLWriter.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/io/VrpXMLWriter.java
@@ -268,10 +268,8 @@ public class VrpXMLWriter {
}
}
- @SuppressWarnings("deprecation")
private void writeProblemType(XMLConfiguration xmlConfig){
xmlConfig.setProperty("problemType.fleetSize", vrp.getFleetSize());
- xmlConfig.setProperty("problemType.fleetComposition", vrp.getFleetComposition());
}
private void writeVehiclesAndTheirTypes(XMLConfiguration xmlConfig) {
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/job/Delivery.java b/jsprit-core/src/main/java/jsprit/core/problem/job/Delivery.java
index a33e1af3..cf974113 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/job/Delivery.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/job/Delivery.java
@@ -27,23 +27,6 @@ public class Delivery extends Service{
public static class Builder extends Service.Builder {
- /**
- * Returns a new instance of Delivery.Builder
- *
- * @param id
- * @param size
- * @return builder
- * @throws IllegalArgumentException if size < 0 or id is null
- * @deprecated use .newInstance(String id) instead, and add a capacity dimension
- * with dimensionIndex='your index' and and dimsionValue=size to the returned builder
- */
- @Deprecated
- public static Builder newInstance(String id, int size){
- Builder builder = new Builder(id,size);
- builder.addSizeDimension(0, size);
- return builder;
- }
-
/**
* Returns a new instance of builder that builds a delivery.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/job/Job.java b/jsprit-core/src/main/java/jsprit/core/problem/job/Job.java
index a04674e4..0d27c0b5 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/job/Job.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/job/Job.java
@@ -33,17 +33,6 @@ public interface Job {
* @return id
*/
public String getId();
-
- /**
- * Returns capacity (demand) of job.
- *
- * It determines how much capacity this job consumes of vehicle/transport unit.
- *
- * @deprecated use .getCapacity() instead
- * @return
- */
- @Deprecated
- public int getCapacityDemand();
/**
* Returns size, i.e. capacity-demand, of this job which can consist of an arbitrary number of capacity dimensions.
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/job/Pickup.java b/jsprit-core/src/main/java/jsprit/core/problem/job/Pickup.java
index 02d79653..261148b5 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/job/Pickup.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/job/Pickup.java
@@ -27,23 +27,6 @@ public class Pickup extends Service {
public static class Builder extends Service.Builder {
- /**
- * Returns a new instance of Pickup.Builder
- *
- * @param id
- * @param size
- * @return builder
- * @throws IllegalArgumentException if size < 0 or id is null
- * @deprecated use .newInstance(String id) instead, and add a capacity dimension
- * with dimensionIndex='your index' and and dimsionValue=size to the returned builder
- */
- @Deprecated
- public static Builder newInstance(String id, int size){
- Builder builder = new Builder(id,size);
- builder.addSizeDimension(0, size);
- return builder;
- }
-
/**
* Returns a new instance of builder that builds a pickup.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/job/Service.java b/jsprit-core/src/main/java/jsprit/core/problem/job/Service.java
index 45d38ad5..b8a21f8b 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/job/Service.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/job/Service.java
@@ -41,25 +41,6 @@ public class Service implements Job {
*/
public static class Builder {
- /**
- * Returns a new instance of service-builder.
- *
- *
Note that if you use this builder, size is assigned to capacity-dimension with index=0.
- *
- * @param id of service
- * @param size of capacity-demand
- * @return builder
- * @throws IllegalArgumentException if size < 0 or id is null
- * @deprecated use .newInstance(String id) instead, and add a capacity dimension
- * with dimensionIndex='your index' and and dimsionValue=size to the returned builder
- */
- @Deprecated
- public static Builder newInstance(String id, int size){
- Builder builder = new Builder(id,size);
- builder.addSizeDimension(0, size);
- return builder;
- }
-
/**
* Returns a new instance of builder that builds a service.
*
@@ -267,17 +248,6 @@ public class Service implements Job {
return timeWindow;
}
- /**
- * @Deprecated use .getCapacity() instead. if you still use this method, it returns the
- * capacity dimension with index=0.
- *
- */
- @Override
- @Deprecated
- public int getCapacityDemand() {
- return size.get(0);
- }
-
/**
* @return the name
*/
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/job/Shipment.java b/jsprit-core/src/main/java/jsprit/core/problem/job/Shipment.java
index 949c4518..24617550 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/job/Shipment.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/job/Shipment.java
@@ -54,24 +54,11 @@ public class Shipment implements Job{
private Capacity capacity;
/**
- * Returns a new instance of this builder.
- *
- *
Note that if you use this builder, size is assigned to capacity-dimension with index=0.
+ * Returns new instance of this builder.
*
* @param id
- * @param size
- * @return builder
- * @throws IllegalArgumentException if size < 0 or id is null
- * @deprecated use .newInstance(String id) instead, and add a capacity dimension
- * with dimensionIndex='your index' and and dimsionValue=size to the returned builder
+ * @return
*/
- @Deprecated
- public static Builder newInstance(String id, int size){
- Builder builder = new Builder(id,size);
- builder.addSizeDimension(0, size);
- return builder;
- }
-
public static Builder newInstance(String id){
return new Builder(id);
}
@@ -90,6 +77,7 @@ public class Shipment implements Job{
}
Builder(String id){
+ if(id == null) throw new IllegalArgumentException("id must not be null");
this.id = id;
}
@@ -289,16 +277,6 @@ public class Shipment implements Job{
return id;
}
- /**
- * @Deprecated use .getCapacity() instead. if you still use this method, it returns the
- * capacity dimension with index=0.
- */
- @Deprecated
- @Override
- public int getCapacityDemand() {
- return capacity.get(0);
- }
-
/**
* Returns the pickup-location.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/VehicleRoute.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/VehicleRoute.java
index 07214236..2f583ead 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/VehicleRoute.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/VehicleRoute.java
@@ -58,20 +58,6 @@ public class VehicleRoute {
return new VehicleRoute(route);
}
- /**
- * Returns a newInstance of {@link VehicleRoute}.
- *
- * @param tour
- * @param driver
- * @param vehicle
- * @return VehicleRoute
- * @deprecated use VehicleRoute.Builder instead
- */
- @Deprecated
- public static VehicleRoute newInstance(TourActivities tour, Driver driver, Vehicle vehicle) {
- return new VehicleRoute(tour,driver,vehicle);
- }
-
/**
* Returns an empty route.
*
@@ -356,16 +342,6 @@ public class VehicleRoute {
this.driver = route.getDriver();
}
- @Deprecated
- private VehicleRoute(TourActivities tour, Driver driver, Vehicle vehicle) {
- super();
- verify(tour, driver, vehicle);
- this.tourActivities = tour;
- this.vehicle = vehicle;
- this.driver = driver;
- setStartAndEnd(vehicle, vehicle.getEarliestDeparture());
- }
-
/**
* Constructs route.
*
@@ -379,22 +355,6 @@ public class VehicleRoute {
this.end = builder.end;
}
- /**
- *
- * @param tour
- * @param driver
- * @param vehicle
- * @deprecated verification is a task of VehicleRoute.Builder
- */
- @Deprecated
- private void verify(TourActivities tour, Driver driver, Vehicle vehicle) {
- if(tour == null || driver == null || vehicle == null) throw new IllegalStateException("null is not allowed for tour, driver or vehicle. use emptyRoute. use Tour.emptyTour, DriverImpl.noDriver() and VehicleImpl.noVehicle() instead." +
- "\n\tor make it easier and use VehicleRoute.emptyRoute()");
- if(!tour.isEmpty() && vehicle instanceof NoVehicle){
- throw new IllegalStateException("if tour is not empty. there must be a vehicle for this tour, but there is no vehicle.");
- }
- }
-
/**
* Returns an unmodifiable list of activities on this route (without start/end).
*
@@ -450,29 +410,6 @@ public class VehicleRoute {
this.vehicle = vehicle;
setStartAndEnd(vehicle, vehicleDepTime);
}
-
- /**
- * Sets the vehicle and its departureTime from vehicle.getStartLocationId().
- *
- *
This implies the following:
- * if start and end are null, new start and end activities are created.
- *
startActivity is initialized with the start-location of the specified vehicle (vehicle.getStartLocationId()). the time-window of this activity is initialized
- * such that [startActivity.getTheoreticalEarliestOperationStartTime() = vehicle.getEarliestDeparture()][startActivity.getTheoreticalLatestOperationStartTime() = vehicle.getLatestArrival()]
- *
endActivity is initialized with the end-location of the specified vehicle (vehicle.getEndLocationId()). The time-window of the
- * endActivity is initialized such that [endActivity.getTheoreticalEarliestOperationStartTime() = vehicle.getEarliestDeparture()][endActivity.getTheoreticalLatestOperationStartTime() = vehicle.getLatestArrival()]
- *
startActivity.endTime (startActivity.getEndTime()) is set to max{vehicle.getEarliestDeparture(), vehicleDepTime}.
- * thus, vehicle.getEarliestDeparture() is a physical constraint that has to be met.
- *
- * @param vehicle
- * @param vehicleDepTime
- * @deprecated use .setVehicleAndDepartureTime(Vehicle vehicle, double vehicleDepTime) instead
- */
- @Deprecated
- public void setVehicle(Vehicle vehicle, double vehicleDepTime){
- this.vehicle = vehicle;
- setStartAndEnd(vehicle, vehicleDepTime);
- }
-
private void setStartAndEnd(Vehicle vehicle, double vehicleDepTime) {
if(!(vehicle instanceof NoVehicle)){
if(start == null && end == null){
@@ -490,19 +427,6 @@ public class VehicleRoute {
}
- /**
- * Sets departureTime of this route, i.e. the time the vehicle departs from its start-location.
- *
- * @param vehicleDepTime
- * @deprecated use .setVehicleAndDepartureTime(...) instead (vehicle requires departureTime and the other way around, and earliestDepartureTime
- * of a vehicle is a physical constraint of the vehicle and cannot be broken. Using this method might break this constraint.)
- */
- @Deprecated
- public void setDepartureTime(double vehicleDepTime){
- if(start == null) throw new IllegalStateException("cannot set departureTime without having a vehicle on this route. use setVehicle(vehicle,departureTime) instead.");
- start.setEndTime(vehicleDepTime);
- }
-
/**
* Returns the departureTime of this vehicle in this route.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverService.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverService.java
index 95ca75a0..5f1e5b29 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverService.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverService.java
@@ -26,15 +26,6 @@ public final class DeliverService implements DeliveryActivity{
capacity = deliveryActivity.getSize();
}
- /**
- * @deprecated use getCapacity() instead
- */
- @Deprecated
- @Override
- public int getCapacityDemand() {
- return delivery.getCapacityDemand()*-1;
- }
-
@Override
public String getName() {
return delivery.getType();
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverShipment.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverShipment.java
index 22376f41..1c15a382 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverShipment.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/DeliverShipment.java
@@ -32,15 +32,6 @@ public final class DeliverShipment implements DeliveryActivity{
return shipment;
}
- /**
- * @deprecated use getCapacity() instead
- */
- @Deprecated
- @Override
- public int getCapacityDemand() {
- return shipment.getCapacityDemand()*-1;
- }
-
@Override
public String getName() {
return "deliverShipment";
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/End.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/End.java
index 8280e00d..a50b2454 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/End.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/End.java
@@ -133,11 +133,6 @@ public final class End implements TourActivity {
}
- @Override
- public int getCapacityDemand() {
- return 0;
- }
-
@Override
public TourActivity duplicate() {
return new End(this);
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupService.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupService.java
index 7ae5fbb9..fc7e1d2a 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupService.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupService.java
@@ -82,16 +82,6 @@ public final class PickupService implements PickupActivity{
return pickup;
}
- /**
- * @deprecated use getCapacity() instead
- *
- */
- @Override
- @Deprecated
- public int getCapacityDemand() {
- return pickup.getCapacityDemand();
- }
-
public String toString() {
return "[type="+getName()+"][locationId=" + getLocationId()
+ "][size=" + getSize().toString()
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupShipment.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupShipment.java
index 277985a9..f26dd6f6 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupShipment.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/PickupShipment.java
@@ -28,15 +28,6 @@ public final class PickupShipment implements PickupActivity{
return shipment;
}
- /**
- * @deprecated use getCapacity() instead
- */
- @Deprecated
- @Override
- public int getCapacityDemand() {
- return shipment.getCapacityDemand();
- }
-
@Override
public String getName() {
return "pickupShipment";
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/ServiceActivity.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/ServiceActivity.java
index 21742800..f9fa9097 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/ServiceActivity.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/ServiceActivity.java
@@ -119,15 +119,6 @@ public class ServiceActivity implements JobActivity{
return service.getTimeWindow().getEnd();
}
- /**
- * @deprecated use getCapacity() instead
- */
- @Override
- @Deprecated
- public int getCapacityDemand() {
- return service.getCapacityDemand();
- }
-
@Override
public double getOperationTime() {
return service.getServiceDuration();
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/Start.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/Start.java
index ef8fdefa..1d36210f 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/Start.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/Start.java
@@ -17,7 +17,6 @@
package jsprit.core.problem.solution.route.activity;
import jsprit.core.problem.Capacity;
-import jsprit.core.util.Coordinate;
public final class Start implements TourActivity {
@@ -38,8 +37,6 @@ public final class Start implements TourActivity {
private String locationId;
- private Coordinate coordinate;
-
private double theoretical_earliestOperationStartTime;
private double theoretical_latestOperationStartTime;
@@ -64,16 +61,6 @@ public final class Start implements TourActivity {
endTime = start.getEndTime();
}
- @Deprecated
- Coordinate getCoordinate() {
- return coordinate;
- }
-
- @Deprecated
- void setCoordinate(Coordinate coordinate) {
- this.coordinate = coordinate;
- }
-
public double getTheoreticalEarliestOperationStartTime() {
return theoretical_earliestOperationStartTime;
}
@@ -136,11 +123,6 @@ public final class Start implements TourActivity {
this.endTime = endTime;
}
- @Override
- public int getCapacityDemand() {
- return 0;
- }
-
@Override
public TourActivity duplicate() {
return new Start(this);
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/TourActivity.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/TourActivity.java
index e05e4b9e..f11ce305 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/TourActivity.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/activity/TourActivity.java
@@ -48,16 +48,6 @@ public interface TourActivity {
}
- /**
- * Returns the capacity-demand of that activity, in terms of what needs to be loaded or unloaded at
- * this activity.
- *
- * @return int
- * @deprecated use getCapacity() instead
- */
- @Deprecated
- public int getCapacityDemand();
-
/**
* Returns the name of this activity.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/state/RouteAndActivityStateGetter.java b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/state/RouteAndActivityStateGetter.java
index 8487eadf..45ffa8e9 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/solution/route/state/RouteAndActivityStateGetter.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/solution/route/state/RouteAndActivityStateGetter.java
@@ -18,17 +18,10 @@ package jsprit.core.problem.solution.route.state;
import jsprit.core.problem.solution.route.VehicleRoute;
import jsprit.core.problem.solution.route.activity.TourActivity;
-import jsprit.core.problem.solution.route.state.StateFactory.State;
import jsprit.core.problem.solution.route.state.StateFactory.StateId;
public interface RouteAndActivityStateGetter {
- @Deprecated
- public State getActivityState(TourActivity act, StateId stateId);
-
- @Deprecated
- public State getRouteState(VehicleRoute route, StateId stateId);
-
public T getActivityState(TourActivity act, StateId stateId, Class type);
public T getRouteState(VehicleRoute route, StateId stateId, Class type);
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/InfiniteVehicles.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/InfiniteVehicles.java
index a0b38bf7..685a4820 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/InfiniteVehicles.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/InfiniteVehicles.java
@@ -79,22 +79,6 @@ class InfiniteVehicles implements VehicleFleetManager{
return types.values();
}
- /**
- * @deprecated use getAvailableVehicles(Vehicle withoutThisType) instead
- */
- @Override
- @Deprecated
- public Collection getAvailableVehicles(String withoutThisType, String locationId) {
- Collection vehicles = new ArrayList();
- VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType, locationId,locationId, 0., 0.);
- for(VehicleTypeKey key : types.keySet()){
- if(!key.equals(thisKey)){
- vehicles.add(types.get(key));
- }
- }
- return vehicles;
- }
-
@Override
public Collection getAvailableVehicles(Vehicle withoutThisType) {
Collection vehicles = new ArrayList();
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/PenaltyVehicleType.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/PenaltyVehicleType.java
index e177c1c2..a3ed9359 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/PenaltyVehicleType.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/PenaltyVehicleType.java
@@ -45,15 +45,6 @@ public class PenaltyVehicleType implements VehicleType{
return type.getTypeId();
}
- /**
- * @deprecated use getCapacityDimensions() instead
- */
- @Deprecated
- @Override
- public int getCapacity() {
- return type.getCapacity();
- }
-
@Override
public VehicleCostParams getVehicleCostParams() {
return type.getVehicleCostParams();
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/Vehicle.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/Vehicle.java
index 0f44343f..bb6b55a7 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/Vehicle.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/Vehicle.java
@@ -41,28 +41,6 @@ public interface Vehicle {
*/
public abstract double getLatestArrival();
- /**
- * Returns the location-id of the this vehicle which should be the start-location of this vehicle.
- *
- * Consequently, it should be the end-location of this vehicle, if returnToDepot is true.
- *
- * @return location-id of this vehicle
- * @deprecated use getStartLocationId() instead
- */
- @Deprecated
- public abstract String getLocationId();
-
- /**
- * Returns the coordinate of this vehicle which should be the coordinate of the start-location of this vehicle.
- *
- *
Consequently, it should be the coordinate of the end-location, if returnToDepot is true.
- *
- * @return coordinate of this vehicle
- * @deprecated use getStartLocationCoordinate() instead
- */
- @Deprecated
- public abstract Coordinate getCoord();
-
/**
* Returns the {@link VehicleType} of this vehicle.
*
@@ -77,17 +55,6 @@ public interface Vehicle {
*/
public abstract String getId();
- /**
- * Returns the capacity of this vehicle.
- *
- * @return capacity
- * @deprecated use .getType().getCapacityDimensions() - if you still use this method,
- * but set capacity-dimensions via VehicleTypeImpl.Builder.newInstance(...).addCapacityDimension(...) then this method returns the
- * dimension with index=0.
- */
- @Deprecated
- public abstract int getCapacity();
-
/**
* Returns true if vehicle returns to depot, false otherwise.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManager.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManager.java
index ab709082..e468ca86 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManager.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManager.java
@@ -62,16 +62,6 @@ public interface VehicleFleetManager {
* @return
*/
public abstract Collection getAvailableVehicles();
-
- /**
- *
- * @param withoutThisType
- * @param locationId
- * @return
- * @deprecated use .getAvailableVehicles(Vehicle without) instead. this might ignore withoutType and returns all available vehicles
- */
- @Deprecated
- public Collection getAvailableVehicles(String withoutThisType, String locationId);
public Collection getAvailableVehicles(Vehicle withoutThisType);
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java
index ec29d991..4ff9471a 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleFleetManagerImpl.java
@@ -173,38 +173,6 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
return vehicles;
}
- /**
- * Returns a collection of available vehicles without vehicles with typeId 'withoutThisType' and locationId 'withThisLocation'.
- *
- * If there is no vehicle with a certain type and location anymore, it looks up whether a penalty vehicle has been specified with
- * this type and location. If so, it returns this penalty vehicle. If not, no vehicle with this type and location is returned.
- *
- * @param typeId to specify the typeId that should not be the returned collection
- * @param locationId to specify the locationId that should not be in the returned collection
- * @return collection of available vehicles without the vehicles that have the typeId 'withoutThisType' AND the locationId 'withThisLocation'.
- * @deprecated use .getAvailableVehicles(Vehicle without) instead - this might ignore withoutThisType and returns all available vehicles
- */
- @Override
- @Deprecated
- public Collection getAvailableVehicles(String withoutThisType, String withThisLocationId) {
- List vehicles = new ArrayList();
- VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType, withThisLocationId, withThisLocationId, 0., 0.);
- for(VehicleTypeKey key : typeMapOfAvailableVehicles.keySet()){
- if(key.equals(thisKey)) continue;
- if(!typeMapOfAvailableVehicles.get(key).isEmpty()){
- vehicles.add(typeMapOfAvailableVehicles.get(key).getVehicle());
- }
- else{
- if(penaltyVehicles.containsKey(key)){
- vehicles.add(penaltyVehicles.get(key));
- }
- }
- }
- return vehicles;
- }
-
-
-
@Override
public Collection getAvailableVehicles(Vehicle withoutThisType) {
List vehicles = new ArrayList();
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleImpl.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleImpl.java
index d73c6e48..f7c6f9c8 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleImpl.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleImpl.java
@@ -30,16 +30,6 @@ import org.apache.log4j.Logger;
public class VehicleImpl implements Vehicle {
- /**
- * @deprecated use createNoVehicle() instead.
- *
- * @return
- */
- @Deprecated
- public static NoVehicle noVehicle(){
- return createNoVehicle();
- }
-
/**
* Extension of {@link VehicleImpl} representing an unspecified vehicle with the id 'noVehicle'
* (to avoid null).
@@ -48,14 +38,9 @@ public class VehicleImpl implements Vehicle {
*
*/
public static class NoVehicle extends VehicleImpl {
-
- @SuppressWarnings("deprecation")
- public NoVehicle() {
- super(Builder.newInstance("noVehicle").setType(VehicleTypeImpl.newInstance(null, 0, null)));
- }
- public int getCapacity(){
- return 0;
+ public NoVehicle() {
+ super(Builder.newInstance("noVehicle").setType(VehicleTypeImpl.Builder.newInstance("noType").build()));
}
}
@@ -129,38 +114,6 @@ public class VehicleImpl implements Vehicle {
return this;
}
- /**
- * Sets location-id of the vehicle which should be its start-location.
- *
- * If returnToDepot is true, it is also its end-location.
- *
- * @param id
- * @return this builder
- * @deprecated use setStartLocationId(..) instead
- */
- @Deprecated
- public Builder setLocationId(String id){
- this.locationId = id;
- this.startLocationId = id;
- return this;
- }
-
- /**
- * Sets coordinate of the vehicle which should be the coordinate of start-location.
- *
- *
If returnToDepot is true, it is also the coordinate of the end-location.
- *
- * @param coord
- * @return this builder
- * @deprecated use setStartLocationCoordinate(...) instead
- */
- @Deprecated
- public Builder setLocationCoord(Coordinate coord){
- this.locationCoord = coord;
- this.startLocationCoord = coord;
- return this;
- }
-
/**
* Sets the start-location of this vehicle.
*
@@ -334,14 +287,6 @@ public class VehicleImpl implements Vehicle {
return "[id="+id+"][type="+type+"][locationId="+locationId+"][coord=" + coord + "][isReturnToDepot=" + isReturnToDepot() + "]";
}
- /**
- * @deprecated use getStartLocationCoordinate() instead
- */
- @Deprecated
- public Coordinate getCoord() {
- return coord;
- }
-
@Override
public double getEarliestDeparture() {
return earliestDeparture;
@@ -352,15 +297,6 @@ public class VehicleImpl implements Vehicle {
return latestArrival;
}
- /**
- * @deprecated use getStartLocationId() instead
- */
- @Deprecated
- @Override
- public String getLocationId() {
- return locationId;
- }
-
@Override
public VehicleType getType() {
return type;
@@ -371,12 +307,6 @@ public class VehicleImpl implements Vehicle {
return id;
}
- @Override
- @Deprecated
- public int getCapacity() {
- return type.getCapacity();
- }
-
public boolean isReturnToDepot() {
return returnToDepot;
}
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java
index 7580513b..8e1f9c40 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleType.java
@@ -34,19 +34,6 @@ public interface VehicleType {
*/
public String getTypeId();
- /**
- * Returns capacity.
- *
- *
In future versions there will be a capacity-object with an arbitrary number of capacity dimensions. (stefan,11.01.14)
- *
- *
- * @deprecated use .getCapacityDimensions() - if you still use it, but set CapacityDimensions rather
- * than setCapacity(...) it will return the capacity.dimension with index=0
- * @return cap
- */
- @Deprecated
- public int getCapacity();
-
/**
* Returns capacity dimensions.
*
diff --git a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java
index a2503a89..b2d3bcb1 100644
--- a/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java
+++ b/jsprit-core/src/main/java/jsprit/core/problem/vehicle/VehicleTypeImpl.java
@@ -66,31 +66,10 @@ public class VehicleTypeImpl implements VehicleType {
*/
public static class Builder{
- /**
- * Returns a new instance.
- *
- *
Input parameters are id and capacity. Note that two vehicle-types are equal
- * if they have the same vehicleId.
- *
- * @param id
- * @param capacity
- * @return the vehicleType builder
- * @throws IllegalStateException if capacity is smaller than zero or id is null
- * @deprecated use newInstance(String id) instead
- */
- @Deprecated
- public static VehicleTypeImpl.Builder newInstance(String id, int capacity){
- if(capacity < 0) throw new IllegalStateException("capacity cannot be smaller than zero");
- if(id == null) throw new IllegalStateException("typeId must be null");
- Builder builder = new Builder(id,capacity);
- builder.addCapacityDimension(0, capacity);
- return builder;
- }
-
public static VehicleTypeImpl.Builder newInstance(String id) {
+ if(id==null) throw new IllegalStateException();
return new Builder(id);
}
-
private String id;
private int capacity = 0;
@@ -108,20 +87,7 @@ public class VehicleTypeImpl implements VehicleType {
private boolean dimensionAdded = false;
- /**
- * Constructs the builder.
- *
- * @param id
- * @param capacity
- */
- @Deprecated
- private Builder(String id, int capacity) {
- super();
- this.id = id;
- this.capacity = capacity;
- }
-
- public Builder(String id) {
+ private Builder(String id) {
this.id = id;
}
@@ -271,15 +237,6 @@ public class VehicleTypeImpl implements VehicleType {
private final Capacity capacityDimensions;
private final double maxVelocity;
-
-
- /**
- * @deprecated use builder instead
- */
- @Deprecated
- public static VehicleTypeImpl newInstance(String typeId, int capacity, VehicleTypeImpl.VehicleCostParams para){
- return new VehicleTypeImpl(typeId, capacity, para);
- }
/**
* priv constructor constructing vehicle-type
@@ -294,23 +251,6 @@ public class VehicleTypeImpl implements VehicleType {
capacityDimensions = builder.capacityDimensions;
}
- /**
- * @deprecated use Builder.newInstance(...) instead.
- *
- * @param typeId
- * @param capacity
- * @param vehicleCostParams
- */
- @Deprecated
- public VehicleTypeImpl(String typeId, int capacity,VehicleTypeImpl.VehicleCostParams vehicleCostParams) {
- super();
- this.typeId = typeId;
- this.capacity = capacity;
- this.vehicleCostParams = vehicleCostParams;
- this.capacityDimensions = Capacity.Builder.newInstance().addDimension(0, capacity).build();
- this.maxVelocity = Double.MAX_VALUE;
- }
-
/* (non-Javadoc)
* @see basics.route.VehicleType#getTypeId()
*/
@@ -319,15 +259,6 @@ public class VehicleTypeImpl implements VehicleType {
return typeId;
}
- /* (non-Javadoc)
- * @see basics.route.VehicleType#getCapacity()
- */
- @Override
- @Deprecated
- public int getCapacity() {
- return capacityDimensions.get(0);
- }
-
/* (non-Javadoc)
* @see basics.route.VehicleType#getVehicleCostParams()
*/
diff --git a/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java b/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java
index ef7eabe3..d0e1dd45 100644
--- a/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java
+++ b/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java
@@ -140,39 +140,4 @@ public class SolutionPrinter {
return new Jobs(nServices,nShipments);
}
-// /**
-// * Prints the details of the solution according to a print-level, i.e. Print.CONCISE or PRINT.VERBOSE.
-// *
-// *
CONCISE prints total-costs and #vehicles.
-// *
VERBOSE prints the route-details additionally. If the DefaultVehicleRouteCostCalculator (which is the standard-calculator)
-// * is used in VehicleRoute, then route-costs are differentiated further between transport, activity, vehicle, driver and other-costs.
-// *
-// * @param solution
-// * @param level
-// *
-// * @deprecated is not going to work anymore
-// */
-// @Deprecated
-// public static void print(VehicleRoutingProblemSolution solution, Print level){
-// if(level.equals(Print.CONCISE)){
-// print(solution);
-// }
-// else{
-// print(solution);
-// System.out.println("routes");
-// int routeCount = 1;
-// for(VehicleRoute route : solution.getRoutes()){
-// System.out.println("[route="+routeCount+"][departureTime="+route.getStart().getEndTime()+"[total=" + route.getCost() + "]");
-// if(route.getVehicleRouteCostCalculator() instanceof DefaultVehicleRouteCostCalculator){
-// DefaultVehicleRouteCostCalculator defaultCalc = (DefaultVehicleRouteCostCalculator) route.getVehicleRouteCostCalculator();
-// System.out.println("[transport=" + defaultCalc.getTpCosts() + "][activity=" + defaultCalc.getActCosts() +
-// "][vehicle=" + defaultCalc.getVehicleCosts() + "][driver=" + defaultCalc.getDriverCosts() + "][other=" + defaultCalc.getOther() + "]");
-// }
-// routeCount++;
-// }
-// }
-//
-//
-// }
-
}
diff --git a/jsprit-core/src/main/java/jsprit/core/util/Solutions.java b/jsprit-core/src/main/java/jsprit/core/util/Solutions.java
index 5243af98..a29d4539 100644
--- a/jsprit-core/src/main/java/jsprit/core/util/Solutions.java
+++ b/jsprit-core/src/main/java/jsprit/core/util/Solutions.java
@@ -23,23 +23,6 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
public class Solutions {
- /**
- *
- * @deprecated use bestOf instead.
- * @param solutions
- * @return
- */
- @Deprecated
- public static VehicleRoutingProblemSolution getBest(Collection solutions){
- VehicleRoutingProblemSolution best = null;
- for(VehicleRoutingProblemSolution s : solutions){
- if(best == null) best = s;
- else if(s.getCost() < best.getCost()) best = s;
- }
- return best;
- }
-
-
public static VehicleRoutingProblemSolution bestOf(Collection solutions){
VehicleRoutingProblemSolution best = null;
for(VehicleRoutingProblemSolution s : solutions){
diff --git a/jsprit-core/src/main/resources/vrp_xml_schema.xsd b/jsprit-core/src/main/resources/vrp_xml_schema.xsd
index a4e126db..ce1f187f 100644
--- a/jsprit-core/src/main/resources/vrp_xml_schema.xsd
+++ b/jsprit-core/src/main/resources/vrp_xml_schema.xsd
@@ -17,7 +17,7 @@
-
+
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/io/TestAlgorithmReader.java b/jsprit-core/src/test/java/jsprit/core/algorithm/io/TestAlgorithmReader.java
index 93f8796e..b282e69b 100644
--- a/jsprit-core/src/test/java/jsprit/core/algorithm/io/TestAlgorithmReader.java
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/io/TestAlgorithmReader.java
@@ -27,7 +27,6 @@ import jsprit.core.algorithm.SearchStrategyModule;
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
import jsprit.core.algorithm.acceptor.SolutionAcceptor;
-import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms.ModKey;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.AcceptorKey;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms.TypedMap.RuinStrategyKey;
@@ -45,14 +44,13 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.core.problem.solution.route.VehicleRoute;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
import org.junit.Before;
import org.junit.Test;
public class TestAlgorithmReader {
- XMLConfiguration config;
+ AlgorithmConfig config;
VehicleRoutingProblem vrp;
@@ -60,7 +58,8 @@ public class TestAlgorithmReader {
@Before
public void doBefore() throws ConfigurationException{
- config = new XMLConfiguration("src/test/resources/testConfig.xml");
+ config = new AlgorithmConfig();
+ new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read("src/test/resources/testConfig.xml");
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
solutions = new ArrayList();
new VrpXMLReader(vrpBuilder,solutions).read("src/test/resources/finiteVrp.xml");
@@ -216,33 +215,27 @@ public class TestAlgorithmReader {
}
-
-
- @SuppressWarnings("deprecation")
@Test
public void initialiseConstructionAlgoCorrectly(){
- VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
+ VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
assertTrue(true);
}
@Test
public void whenCreatingAlgorithm_nOfStrategiesIsCorrect(){
- @SuppressWarnings("deprecation")
- VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
+ VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
}
@Test
public void whenCreatingAlgorithm_nOfIterationsIsReadCorrectly(){
- @SuppressWarnings("deprecation")
- VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
+ VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
assertEquals(10, algo.getNuOfIterations());
}
@Test
public void whenCreatingAlgorithm_nOfStrategyModulesIsCorrect(){
- @SuppressWarnings("deprecation")
- VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
+ VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.createAlgorithm(vrp, config);
int nOfModules = 0;
for(SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()){
nOfModules += strat.getSearchStrategyModules().size();
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java b/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java
index 79ce1316..c3791629 100644
--- a/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java
@@ -14,28 +14,6 @@ import org.junit.Test;
public class StateManagerTest {
- @SuppressWarnings("deprecation")
- @Test
- public void whenInternalRouteStateIsSet_itMustBeSetCorrectly(){
- VehicleRoute route = mock(VehicleRoute.class);
- StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
- StateId id = StateFactory.createId("myState");
- State state = StateFactory.createState(1.);
- stateManager.putInternalRouteState(route, id, state);
- assertEquals(1.,stateManager.getRouteState(route, id).toDouble(),0.01);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void whenRouteStateIsSet_itMustBeSetCorrectly(){
- VehicleRoute route = mock(VehicleRoute.class);
- StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
- StateId id = StateFactory.createId("myState");
- State state = StateFactory.createState(1.);
- stateManager.putRouteState(route, id, state);
- assertEquals(1.,stateManager.getRouteState(route, id).toDouble(),0.01);
- }
-
@Test
public void whenRouteStateIsSetWithGenericMethod_itMustBeSetCorrectly(){
VehicleRoute route = mock(VehicleRoute.class);
@@ -78,30 +56,6 @@ public class StateManagerTest {
assertEquals(500, getCap.get(0));
}
-
-
- @SuppressWarnings("deprecation")
- @Test
- public void whenInternalActivityStateIsSet_itMustBeSetCorrectly(){
- TourActivity activity = mock(TourActivity.class);
- StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
- StateId id = StateFactory.createId("myState");
- State state = StateFactory.createState(1.);
- stateManager.putInternalActivityState(activity, id, state);
- assertEquals(1.,stateManager.getActivityState(activity, id).toDouble(),0.01);
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void whenActivityStateIsSet_itMustBeSetCorrectly(){
- TourActivity activity = mock(TourActivity.class);
- StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
- StateId id = StateFactory.createId("myState");
- State state = StateFactory.createState(1.);
- stateManager.putActivityState(activity, id, state);
- assertEquals(1.,stateManager.getActivityState(activity, id).toDouble(),0.01);
- }
-
@Test
public void whenActivityStateIsSetWithGenericMethod_itMustBeSetCorrectly(){
TourActivity activity = mock(TourActivity.class);
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLReaderTest.java b/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLReaderTest.java
index d7a7010d..0a01b6c8 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLReaderTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLReaderTest.java
@@ -63,14 +63,12 @@ public class VrpXMLReaderTest {
assertTrue(idsInCollection(Arrays.asList("v1","v2"),vrp.getVehicles()));
}
- @SuppressWarnings("deprecation")
@Test
public void whenReadingVrp_vehiclesAreReadCorrectly2(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1",vrp.getVehicles());
- assertEquals(20,v1.getCapacity());
assertEquals(20,v1.getType().getCapacityDimensions().get(0));
assertEquals(100.0,v1.getStartLocationCoordinate().getX(),0.01);
assertEquals(0.0,v1.getEarliestDeparture(),0.01);
@@ -141,14 +139,12 @@ public class VrpXMLReaderTest {
assertEquals(2,shipCounter);
}
- @SuppressWarnings("deprecation")
@Test
public void whenReadingServices_capOfService1IsReadCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Service s1 = (Service) vrp.getJobs().get("1");
- assertEquals(1,s1.getCapacityDemand());
assertEquals(1,s1.getSize().get(0));
}
@@ -303,14 +299,12 @@ public class VrpXMLReaderTest {
assertEquals("startLoc",v.getStartLocationId());
}
- @SuppressWarnings("deprecation")
@Test
public void whenReadingJobs_capOfShipment3IsReadCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName);
VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3");
- assertEquals(10,s.getCapacityDemand());
assertEquals(10,s.getSize().get(0));
}
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLWriterTest.java b/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLWriterTest.java
index 4423ba89..cbd2f5c2 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLWriterTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/io/VrpXMLWriterTest.java
@@ -35,7 +35,6 @@ import jsprit.core.util.Coordinate;
import org.junit.Before;
import org.junit.Test;
-@SuppressWarnings("deprecation")
public class VrpXMLWriterTest {
private String infileName;
@@ -50,7 +49,7 @@ public class VrpXMLWriterTest {
public void whenWritingInfiniteVrp_itWritesCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
builder.setFleetSize(FleetSize.INFINITE);
- VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
+ VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setStartLocationId("loc").setType(type).build();
builder.addVehicle(vehicle);
VehicleRoutingProblem vrp = builder.build();
@@ -61,8 +60,8 @@ public class VrpXMLWriterTest {
public void whenWritingFiniteVrp_itWritesCorrectly(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
builder.setFleetSize(FleetSize.FINITE);
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
@@ -75,8 +74,8 @@ public class VrpXMLWriterTest {
public void t(){
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
builder.setFleetSize(FleetSize.FINITE);
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
@@ -92,8 +91,8 @@ public class VrpXMLWriterTest {
public void whenWritingServices_itWritesThemCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
@@ -101,8 +100,8 @@ public class VrpXMLWriterTest {
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -127,7 +126,7 @@ public class VrpXMLWriterTest {
.addSizeDimension(0, 20)
.addSizeDimension(1, 200)
.setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -149,17 +148,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenLocationIdsOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
+ Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@@ -180,17 +179,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenPickupTimeWindowsOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
+ Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@@ -212,17 +211,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenDeliveryTimeWindowsOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
+ Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@@ -243,17 +242,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenDeliveryServiceTimeOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
+ Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupLocation("pickLoc").setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@@ -274,17 +273,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenLocationIdOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
+ Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@@ -303,17 +302,17 @@ public class VrpXMLWriterTest {
public void whenWritingShipments_readingThemAgainMustReturnTheWrittenLocationCoordOfS1(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Shipment s1 = Shipment.Builder.newInstance("1", 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
+ Shipment s1 = Shipment.Builder.newInstance("1").addSizeDimension(0, 10).setPickupCoord(Coordinate.newInstance(1, 2)).setDeliveryCoord(Coordinate.newInstance(5, 6)).setDeliveryLocation("delLoc").setPickupTimeWindow(TimeWindow.newInstance(1, 2))
.setDeliveryTimeWindow(TimeWindow.newInstance(3, 4)).setPickupServiceTime(100).setDeliveryServiceTime(50).build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
@@ -343,7 +342,7 @@ public class VrpXMLWriterTest {
.addSizeDimension(2, 100)
.build();
- Shipment s2 = Shipment.Builder.newInstance("2", 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
+ Shipment s2 = Shipment.Builder.newInstance("2").addSizeDimension(0, 20).setPickupLocation("pickLocation").setDeliveryLocation("delLocation").setPickupTimeWindow(TimeWindow.newInstance(5, 6))
.setDeliveryTimeWindow(TimeWindow.newInstance(7, 8)).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
@@ -366,16 +365,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV1_itsStartLocationMustBeWrittenCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -394,16 +393,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV1_itDoesNotReturnToDepotMustBeWrittenCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -420,16 +419,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV1_readingAgainAssignsCorrectType(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -446,16 +445,16 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV2_readingAgainAssignsCorrectType(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("loc").setType(type2).build();
builder.addVehicle(v1);
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -466,7 +465,7 @@ public class VrpXMLWriterTest {
Vehicle v = getVehicle("v2",readVrp.getVehicles());
assertEquals("vehType2",v.getType().getTypeId());
- assertEquals(200,v.getType().getCapacity());
+ assertEquals(200,v.getType().getCapacityDimensions().get(0));
}
@@ -474,8 +473,8 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV2_readingItsLocationsAgainReturnsCorrectLocations(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setStartLocationCoordinate(Coordinate.newInstance(1, 2))
.setEndLocationId("endLoc").setEndLocationCoordinate(Coordinate.newInstance(4, 5)).setType(type2).build();
@@ -483,8 +482,8 @@ public class VrpXMLWriterTest {
builder.addVehicle(v1);
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -502,8 +501,8 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleV2_readingItsLocationsCoordsAgainReturnsCorrectLocationsCoords(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType", 20).build();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
+ VehicleTypeImpl type1 = VehicleTypeImpl.Builder.newInstance("vehType").addCapacityDimension(0, 20).build();
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2").addCapacityDimension(0, 200).build();
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setReturnToDepot(false).setStartLocationId("loc").setType(type1).build();
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setStartLocationId("startLoc").setStartLocationCoordinate(Coordinate.newInstance(1, 2))
.setEndLocationId("endLoc").setEndLocationCoordinate(Coordinate.newInstance(4, 5)).setType(type2).build();
@@ -511,8 +510,8 @@ public class VrpXMLWriterTest {
builder.addVehicle(v1);
builder.addVehicle(v2);
- Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
- Service s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
+ Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("loc").setServiceTime(2.0).build();
+ Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("loc2").setServiceTime(4.0).build();
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
new VrpXMLWriter(vrp, null).write(infileName);
@@ -533,7 +532,7 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleWithSeveralCapacityDimensions_itShouldBeWrittenAndRereadCorrectly(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type", 200)
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type")
.addCapacityDimension(0, 100)
.addCapacityDimension(1, 1000)
.addCapacityDimension(2, 10000)
@@ -561,7 +560,7 @@ public class VrpXMLWriterTest {
public void whenWritingVehicleWithSeveralCapacityDimensions_itShouldBeWrittenAndRereadCorrectlyV2(){
Builder builder = VehicleRoutingProblem.Builder.newInstance();
- VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type", 200)
+ VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("type")
.addCapacityDimension(0, 100)
.addCapacityDimension(1, 1000)
.addCapacityDimension(10, 10000)
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/job/DeliveryTest.java b/jsprit-core/src/test/java/jsprit/core/problem/job/DeliveryTest.java
index 78db1634..2b714a5a 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/job/DeliveryTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/job/DeliveryTest.java
@@ -6,10 +6,9 @@ import org.junit.Test;
public class DeliveryTest {
- @SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
public void whenNeitherLocationIdNorCoordIsSet_itThrowsException(){
- Delivery.Builder.newInstance("p", 0).build();
+ Delivery.Builder.newInstance("p").build();
}
@Test
@@ -32,12 +31,10 @@ public class DeliveryTest {
assertEquals(0,one.getSize().get(0));
}
- @SuppressWarnings("deprecation")
@Test
public void whenPickupIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
- Delivery one = (Delivery)Delivery.Builder.newInstance("s",1).setLocationId("foofoo")
+ Delivery one = (Delivery)Delivery.Builder.newInstance("s").addSizeDimension(0, 1).setLocationId("foofoo")
.build();
- assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/job/PickupTest.java b/jsprit-core/src/test/java/jsprit/core/problem/job/PickupTest.java
index 838c3f8b..7d7cee9f 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/job/PickupTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/job/PickupTest.java
@@ -6,10 +6,9 @@ import org.junit.Test;
public class PickupTest {
- @SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
public void whenNeitherLocationIdNorCoordIsSet_itThrowsException(){
- Pickup.Builder.newInstance("p", 0).build();
+ Pickup.Builder.newInstance("p").build();
}
@Test
@@ -32,12 +31,10 @@ public class PickupTest {
assertEquals(0,one.getSize().get(0));
}
- @SuppressWarnings("deprecation")
@Test
public void whenPickupIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
- Pickup one = (Pickup)Pickup.Builder.newInstance("s",1).setLocationId("foofoo")
+ Pickup one = (Pickup)Pickup.Builder.newInstance("s").addSizeDimension(0, 1).setLocationId("foofoo")
.build();
- assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/job/ServiceTest.java b/jsprit-core/src/test/java/jsprit/core/problem/job/ServiceTest.java
index fad22ad0..a556c7cc 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/job/ServiceTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/job/ServiceTest.java
@@ -30,21 +30,20 @@ import jsprit.core.util.Coordinate;
import org.junit.Test;
-@SuppressWarnings("deprecation")
public class ServiceTest {
@Test
public void whenTwoServicesHaveTheSameId_theirReferencesShouldBeUnEqual(){
- Service one = Service.Builder.newInstance("service", 10).setLocationId("foo").build();
- Service two = Service.Builder.newInstance("service", 10).setLocationId("fo").build();
+ Service one = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("foo").build();
+ Service two = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("fo").build();
assertTrue(one != two);
}
@Test
public void whenTwoServicesHaveTheSameId_theyShouldBeEqual(){
- Service one = Service.Builder.newInstance("service", 10).setLocationId("foo").build();
- Service two = Service.Builder.newInstance("service", 10).setLocationId("fo").build();
+ Service one = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("foo").build();
+ Service two = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("fo").build();
assertTrue(one.equals(two));
}
@@ -52,8 +51,8 @@ public class ServiceTest {
@Test
public void noName(){
Set serviceSet = new HashSet();
- Service one = Service.Builder.newInstance("service", 10).setLocationId("foo").build();
- Service two = Service.Builder.newInstance("service", 10).setLocationId("fo").build();
+ Service one = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("foo").build();
+ Service two = Service.Builder.newInstance("service").addSizeDimension(0, 10).setLocationId("fo").build();
serviceSet.add(one);
// assertTrue(serviceSet.contains(two));
serviceSet.remove(two);
@@ -85,35 +84,34 @@ public class ServiceTest {
@Test
public void whenShipmentIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
- Service one = Service.Builder.newInstance("s",1).setLocationId("foofoo")
+ Service one = Service.Builder.newInstance("s").addSizeDimension(0, 1).setLocationId("foofoo")
.build();
- assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}
@Test
public void whenCallingForNewInstanceOfBuilder_itShouldReturnBuilderCorrectly(){
- Service.Builder builder = Service.Builder.newInstance("s", 0);
+ Service.Builder builder = Service.Builder.newInstance("s");
assertNotNull(builder);
assertTrue(builder instanceof Service.Builder);
}
@Test
public void whenSettingNoType_itShouldReturn_service(){
- Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").build();
+ Service s = Service.Builder.newInstance("s").setLocationId("loc").build();
assertEquals("service",s.getType());
}
@Test
public void whenSettingLocation_itShouldBeSetCorrectly(){
- Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").build();
+ Service s = Service.Builder.newInstance("s").setLocationId("loc").build();
assertEquals("loc",s.getLocationId());
}
@Test
public void whenSettingLocationCoord_itShouldBeSetCorrectly(){
- Service s = Service.Builder.newInstance("s", 0).setCoord(Coordinate.newInstance(1, 2)).build();
+ Service s = Service.Builder.newInstance("s").setCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,s.getCoord().getX(),0.01);
assertEquals(2.0,s.getCoord().getY(),0.01);
}
@@ -121,30 +119,30 @@ public class ServiceTest {
@Test(expected=IllegalStateException.class)
public void whenSettingNeitherLocationIdNorCoord_throwsException(){
@SuppressWarnings("unused")
- Service s = Service.Builder.newInstance("s", 0).build();
+ Service s = Service.Builder.newInstance("s").build();
}
@Test(expected=IllegalArgumentException.class)
public void whenServiceTimeSmallerZero_throwIllegalStateException(){
@SuppressWarnings("unused")
- Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setServiceTime(-1).build();
+ Service s = Service.Builder.newInstance("s").setLocationId("loc").setServiceTime(-1).build();
}
@Test
public void whenSettingServiceTime_itShouldBeSetCorrectly(){
- Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setServiceTime(1).build();
+ Service s = Service.Builder.newInstance("s").setLocationId("loc").setServiceTime(1).build();
assertEquals(1.0,s.getServiceDuration(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenTimeWindowIsNull_throwException(){
@SuppressWarnings("unused")
- Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setTimeWindow(null).build();
+ Service s = Service.Builder.newInstance("s").setLocationId("loc").setTimeWindow(null).build();
}
@Test
public void whenSettingTimeWindow_itShouldBeSetCorrectly(){
- Service s = Service.Builder.newInstance("s", 0).setLocationId("loc").setTimeWindow(TimeWindow.newInstance(1.0, 2.0)).build();
+ Service s = Service.Builder.newInstance("s").setLocationId("loc").setTimeWindow(TimeWindow.newInstance(1.0, 2.0)).build();
assertEquals(1.0,s.getTimeWindow().getStart(),0.01);
assertEquals(2.0,s.getTimeWindow().getEnd(),0.01);
}
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/job/ShipmentTest.java b/jsprit-core/src/test/java/jsprit/core/problem/job/ShipmentTest.java
index 2b249d75..a314775e 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/job/ShipmentTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/job/ShipmentTest.java
@@ -8,14 +8,13 @@ import jsprit.core.util.Coordinate;
import org.junit.Test;
-@SuppressWarnings("deprecation")
public class ShipmentTest {
@Test
public void whenTwoShipmentsHaveTheSameId_theyReferencesShouldBeUnEqual(){
- Shipment one = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
+ Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
- Shipment two = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
+ Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
assertTrue(one != two);
@@ -23,9 +22,9 @@ public class ShipmentTest {
@Test
public void whenTwoShipmentsHaveTheSameId_theyShouldBeEqual(){
- Shipment one = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
+ Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
- Shipment two = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
+ Shipment two = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
assertTrue(one.equals(two));
@@ -33,15 +32,15 @@ public class ShipmentTest {
@Test
public void whenShipmentIsInstantiatedWithASizeOf10_theSizeShouldBe10(){
- Shipment one = Shipment.Builder.newInstance("s", 10).setPickupLocation("foo").
+ Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 10).setPickupLocation("foo").
setDeliveryLocation("foofoo").setPickupServiceTime(10).setDeliveryServiceTime(20).build();
- assertEquals(10,one.getCapacityDemand());
+ assertEquals(10,one.getSize().get(0));
}
@Test(expected=IllegalArgumentException.class)
public void whenShipmentIsBuiltWithNegativeDemand_itShouldThrowException(){
@SuppressWarnings("unused")
- Shipment one = Shipment.Builder.newInstance("s", -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
+ Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, -10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
}
@Test(expected=IllegalArgumentException.class)
@@ -53,42 +52,42 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenIdIsNull_itShouldThrowException(){
@SuppressWarnings("unused")
- Shipment one = Shipment.Builder.newInstance(null, 10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
+ Shipment one = Shipment.Builder.newInstance(null).addSizeDimension(0, 10).setPickupLocation("foo").setDeliveryLocation("foofoo").build();
}
@Test
public void whenCallingForANewBuilderInstance_itShouldReturnBuilderCorrectly(){
- Shipment.Builder builder = Shipment.Builder.newInstance("s", 0);
+ Shipment.Builder builder = Shipment.Builder.newInstance("s");
assertNotNull(builder);
}
@Test(expected=IllegalStateException.class)
public void whenNeitherPickupLocationIdNorPickupCoord_itThrowsException(){
@SuppressWarnings("unused")
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").build();
}
@Test(expected=IllegalStateException.class)
public void whenNeitherDeliveryLocationIdNorDeliveryCoord_itThrowsException(){
@SuppressWarnings("unused")
- Shipment s = Shipment.Builder.newInstance("s", 0).setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setPickupLocation("pickLoc").build();
}
@Test
public void whenPickupLocationIdIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals("pickLoc",s.getPickupLocation());
}
@Test(expected=IllegalArgumentException.class)
public void whenPickupLocationIsNull_itThrowsException(){
@SuppressWarnings("unused")
- Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setPickupLocation(null);
+ Shipment.Builder builder = Shipment.Builder.newInstance("s").setPickupLocation(null);
}
@Test
public void whenPickupCoordIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setPickupCoord(Coordinate.newInstance(1, 2)).build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setPickupCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,s.getPickupCoord().getX(),0.01);
assertEquals(2.0,s.getPickupCoord().getY(),0.01);
}
@@ -96,24 +95,24 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenPickupCoordIsNull_itThrowsException(){
@SuppressWarnings("unused")
- Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setPickupCoord(null);
+ Shipment.Builder builder = Shipment.Builder.newInstance("s").setPickupCoord(null);
}
@Test
public void whenDeliveryLocationIdIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals("delLoc",s.getDeliveryLocation());
}
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryLocationIsNull_itThrowsException(){
@SuppressWarnings("unused")
- Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setDeliveryLocation(null);
+ Shipment.Builder builder = Shipment.Builder.newInstance("s").setDeliveryLocation(null);
}
@Test
public void whenDeliveryCoordIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setDeliveryCoord(Coordinate.newInstance(1, 2)).build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").setDeliveryCoord(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0,s.getDeliveryCoord().getX(),0.01);
assertEquals(2.0,s.getDeliveryCoord().getY(),0.01);
}
@@ -121,48 +120,48 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryCoordIsNull_itThrowsException(){
@SuppressWarnings("unused")
- Shipment.Builder builder = Shipment.Builder.newInstance("s", 0).setDeliveryCoord(null);
+ Shipment.Builder builder = Shipment.Builder.newInstance("s").setDeliveryCoord(null);
}
@Test
public void whenPickupServiceTimeIsNotSet_itShouldBeZero(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getPickupServiceTime(),0.01);
}
@Test
public void whenDeliveryServiceTimeIsNotSet_itShouldBeZero(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getDeliveryServiceTime(),0.01);
}
@Test
public void whenPickupServiceTimeIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setPickupServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(2.0,s.getPickupServiceTime(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenPickupServiceIsSmallerThanZero_itShouldThrowException(){
@SuppressWarnings("unused")
- Shipment s = Shipment.Builder.newInstance("s", 0).setPickupServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setPickupServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenDeliveryServiceTimeIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(2.0,s.getDeliveryServiceTime(),0.01);
}
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryServiceIsSmallerThanZero_itShouldThrowException(){
@SuppressWarnings("unused")
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryServiceTime(-2.0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenPickupTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getPickupTimeWindow().getStart(),0.01);
assertEquals(Double.MAX_VALUE,s.getPickupTimeWindow().getEnd(),0.01);
}
@@ -170,19 +169,19 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenPickupTimeWindowIsNull_itShouldThrowException(){
@SuppressWarnings("unused")
- Shipment s = Shipment.Builder.newInstance("s", 0).setPickupTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenPickupTimeWindowIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setPickupTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setPickupTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(1.0,s.getPickupTimeWindow().getStart(),0.01);
assertEquals(2.0,s.getPickupTimeWindow().getEnd(),0.01);
}
@Test
public void whenDeliveryTimeWindowIsNotSet_itShouldBeTheDefaultOne(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(0.0,s.getDeliveryTimeWindow().getStart(),0.01);
assertEquals(Double.MAX_VALUE,s.getDeliveryTimeWindow().getEnd(),0.01);
}
@@ -190,12 +189,12 @@ public class ShipmentTest {
@Test(expected=IllegalArgumentException.class)
public void whenDeliveryTimeWindowIsNull_itShouldThrowException(){
@SuppressWarnings("unused")
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(null).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
}
@Test
public void whenDeliveryTimeWindowIsSet_itShouldBeDoneCorrectly(){
- Shipment s = Shipment.Builder.newInstance("s", 0).setDeliveryTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
+ Shipment s = Shipment.Builder.newInstance("s").setDeliveryTimeWindow(TimeWindow.newInstance(1, 2)).setDeliveryLocation("delLoc").setPickupLocation("pickLoc").build();
assertEquals(1.0,s.getDeliveryTimeWindow().getStart(),0.01);
assertEquals(2.0,s.getDeliveryTimeWindow().getEnd(),0.01);
}
@@ -227,9 +226,8 @@ public class ShipmentTest {
@Test
public void whenShipmentIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
- Shipment one = Shipment.Builder.newInstance("s",1).setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
+ Shipment one = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocation("foo").setPickupCoord(Coordinate.newInstance(0, 0))
.setDeliveryLocation("foofoo").build();
- assertEquals(1,one.getCapacityDemand());
assertEquals(1,one.getSize().getNuOfDimensions());
assertEquals(1,one.getSize().get(0));
}
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverServiceTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverServiceTest.java
index d7f9f681..2c450b92 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverServiceTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverServiceTest.java
@@ -27,12 +27,6 @@ public class DeliverServiceTest {
assertEquals(-100,deliver.getSize().get(1));
assertEquals(-1000,deliver.getSize().get(2));
}
-
- @SuppressWarnings("deprecation")
- @Test
- public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
- assertEquals(-10,deliver.getCapacityDemand());
- }
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverShipmentTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverShipmentTest.java
index 431638f7..acab1a82 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverShipmentTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/DeliverShipmentTest.java
@@ -30,12 +30,6 @@ public class DeliverShipmentTest {
assertEquals(-1000,deliver.getSize().get(2));
}
- @SuppressWarnings("deprecation")
- @Test
- public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
- assertEquals(-10,deliver.getCapacityDemand());
- }
-
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
assertEquals(3.,deliver.getTheoreticalEarliestOperationStartTime(),0.01);
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/EndTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/EndTest.java
index 3d22fae2..bb6aba00 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/EndTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/EndTest.java
@@ -13,12 +13,6 @@ public class EndTest {
assertEquals(0,end.getSize().get(0));
}
- @Test
- public void whenCallingCapacityDemand_itShouldReturnEmptyCapacity(){
- End end = End.newInstance("loc", 0., 0.);
- assertEquals(0,end.getCapacityDemand());
- }
-
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
End end = End.newInstance("loc", 1., 2.);
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupServiceTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupServiceTest.java
index 1e3f733c..8a3ff5e7 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupServiceTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupServiceTest.java
@@ -28,11 +28,6 @@ public class PickupServiceTest {
assertEquals(1000,pickup.getSize().get(2));
}
- @SuppressWarnings("deprecation")
- @Test
- public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
- assertEquals(10,pickup.getCapacityDemand());
- }
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupShipmentTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupShipmentTest.java
index ad12bb7a..f233862f 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupShipmentTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/PickupShipmentTest.java
@@ -30,12 +30,6 @@ public class PickupShipmentTest {
assertEquals(1000,pickup.getSize().get(2));
}
- @SuppressWarnings("deprecation")
- @Test
- public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
- assertEquals(10,pickup.getCapacityDemand());
- }
-
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
assertEquals(1.,pickup.getTheoreticalEarliestOperationStartTime(),0.01);
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/ServiceActivityTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/ServiceActivityTest.java
index c9eac6f3..84e7c6c2 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/ServiceActivityTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/ServiceActivityTest.java
@@ -48,12 +48,6 @@ public class ServiceActivityTest {
}
- @SuppressWarnings("deprecation")
- @Test
- public void whenCallingCapacityDemand_itShouldReturnCapDimWithIndex0(){
- assertEquals(10,serviceActivity.getCapacityDemand());
- }
-
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
assertEquals(1.,serviceActivity.getTheoreticalEarliestOperationStartTime(),0.01);
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/StartTest.java b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/StartTest.java
index 3f4bbc66..3f2a0c47 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/StartTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/solution/route/activity/StartTest.java
@@ -11,12 +11,6 @@ public class StartTest {
Start start = Start.newInstance("loc", 0., 0.);
assertEquals(0,start.getSize().get(0));
}
-
- @Test
- public void whenCallingCapacityDemand_itShouldReturnEmptyCapacity(){
- Start start = Start.newInstance("loc", 0., 0.);
- assertEquals(0,start.getCapacityDemand());
- }
@Test
public void whenStartIsIniWithEarliestStart_itShouldBeSetCorrectly(){
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleImplTest.java b/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleImplTest.java
index ef48238f..7c81529d 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleImplTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleImplTest.java
@@ -1,35 +1,18 @@
package jsprit.core.problem.vehicle;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import jsprit.core.problem.vehicle.VehicleImpl.NoVehicle;
import jsprit.core.util.Coordinate;
import org.junit.Test;
-@SuppressWarnings("deprecation") // still tests whether deprecated methods work correctly - if deprecated methods are removed entirely, shift to setStartLocationId(..) and setStartLocationCoordinate()
+
public class VehicleImplTest {
- @Test
- public void whenSettingTypeWithBuilder_typeShouldBeSet(){
- VehicleType type = mock(VehicleType.class);
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(type).build();
- assertEquals(type,v.getType());
- }
- @Test(expected=IllegalStateException.class)
- public void whenTypeIsNull_itThrowsIllegalStateException(){
- @SuppressWarnings("unused")
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").setType(null).build();
- }
-
- @Test
- public void whenTypeIsNotSet_defaultTypeIsSet(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").build();
- assertEquals("default",v.getType().getTypeId());
- assertEquals(0,v.getType().getCapacity());
- }
@Test(expected=IllegalStateException.class)
public void whenVehicleIsBuiltWithoutSettingNeitherLocationNorCoord_itThrowsAnIllegalStateException(){
@@ -37,58 +20,52 @@ public class VehicleImplTest {
Vehicle v = VehicleImpl.Builder.newInstance("v").build();
}
- @Test
- public void whenVehicleIsBuiltAndReturnToDepotFlagIsNotSet_itShouldReturnToDepot(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").build();
- assertTrue(v.isReturnToDepot());
- }
-
@Test
public void whenVehicleIsBuiltToReturnToDepot_itShouldReturnToDepot(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(true).setLocationId("loc").build();
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(true).setStartLocationId("loc").build();
assertTrue(v.isReturnToDepot());
}
@Test
public void whenVehicleIsBuiltToNotReturnToDepot_itShouldNotReturnToDepot(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(false).setLocationId("loc").build();
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setReturnToDepot(false).setStartLocationId("loc").build();
assertFalse(v.isReturnToDepot());
}
@Test
public void whenVehicleIsBuiltWithLocation_itShouldHvTheCorrectLocation(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationId("loc").build();
- assertEquals("loc",v.getLocationId());
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
+ assertEquals("loc",v.getStartLocationId());
}
@Test
public void whenVehicleIsBuiltWithCoord_itShouldHvTheCorrectCoord(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationCoord(Coordinate.newInstance(1, 2)).build();
- assertEquals(1.0,v.getCoord().getX(),0.01);
- assertEquals(2.0,v.getCoord().getY(),0.01);
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
+ assertEquals(1.0,v.getStartLocationCoordinate().getX(),0.01);
+ assertEquals(2.0,v.getStartLocationCoordinate().getY(),0.01);
}
@Test
public void whenVehicleIsBuiltAndEarliestStartIsNotSet_itShouldSetTheDefaultOfZero(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationCoord(Coordinate.newInstance(1, 2)).build();
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(0.0,v.getEarliestDeparture(),0.01);
}
@Test
public void whenVehicleIsBuiltAndEarliestStartSet_itShouldBeSetCorrectly(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setEarliestStart(10.0).setLocationCoord(Coordinate.newInstance(1, 2)).build();
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setEarliestStart(10.0).setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(10.0,v.getEarliestDeparture(),0.01);
}
@Test
public void whenVehicleIsBuiltAndLatestArrivalIsNotSet_itShouldSetDefaultOfDoubleMaxValue(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLocationCoord(Coordinate.newInstance(1, 2)).build();
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(Double.MAX_VALUE,v.getLatestArrival(),0.01);
}
@Test
public void whenVehicleIsBuiltAndLatestArrivalIsSet_itShouldBeSetCorrectly(){
- Vehicle v = VehicleImpl.Builder.newInstance("v").setLatestArrival(30.0).setLocationCoord(Coordinate.newInstance(1, 2)).build();
+ Vehicle v = VehicleImpl.Builder.newInstance("v").setLatestArrival(30.0).setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(30.0,v.getLatestArrival(),0.01);
}
@@ -102,7 +79,6 @@ public class VehicleImplTest {
@Test
public void whenStartLocationIsSet_itIsDoneCorrectly(){
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationId("startLoc").build();
- assertEquals("startLoc", v.getLocationId());
assertEquals("startLoc", v.getStartLocationId());
}
@@ -117,9 +93,6 @@ public class VehicleImplTest {
Vehicle v = VehicleImpl.Builder.newInstance("v").setStartLocationCoordinate(Coordinate.newInstance(1, 2)).build();
assertEquals(1.0, v.getStartLocationCoordinate().getX(),0.01);
assertEquals(2.0, v.getStartLocationCoordinate().getY(),0.01);
-
- assertEquals(1.0, v.getCoord().getX(),0.01);
- assertEquals(2.0, v.getCoord().getY(),0.01);
}
@Test
diff --git a/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleTypeImplTest.java b/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleTypeImplTest.java
index d83b5fa0..7eef6669 100644
--- a/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleTypeImplTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/problem/vehicle/VehicleTypeImplTest.java
@@ -5,7 +5,6 @@ import static org.junit.Assert.*;
import org.junit.Test;
public class VehicleTypeImplTest {
-
@Test(expected=IllegalArgumentException.class)
public void whenTypeHasNegativeCapacityVal_throwIllegalStateExpception(){
@@ -44,47 +43,34 @@ public class VehicleTypeImplTest {
assertEquals(0,type.getCapacityDimensions().get(0));
}
- @SuppressWarnings("deprecation")
- @Test
- public void whenTypeIsBuiltWithConstructorWhereSizeIsSpecified_capacityShouldBeSetCorrectly(){
- VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("t",20).build();
- assertEquals(20,type.getCapacity());
- assertEquals(20,type.getCapacityDimensions().get(0));
- }
-
- @SuppressWarnings("deprecation")
@Test
public void whenCallingStaticNewBuilderInstance_itShouldReturnNewBuilderInstance(){
- VehicleTypeImpl.Builder builder = VehicleTypeImpl.Builder.newInstance("foo", 0);
+ VehicleTypeImpl.Builder builder = VehicleTypeImpl.Builder.newInstance("foo");
assertNotNull(builder);
}
- @SuppressWarnings("deprecation")
@Test
public void whenBuildingTypeJustByCallingNewInstance_typeIdMustBeCorrect(){
- VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo", 0).build();
+ VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").build();
assertEquals("foo",type.getTypeId());
}
- @SuppressWarnings("deprecation")
@Test
public void whenBuildingTypeJustByCallingNewInstance_capMustBeCorrect(){
- VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo", 0).build();
- assertEquals(0,type.getCapacity());
+ VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").build();
+ assertEquals(0,type.getCapacityDimensions().get(0));
}
- @SuppressWarnings("deprecation")
- @Test(expected=IllegalStateException.class)
+ @Test(expected=IllegalArgumentException.class)
public void whenBuildingTypeWithCapSmallerThanZero_throwIllegalStateException(){
@SuppressWarnings("unused")
- VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo", -10).build();
+ VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("foo").addCapacityDimension(0, -10).build();
}
- @SuppressWarnings("deprecation")
@Test(expected=IllegalStateException.class)
public void whenBuildingTypeWithNullId_throwIllegalStateException(){
@SuppressWarnings("unused")
- VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance(null, 10).build();
+ VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance(null).addCapacityDimension(0, 10).build();
}
diff --git a/jsprit-core/src/test/resources/finiteVrpForReaderTest.xml b/jsprit-core/src/test/resources/finiteVrpForReaderTest.xml
index 3e8fe7af..ddb11896 100644
--- a/jsprit-core/src/test/resources/finiteVrpForReaderTest.xml
+++ b/jsprit-core/src/test/resources/finiteVrpForReaderTest.xml
@@ -194,7 +194,9 @@
- 10
+
+ 10
+
diff --git a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml b/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml
index bd0ff7bd..e5ffcfb8 100644
--- a/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml
+++ b/jsprit-core/src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml
@@ -3,7 +3,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
FINITE
- HETEROGENEOUS
@@ -41,7 +40,7 @@
false
- v4
+ v3
vehType2
startLoc
@@ -58,7 +57,7 @@
true
- v3
+ v4
vehType2
startLoc
diff --git a/jsprit-core/src/test/resources/infiniteWriterV2Test.xml b/jsprit-core/src/test/resources/infiniteWriterV2Test.xml
index 3f20b784..d5236fe7 100644
--- a/jsprit-core/src/test/resources/infiniteWriterV2Test.xml
+++ b/jsprit-core/src/test/resources/infiniteWriterV2Test.xml
@@ -3,7 +3,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
INFINITE
- HOMOGENEOUS