mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
inspect and remove warnings
This commit is contained in:
parent
7ec9786c2b
commit
5ff6d40d63
63 changed files with 86 additions and 283 deletions
|
|
@ -100,8 +100,6 @@ public class GraphStreamViewer {
|
||||||
|
|
||||||
private long renderDelay_in_ms = 0;
|
private long renderDelay_in_ms = 0;
|
||||||
|
|
||||||
private boolean enableAutoLayout = false;
|
|
||||||
|
|
||||||
private boolean renderShipments = false;
|
private boolean renderShipments = false;
|
||||||
|
|
||||||
private Center center;
|
private Center center;
|
||||||
|
|
@ -136,7 +134,6 @@ public class GraphStreamViewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GraphStreamViewer setEnableAutoLayout(boolean enableAutoLayout) {
|
public GraphStreamViewer setEnableAutoLayout(boolean enableAutoLayout) {
|
||||||
this.enableAutoLayout = enableAutoLayout;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,9 +174,6 @@ public class GraphStreamViewer {
|
||||||
|
|
||||||
//result-panel
|
//result-panel
|
||||||
JPanel resultPanel = createResultPanel();
|
JPanel resultPanel = createResultPanel();
|
||||||
//legend-panel
|
|
||||||
final JPanel legendPanel = createLegendPanel();
|
|
||||||
|
|
||||||
//graphstream-panel
|
//graphstream-panel
|
||||||
Graph g = new MultiGraph("g");
|
Graph g = new MultiGraph("g");
|
||||||
g.addAttribute("ui.quality");
|
g.addAttribute("ui.quality");
|
||||||
|
|
@ -256,67 +250,6 @@ public class GraphStreamViewer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createLegendPanel() {
|
|
||||||
int width = 800;
|
|
||||||
int height = 50;
|
|
||||||
|
|
||||||
JPanel panel = new JPanel();
|
|
||||||
panel.setPreferredSize(new Dimension((int)(width*scaling),(int)(height*scaling)));
|
|
||||||
panel.setBackground(Color.WHITE);
|
|
||||||
|
|
||||||
JPanel subpanel = new JPanel();
|
|
||||||
subpanel.setLayout(new FlowLayout());
|
|
||||||
subpanel.setPreferredSize(new Dimension((int)(700*scaling),(int)(40*scaling)));
|
|
||||||
subpanel.setBackground(Color.WHITE);
|
|
||||||
subpanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
|
|
||||||
|
|
||||||
Font font = Font.decode("couriernew");
|
|
||||||
|
|
||||||
//graphic2d
|
|
||||||
// Graphics2D gr = new
|
|
||||||
|
|
||||||
//label
|
|
||||||
JLabel depots = new JLabel(new String("depots"));
|
|
||||||
depots.setFont(font);
|
|
||||||
depots.setPreferredSize(new Dimension((int)(40*scaling),(int)(25*scaling)));
|
|
||||||
|
|
||||||
|
|
||||||
//graphic2d
|
|
||||||
|
|
||||||
//label
|
|
||||||
JLabel pickups = new JLabel(new String("pickups"));
|
|
||||||
pickups.setFont(font);
|
|
||||||
pickups.setPreferredSize(new Dimension((int)(40*scaling),(int)(25*scaling)));
|
|
||||||
|
|
||||||
//graphic2d
|
|
||||||
|
|
||||||
//label
|
|
||||||
JLabel deliveries = new JLabel(new String("deliveries"));
|
|
||||||
deliveries.setFont(font);
|
|
||||||
deliveries.setPreferredSize(new Dimension((int)(40*scaling),(int)(25*scaling)));
|
|
||||||
|
|
||||||
//shipments
|
|
||||||
// if(renderShipments()){
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
subpanel.add(depots);
|
|
||||||
|
|
||||||
JLabel emptyLabel1 = createEmptyLabel();
|
|
||||||
subpanel.add(emptyLabel1);
|
|
||||||
|
|
||||||
subpanel.add(pickups);
|
|
||||||
subpanel.add(createEmptyLabel());
|
|
||||||
|
|
||||||
subpanel.add(deliveries);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
panel.add(subpanel);
|
|
||||||
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JLabel createEmptyLabel() {
|
private JLabel createEmptyLabel() {
|
||||||
JLabel emptyLabel1 = new JLabel();
|
JLabel emptyLabel1 = new JLabel();
|
||||||
emptyLabel1.setPreferredSize(new Dimension((int)(40*scaling),(int)(25*scaling)));
|
emptyLabel1.setPreferredSize(new Dimension((int)(40*scaling),(int)(25*scaling)));
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ import java.util.Collection;
|
||||||
|
|
||||||
import jsprit.core.util.BenchmarkResult;
|
import jsprit.core.util.BenchmarkResult;
|
||||||
|
|
||||||
import org.jfree.chart.renderer.xy.DeviationRenderer;
|
|
||||||
|
|
||||||
public class HtmlBenchmarkTableWriter implements BenchmarkWriter{
|
public class HtmlBenchmarkTableWriter implements BenchmarkWriter{
|
||||||
|
|
||||||
private String filename;
|
private String filename;
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class NeighborhoodThresholdInitialiser implements AlgorithmStartsListener{
|
||||||
}
|
}
|
||||||
|
|
||||||
private double determineThreshold(VehicleRoutingProblem pblm, Locations locations, Collection<VehicleRoutingProblemSolution> mySolutions) {
|
private double determineThreshold(VehicleRoutingProblem pblm, Locations locations, Collection<VehicleRoutingProblemSolution> mySolutions) {
|
||||||
VehicleRoutingProblemSolution bestSolution = Solutions.getBest(mySolutions);
|
VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(mySolutions);
|
||||||
double[] distances = new double[bestSolution.getRoutes().size()+pblm.getJobs().size()];
|
double[] distances = new double[bestSolution.getRoutes().size()+pblm.getJobs().size()];
|
||||||
getDistances(distances,bestSolution,locations);
|
getDistances(distances,bestSolution,locations);
|
||||||
Mean mean = new Mean();
|
Mean mean = new Mean();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import jsprit.core.algorithm.listener.IterationEndsListener;
|
||||||
import jsprit.core.algorithm.listener.IterationStartsListener;
|
import jsprit.core.algorithm.listener.IterationStartsListener;
|
||||||
import jsprit.core.algorithm.listener.SearchStrategyListener;
|
import jsprit.core.algorithm.listener.SearchStrategyListener;
|
||||||
import jsprit.core.algorithm.listener.SearchStrategyModuleListener;
|
import jsprit.core.algorithm.listener.SearchStrategyModuleListener;
|
||||||
import jsprit.core.algorithm.listener.StrategySelectedListener;
|
|
||||||
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener;
|
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListener;
|
||||||
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners;
|
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners;
|
||||||
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||||
|
|
@ -67,10 +66,6 @@ public class VehicleRoutingAlgorithm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void print() {
|
|
||||||
log.info(this.name + counter);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
counter=0;
|
counter=0;
|
||||||
nextCounter=1;
|
nextCounter=1;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ public class ExperimentalSchrimpfAcceptance implements SolutionAcceptor, Iterati
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
double result = Solutions.getBest(solutions).getCost();
|
double result = Solutions.bestOf(solutions).getCost();
|
||||||
// logger.info("result="+result);
|
// logger.info("result="+result);
|
||||||
results[iteration-1] = result;
|
results[iteration-1] = result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
public void informIterationEnds(int iteration, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
double result = Solutions.getBest(solutions).getCost();
|
double result = Solutions.bestOf(solutions).getCost();
|
||||||
// logger.info("result="+result);
|
// logger.info("result="+result);
|
||||||
results[iteration-1] = result;
|
results[iteration-1] = result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class InsertionFactory {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(InsertionFactory.class);
|
private static Logger log = Logger.getLogger(InsertionFactory.class);
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static InsertionStrategy createInsertion(VehicleRoutingProblem vrp, HierarchicalConfiguration config,
|
public static InsertionStrategy createInsertion(VehicleRoutingProblem vrp, HierarchicalConfiguration config,
|
||||||
VehicleFleetManager vehicleFleetManager, StateManager routeStates, List<PrioritizedVRAListener> algorithmListeners, ExecutorService executorService, int nuOfThreads, ConstraintManager constraintManager){
|
VehicleFleetManager vehicleFleetManager, StateManager routeStates, List<PrioritizedVRAListener> algorithmListeners, ExecutorService executorService, int nuOfThreads, ConstraintManager constraintManager){
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -856,7 +856,6 @@ public class VehicleRoutingAlgorithms {
|
||||||
ruin = getRandomRuin(vrp, routeStates, definedClasses, ruinKey, shareToRuin);
|
ruin = getRandomRuin(vrp, routeStates, definedClasses, ruinKey, shareToRuin);
|
||||||
}
|
}
|
||||||
else if(ruin_name.equals("radialRuin")){
|
else if(ruin_name.equals("radialRuin")){
|
||||||
String ruin_distance = moduleConfig.getString("ruin.distance");
|
|
||||||
JobDistance jobDistance = new AvgServiceAndShipmentDistance(vrp.getTransportCosts());
|
JobDistance jobDistance = new AvgServiceAndShipmentDistance(vrp.getTransportCosts());
|
||||||
// if(ruin_distance == null) jobDistance
|
// if(ruin_distance == null) jobDistance
|
||||||
// else {
|
// else {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package jsprit.core.algorithm.recreate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import jsprit.core.problem.driver.Driver;
|
import jsprit.core.problem.driver.Driver;
|
||||||
import jsprit.core.problem.job.Job;
|
import jsprit.core.problem.job.Job;
|
||||||
|
|
@ -36,7 +35,7 @@ class CalculatesServiceInsertionWithTimeScheduling implements JobInsertionCostsC
|
||||||
|
|
||||||
private JobInsertionCostsCalculator jic;
|
private JobInsertionCostsCalculator jic;
|
||||||
|
|
||||||
private Random random = new Random();
|
// private Random random = new Random();
|
||||||
|
|
||||||
private int nOfDepartureTimes = 3;
|
private int nOfDepartureTimes = 3;
|
||||||
|
|
||||||
|
|
@ -65,8 +64,8 @@ class CalculatesServiceInsertionWithTimeScheduling implements JobInsertionCostsC
|
||||||
else currentStart = currentRoute.getStart().getEndTime();
|
else currentStart = currentRoute.getStart().getEndTime();
|
||||||
|
|
||||||
vehicleDepartureTimes.add(currentStart);
|
vehicleDepartureTimes.add(currentStart);
|
||||||
double earliestDeparture = newVehicle.getEarliestDeparture();
|
// double earliestDeparture = newVehicle.getEarliestDeparture();
|
||||||
double latestEnd = newVehicle.getLatestArrival();
|
// double latestEnd = newVehicle.getLatestArrival();
|
||||||
|
|
||||||
for(int i=0;i<nOfDepartureTimes;i++){
|
for(int i=0;i<nOfDepartureTimes;i++){
|
||||||
double neighborStartTime_earlier = currentStart - (i+1)*timeSlice;
|
double neighborStartTime_earlier = currentStart - (i+1)*timeSlice;
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,6 @@ class CalculatorBuilder {
|
||||||
JobInsertionCostsCalculator jobInsertionCalculator = new ServiceInsertionOnRouteLevelCalculator(vrp.getTransportCosts(), vrp.getActivityCosts(), routeLevelCostEstimator, constraintManager, constraintManager);
|
JobInsertionCostsCalculator jobInsertionCalculator = new ServiceInsertionOnRouteLevelCalculator(vrp.getTransportCosts(), vrp.getActivityCosts(), routeLevelCostEstimator, constraintManager, constraintManager);
|
||||||
((ServiceInsertionOnRouteLevelCalculator)jobInsertionCalculator).setNuOfActsForwardLooking(after);
|
((ServiceInsertionOnRouteLevelCalculator)jobInsertionCalculator).setNuOfActsForwardLooking(after);
|
||||||
((ServiceInsertionOnRouteLevelCalculator)jobInsertionCalculator).setMemorySize(solutionMemory);
|
((ServiceInsertionOnRouteLevelCalculator)jobInsertionCalculator).setMemorySize(solutionMemory);
|
||||||
((ServiceInsertionOnRouteLevelCalculator)jobInsertionCalculator).setNeighborhood(vrp.getNeighborhood());
|
|
||||||
((ServiceInsertionOnRouteLevelCalculator) jobInsertionCalculator).setStates(activityStates2);
|
((ServiceInsertionOnRouteLevelCalculator) jobInsertionCalculator).setStates(activityStates2);
|
||||||
|
|
||||||
PenalyzeInsertionCostsWithPenaltyVehicle penalyzeInsertionCosts = new PenalyzeInsertionCostsWithPenaltyVehicle(jobInsertionCalculator);
|
PenalyzeInsertionCostsWithPenaltyVehicle penalyzeInsertionCosts = new PenalyzeInsertionCostsWithPenaltyVehicle(jobInsertionCalculator);
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,9 @@ import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.job.Job;
|
import jsprit.core.problem.job.Job;
|
||||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final class ConfigureFixCostCalculator implements InsertionStartsListener, JobInsertedListener{
|
final class ConfigureFixCostCalculator implements InsertionStartsListener, JobInsertedListener{
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(ConfigureFixCostCalculator.class);
|
|
||||||
|
|
||||||
VehicleRoutingProblem vrp;
|
VehicleRoutingProblem vrp;
|
||||||
|
|
||||||
JobInsertionConsideringFixCostsCalculator calcConsideringFix;
|
JobInsertionConsideringFixCostsCalculator calcConsideringFix;
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.algorithm.recreate;
|
package jsprit.core.algorithm.recreate;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import jsprit.core.algorithm.recreate.InsertionData.NoInsertionFound;
|
import jsprit.core.algorithm.recreate.InsertionData.NoInsertionFound;
|
||||||
import jsprit.core.algorithm.recreate.listener.InsertionListeners;
|
import jsprit.core.algorithm.recreate.listener.InsertionListeners;
|
||||||
import jsprit.core.problem.job.Job;
|
import jsprit.core.problem.job.Job;
|
||||||
|
|
@ -120,8 +118,6 @@ class Inserter {
|
||||||
|
|
||||||
private JobInsertionHandler jobInsertionHandler;
|
private JobInsertionHandler jobInsertionHandler;
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(Inserter.class);
|
|
||||||
|
|
||||||
public Inserter(InsertionListeners insertionListeners) {
|
public Inserter(InsertionListeners insertionListeners) {
|
||||||
this.insertionListeners = insertionListeners;
|
this.insertionListeners = insertionListeners;
|
||||||
new DefaultTourActivityFactory();
|
new DefaultTourActivityFactory();
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import jsprit.core.problem.solution.route.activity.End;
|
||||||
import jsprit.core.problem.solution.route.activity.Start;
|
import jsprit.core.problem.solution.route.activity.Start;
|
||||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import jsprit.core.problem.solution.route.activity.TourShipmentActivityFactory;
|
import jsprit.core.problem.solution.route.activity.TourShipmentActivityFactory;
|
||||||
import jsprit.core.problem.vehicle.PenaltyVehicleType;
|
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.NoVehicle;
|
import jsprit.core.problem.vehicle.VehicleImpl.NoVehicle;
|
||||||
import jsprit.core.util.CalculationUtils;
|
import jsprit.core.util.CalculationUtils;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ import jsprit.core.problem.job.Shipment;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.EuclideanDistanceCalculator;
|
import jsprit.core.util.EuclideanDistanceCalculator;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,8 +35,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class AvgServiceAndShipmentDistance implements JobDistance {
|
public class AvgServiceAndShipmentDistance implements JobDistance {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(AvgServiceAndShipmentDistance.class);
|
|
||||||
|
|
||||||
private VehicleRoutingTransportCosts costs;
|
private VehicleRoutingTransportCosts costs;
|
||||||
|
|
||||||
public AvgServiceAndShipmentDistance(VehicleRoutingTransportCosts costs) {
|
public AvgServiceAndShipmentDistance(VehicleRoutingTransportCosts costs) {
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
||||||
import jsprit.core.problem.job.Job;
|
import jsprit.core.problem.job.Job;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,8 +32,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class AvgServiceDistance implements JobDistance {
|
public class AvgServiceDistance implements JobDistance {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(AvgServiceDistance.class);
|
|
||||||
|
|
||||||
private VehicleRoutingTransportCosts costs;
|
private VehicleRoutingTransportCosts costs;
|
||||||
|
|
||||||
public AvgServiceDistance(VehicleRoutingTransportCosts costs) {
|
public AvgServiceDistance(VehicleRoutingTransportCosts costs) {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import jsprit.core.algorithm.listener.IterationStartsListener;
|
import jsprit.core.algorithm.listener.IterationStartsListener;
|
||||||
import jsprit.core.algorithm.recreate.listener.InsertionEndsListener;
|
import jsprit.core.algorithm.recreate.listener.InsertionEndsListener;
|
||||||
import jsprit.core.algorithm.recreate.listener.InsertionListener;
|
import jsprit.core.algorithm.recreate.listener.InsertionListener;
|
||||||
|
|
@ -52,8 +50,6 @@ import jsprit.core.problem.solution.route.state.StateFactory.States;
|
||||||
|
|
||||||
public class StateManager implements RouteAndActivityStateGetter, IterationStartsListener, RuinListener, InsertionStartsListener, JobInsertedListener, InsertionEndsListener {
|
public class StateManager implements RouteAndActivityStateGetter, IterationStartsListener, RuinListener, InsertionStartsListener, JobInsertedListener, InsertionEndsListener {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(StateManager.class);
|
|
||||||
|
|
||||||
private Map<VehicleRoute,States> vehicleRouteStates = new HashMap<VehicleRoute, States>();
|
private Map<VehicleRoute,States> vehicleRouteStates = new HashMap<VehicleRoute, States>();
|
||||||
|
|
||||||
private Map<TourActivity,States> activityStates = new HashMap<TourActivity, States>();
|
private Map<TourActivity,States> activityStates = new HashMap<TourActivity, States>();
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||||
import jsprit.core.util.ActivityTimeTracker;
|
import jsprit.core.util.ActivityTimeTracker;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates total costs (i.e. transport and activity costs) at route and activity level.
|
* Updates total costs (i.e. transport and activity costs) at route and activity level.
|
||||||
|
|
@ -25,8 +23,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class UpdateVariableCosts implements ActivityVisitor,StateUpdater{
|
public class UpdateVariableCosts implements ActivityVisitor,StateUpdater{
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(UpdateVariableCosts.class);
|
|
||||||
|
|
||||||
private VehicleRoutingActivityCosts activityCost;
|
private VehicleRoutingActivityCosts activityCost;
|
||||||
|
|
||||||
private ForwardTransportCost transportCost;
|
private ForwardTransportCost transportCost;
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class VariationCoefficientTermination implements PrematureAlgorithmTermin
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
if(lastAccepted == null) lastAccepted = Solutions.getBest(solutions);
|
if(lastAccepted == null) lastAccepted = Solutions.bestOf(solutions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class ConstraintManager implements HardActivityStateLevelConstraint, HardRouteStateLevelConstraint{
|
public class ConstraintManager implements HardActivityStateLevelConstraint, HardRouteStateLevelConstraint{
|
||||||
|
|
||||||
public static enum Priority {
|
public static enum Priority {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constraint that ensures capacity constraint at each activity.
|
* Constraint that ensures capacity constraint at each activity.
|
||||||
|
|
@ -22,8 +20,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements HardActivityStateLevelConstraint {
|
public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements HardActivityStateLevelConstraint {
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(PickupAndDeliverShipmentLoadActivityLevelConstraint.class);
|
|
||||||
|
|
||||||
private RouteAndActivityStateGetter stateManager;
|
private RouteAndActivityStateGetter stateManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures load constraint for inserting ServiceActivity.
|
* Ensures load constraint for inserting ServiceActivity.
|
||||||
|
|
@ -23,8 +21,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
class ServiceLoadActivityLevelConstraint implements HardActivityStateLevelConstraint {
|
class ServiceLoadActivityLevelConstraint implements HardActivityStateLevelConstraint {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(ServiceLoadActivityLevelConstraint.class);
|
|
||||||
|
|
||||||
private RouteAndActivityStateGetter stateManager;
|
private RouteAndActivityStateGetter stateManager;
|
||||||
|
|
||||||
public ServiceLoadActivityLevelConstraint(RouteAndActivityStateGetter stateManager) {
|
public ServiceLoadActivityLevelConstraint(RouteAndActivityStateGetter stateManager) {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||||
import jsprit.core.util.CalculationUtils;
|
import jsprit.core.util.CalculationUtils;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ljsljslfjs
|
* ljsljslfjs
|
||||||
|
|
@ -17,8 +15,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
class TimeWindowConstraint implements HardActivityStateLevelConstraint {
|
class TimeWindowConstraint implements HardActivityStateLevelConstraint {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(TimeWindowConstraint.class);
|
|
||||||
|
|
||||||
private RouteAndActivityStateGetter states;
|
private RouteAndActivityStateGetter states;
|
||||||
|
|
||||||
private VehicleRoutingTransportCosts routingCosts;
|
private VehicleRoutingTransportCosts routingCosts;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class VrpXMLReader{
|
public class VrpXMLReader{
|
||||||
|
|
||||||
public interface ServiceBuilderFactory {
|
public interface ServiceBuilderFactory {
|
||||||
|
|
@ -223,7 +224,6 @@ public class VrpXMLReader{
|
||||||
List<HierarchicalConfiguration> routeConfigs = solutionConfig.configurationsAt("routes.route");
|
List<HierarchicalConfiguration> routeConfigs = solutionConfig.configurationsAt("routes.route");
|
||||||
List<VehicleRoute> routes = new ArrayList<VehicleRoute>();
|
List<VehicleRoute> routes = new ArrayList<VehicleRoute>();
|
||||||
for(HierarchicalConfiguration routeConfig : routeConfigs){
|
for(HierarchicalConfiguration routeConfig : routeConfigs){
|
||||||
String driverId = routeConfig.getString("driverId");
|
|
||||||
//! here, driverId is set to noDriver, no matter whats in driverId.
|
//! here, driverId is set to noDriver, no matter whats in driverId.
|
||||||
Driver driver = DriverImpl.noDriver();
|
Driver driver = DriverImpl.noDriver();
|
||||||
String vehicleId = routeConfig.getString("vehicleId");
|
String vehicleId = routeConfig.getString("vehicleId");
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ public class VrpXMLWriter {
|
||||||
static class XMLConf extends XMLConfiguration {
|
static class XMLConf extends XMLConfiguration {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Document createDoc() throws ConfigurationException{
|
public Document createDoc() throws ConfigurationException{
|
||||||
Document doc = createDocument();
|
Document doc = createDocument();
|
||||||
return doc;
|
return doc;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
||||||
public static class DefaultFleetManager extends VehicleFleetManagerImpl {
|
public static class DefaultFleetManager extends VehicleFleetManagerImpl {
|
||||||
|
|
||||||
public DefaultFleetManager() {
|
public DefaultFleetManager() {
|
||||||
super(Collections.EMPTY_LIST);
|
super(Collections.<Vehicle> emptyList());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,13 +54,10 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
||||||
|
|
||||||
static class TypeContainer {
|
static class TypeContainer {
|
||||||
|
|
||||||
private VehicleTypeKey type;
|
|
||||||
|
|
||||||
private ArrayList<Vehicle> vehicleList;
|
private ArrayList<Vehicle> vehicleList;
|
||||||
|
|
||||||
public TypeContainer(VehicleTypeKey type) {
|
public TypeContainer(VehicleTypeKey type) {
|
||||||
super();
|
super();
|
||||||
this.type = type;
|
|
||||||
vehicleList = new ArrayList<Vehicle>();
|
vehicleList = new ArrayList<Vehicle>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ public class VehicleImpl implements Vehicle {
|
||||||
|
|
||||||
public static class NoVehicle extends VehicleImpl {
|
public static class NoVehicle extends VehicleImpl {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public NoVehicle() {
|
public NoVehicle() {
|
||||||
super(Builder.newInstance("noVehicle").setType(VehicleTypeImpl.newInstance(null, 0, null)));
|
super(Builder.newInstance("noVehicle").setType(VehicleTypeImpl.newInstance(null, 0, null)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ import jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts;
|
||||||
import jsprit.core.problem.driver.Driver;
|
import jsprit.core.problem.driver.Driver;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -33,8 +31,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class CrowFlyCosts extends AbstractForwardVehicleRoutingTransportCosts {
|
public class CrowFlyCosts extends AbstractForwardVehicleRoutingTransportCosts {
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger(CrowFlyCosts.class);
|
|
||||||
|
|
||||||
public int speed = 1;
|
public int speed = 1;
|
||||||
|
|
||||||
public double detourFactor = 1.0;
|
public double detourFactor = 1.0;
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,9 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.util;
|
package jsprit.core.util;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
public class StopWatch {
|
public class StopWatch {
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(StopWatch.class);
|
|
||||||
|
|
||||||
private double ran;
|
private double ran;
|
||||||
|
|
||||||
private double startTime;
|
private double startTime;
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ public class VrpVerifier implements AlgorithmStartsListener{
|
||||||
|
|
||||||
private static Logger log = Logger.getLogger(VrpVerifier.class);
|
private static Logger log = Logger.getLogger(VrpVerifier.class);
|
||||||
|
|
||||||
private boolean hardTimeWindows = true;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) {
|
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
//check capacity
|
//check capacity
|
||||||
|
|
@ -54,7 +52,6 @@ public class VrpVerifier implements AlgorithmStartsListener{
|
||||||
Service s = (Service)j;
|
Service s = (Service)j;
|
||||||
boolean jobCanBeRoutedWithinTimeWindow = false;
|
boolean jobCanBeRoutedWithinTimeWindow = false;
|
||||||
for(Vehicle v : problem.getVehicles()){
|
for(Vehicle v : problem.getVehicles()){
|
||||||
double transportCost = problem.getTransportCosts().getTransportCost(v.getLocationId(), s.getLocationId(), v.getEarliestDeparture(), DriverImpl.noDriver(), v);
|
|
||||||
double transportTime = problem.getTransportCosts().getTransportTime(v.getLocationId(), s.getLocationId(), v.getEarliestDeparture(), DriverImpl.noDriver(), v);
|
double transportTime = problem.getTransportCosts().getTransportTime(v.getLocationId(), s.getLocationId(), v.getEarliestDeparture(), DriverImpl.noDriver(), v);
|
||||||
if(transportTime+v.getEarliestDeparture() < s.getTimeWindow().getEnd()){
|
if(transportTime+v.getEarliestDeparture() < s.getTimeWindow().getEnd()){
|
||||||
jobCanBeRoutedWithinTimeWindow = true;
|
jobCanBeRoutedWithinTimeWindow = true;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
||||||
import jsprit.core.algorithm.listener.IterationStartsListener;
|
|
||||||
import jsprit.core.algorithm.module.RuinAndRecreateModule;
|
import jsprit.core.algorithm.module.RuinAndRecreateModule;
|
||||||
import jsprit.core.algorithm.recreate.BestInsertionBuilder;
|
import jsprit.core.algorithm.recreate.BestInsertionBuilder;
|
||||||
import jsprit.core.algorithm.recreate.InsertionStrategy;
|
import jsprit.core.algorithm.recreate.InsertionStrategy;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import jsprit.core.algorithm.ruin.RuinStrategy;
|
||||||
import jsprit.core.algorithm.ruin.distance.AvgServiceDistance;
|
import jsprit.core.algorithm.ruin.distance.AvgServiceDistance;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
import jsprit.core.algorithm.state.StateManager;
|
||||||
|
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.constraint.ConstraintManager;
|
import jsprit.core.problem.constraint.ConstraintManager;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
|
|
@ -106,7 +107,7 @@ public class BuildPDVRPAlgoFromScratch_IT {
|
||||||
|
|
||||||
vra.addInitialSolution(iniSolution);
|
vra.addInitialSolution(iniSolution);
|
||||||
vra.setNuOfIterations(1000);
|
vra.setNuOfIterations(1000);
|
||||||
vra.setPrematureBreak(100);
|
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.algorithm;
|
package jsprit.core.algorithm;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
||||||
|
|
@ -38,7 +40,6 @@ import jsprit.core.problem.solution.route.VehicleRoute;
|
||||||
import jsprit.core.problem.solution.route.state.StateFactory;
|
import jsprit.core.problem.solution.route.state.StateFactory;
|
||||||
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||||
import jsprit.core.util.Solutions;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
@ -119,7 +120,7 @@ public class BuildPDVRPWithShipmentsAlgoFromScratch_IT {
|
||||||
@Test
|
@Test
|
||||||
public void test(){
|
public void test(){
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
|
assertTrue(!solutions.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import jsprit.core.algorithm.box.GreedySchrimpfFactory;
|
import jsprit.core.algorithm.box.GreedySchrimpfFactory;
|
||||||
|
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||||
import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
||||||
|
|
@ -184,7 +185,7 @@ public class RefuseCollection_IT {
|
||||||
vrpBuilder.setRoutingCost(matrixBuilder.build());
|
vrpBuilder.setRoutingCost(matrixBuilder.build());
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
VehicleRoutingAlgorithm vra = new GreedySchrimpfFactory().createAlgorithm(vrp);
|
VehicleRoutingAlgorithm vra = new GreedySchrimpfFactory().createAlgorithm(vrp);
|
||||||
vra.setPrematureBreak(100);
|
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(397.0,Solutions.bestOf(solutions).getCost(),0.01);
|
assertEquals(397.0,Solutions.bestOf(solutions).getCost(),0.01);
|
||||||
|
|
@ -209,7 +210,7 @@ public class RefuseCollection_IT {
|
||||||
/*
|
/*
|
||||||
* and add it to problem
|
* and add it to problem
|
||||||
*/
|
*/
|
||||||
vrpBuilder.addService(service);
|
vrpBuilder.addJob(service);
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ import static org.mockito.Mockito.when;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -39,7 +37,6 @@ public class AcceptNewRemoveWorstTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenHavingNewSolAndLimitedMemory_removeWorstAndAddNew(){
|
public void whenHavingNewSolAndLimitedMemory_removeWorstAndAddNew(){
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = mock(VehicleRoutingProblem.class);
|
|
||||||
VehicleRoutingProblemSolution sol1 = mock(VehicleRoutingProblemSolution.class);
|
VehicleRoutingProblemSolution sol1 = mock(VehicleRoutingProblemSolution.class);
|
||||||
VehicleRoutingProblemSolution sol2 = mock(VehicleRoutingProblemSolution.class);
|
VehicleRoutingProblemSolution sol2 = mock(VehicleRoutingProblemSolution.class);
|
||||||
when(sol1.getCost()).thenReturn(1.0);
|
when(sol1.getCost()).thenReturn(1.0);
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.algorithm.box;
|
package jsprit.core.algorithm.box;
|
||||||
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -28,8 +24,6 @@ public class TestSchrimpf {
|
||||||
@Test
|
@Test
|
||||||
public void whenUsingSchrimpfFactory_itFindsTheConfig(){
|
public void whenUsingSchrimpfFactory_itFindsTheConfig(){
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(VehicleRoutingProblem.Builder.newInstance().build());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,6 @@ public class TestAlgorithmReader {
|
||||||
String acceptorName = "acceptor";
|
String acceptorName = "acceptor";
|
||||||
String acceptorId = "acceptorId";
|
String acceptorId = "acceptorId";
|
||||||
|
|
||||||
String moduleName = "acceptor";
|
|
||||||
String moduleId = "acceptorId";
|
|
||||||
|
|
||||||
ModKey key = new ModKey(acceptorName,acceptorId);
|
ModKey key = new ModKey(acceptorName,acceptorId);
|
||||||
RuinStrategyKey accKey = new RuinStrategyKey(key);
|
RuinStrategyKey accKey = new RuinStrategyKey(key);
|
||||||
RuinStrategy acceptor = new RuinStrategy(){
|
RuinStrategy acceptor = new RuinStrategy(){
|
||||||
|
|
@ -221,6 +218,7 @@ public class TestAlgorithmReader {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void initialiseConstructionAlgoCorrectly(){
|
public void initialiseConstructionAlgoCorrectly(){
|
||||||
VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
||||||
|
|
@ -229,18 +227,21 @@ public class TestAlgorithmReader {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCreatingAlgorithm_nOfStrategiesIsCorrect(){
|
public void whenCreatingAlgorithm_nOfStrategiesIsCorrect(){
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
||||||
assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
|
assertEquals(3, algo.getSearchStrategyManager().getStrategies().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCreatingAlgorithm_nOfIterationsIsReadCorrectly(){
|
public void whenCreatingAlgorithm_nOfIterationsIsReadCorrectly(){
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
||||||
assertEquals(10, algo.getNuOfIterations());
|
assertEquals(10, algo.getNuOfIterations());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCreatingAlgorithm_nOfStrategyModulesIsCorrect(){
|
public void whenCreatingAlgorithm_nOfStrategyModulesIsCorrect(){
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, config);
|
||||||
int nOfModules = 0;
|
int nOfModules = 0;
|
||||||
for(SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()){
|
for(SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()){
|
||||||
|
|
@ -249,21 +250,4 @@ public class TestAlgorithmReader {
|
||||||
assertEquals(3, nOfModules);
|
assertEquals(3, nOfModules);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
|
||||||
// public void whenCreatingAlgorithm_regretInsertionIsReadCorrectly(){
|
|
||||||
// VehicleRoutingAlgorithm algo = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/configWithRegretInsertion.xml");
|
|
||||||
// int nOfModules = 0;
|
|
||||||
// for(SearchStrategy strat : algo.getSearchStrategyManager().getStrategies()){
|
|
||||||
// for(SearchStrategyModule module : strat.getSearchStrategyModules()){
|
|
||||||
// if(module.getName().contains("ruin_and_recreate")){
|
|
||||||
// nOfModules++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// assertEquals(3, nOfModules);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class CalcWithTimeSchedulingTest {
|
||||||
setLocationCoord(Coordinate.newInstance(0, 0)).setLocationId("0,0")
|
setLocationCoord(Coordinate.newInstance(0, 0)).setLocationId("0,0")
|
||||||
.setType(VehicleTypeImpl.Builder.newInstance("myType", 20).setCostPerDistance(1.0).build()).build();
|
.setType(VehicleTypeImpl.Builder.newInstance("myType", 20).setCostPerDistance(1.0).build()).build();
|
||||||
vrpBuilder.addVehicle(vehicle);
|
vrpBuilder.addVehicle(vehicle);
|
||||||
vrpBuilder.addService(Service.Builder.newInstance("myService", 2).setLocationId("0,20").setCoord(Coordinate.newInstance(0, 20)).build());
|
vrpBuilder.addJob(Service.Builder.newInstance("myService", 2).setLocationId("0,20").setCoord(Coordinate.newInstance(0, 20)).build());
|
||||||
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
vrpBuilder.setFleetSize(FleetSize.INFINITE);
|
||||||
vrpBuilder.setRoutingCost(getTpCosts(new CrowFlyCosts(vrpBuilder.getLocations())));
|
vrpBuilder.setRoutingCost(getTpCosts(new CrowFlyCosts(vrpBuilder.getLocations())));
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
|
|
@ -54,7 +54,7 @@ public class CalcWithTimeSchedulingTest {
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/testConfig.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/testConfig.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
VehicleRoutingProblemSolution sol = Solutions.getBest(solutions);
|
VehicleRoutingProblemSolution sol = Solutions.bestOf(solutions);
|
||||||
assertEquals(40.0,sol.getCost(),0.01);
|
assertEquals(40.0,sol.getCost(),0.01);
|
||||||
assertEquals(1, sol.getRoutes().size());
|
assertEquals(1, sol.getRoutes().size());
|
||||||
VehicleRoute route = sol.getRoutes().iterator().next();
|
VehicleRoute route = sol.getRoutes().iterator().next();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import jsprit.core.problem.driver.DriverImpl;
|
||||||
import jsprit.core.problem.job.Pickup;
|
import jsprit.core.problem.job.Pickup;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
import jsprit.core.problem.misc.JobInsertionContext;
|
import jsprit.core.problem.misc.JobInsertionContext;
|
||||||
import jsprit.core.problem.solution.route.RouteActivityVisitor;
|
|
||||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
|
|
@ -212,8 +211,6 @@ public class ShipmentInsertionCalculatorTest {
|
||||||
public void whenInsertingServiceWhileNoCapIsAvailable_itMustReturnNoInsertionData(){
|
public void whenInsertingServiceWhileNoCapIsAvailable_itMustReturnNoInsertionData(){
|
||||||
Shipment shipment = Shipment.Builder.newInstance("s", 1).setPickupLocation("0,10").setDeliveryLocation("0,0").build();
|
Shipment shipment = Shipment.Builder.newInstance("s", 1).setPickupLocation("0,10").setDeliveryLocation("0,0").build();
|
||||||
Shipment shipment2 = Shipment.Builder.newInstance("s2", 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
Shipment shipment2 = Shipment.Builder.newInstance("s2", 1).setPickupLocation("10,10").setDeliveryLocation("0,0").build();
|
||||||
Shipment shipment3 = Shipment.Builder.newInstance("s3", 1).setPickupLocation("10,10").setDeliveryLocation("0,").build();
|
|
||||||
|
|
||||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||||
route.setVehicle(vehicle, 0.0);
|
route.setVehicle(vehicle, 0.0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.core.algorithm.recreate;
|
package jsprit.core.algorithm.recreate;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package jsprit.core.algorithm.recreate;
|
package jsprit.core.algorithm.recreate;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package jsprit.core.algorithm.recreate;
|
package jsprit.core.algorithm.recreate;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
@ -33,7 +32,6 @@ import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
import jsprit.core.problem.solution.route.activity.TourActivity;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
|
|
@ -47,7 +45,6 @@ public class TestDepartureTimeOpt {
|
||||||
public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_totalCostsShouldBe50(){
|
public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_totalCostsShouldBe50(){
|
||||||
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
||||||
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
||||||
VehicleType type = mock(VehicleTypeImpl.class);
|
|
||||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||||
|
|
||||||
|
|
@ -62,12 +59,12 @@ public class TestDepartureTimeOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.addService(service).addVehicle(vehicle).build();
|
VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(20.0+30.0,Solutions.getBest(solutions).getCost(),0.1);
|
assertEquals(20.0+30.0,Solutions.bestOf(solutions).getCost(),0.1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,7 +72,6 @@ public class TestDepartureTimeOpt {
|
||||||
public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_depTimeShouldBe0(){
|
public void whenSettingOneCustWithTWAnd_NO_DepTimeChoice_depTimeShouldBe0(){
|
||||||
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
TimeWindow timeWindow = TimeWindow.newInstance(40, 45);
|
||||||
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
Service service = Service.Builder.newInstance("s", 0).setLocationId("servLoc").setCoord(Coordinate.newInstance(0, 10)).setTimeWindow(timeWindow).build();
|
||||||
VehicleType type = mock(VehicleTypeImpl.class);
|
|
||||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLocationId("vehLoc").setLocationCoord(Coordinate.newInstance(0, 0))
|
||||||
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
.setType(VehicleTypeImpl.Builder.newInstance("vType", 0).build()).build();
|
||||||
|
|
||||||
|
|
@ -90,12 +86,12 @@ public class TestDepartureTimeOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.addService(service).addVehicle(vehicle).build();
|
VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(0.0,Solutions.getBest(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
|
assertEquals(0.0,Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,13 +113,13 @@ public class TestDepartureTimeOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.addService(service).addVehicle(vehicle).build();
|
VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
|
||||||
|
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(20.0,Solutions.getBest(solutions).getCost(),0.1);
|
assertEquals(20.0,Solutions.bestOf(solutions).getCost(),0.1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,13 +141,13 @@ public class TestDepartureTimeOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.addService(service).addVehicle(vehicle).build();
|
VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addVehicle(vehicle).build();
|
||||||
|
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(30.0,Solutions.getBest(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
|
assertEquals(30.0,Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,13 +173,13 @@ public class TestDepartureTimeOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.addService(service).addService(service2).addVehicle(vehicle).build();
|
VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addJob(service2).addVehicle(vehicle).build();
|
||||||
|
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(40.0,Solutions.getBest(solutions).getCost(),0.1);
|
assertEquals(40.0,Solutions.bestOf(solutions).getCost(),0.1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,13 +205,13 @@ public class TestDepartureTimeOpt {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.addService(service).addService(service2).addVehicle(vehicle).build();
|
VehicleRoutingProblem vrp = vrpBuilder.addJob(service).addJob(service2).addVehicle(vehicle).build();
|
||||||
|
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigWithDepartureTimeChoice.xml");
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
assertEquals(10.0,Solutions.getBest(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
|
assertEquals(10.0,Solutions.bestOf(solutions).getRoutes().iterator().next().getStart().getEndTime(),0.1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package jsprit.core.algorithm.recreate;
|
package jsprit.core.algorithm.recreate;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertTrue;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
|
||||||
import jsprit.core.algorithm.recreate.BestInsertionBuilder;
|
|
||||||
import jsprit.core.algorithm.recreate.InsertionStrategy;
|
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
import jsprit.core.algorithm.state.StateManager;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.constraint.ConstraintManager;
|
import jsprit.core.problem.constraint.ConstraintManager;
|
||||||
|
|
@ -13,12 +10,11 @@ import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -78,8 +74,6 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra;
|
|
||||||
|
|
||||||
final StateManager stateManager = new StateManager(vrp);
|
final StateManager stateManager = new StateManager(vrp);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -91,6 +85,7 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
|
||||||
|
|
||||||
BestInsertionBuilder bestIBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager,constraintManager);
|
BestInsertionBuilder bestIBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager,constraintManager);
|
||||||
bestIBuilder.setRouteLevel(2, 2);
|
bestIBuilder.setRouteLevel(2, 2);
|
||||||
|
@SuppressWarnings("unused")
|
||||||
InsertionStrategy bestInsertion = bestIBuilder.build();
|
InsertionStrategy bestInsertion = bestIBuilder.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -144,8 +139,6 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||||
|
|
||||||
VehicleRoutingAlgorithm vra;
|
|
||||||
|
|
||||||
final StateManager stateManager = new StateManager(vrp);
|
final StateManager stateManager = new StateManager(vrp);
|
||||||
|
|
||||||
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
|
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
|
||||||
|
|
@ -156,6 +149,7 @@ public class TestMixedServiceAndShipmentsProblemOnRouteLevel {
|
||||||
|
|
||||||
BestInsertionBuilder bestIBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager,constraintManager);
|
BestInsertionBuilder bestIBuilder = new BestInsertionBuilder(vrp, fleetManager, stateManager,constraintManager);
|
||||||
bestIBuilder.setRouteLevel(2, 2);
|
bestIBuilder.setRouteLevel(2, 2);
|
||||||
|
@SuppressWarnings("unused")
|
||||||
InsertionStrategy bestInsertion = bestIBuilder.build();
|
InsertionStrategy bestInsertion = bestIBuilder.build();
|
||||||
|
|
||||||
assertTrue(true);
|
assertTrue(true);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
package jsprit.core.algorithm.ruin;
|
package jsprit.core.algorithm.ruin;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jsprit.core.algorithm.ruin.RuinRadial.JobNeighborhoodsImpl;
|
|
||||||
import jsprit.core.algorithm.ruin.RuinRadial.JobNeighborhoodsImplWithCapRestriction;
|
import jsprit.core.algorithm.ruin.RuinRadial.JobNeighborhoodsImplWithCapRestriction;
|
||||||
import jsprit.core.algorithm.ruin.distance.EuclideanServiceDistance;
|
import jsprit.core.algorithm.ruin.distance.EuclideanServiceDistance;
|
||||||
import jsprit.core.algorithm.ruin.distance.JobDistance;
|
import jsprit.core.algorithm.ruin.distance.JobDistance;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public class TestJobDistanceAvgCosts {
|
||||||
@Override
|
@Override
|
||||||
public double getTransportCost(String fromId, String toId,
|
public double getTransportCost(String fromId, String toId,
|
||||||
double departureTime, Driver driver, Vehicle vehicle) {
|
double departureTime, Driver driver, Vehicle vehicle) {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
String vehicleId = vehicle.getId();
|
String vehicleId = vehicle.getId();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -82,6 +83,7 @@ public class TestJobDistanceAvgCosts {
|
||||||
@Override
|
@Override
|
||||||
public double getTransportCost(String fromId, String toId,
|
public double getTransportCost(String fromId, String toId,
|
||||||
double departureTime, Driver driver, Vehicle vehicle) {
|
double departureTime, Driver driver, Vehicle vehicle) {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
String vehicleId = vehicle.getId();
|
String vehicleId = vehicle.getId();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class SelectBestTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenHavingNoSolutions_returnNull(){
|
public void whenHavingNoSolutions_returnNull(){
|
||||||
assertNull(new SelectBest().selectSolution(Collections.EMPTY_LIST));
|
assertNull(new SelectBest().selectSolution(Collections.<VehicleRoutingProblemSolution> emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,6 @@ public class SelectRandomlyTest {
|
||||||
SelectRandomly selectRandomly = new SelectRandomly();
|
SelectRandomly selectRandomly = new SelectRandomly();
|
||||||
selectRandomly.setRandom(random);
|
selectRandomly.setRandom(random);
|
||||||
|
|
||||||
assertNull(selectRandomly.selectSolution(Collections.EMPTY_LIST));
|
assertNull(selectRandomly.selectSolution(Collections.<VehicleRoutingProblemSolution> emptyList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,7 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
|
||||||
import jsprit.core.problem.job.Job;
|
import jsprit.core.problem.job.Job;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
|
|
@ -53,7 +51,6 @@ public class VrpReaderV2Test {
|
||||||
new VrpXMLReader(builder, null).read(inFileName);
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
assertEquals(FleetSize.FINITE,vrp.getFleetSize());
|
assertEquals(FleetSize.FINITE,vrp.getFleetSize());
|
||||||
assertEquals(FleetComposition.HETEROGENEOUS,vrp.getFleetComposition());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,10 @@
|
||||||
package jsprit.core.problem.io;
|
package jsprit.core.problem.io;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
|
||||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
|
||||||
import jsprit.core.problem.solution.route.activity.End;
|
|
||||||
import jsprit.core.problem.solution.route.activity.ServiceActivity;
|
|
||||||
import jsprit.core.problem.solution.route.activity.Start;
|
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
|
@ -55,7 +42,6 @@ public class VrpWriterV2Test {
|
||||||
@Test
|
@Test
|
||||||
public void whenWritingInfiniteVrp_itWritesCorrectly(){
|
public void whenWritingInfiniteVrp_itWritesCorrectly(){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
builder.setFleetComposition(FleetComposition.HETEROGENEOUS);
|
|
||||||
builder.setFleetSize(FleetSize.INFINITE);
|
builder.setFleetSize(FleetSize.INFINITE);
|
||||||
// Depot depot = new Depot("depotLoc",Coordinate.newInstance(0, 0));
|
// Depot depot = new Depot("depotLoc",Coordinate.newInstance(0, 0));
|
||||||
// Depot depot2 = new Depot("depotLoc2",Coordinate.newInstance(100, 100));
|
// Depot depot2 = new Depot("depotLoc2",Coordinate.newInstance(100, 100));
|
||||||
|
|
@ -72,7 +58,6 @@ public class VrpWriterV2Test {
|
||||||
@Test
|
@Test
|
||||||
public void whenWritingFiniteVrp_itWritesCorrectly(){
|
public void whenWritingFiniteVrp_itWritesCorrectly(){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
builder.setFleetComposition(FleetComposition.HETEROGENEOUS);
|
|
||||||
builder.setFleetSize(FleetSize.FINITE);
|
builder.setFleetSize(FleetSize.FINITE);
|
||||||
// Depot depot = new Depot("depotLoc",Coordinate.newInstance(0, 0));
|
// Depot depot = new Depot("depotLoc",Coordinate.newInstance(0, 0));
|
||||||
// Depot depot2 = new Depot("depotLoc2",Coordinate.newInstance(100, 100));
|
// Depot depot2 = new Depot("depotLoc2",Coordinate.newInstance(100, 100));
|
||||||
|
|
@ -81,8 +66,6 @@ public class VrpWriterV2Test {
|
||||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||||
builder.addVehicleType(type1);
|
|
||||||
builder.addVehicleType(type2);
|
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
|
|
@ -92,7 +75,6 @@ public class VrpWriterV2Test {
|
||||||
@Test
|
@Test
|
||||||
public void t(){
|
public void t(){
|
||||||
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
builder.setFleetComposition(FleetComposition.HETEROGENEOUS);
|
|
||||||
builder.setFleetSize(FleetSize.FINITE);
|
builder.setFleetSize(FleetSize.FINITE);
|
||||||
// Depot depot = new Depot("depotLoc",Coordinate.newInstance(0, 0));
|
// Depot depot = new Depot("depotLoc",Coordinate.newInstance(0, 0));
|
||||||
// Depot depot2 = new Depot("depotLoc2",Coordinate.newInstance(100, 100));
|
// Depot depot2 = new Depot("depotLoc2",Coordinate.newInstance(100, 100));
|
||||||
|
|
@ -101,8 +83,6 @@ public class VrpWriterV2Test {
|
||||||
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
VehicleTypeImpl type2 = VehicleTypeImpl.Builder.newInstance("vehType2", 200).build();
|
||||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||||
builder.addVehicleType(type1);
|
|
||||||
builder.addVehicleType(type2);
|
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
|
|
@ -121,15 +101,13 @@ public class VrpWriterV2Test {
|
||||||
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
Vehicle v1 = VehicleImpl.Builder.newInstance("v1").setLocationId("loc").setType(type1).build();
|
||||||
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
Vehicle v2 = VehicleImpl.Builder.newInstance("v2").setLocationId("loc").setType(type2).build();
|
||||||
|
|
||||||
builder.addVehicleType(type1);
|
|
||||||
builder.addVehicleType(type2);
|
|
||||||
builder.addVehicle(v1);
|
builder.addVehicle(v1);
|
||||||
builder.addVehicle(v2);
|
builder.addVehicle(v2);
|
||||||
|
|
||||||
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("loc").setServiceTime(2.0).build();
|
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 s2 = Service.Builder.newInstance("2", 1).setLocationId("loc2").setServiceTime(4.0).build();
|
||||||
|
|
||||||
VehicleRoutingProblem vrp = builder.addService(s1).addService(s2).build();
|
VehicleRoutingProblem vrp = builder.addJob(s1).addJob(s2).build();
|
||||||
new VrpXMLWriter(vrp, null).write(infileName);
|
new VrpXMLWriter(vrp, null).write(infileName);
|
||||||
|
|
||||||
VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
|
VehicleRoutingProblem.Builder vrpToReadBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
|
|
||||||
|
|
@ -52,16 +52,14 @@ public class TestVehicleRoute {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenBuildingEmptyRouteCorrectly_go(){
|
public void whenBuildingEmptyRouteCorrectly_go(){
|
||||||
|
|
||||||
VehicleRoute route = VehicleRoute.newInstance(TourActivities.emptyTour(),DriverImpl.noDriver(),VehicleImpl.noVehicle());
|
VehicleRoute route = VehicleRoute.newInstance(TourActivities.emptyTour(),DriverImpl.noDriver(),VehicleImpl.noVehicle());
|
||||||
assertTrue(true);
|
assertTrue(route!=null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenBuildingEmptyRouteCorrectlyV2_go(){
|
public void whenBuildingEmptyRouteCorrectlyV2_go(){
|
||||||
|
|
||||||
VehicleRoute route = VehicleRoute.emptyRoute();
|
VehicleRoute route = VehicleRoute.emptyRoute();
|
||||||
assertTrue(true);
|
assertTrue(route!=null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -78,17 +76,16 @@ public class TestVehicleRoute {
|
||||||
|
|
||||||
@Test(expected=IllegalStateException.class)
|
@Test(expected=IllegalStateException.class)
|
||||||
public void whenBuildingEmptyRoute_(){
|
public void whenBuildingEmptyRoute_(){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
VehicleRoute route = VehicleRoute.newInstance(null,null,null);
|
VehicleRoute route = VehicleRoute.newInstance(null,null,null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalStateException.class)
|
@Test(expected=IllegalStateException.class)
|
||||||
public void whenBuildingRouteWithNonEmptyTour_throwException(){
|
public void whenBuildingRouteWithNonEmptyTour_throwException(){
|
||||||
TourActivities tour = new TourActivities();
|
TourActivities tour = new TourActivities();
|
||||||
tour.addActivity(ServiceActivity.newInstance(Service.Builder.newInstance("jo", 10).build()));
|
tour.addActivity(ServiceActivity.newInstance(Service.Builder.newInstance("jo", 10).build()));
|
||||||
|
@SuppressWarnings("unused")
|
||||||
VehicleRoute route = VehicleRoute.newInstance(tour,DriverImpl.noDriver(),VehicleImpl.noVehicle());
|
VehicleRoute route = VehicleRoute.newInstance(tour,DriverImpl.noDriver(),VehicleImpl.noVehicle());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -99,6 +96,7 @@ public class TestVehicleRoute {
|
||||||
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
TourActivity act = iter.next();
|
TourActivity act = iter.next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -113,6 +111,7 @@ public class TestVehicleRoute {
|
||||||
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
TourActivity act = iter.next();
|
TourActivity act = iter.next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -130,6 +129,7 @@ public class TestVehicleRoute {
|
||||||
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
TourActivity act = iter.next();
|
TourActivity act = iter.next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -140,6 +140,7 @@ public class TestVehicleRoute {
|
||||||
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
Iterator<TourActivity> iter = route.getTourActivities().iterator();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
TourActivity act = iter.next();
|
TourActivity act = iter.next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -154,6 +155,7 @@ public class TestVehicleRoute {
|
||||||
Iterator<TourActivity> iter = route.getTourActivities().reverseActivityIterator();
|
Iterator<TourActivity> iter = route.getTourActivities().reverseActivityIterator();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
TourActivity act = iter.next();
|
TourActivity act = iter.next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -168,6 +170,7 @@ public class TestVehicleRoute {
|
||||||
Iterator<TourActivity> iter = route.getTourActivities().reverseActivityIterator();
|
Iterator<TourActivity> iter = route.getTourActivities().reverseActivityIterator();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
|
@SuppressWarnings("unused")
|
||||||
TourActivity act = iter.next();
|
TourActivity act = iter.next();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class TestRefs {
|
||||||
|
|
||||||
private void doSmth(List<Start> starts) {
|
private void doSmth(List<Start> starts) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(Start s : starts){
|
for(@SuppressWarnings("unused") Start s : starts){
|
||||||
s = Start.newInstance("yo_"+count,0.0,0.0);
|
s = Start.newInstance("yo_"+count,0.0,0.0);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ public class TestVehicleFleetManager extends TestCase{
|
||||||
assertEquals(1, vehicles.size());
|
assertEquals(1, vehicles.size());
|
||||||
try{
|
try{
|
||||||
fleetManager.lock(v1);
|
fleetManager.lock(v1);
|
||||||
|
@SuppressWarnings("unused")
|
||||||
Collection<Vehicle> vehicles_ = fleetManager.getAvailableVehicles();
|
Collection<Vehicle> vehicles_ = fleetManager.getAvailableVehicles();
|
||||||
assertFalse(true);
|
assertFalse(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Collection;
|
||||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.Constraint;
|
import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Delivery;
|
import jsprit.core.problem.job.Delivery;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
|
|
@ -98,7 +98,7 @@ public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample {
|
||||||
vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4)
|
vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4)
|
||||||
.addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(delivery4).build();
|
.addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(delivery4).build();
|
||||||
|
|
||||||
vrpBuilder.addProblemConstraint(Constraint.DELIVERIES_FIRST);
|
vrpBuilder.addConstraint(new ServiceDeliveriesFirstConstraint());
|
||||||
|
|
||||||
VehicleRoutingProblem problem = vrpBuilder.build();
|
VehicleRoutingProblem problem = vrpBuilder.build();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.Collection;
|
||||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.Constraint;
|
import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Delivery;
|
import jsprit.core.problem.job.Delivery;
|
||||||
import jsprit.core.problem.job.Pickup;
|
import jsprit.core.problem.job.Pickup;
|
||||||
|
|
@ -83,7 +83,7 @@ public class SimpleVRPWithBackhaulsExample {
|
||||||
vrpBuilder.addJob(pickup1).addJob(pickup2).addJob(delivery1).addJob(delivery2);
|
vrpBuilder.addJob(pickup1).addJob(pickup2).addJob(delivery1).addJob(delivery2);
|
||||||
|
|
||||||
//
|
//
|
||||||
vrpBuilder.addProblemConstraint(Constraint.DELIVERIES_FIRST);
|
vrpBuilder.addConstraint(new ServiceDeliveriesFirstConstraint());
|
||||||
|
|
||||||
VehicleRoutingProblem problem = vrpBuilder.build();
|
VehicleRoutingProblem problem = vrpBuilder.build();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.Constraint;
|
|
||||||
import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
|
import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class ChristofidesReader {
|
||||||
int demand = Integer.parseInt(tokens[2].trim());
|
int demand = Integer.parseInt(tokens[2].trim());
|
||||||
String customer = Integer.valueOf(counter-1).toString();
|
String customer = Integer.valueOf(counter-1).toString();
|
||||||
Service service = Service.Builder.newInstance(customer, demand).setServiceTime(serviceTime).setCoord(customerCoord).build();
|
Service service = Service.Builder.newInstance(customer, demand).setServiceTime(serviceTime).setCoord(customerCoord).build();
|
||||||
vrpBuilder.addService(service);
|
vrpBuilder.addJob(service);
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ public class CordeauReader {
|
||||||
double serviceTime = Double.parseDouble(tokens[3].trim());
|
double serviceTime = Double.parseDouble(tokens[3].trim());
|
||||||
int demand = Integer.parseInt(tokens[4].trim());
|
int demand = Integer.parseInt(tokens[4].trim());
|
||||||
Service service = Service.Builder.newInstance(id, demand).setServiceTime(serviceTime).setLocationId(id).setCoord(customerCoord).build();
|
Service service = Service.Builder.newInstance(id, demand).setServiceTime(serviceTime).setLocationId(id).setCoord(customerCoord).build();
|
||||||
vrpBuilder.addService(service);
|
vrpBuilder.addJob(service);
|
||||||
}
|
}
|
||||||
else if(counter <= (nOfCustomers+nOfDepots+nOfDepots)){
|
else if(counter <= (nOfCustomers+nOfDepots+nOfDepots)){
|
||||||
Coordinate depotCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
|
Coordinate depotCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,12 @@ package jsprit.instance.reader;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
|
||||||
import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
|
||||||
import jsprit.core.problem.driver.Driver;
|
import jsprit.core.problem.driver.Driver;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
import jsprit.core.util.CrowFlyCosts;
|
import jsprit.core.util.CrowFlyCosts;
|
||||||
import jsprit.core.util.Locations;
|
import jsprit.core.util.Locations;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
public class FigliozziReader {
|
public class FigliozziReader {
|
||||||
|
|
||||||
|
|
@ -127,17 +123,17 @@ public class FigliozziReader {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private VehicleRoutingProblem.Builder builder;
|
// private VehicleRoutingProblem.Builder builder;
|
||||||
|
//
|
||||||
public FigliozziReader(Builder builder) {
|
// public FigliozziReader(Builder builder) {
|
||||||
super();
|
// super();
|
||||||
this.builder = builder;
|
// this.builder = builder;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void read(String instanceFile, String speedScenarioFile, String speedScenario){
|
// public void read(String instanceFile, String speedScenarioFile, String speedScenario){
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
import jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||||
|
|
@ -47,7 +46,7 @@ public class LuiShenReader {
|
||||||
public LuiShenReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
public LuiShenReader(VehicleRoutingProblem.Builder vrpBuilder) {
|
||||||
super();
|
super();
|
||||||
this.vrpBuilder = vrpBuilder;
|
this.vrpBuilder = vrpBuilder;
|
||||||
this.vrpBuilder.setFleetComposition(FleetComposition.HETEROGENEOUS);
|
// this.vrpBuilder.setFleetComposition(FleetComposition.HETEROGENEOUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,7 +89,7 @@ public class LuiShenReader {
|
||||||
else{
|
else{
|
||||||
Service service = Service.Builder.newInstance("" + counter, demand).setCoord(coord).setLocationId(customerId).setServiceTime(serviceTime)
|
Service service = Service.Builder.newInstance("" + counter, demand).setCoord(coord).setLocationId(customerId).setServiceTime(serviceTime)
|
||||||
.setTimeWindow(TimeWindow.newInstance(start, end)).build();
|
.setTimeWindow(TimeWindow.newInstance(start, end)).build();
|
||||||
vrpBuilder.addService(service);
|
vrpBuilder.addJob(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ public class SolomonReader {
|
||||||
else{
|
else{
|
||||||
Service service = Service.Builder.newInstance(customerId, demand).setCoord(coord).setLocationId(customerId).setServiceTime(serviceTime)
|
Service service = Service.Builder.newInstance(customerId, demand).setCoord(coord).setLocationId(customerId).setServiceTime(serviceTime)
|
||||||
.setTimeWindow(TimeWindow.newInstance(start, end)).build();
|
.setTimeWindow(TimeWindow.newInstance(start, end)).build();
|
||||||
vrpBuilder.addService(service);
|
vrpBuilder.addJob(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@ package jsprit.instance.reader;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetComposition;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||||
import jsprit.instance.reader.LuiShenReader;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -39,11 +37,6 @@ public class LuiShenReaderTest {
|
||||||
vrp = builder.build();
|
vrp = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFleetCompostion(){
|
|
||||||
assertEquals(FleetComposition.HETEROGENEOUS,vrp.getFleetComposition());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFleetSize(){
|
public void testFleetSize(){
|
||||||
assertEquals(FleetSize.INFINITE,vrp.getFleetSize());
|
assertEquals(FleetSize.INFINITE,vrp.getFleetSize());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue