mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
remove deprecated code
This commit is contained in:
parent
ca26171548
commit
2aea38e572
50 changed files with 109 additions and 618 deletions
|
|
@ -102,12 +102,6 @@ public class AlgorithmEventsRecorder implements RuinListener, IterationStartsLis
|
|||
initialiseGraph(vrp);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AlgorithmEventsRecorder(VehicleRoutingProblem vrp, String dgsFileLocation, boolean renderShipments) {
|
||||
this.renderShipments = renderShipments;
|
||||
new AlgorithmEventsRecorder(vrp, dgsFileLocation);
|
||||
}
|
||||
|
||||
public void setRecordingRange(int startIteration, int endIteration) {
|
||||
this.start_recording_at = startIteration;
|
||||
this.end_recording_at = endIteration;
|
||||
|
|
|
|||
|
|
@ -289,11 +289,6 @@ public class GraphStreamViewer {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public GraphStreamViewer setEnableAutoLayout(boolean enableAutoLayout) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public GraphStreamViewer setRenderShipments(boolean renderShipments) {
|
||||
this.renderShipments = renderShipments;
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.analysis.toolbox;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.job.*;
|
||||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
|
|
@ -23,7 +24,6 @@ import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
|
|||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||
import com.graphhopper.jsprit.core.util.Coordinate;
|
||||
import com.graphhopper.jsprit.core.util.Locations;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jfree.chart.*;
|
||||
|
|
@ -459,22 +459,22 @@ public class Plotter {
|
|||
}
|
||||
|
||||
private XYSeriesCollection makeSolutionSeries(VehicleRoutingProblem vrp, Collection<VehicleRoute> routes) throws NoLocationFoundException {
|
||||
Locations locations = retrieveLocations(vrp);
|
||||
Map<String,Coordinate> coords = makeMap(vrp.getAllLocations());
|
||||
XYSeriesCollection coll = new XYSeriesCollection();
|
||||
int counter = 1;
|
||||
for (VehicleRoute route : routes) {
|
||||
if (route.isEmpty()) continue;
|
||||
XYSeries series = new XYSeries(counter, false, true);
|
||||
|
||||
Coordinate startCoord = getCoordinate(locations.getCoord(route.getStart().getLocation().getId()));
|
||||
Coordinate startCoord = getCoordinate(coords.get(route.getStart().getLocation().getId()));
|
||||
series.add(startCoord.getX() * scalingFactor, startCoord.getY() * scalingFactor);
|
||||
|
||||
for (TourActivity act : route.getTourActivities().getActivities()) {
|
||||
Coordinate coord = getCoordinate(locations.getCoord(act.getLocation().getId()));
|
||||
Coordinate coord = getCoordinate(coords.get(act.getLocation().getId()));
|
||||
series.add(coord.getX() * scalingFactor, coord.getY() * scalingFactor);
|
||||
}
|
||||
|
||||
Coordinate endCoord = getCoordinate(locations.getCoord(route.getEnd().getLocation().getId()));
|
||||
Coordinate endCoord = getCoordinate(coords.get(route.getEnd().getLocation().getId()));
|
||||
series.add(endCoord.getX() * scalingFactor, endCoord.getY() * scalingFactor);
|
||||
|
||||
coll.addSeries(series);
|
||||
|
|
@ -483,6 +483,12 @@ public class Plotter {
|
|||
return coll;
|
||||
}
|
||||
|
||||
private Map<String, Coordinate> makeMap(Collection<Location> allLocations) {
|
||||
Map<String, Coordinate> coords = new HashMap<String, Coordinate>();
|
||||
for(Location l : allLocations) coords.put(l.getId(),l.getCoordinate());
|
||||
return coords;
|
||||
}
|
||||
|
||||
private XYSeriesCollection makeShipmentSeries(Collection<Job> jobs) throws NoLocationFoundException {
|
||||
XYSeriesCollection coll = new XYSeriesCollection();
|
||||
if (!plotShipments) return coll;
|
||||
|
|
@ -619,8 +625,5 @@ public class Plotter {
|
|||
activitiesByDataItem.put(item, activity);
|
||||
}
|
||||
|
||||
private Locations retrieveLocations(VehicleRoutingProblem vrp) throws NoLocationFoundException {
|
||||
return vrp.getLocations();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,11 +55,6 @@ public class SearchStrategy {
|
|||
return accepted;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getStrategyName() {
|
||||
return strategyId;
|
||||
}
|
||||
|
||||
public String getStrategyId() {
|
||||
return strategyId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,18 +51,6 @@ public class SearchStrategyManager {
|
|||
return Collections.unmodifiableList(strategies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the probabilities.
|
||||
* [schroeder (2014.11.21): Now they are actually no propabilities anymore but weights. The resulting probabilities
|
||||
* are calculated here with the sum of weights]
|
||||
*
|
||||
* @return list of probabilities
|
||||
*/
|
||||
@Deprecated
|
||||
public List<Double> getProbabilities() {
|
||||
return Collections.unmodifiableList(weights);
|
||||
}
|
||||
|
||||
public List<Double> getWeights() {
|
||||
return Collections.unmodifiableList(weights);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,3 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2014 Stefan Schroeder
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.acceptor;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
|
|
@ -21,9 +5,8 @@ import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolutio
|
|||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @deprecated use GreedyAcceptance instead
|
||||
* Created by schroeder on 09/02/16.
|
||||
*/
|
||||
@Deprecated
|
||||
public class AcceptNewRemoveFirst implements SolutionAcceptor {
|
||||
|
||||
private final int solutionMemory;
|
||||
|
|
@ -51,6 +34,4 @@ public class AcceptNewRemoveFirst implements SolutionAcceptor {
|
|||
public String toString() {
|
||||
return "[name=acceptNewRemoveFirst]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2014 Stefan Schroeder
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
package com.graphhopper.jsprit.core.algorithm.acceptor;
|
||||
|
||||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public class GreedyAcceptance_minVehFirst implements SolutionAcceptor {
|
||||
|
||||
private final int solutionMemory;
|
||||
|
||||
public GreedyAcceptance_minVehFirst(int solutionMemory) {
|
||||
this.solutionMemory = solutionMemory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts every solution if solution memory allows. If memory occupied, than accepts new solution only if better than the worst in memory.
|
||||
* Consequently, the worst solution is removed from solutions, and the new solution added.
|
||||
* <p/>
|
||||
* <p>Note that this modifies Collection<VehicleRoutingProblemSolution> solutions.
|
||||
*/
|
||||
@Override
|
||||
public boolean acceptSolution(Collection<VehicleRoutingProblemSolution> solutions, VehicleRoutingProblemSolution newSolution) {
|
||||
boolean solutionAccepted = false;
|
||||
if (solutions.size() < solutionMemory) {
|
||||
solutions.add(newSolution);
|
||||
solutionAccepted = true;
|
||||
} else {
|
||||
VehicleRoutingProblemSolution worstSolution = null;
|
||||
for (VehicleRoutingProblemSolution s : solutions) {
|
||||
if (worstSolution == null) worstSolution = s;
|
||||
else if (s.getRoutes().size() > worstSolution.getRoutes().size()) worstSolution = s;
|
||||
}
|
||||
if (newSolution.getRoutes().size() < worstSolution.getRoutes().size()) {
|
||||
solutions.remove(worstSolution);
|
||||
solutions.add(newSolution);
|
||||
solutionAccepted = true;
|
||||
} else if (newSolution.getRoutes().size() == worstSolution.getRoutes().size() && newSolution.getCost() < worstSolution.getCost()) {
|
||||
solutions.remove(worstSolution);
|
||||
solutions.add(newSolution);
|
||||
solutionAccepted = true;
|
||||
}
|
||||
}
|
||||
return solutionAccepted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[name=greedyAcceptance_minVehFirst]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -91,11 +91,6 @@ class InsertionFactory {
|
|||
"if latter, you can also omit the tag. this has to be changed in algorithm-config-xml-file");
|
||||
}
|
||||
}
|
||||
String timeSliceString = config.getString("experimental[@timeSlice]");
|
||||
String neighbors = config.getString("experimental[@neighboringSlices]");
|
||||
if (timeSliceString != null && neighbors != null) {
|
||||
iBuilder.experimentalTimeScheduler(Double.parseDouble(timeSliceString), Integer.parseInt(neighbors));
|
||||
}
|
||||
String allowVehicleSwitch = config.getString("allowVehicleSwitch");
|
||||
if (allowVehicleSwitch != null) {
|
||||
iBuilder.setAllowVehicleSwitch(Boolean.parseBoolean(allowVehicleSwitch));
|
||||
|
|
|
|||
|
|
@ -795,11 +795,6 @@ public class VehicleRoutingAlgorithms {
|
|||
typedMap.put(acceptorKey, acceptor);
|
||||
return acceptor;
|
||||
}
|
||||
if (acceptorName.equals("greedyAcceptance_minVehFirst")) {
|
||||
GreedyAcceptance_minVehFirst acceptor = new GreedyAcceptance_minVehFirst(solutionMemory);
|
||||
typedMap.put(acceptorKey, acceptor);
|
||||
return acceptor;
|
||||
}
|
||||
if (acceptorName.equals("schrimpfAcceptance")) {
|
||||
String nuWarmupIterations = strategyConfig.getString("acceptor.warmup");
|
||||
double alpha = strategyConfig.getDouble("acceptor.alpha");
|
||||
|
|
|
|||
|
|
@ -163,17 +163,6 @@ public class BestInsertionBuilder {
|
|||
return bestInsertion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeSlice the time slice
|
||||
* @param nNeighbors number of neighbors
|
||||
* @deprecated this is experimental and can disappear.
|
||||
*/
|
||||
@Deprecated
|
||||
public void experimentalTimeScheduler(double timeSlice, int nNeighbors) {
|
||||
this.timeSlice = timeSlice;
|
||||
this.nNeighbors = nNeighbors;
|
||||
timeScheduling = true;
|
||||
}
|
||||
|
||||
public void setAllowVehicleSwitch(boolean allowVehicleSwitch) {
|
||||
this.allowVehicleSwitch = allowVehicleSwitch;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
|
||||
|
|
@ -79,11 +82,6 @@ public final class BestInsertionConcurrent extends AbstractInsertionStrategy {
|
|||
|
||||
private ExecutorCompletionService<Insertion> completionService;
|
||||
|
||||
@Deprecated
|
||||
public void setRandom(Random random) {
|
||||
super.random = random;
|
||||
}
|
||||
|
||||
public BestInsertionConcurrent(JobInsertionCostsCalculator jobInsertionCalculator, ExecutorService executorService, int nuOfBatches, VehicleRoutingProblem vehicleRoutingProblem) {
|
||||
super(vehicleRoutingProblem);
|
||||
this.insertionsListeners = new InsertionListeners();
|
||||
|
|
|
|||
|
|
@ -204,18 +204,6 @@ public class InsertionBuilder {
|
|||
return insertion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeSlice the time slice
|
||||
* @param nNeighbors number of neighbors
|
||||
* @deprecated this is experimental and can disappear.
|
||||
*/
|
||||
@Deprecated
|
||||
public void experimentalTimeScheduler(double timeSlice, int nNeighbors) {
|
||||
this.timeSlice = timeSlice;
|
||||
this.nNeighbors = nNeighbors;
|
||||
timeScheduling = true;
|
||||
}
|
||||
|
||||
public InsertionBuilder setAllowVehicleSwitch(boolean allowVehicleSwitch) {
|
||||
this.allowVehicleSwitch = allowVehicleSwitch;
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -70,19 +70,6 @@ public abstract class AbstractRuinStrategy implements RuinStrategy {
|
|||
|
||||
public abstract Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes);
|
||||
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
ruinListeners.ruinStarts(vehicleRoutes);
|
||||
Collection<Job> unassigned = ruinRoutes(vehicleRoutes, targetJob, nOfJobs2BeRemoved);
|
||||
ruinListeners.ruinEnds(vehicleRoutes, unassigned);
|
||||
return unassigned;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public abstract Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved);
|
||||
|
||||
@Override
|
||||
public void addListener(RuinListener ruinListener) {
|
||||
ruinListeners.addListener(ruinListener);
|
||||
|
|
|
|||
|
|
@ -106,14 +106,6 @@ public final class RuinClusters extends AbstractRuinStrategy implements Iteratio
|
|||
return unassignedJobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes nOfJobs2BeRemoved from vehicleRoutes, including targetJob.
|
||||
*/
|
||||
@Override
|
||||
public Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
throw new IllegalStateException("not supported");
|
||||
}
|
||||
|
||||
private void ruin(Collection<VehicleRoute> vehicleRoutes, int nOfJobs2BeRemoved, List<Job> unassignedJobs) {
|
||||
if (vrp.getJobs().values().size() == 0) return;
|
||||
Map<Job, VehicleRoute> mappedRoutes = map(vehicleRoutes);
|
||||
|
|
|
|||
|
|
@ -129,10 +129,8 @@ public final class RuinRadial extends AbstractRuinStrategy {
|
|||
/**
|
||||
* Removes targetJob and its neighborhood and returns the removed jobs.
|
||||
*
|
||||
* @deprecated will be private
|
||||
*/
|
||||
@Deprecated
|
||||
public Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
private Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
List<Job> unassignedJobs = new ArrayList<Job>();
|
||||
int nNeighbors = nOfJobs2BeRemoved - 1;
|
||||
removeJob(targetJob, vehicleRoutes);
|
||||
|
|
@ -147,4 +145,5 @@ public final class RuinRadial extends AbstractRuinStrategy {
|
|||
return unassignedJobs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.util.*;
|
|||
*
|
||||
* @author stefan
|
||||
*/
|
||||
@Deprecated
|
||||
public final class RuinRadialMultipleCenters extends AbstractRuinStrategy {
|
||||
|
||||
private Logger logger = LogManager.getLogger(RuinRadialMultipleCenters.class);
|
||||
|
|
@ -96,16 +97,6 @@ public final class RuinRadialMultipleCenters extends AbstractRuinStrategy {
|
|||
return ruined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes targetJob and its neighborhood and returns the removed jobs.
|
||||
*
|
||||
* @deprecated will be private
|
||||
*/
|
||||
@Deprecated
|
||||
public Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
return ruinRoutes_(vehicleRoutes, targetJob, nOfJobs2BeRemoved, null);
|
||||
}
|
||||
|
||||
private Collection<Job> ruinRoutes_(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved, Set<Job> available) {
|
||||
List<Job> unassignedJobs = new ArrayList<Job>();
|
||||
int nNeighbors = nOfJobs2BeRemoved - 1;
|
||||
|
|
|
|||
|
|
@ -75,14 +75,6 @@ public final class RuinRandom extends AbstractRuinStrategy {
|
|||
return unassignedJobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes nOfJobs2BeRemoved from vehicleRoutes, including targetJob.
|
||||
*/
|
||||
@Override
|
||||
public Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
throw new IllegalStateException("not supported");
|
||||
}
|
||||
|
||||
private void ruin(Collection<VehicleRoute> vehicleRoutes, int nOfJobs2BeRemoved, List<Job> unassignedJobs) {
|
||||
ArrayList<Job> availableJobs = new ArrayList<Job>(vrp.getJobs().values());
|
||||
Collections.shuffle(availableJobs, random);
|
||||
|
|
|
|||
|
|
@ -38,12 +38,6 @@ public interface RuinStrategy {
|
|||
*/
|
||||
public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes);
|
||||
|
||||
/**
|
||||
* Removes targetJob as well as its neighbors with a size of (nOfJobs2BeRemoved-1).
|
||||
*/
|
||||
@Deprecated
|
||||
public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved);
|
||||
|
||||
/**
|
||||
* Adds a ruin-listener.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -79,14 +79,6 @@ public final class RuinWorst extends AbstractRuinStrategy {
|
|||
return unassignedJobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes nOfJobs2BeRemoved from vehicleRoutes, including targetJob.
|
||||
*/
|
||||
@Override
|
||||
public Collection<Job> ruinRoutes(Collection<VehicleRoute> vehicleRoutes, Job targetJob, int nOfJobs2BeRemoved) {
|
||||
throw new UnsupportedOperationException("ruinRoutes not supported");
|
||||
}
|
||||
|
||||
private void ruin(Collection<VehicleRoute> vehicleRoutes, int nOfJobs2BeRemoved, List<Job> unassignedJobs) {
|
||||
LinkedList<Job> availableJobs = new LinkedList<Job>(vrp.getJobs().values());
|
||||
int toRemove = nOfJobs2BeRemoved;
|
||||
|
|
|
|||
|
|
@ -634,8 +634,4 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
|
|||
addActivityVisitor(new UpdateSkills(this));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void addCoreUpdater() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ package com.graphhopper.jsprit.core.analysis;
|
|||
import com.graphhopper.jsprit.core.algorithm.VariablePlusFixedSolutionCostCalculatorFactory;
|
||||
import com.graphhopper.jsprit.core.algorithm.state.*;
|
||||
import com.graphhopper.jsprit.core.problem.Capacity;
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.cost.TransportDistance;
|
||||
import com.graphhopper.jsprit.core.problem.cost.VehicleRoutingActivityCosts;
|
||||
|
|
@ -54,15 +53,6 @@ public class SolutionAnalyser {
|
|||
|
||||
private final static String LOAD_DELIVERED = "load-delivered";
|
||||
|
||||
/**
|
||||
* @deprecated use TransportDistance instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static interface DistanceCalculator {
|
||||
|
||||
public double getDistance(Location from, Location to);
|
||||
|
||||
}
|
||||
|
||||
private static class LoadAndActivityCounter implements StateUpdater, ActivityVisitor {
|
||||
|
||||
|
|
@ -304,7 +294,7 @@ public class SolutionAnalyser {
|
|||
private static class LastTransportUpdater implements StateUpdater, ActivityVisitor {
|
||||
private final StateManager stateManager;
|
||||
private final VehicleRoutingTransportCosts transportCost;
|
||||
private final DistanceCalculator distanceCalculator;
|
||||
private final TransportDistance distanceCalculator;
|
||||
private final StateId last_transport_distance_id;
|
||||
private final StateId last_transport_time_id;
|
||||
private final StateId last_transport_cost_id;
|
||||
|
|
@ -313,7 +303,7 @@ public class SolutionAnalyser {
|
|||
private VehicleRoute route;
|
||||
|
||||
|
||||
private LastTransportUpdater(StateManager stateManager, VehicleRoutingTransportCosts transportCost, DistanceCalculator distanceCalculator, StateId last_distance_id, StateId last_time_id, StateId last_cost_id) {
|
||||
private LastTransportUpdater(StateManager stateManager, VehicleRoutingTransportCosts transportCost, TransportDistance distanceCalculator, StateId last_distance_id, StateId last_time_id, StateId last_cost_id) {
|
||||
this.stateManager = stateManager;
|
||||
this.transportCost = transportCost;
|
||||
this.distanceCalculator = distanceCalculator;
|
||||
|
|
@ -368,13 +358,13 @@ public class SolutionAnalyser {
|
|||
|
||||
private double sum_distance = 0.;
|
||||
|
||||
private DistanceCalculator distanceCalculator;
|
||||
private TransportDistance distanceCalculator;
|
||||
|
||||
private TourActivity prevAct;
|
||||
|
||||
private VehicleRoute route;
|
||||
|
||||
private DistanceUpdater(StateId distance_id, StateManager stateManager, DistanceCalculator distanceCalculator) {
|
||||
private DistanceUpdater(StateId distance_id, StateManager stateManager, TransportDistance distanceCalculator) {
|
||||
this.distance_id = distance_id;
|
||||
this.stateManager = stateManager;
|
||||
this.distanceCalculator = distanceCalculator;
|
||||
|
|
@ -451,7 +441,7 @@ public class SolutionAnalyser {
|
|||
|
||||
private StateManager stateManager;
|
||||
|
||||
private DistanceCalculator distanceCalculator;
|
||||
private TransportDistance distanceCalculator;
|
||||
|
||||
private StateId waiting_time_id;
|
||||
|
||||
|
|
@ -510,10 +500,9 @@ public class SolutionAnalyser {
|
|||
* @param vrp
|
||||
* @param solution
|
||||
* @param distanceCalculator
|
||||
* @deprecated use SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, final TransportDistance distanceCalculator) instead
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, DistanceCalculator distanceCalculator) {
|
||||
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, TransportDistance distanceCalculator) {
|
||||
this.vrp = vrp;
|
||||
this.solution = solution;
|
||||
this.distanceCalculator = distanceCalculator;
|
||||
|
|
@ -522,21 +511,7 @@ public class SolutionAnalyser {
|
|||
refreshStates();
|
||||
}
|
||||
|
||||
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, final TransportDistance distanceCalculator) {
|
||||
this.vrp = vrp;
|
||||
this.solution = solution;
|
||||
this.distanceCalculator = new DistanceCalculator() {
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
return distanceCalculator.getDistance(from, to);
|
||||
}
|
||||
};
|
||||
initialise();
|
||||
this.solutionCostCalculator = new VariablePlusFixedSolutionCostCalculatorFactory(stateManager).createCalculator();
|
||||
refreshStates();
|
||||
}
|
||||
|
||||
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, SolutionCostCalculator solutionCostCalculator, DistanceCalculator distanceCalculator) {
|
||||
public SolutionAnalyser(VehicleRoutingProblem vrp, VehicleRoutingProblemSolution solution, SolutionCostCalculator solutionCostCalculator, TransportDistance distanceCalculator) {
|
||||
this.vrp = vrp;
|
||||
this.solution = solution;
|
||||
this.distanceCalculator = distanceCalculator;
|
||||
|
|
@ -684,7 +659,7 @@ public class SolutionAnalyser {
|
|||
}
|
||||
|
||||
private void verifyThatRouteContainsAct(TourActivity activity, VehicleRoute route) {
|
||||
if (!route.getTourActivities().hasActivity(activity)) {
|
||||
if (!route.getActivities().contains(activity)) {
|
||||
throw new IllegalArgumentException("specified route does not contain specified activity " + activity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,9 +203,8 @@ public class VehicleRoutingProblem {
|
|||
* @param job job to be added
|
||||
* @return this builder
|
||||
* @throws IllegalStateException if job is neither a shipment nor a service, or jobId has already been added.
|
||||
* @deprecated use addJob(AbstractJob job) instead
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public Builder addJob(Job job) {
|
||||
if (!(job instanceof AbstractJob)) throw new IllegalArgumentException("job must be of type AbstractJob");
|
||||
return addJob((AbstractJob) job);
|
||||
|
|
@ -348,9 +347,7 @@ public class VehicleRoutingProblem {
|
|||
*
|
||||
* @param vehicle vehicle to be added
|
||||
* @return this builder
|
||||
* @deprecated use addVehicle(AbstractVehicle vehicle) instead
|
||||
*/
|
||||
@Deprecated
|
||||
* */
|
||||
public Builder addVehicle(Vehicle vehicle) {
|
||||
if (!(vehicle instanceof AbstractVehicle))
|
||||
throw new IllegalStateException("vehicle must be an AbstractVehicle");
|
||||
|
|
@ -445,7 +442,6 @@ public class VehicleRoutingProblem {
|
|||
* @param jobs which is a collection of jobs that subclasses Job
|
||||
* @return this builder
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public Builder addAllJobs(Collection<? extends Job> jobs) {
|
||||
for (Job j : jobs) {
|
||||
addJob(j);
|
||||
|
|
@ -453,6 +449,7 @@ public class VehicleRoutingProblem {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a collection of vehicles.
|
||||
*
|
||||
|
|
@ -663,15 +660,6 @@ public class VehicleRoutingProblem {
|
|||
return activityCosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns all location, i.e. from vehicles and jobs.
|
||||
*/
|
||||
@Deprecated
|
||||
public Locations getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
|
||||
public Collection<Location> getAllLocations(){
|
||||
return allLocations;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import com.graphhopper.jsprit.core.problem.job.*;
|
|||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivityFactory;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||
|
|
@ -70,12 +69,6 @@ public class VrpXMLReader {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
interface JobConfigReader {
|
||||
|
||||
void readConfig(XMLConfiguration vrpProblem);
|
||||
}
|
||||
|
||||
private static Logger logger = LogManager.getLogger(VrpXMLReader.class);
|
||||
|
||||
private VehicleRoutingProblem.Builder vrpBuilder;
|
||||
|
|
@ -94,21 +87,7 @@ public class VrpXMLReader {
|
|||
|
||||
private ServiceBuilderFactory serviceBuilderFactory = new DefaultServiceBuilderFactory();
|
||||
|
||||
private Collection<JobConfigReader> jobConfigReaders = new ArrayList<VrpXMLReader.JobConfigReader>();
|
||||
|
||||
@Deprecated
|
||||
public void addJobConfigReader(JobConfigReader reader) {
|
||||
jobConfigReaders.add(reader);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setTourActivityFactory(TourActivityFactory tourActivityFactory) {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setServiceBuilderFactory(ServiceBuilderFactory serviceBuilderFactory) {
|
||||
this.serviceBuilderFactory = serviceBuilderFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param schemaValidation the schemaValidation to set
|
||||
|
|
@ -287,7 +266,6 @@ public class VrpXMLReader {
|
|||
|
||||
VehicleRoute.Builder routeBuilder = VehicleRoute.Builder.newInstance(vehicle, driver);
|
||||
routeBuilder.setDepartureTime(departureTime);
|
||||
routeBuilder.setRouteEndArrivalTime(Double.parseDouble(end));
|
||||
List<HierarchicalConfiguration> actConfigs = routeConfig.configurationsAt("act");
|
||||
for (HierarchicalConfiguration actConfig : actConfigs) {
|
||||
String type = actConfig.getString("[@type]");
|
||||
|
|
|
|||
|
|
@ -139,32 +139,6 @@ public class VehicleRoute {
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the serviceActivityFactory to create serviceActivities.
|
||||
* <p/>
|
||||
* <p>By default {@link DefaultTourActivityFactory} is used.
|
||||
*
|
||||
* @param serviceActivityFactory the factory to create serviceActivities
|
||||
*/
|
||||
@Deprecated
|
||||
public Builder setServiceActivityFactory(TourActivityFactory serviceActivityFactory) {
|
||||
this.serviceActivityFactory = serviceActivityFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the shipmentActivityFactory to create shipmentActivities.
|
||||
* <p/>
|
||||
* <p>By default {@link DefaultShipmentActivityFactory} is used.
|
||||
*
|
||||
* @param shipmentActivityFactory the factory to create shipmentActivities
|
||||
*/
|
||||
@Deprecated
|
||||
public Builder setShipmentActivityFactory(TourShipmentActivityFactory shipmentActivityFactory) {
|
||||
this.shipmentActivityFactory = shipmentActivityFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setJobActivityFactory(JobActivityFactory jobActivityFactory) {
|
||||
this.jobActivityFactory = jobActivityFactory;
|
||||
return this;
|
||||
|
|
@ -195,21 +169,6 @@ public class VehicleRoute {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end-time of the route, i.e. which is the time the vehicle has to be at its end-location at latest.
|
||||
*
|
||||
* @param endTime endTime of route
|
||||
* @return this builder
|
||||
* @throws IllegalArgumentException if endTime > vehicle.getLatestArrival()
|
||||
*/
|
||||
@Deprecated
|
||||
public Builder setRouteEndArrivalTime(double endTime) {
|
||||
if (endTime > vehicle.getLatestArrival())
|
||||
throw new IllegalArgumentException("endTime > vehicle.getLatestArrival(). this must not be.");
|
||||
end.setArrTime(endTime);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a service to this route. Activity is initialized with .getTimeWindow(). If you want to explicitly set another time window
|
||||
* use .addService(Service service, TimeWindow timeWindow)
|
||||
|
|
|
|||
|
|
@ -135,11 +135,6 @@ public class BreakActivity extends AbstractActivity implements TourActivity.JobA
|
|||
return aBreak.getServiceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
return aBreak.getLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
|
|
|
|||
|
|
@ -56,11 +56,6 @@ public final class DeliverService extends AbstractActivity implements DeliveryAc
|
|||
return delivery.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
return delivery.getLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return delivery.getLocation();
|
||||
|
|
@ -123,7 +118,7 @@ public final class DeliverService extends AbstractActivity implements DeliveryAc
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return "[type=" + getName() + "][locationId=" + getLocationId()
|
||||
return "[type=" + getName() + "][locationId=" + getLocation().getId()
|
||||
+ "][size=" + getSize().toString()
|
||||
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ public final class DeliverShipment extends AbstractActivity implements DeliveryA
|
|||
this.capacity = Capacity.invert(shipment.getSize());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public DeliverShipment(DeliverShipment deliveryShipmentActivity) {
|
||||
private DeliverShipment(DeliverShipment deliveryShipmentActivity) {
|
||||
this.shipment = (Shipment) deliveryShipmentActivity.getJob();
|
||||
this.arrTime = deliveryShipmentActivity.getArrTime();
|
||||
this.endTime = deliveryShipmentActivity.getEndTime();
|
||||
|
|
@ -73,11 +72,6 @@ public final class DeliverShipment extends AbstractActivity implements DeliveryA
|
|||
return "deliverShipment";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
return shipment.getDeliveryLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return shipment.getDeliveryLocation();
|
||||
|
|
@ -124,7 +118,7 @@ public final class DeliverShipment extends AbstractActivity implements DeliveryA
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return "[type=" + getName() + "][locationId=" + getLocationId()
|
||||
return "[type=" + getName() + "][locationId=" + getLocation().getId()
|
||||
+ "][size=" + getSize().toString()
|
||||
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||
|
|
|
|||
|
|
@ -19,15 +19,10 @@ package com.graphhopper.jsprit.core.problem.solution.route.activity;
|
|||
import com.graphhopper.jsprit.core.problem.AbstractActivity;
|
||||
import com.graphhopper.jsprit.core.problem.Capacity;
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.util.Coordinate;
|
||||
|
||||
public final class End extends AbstractActivity implements TourActivity {
|
||||
|
||||
@Deprecated
|
||||
public static int creation = 0;
|
||||
|
||||
public static End newInstance(String locationId, double earliestArrival, double latestArrival) {
|
||||
creation++;
|
||||
return new End(locationId, earliestArrival, latestArrival);
|
||||
}
|
||||
|
||||
|
|
@ -37,17 +32,6 @@ public final class End extends AbstractActivity implements TourActivity {
|
|||
|
||||
private final static Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
|
||||
private Coordinate coordinate;
|
||||
|
||||
@Deprecated
|
||||
Coordinate getCoordinate() {
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
void setCoordinate(Coordinate coordinate) {
|
||||
this.coordinate = coordinate;
|
||||
}
|
||||
|
||||
private double endTime = -1;
|
||||
|
||||
|
|
@ -112,23 +96,10 @@ public final class End extends AbstractActivity implements TourActivity {
|
|||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setLocationId(String locationId) {
|
||||
if (locationId == null) return;
|
||||
this.location = Location.Builder.newInstance().setId(locationId).build();
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
if (location == null) return null;
|
||||
return location.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
|
|
|
|||
|
|
@ -57,11 +57,6 @@ public final class PickupService extends AbstractActivity implements PickupActiv
|
|||
return pickup.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
return pickup.getLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return pickup.getLocation();
|
||||
|
|
@ -123,7 +118,7 @@ public final class PickupService extends AbstractActivity implements PickupActiv
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return "[type=" + getName() + "][locationId=" + getLocationId()
|
||||
return "[type=" + getName() + "][locationId=" + getLocation().getId()
|
||||
+ "][size=" + getSize().toString()
|
||||
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ public final class PickupShipment extends AbstractActivity implements PickupActi
|
|||
this.shipment = shipment;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public PickupShipment(PickupShipment pickupShipmentActivity) {
|
||||
private PickupShipment(PickupShipment pickupShipmentActivity) {
|
||||
this.shipment = (Shipment) pickupShipmentActivity.getJob();
|
||||
this.arrTime = pickupShipmentActivity.getArrTime();
|
||||
this.endTime = pickupShipmentActivity.getEndTime();
|
||||
|
|
@ -69,11 +68,6 @@ public final class PickupShipment extends AbstractActivity implements PickupActi
|
|||
return "pickupShipment";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
return shipment.getPickupLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return shipment.getPickupLocation();
|
||||
|
|
@ -120,7 +114,7 @@ public final class PickupShipment extends AbstractActivity implements PickupActi
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return "[type=" + getName() + "][locationId=" + getLocationId()
|
||||
return "[type=" + getName() + "][locationId=" + getLocation().getId()
|
||||
+ "][size=" + getSize().toString()
|
||||
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@ import com.graphhopper.jsprit.core.problem.job.Service;
|
|||
|
||||
public class ServiceActivity extends AbstractActivity implements TourActivity.JobActivity {
|
||||
|
||||
@Deprecated
|
||||
public static int counter = 0;
|
||||
|
||||
public double arrTime;
|
||||
|
||||
public double endTime;
|
||||
|
|
@ -74,12 +71,10 @@ public class ServiceActivity extends AbstractActivity implements TourActivity.Jo
|
|||
private final Service service;
|
||||
|
||||
protected ServiceActivity(Service service) {
|
||||
counter++;
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
protected ServiceActivity(ServiceActivity serviceActivity) {
|
||||
counter++;
|
||||
this.service = serviceActivity.getJob();
|
||||
this.arrTime = serviceActivity.getArrTime();
|
||||
this.endTime = serviceActivity.getEndTime();
|
||||
|
|
@ -143,11 +138,6 @@ public class ServiceActivity extends AbstractActivity implements TourActivity.Jo
|
|||
return service.getServiceDuration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
return service.getLocation().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return service.getLocation();
|
||||
|
|
@ -162,7 +152,7 @@ public class ServiceActivity extends AbstractActivity implements TourActivity.Jo
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[type=" + getName() + "][locationId=" + getLocationId()
|
||||
return "[type=" + getName() + "][locationId=" + getLocation().getId()
|
||||
+ "][size=" + getSize().toString()
|
||||
+ "][twStart=" + Activities.round(getTheoreticalEarliestOperationStartTime())
|
||||
+ "][twEnd=" + Activities.round(getTheoreticalLatestOperationStartTime()) + "]";
|
||||
|
|
|
|||
|
|
@ -22,15 +22,12 @@ import com.graphhopper.jsprit.core.problem.Location;
|
|||
|
||||
public final class Start extends AbstractActivity implements TourActivity {
|
||||
|
||||
public final static String ACTIVITY_NAME = "start";
|
||||
|
||||
@Deprecated
|
||||
public static int creation;
|
||||
|
||||
public final static String ACTIVITY_NAME = "start";
|
||||
|
||||
private final static Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
|
||||
public static Start newInstance(String locationId, double theoreticalStart, double theoreticalEnd) {
|
||||
creation++;
|
||||
return new Start(locationId, theoreticalStart, theoreticalEnd);
|
||||
}
|
||||
|
||||
|
|
@ -50,8 +47,7 @@ public final class Start extends AbstractActivity implements TourActivity {
|
|||
|
||||
private Location location;
|
||||
|
||||
@Deprecated
|
||||
public Start(String locationId, double theoreticalStart, double theoreticalEnd) {
|
||||
private Start(String locationId, double theoreticalStart, double theoreticalEnd) {
|
||||
super();
|
||||
if (locationId != null) this.location = Location.Builder.newInstance().setId(locationId).build();
|
||||
this.theoretical_earliestOperationStartTime = theoreticalStart;
|
||||
|
|
@ -81,12 +77,6 @@ public final class Start extends AbstractActivity implements TourActivity {
|
|||
return theoretical_earliestOperationStartTime;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setLocationId(String locationId) {
|
||||
if (locationId == null) return;
|
||||
this.location = Location.Builder.newInstance().setId(locationId).build();
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
|
@ -97,23 +87,15 @@ public final class Start extends AbstractActivity implements TourActivity {
|
|||
return theoretical_latestOperationStartTime;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
public void setTheoreticalEarliestOperationStartTime(double time) {
|
||||
this.theoretical_earliestOperationStartTime = time;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setTheoreticalLatestOperationStartTime(double time) {
|
||||
this.theoretical_latestOperationStartTime = time;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public String getLocationId() {
|
||||
if (location == null) return null;
|
||||
return location.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
|
|
|
|||
|
|
@ -146,17 +146,6 @@ public class TourActivities {
|
|||
return activityRemoved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this contains specified activity.
|
||||
*
|
||||
* @param activity to be looked up
|
||||
* @return true if this contains specified activity, false otherwise
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasActivity(TourActivity activity) {
|
||||
return tourActivities.contains(activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes activity from this activity sequence. Removes its corresponding job as well, if there are no other activities
|
||||
* related to this job.
|
||||
|
|
|
|||
|
|
@ -59,15 +59,6 @@ public interface TourActivity extends HasIndex {
|
|||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Returns the activity's locationId.
|
||||
*
|
||||
* @return locationId
|
||||
* @deprecated use location
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract String getLocationId();
|
||||
|
||||
/**
|
||||
* Returns location.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public class CalculationUtils {
|
|||
* @param act
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static double getActivityEndTime(double actArrTime, TourActivity act){
|
||||
return Math.max(actArrTime, act.getTheoreticalEarliestOperationStartTime()) + act.getOperationTime();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,25 +49,10 @@ public class GreatCircleCosts extends AbstractForwardVehicleRoutingTransportCost
|
|||
this.detour = detour;
|
||||
}
|
||||
|
||||
private Locations locations;
|
||||
|
||||
private DistanceUnit distanceUnit = DistanceUnit.Kilometer;
|
||||
|
||||
@Deprecated
|
||||
public GreatCircleCosts(Locations locations) {
|
||||
public GreatCircleCosts() {
|
||||
super();
|
||||
this.locations = locations;
|
||||
}
|
||||
|
||||
public GreatCircleCosts() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public GreatCircleCosts(Locations locations, DistanceUnit distanceUnit) {
|
||||
super();
|
||||
this.locations = locations;
|
||||
this.distanceUnit = distanceUnit;
|
||||
}
|
||||
|
||||
public GreatCircleCosts(DistanceUnit distanceUnit) {
|
||||
|
|
@ -96,12 +81,9 @@ public class GreatCircleCosts extends AbstractForwardVehicleRoutingTransportCost
|
|||
private double calculateDistance(Location fromLocation, Location toLocation) {
|
||||
Coordinate from = null;
|
||||
Coordinate to = null;
|
||||
if (fromLocation.getCoordinate() != null & toLocation.getCoordinate() != null) {
|
||||
if (fromLocation.getCoordinate() != null && toLocation.getCoordinate() != null) {
|
||||
from = fromLocation.getCoordinate();
|
||||
to = toLocation.getCoordinate();
|
||||
} else if (locations != null) {
|
||||
from = locations.getCoord(fromLocation.getId());
|
||||
to = locations.getCoord(toLocation.getId());
|
||||
}
|
||||
if (from == null || to == null) throw new NullPointerException("either from or to location is null");
|
||||
return GreatCircleDistanceCalculator.calculateDistance(from, to, distanceUnit) * detour;
|
||||
|
|
@ -112,19 +94,6 @@ public class GreatCircleCosts extends AbstractForwardVehicleRoutingTransportCost
|
|||
return calculateDistance(from, to) / speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fromId
|
||||
* @param toId
|
||||
* @return
|
||||
* @deprecated use getDistance(Location from, Location to) instead
|
||||
*/
|
||||
@Deprecated
|
||||
public double getDistance(String fromId, String toId) {
|
||||
Coordinate fromCoordinate = locations.getCoord(fromId);
|
||||
Coordinate toCoordinate = locations.getCoord(toId);
|
||||
return GreatCircleDistanceCalculator.calculateDistance(fromCoordinate, toCoordinate, distanceUnit) * detour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
return calculateDistance(from, to);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class VehicleRoutingAlgorithmTest {
|
|||
VehicleRoutingAlgorithm algorithm = new VehicleRoutingAlgorithm(mock(VehicleRoutingProblem.class),
|
||||
stratManager);
|
||||
when(stratManager.getRandomStrategy()).thenReturn(mock(SearchStrategy.class));
|
||||
when(stratManager.getProbabilities()).thenReturn(Arrays.asList(1.0));
|
||||
when(stratManager.getWeights()).thenReturn(Arrays.asList(1.0));
|
||||
algorithm.setMaxIterations(1000);
|
||||
CountIterations counter = new CountIterations();
|
||||
algorithm.addListener(counter);
|
||||
|
|
@ -82,7 +82,7 @@ public class VehicleRoutingAlgorithmTest {
|
|||
VehicleRoutingAlgorithm algorithm = new VehicleRoutingAlgorithm(mock(VehicleRoutingProblem.class),
|
||||
stratManager);
|
||||
when(stratManager.getRandomStrategy()).thenReturn(mock(SearchStrategy.class));
|
||||
when(stratManager.getProbabilities()).thenReturn(Arrays.asList(1.0));
|
||||
when(stratManager.getWeights()).thenReturn(Arrays.asList(1.0));
|
||||
algorithm.setMaxIterations(1000);
|
||||
CountIterations counter = new CountIterations();
|
||||
algorithm.addListener(counter);
|
||||
|
|
@ -96,7 +96,7 @@ public class VehicleRoutingAlgorithmTest {
|
|||
VehicleRoutingAlgorithm algorithm = new VehicleRoutingAlgorithm(mock(VehicleRoutingProblem.class),
|
||||
stratManager);
|
||||
when(stratManager.getRandomStrategy()).thenReturn(mock(SearchStrategy.class));
|
||||
when(stratManager.getProbabilities()).thenReturn(Arrays.asList(1.0));
|
||||
when(stratManager.getWeights()).thenReturn(Arrays.asList(1.0));
|
||||
algorithm.setMaxIterations(1000);
|
||||
PrematureAlgorithmTermination termination = new PrematureAlgorithmTermination() {
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ public class VehicleRoutingAlgorithmTest {
|
|||
SearchStrategyManager stratManager = mock(SearchStrategyManager.class);
|
||||
VehicleRoutingAlgorithm algorithm = new VehicleRoutingAlgorithm(mock(VehicleRoutingProblem.class), stratManager);
|
||||
when(stratManager.getRandomStrategy()).thenReturn(mock(SearchStrategy.class));
|
||||
when(stratManager.getProbabilities()).thenReturn(Arrays.asList(1.0));
|
||||
when(stratManager.getWeights()).thenReturn(Arrays.asList(1.0));
|
||||
algorithm.setMaxIterations(1000);
|
||||
PrematureAlgorithmTermination termination = new PrematureAlgorithmTermination() {
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ public class VehicleRoutingAlgorithmTest {
|
|||
SearchStrategyManager stratManager = mock(SearchStrategyManager.class);
|
||||
VehicleRoutingAlgorithm algorithm = new VehicleRoutingAlgorithm(mock(VehicleRoutingProblem.class), stratManager);
|
||||
when(stratManager.getRandomStrategy()).thenReturn(mock(SearchStrategy.class));
|
||||
when(stratManager.getProbabilities()).thenReturn(Arrays.asList(1.0));
|
||||
when(stratManager.getWeights()).thenReturn(Arrays.asList(1.0));
|
||||
algorithm.setMaxIterations(1000);
|
||||
PrematureAlgorithmTermination termination = new PrematureAlgorithmTermination() {
|
||||
|
||||
|
|
|
|||
|
|
@ -193,11 +193,6 @@ public class TestAlgorithmReader {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Job> ruin(Collection<VehicleRoute> vehicleRoutes,
|
||||
Job targetJob, int nOfJobs2BeRemoved) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(RuinListener ruinListener) {
|
||||
|
|
|
|||
|
|
@ -2212,7 +2212,7 @@ public class SolutionAnalyserTest {
|
|||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
TourActivity deliverShipment = route.getActivities().get(2);
|
||||
route.getTourActivities().removeActivity(deliverShipment);
|
||||
assertFalse(route.getTourActivities().hasActivity(deliverShipment));
|
||||
assertFalse(route.getActivities().contains(deliverShipment));
|
||||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
|
|
@ -2233,7 +2233,7 @@ public class SolutionAnalyserTest {
|
|||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
TourActivity pickupShipment = route.getActivities().get(1);
|
||||
route.getTourActivities().removeActivity(pickupShipment);
|
||||
assertFalse(route.getTourActivities().hasActivity(pickupShipment));
|
||||
assertFalse(route.getActivities().contains(pickupShipment));
|
||||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
|
|
@ -2254,7 +2254,7 @@ public class SolutionAnalyserTest {
|
|||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
TourActivity pickupShipment = route.getActivities().get(1);
|
||||
route.getTourActivities().removeActivity(pickupShipment);
|
||||
assertFalse(route.getTourActivities().hasActivity(pickupShipment));
|
||||
assertFalse(route.getActivities().contains(pickupShipment));
|
||||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
|
|
@ -2275,7 +2275,7 @@ public class SolutionAnalyserTest {
|
|||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
TourActivity pickupShipment = route.getActivities().get(1);
|
||||
route.getTourActivities().removeActivity(pickupShipment);
|
||||
assertFalse(route.getTourActivities().hasActivity(pickupShipment));
|
||||
assertFalse(route.getActivities().contains(pickupShipment));
|
||||
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.matchers.JUnitMatchers.hasItem;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
|
@ -408,15 +409,17 @@ public class VehicleRoutingProblemTest {
|
|||
|
||||
@Test
|
||||
public void whenAddingInitialRoute_locationOfVehicleMustBeMemorized() {
|
||||
Location start = TestUtils.loc("start", Coordinate.newInstance(0, 1));
|
||||
Location end = Location.newInstance("end");
|
||||
VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v")
|
||||
.setStartLocation(TestUtils.loc("start", Coordinate.newInstance(0, 1)))
|
||||
.setEndLocation(Location.newInstance("end")).build();
|
||||
.setStartLocation(start)
|
||||
.setEndLocation(end).build();
|
||||
VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
vrpBuilder.addInitialVehicleRoute(route);
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
assertEquals(0., vrp.getLocations().getCoord("start").getX(), 0.01);
|
||||
assertEquals(1., vrp.getLocations().getCoord("start").getY(), 0.01);
|
||||
assertThat(vrp.getAllLocations(),hasItem(start));
|
||||
assertThat(vrp.getAllLocations(),hasItem(end));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -178,29 +178,5 @@ public class VehicleRouteBuilderTest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void whenSettingEndTime() {
|
||||
Shipment s = mock(Shipment.class);
|
||||
Shipment s2 = mock(Shipment.class);
|
||||
Capacity capacity = Capacity.Builder.newInstance().build();
|
||||
when(s.getSize()).thenReturn(capacity);
|
||||
when(s2.getSize()).thenReturn(capacity);
|
||||
when(s2.getDeliveryLocation()).thenReturn(Location.Builder.newInstance().setId("delLoc").build());
|
||||
when(s2.getPickupTimeWindow()).thenReturn(TimeWindow.newInstance(0.,10.));
|
||||
when(s2.getDeliveryTimeWindow()).thenReturn(TimeWindow.newInstance(0.,10.));
|
||||
when(s.getPickupTimeWindow()).thenReturn(TimeWindow.newInstance(0., 10.));
|
||||
when(s.getDeliveryTimeWindow()).thenReturn(TimeWindow.newInstance(0.,10.));
|
||||
Vehicle vehicle = mock(Vehicle.class);
|
||||
when(vehicle.isReturnToDepot()).thenReturn(false);
|
||||
when(vehicle.getStartLocation()).thenReturn(Location.Builder.newInstance().setId("vehLoc").build());
|
||||
when(vehicle.getLatestArrival()).thenReturn(200.0);
|
||||
VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
|
||||
builder.addPickup(s);
|
||||
builder.addPickup(s2);
|
||||
builder.addDelivery(s);
|
||||
builder.addDelivery(s2);
|
||||
builder.setRouteEndArrivalTime(100.0);
|
||||
VehicleRoute route = builder.build();
|
||||
assertEquals(100.0, route.getEnd().getArrTime(), 0.01);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,12 +48,6 @@ public class EndTest {
|
|||
assertEquals(4., end.getEndTime(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSettingLocationId_itShouldBeSetCorrectly() {
|
||||
End end = End.newInstance("loc", 1., 2.);
|
||||
end.setLocationId("newLoc");
|
||||
assertEquals("newLoc", end.getLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSettingEarliestStart_itShouldBeSetCorrectly() {
|
||||
|
|
|
|||
|
|
@ -48,13 +48,6 @@ public class StartTest {
|
|||
assertEquals(4., start.getEndTime(), 0.01);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSettingLocationId_itShouldBeSetCorrectly() {
|
||||
Start start = Start.newInstance("loc", 1., 2.);
|
||||
start.setLocationId("newLoc");
|
||||
assertEquals("newLoc", start.getLocation().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenSettingEarliestStart_itShouldBeSetCorrectly() {
|
||||
Start start = Start.newInstance("loc", 1., 2.);
|
||||
|
|
|
|||
|
|
@ -121,12 +121,12 @@ public class TestTourActivities {
|
|||
public void removingActivityShouldWork() {
|
||||
tour.addActivity(act);
|
||||
assertTrue(tour.servesJob(service));
|
||||
assertTrue(tour.hasActivity(act));
|
||||
assertTrue(tour.getActivities().contains(act));
|
||||
|
||||
tour.removeActivity(act);
|
||||
|
||||
assertTrue(tour.isEmpty());
|
||||
assertFalse(tour.hasActivity(act));
|
||||
assertFalse(tour.getActivities().contains(act));
|
||||
assertFalse(tour.servesJob(service));
|
||||
assertEquals(0, tour.jobSize());
|
||||
}
|
||||
|
|
@ -136,12 +136,11 @@ public class TestTourActivities {
|
|||
tour.addActivity(act);
|
||||
|
||||
assertTrue(tour.servesJob(service));
|
||||
assertTrue(tour.hasActivity(act));
|
||||
|
||||
TourActivities acts = TourActivities.copyOf(tour);
|
||||
|
||||
assertTrue(acts.servesJob(service));
|
||||
assertTrue(acts.hasActivity(act));
|
||||
assertTrue(acts.getActivities().contains(act));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -158,15 +157,15 @@ public class TestTourActivities {
|
|||
assertEquals(1, tour.jobSize());
|
||||
assertEquals(2, tour.getActivities().size());
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.hasActivity(pickupShipment));
|
||||
assertTrue(tour.hasActivity(deliverShipment));
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.getActivities().contains(deliverShipment));
|
||||
|
||||
tour.removeActivity(pickupShipment);
|
||||
|
||||
assertEquals(1, tour.jobSize());
|
||||
assertEquals(1, tour.getActivities().size());
|
||||
assertTrue(tour.hasActivity(deliverShipment));
|
||||
assertFalse(tour.hasActivity(pickupShipment));
|
||||
assertTrue(tour.getActivities().contains(deliverShipment));
|
||||
assertFalse(tour.getActivities().contains(pickupShipment));
|
||||
assertFalse(tour.getActivities().contains(pickupShipment));
|
||||
|
||||
}
|
||||
|
|
@ -185,8 +184,8 @@ public class TestTourActivities {
|
|||
assertEquals(1, tour.jobSize());
|
||||
assertEquals(2, tour.getActivities().size());
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.hasActivity(pickupShipment));
|
||||
assertTrue(tour.hasActivity(deliverShipment));
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.getActivities().contains(deliverShipment));
|
||||
|
||||
TourActivities copiedTour = TourActivities.copyOf(tour);
|
||||
|
||||
|
|
@ -206,8 +205,8 @@ public class TestTourActivities {
|
|||
assertEquals(1, tour.jobSize());
|
||||
assertEquals(2, tour.getActivities().size());
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.hasActivity(pickupShipment));
|
||||
assertTrue(tour.hasActivity(deliverShipment));
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.getActivities().contains(deliverShipment));
|
||||
|
||||
TourActivities copiedTour = TourActivities.copyOf(tour);
|
||||
|
||||
|
|
@ -227,8 +226,8 @@ public class TestTourActivities {
|
|||
assertEquals(1, tour.jobSize());
|
||||
assertEquals(2, tour.getActivities().size());
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.hasActivity(pickupShipment));
|
||||
assertTrue(tour.hasActivity(deliverShipment));
|
||||
assertTrue(tour.getActivities().contains(pickupShipment));
|
||||
assertTrue(tour.getActivities().contains(deliverShipment));
|
||||
|
||||
TourActivities copiedTour = TourActivities.copyOf(tour);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,24 @@
|
|||
<problem xmlns="http://www.w3schools.com"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
|
||||
<problemType>
|
||||
<fleetSize>INFINITE</fleetSize>
|
||||
<fleetSize>FINITE</fleetSize>
|
||||
</problemType>
|
||||
<vehicles>
|
||||
<vehicle>
|
||||
<id>v2</id>
|
||||
<typeId>vehType2</typeId>
|
||||
<startLocation>
|
||||
<id>loc</id>
|
||||
</startLocation>
|
||||
<endLocation>
|
||||
<id>loc</id>
|
||||
</endLocation>
|
||||
<timeSchedule>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeSchedule>
|
||||
<returnToDepot>true</returnToDepot>
|
||||
</vehicle>
|
||||
<vehicle>
|
||||
<id>v1</id>
|
||||
<typeId>vehType</typeId>
|
||||
|
|
@ -33,58 +48,16 @@
|
|||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
<type>
|
||||
<id>vehType2</id>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">200</dimension>
|
||||
</capacity-dimensions>
|
||||
<costs>
|
||||
<fixed>0.0</fixed>
|
||||
<distance>1.0</distance>
|
||||
<time>0.0</time>
|
||||
</costs>
|
||||
</type>
|
||||
</vehicleTypes>
|
||||
<services>
|
||||
<service id="1" type="service">
|
||||
<location>
|
||||
<id>loc</id>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>2.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
<service id="2" type="service">
|
||||
<location>
|
||||
<id>loc2</id>
|
||||
</location>
|
||||
<capacity-dimensions>
|
||||
<dimension index="0">1</dimension>
|
||||
</capacity-dimensions>
|
||||
<duration>4.0</duration>
|
||||
<timeWindows>
|
||||
<timeWindow>
|
||||
<start>0.0</start>
|
||||
<end>1.7976931348623157E308</end>
|
||||
</timeWindow>
|
||||
</timeWindows>
|
||||
</service>
|
||||
</services>
|
||||
<solutions>
|
||||
<solution>
|
||||
<cost>10.0</cost>
|
||||
<routes>
|
||||
<route>
|
||||
<driverId>noDriver</driverId>
|
||||
<vehicleId>v1</vehicleId>
|
||||
<start>0.0</start>
|
||||
<act type="service">
|
||||
<serviceId>1</serviceId>
|
||||
<arrTime>0.0</arrTime>
|
||||
<endTime>0.0</endTime>
|
||||
</act>
|
||||
<end>0.0</end>
|
||||
</route>
|
||||
</routes>
|
||||
<unassignedJobs>
|
||||
<job id="2"/>
|
||||
</unassignedJobs>
|
||||
</solution>
|
||||
</solutions>
|
||||
</problem>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public class BreakExample {
|
|||
vehicleBuilder.setType(vehicleType);
|
||||
VehicleImpl vehicle = vehicleBuilder.build();
|
||||
|
||||
|
||||
VehicleImpl v2 = VehicleImpl.Builder.newInstance("v2").setStartLocation(Location.newInstance(0, 10)).setType(vehicleType)
|
||||
.setBreak((Break) Break.Builder.newInstance("mySecondBreak").setTimeWindow(TimeWindow.newInstance(5, 10)).setServiceTime(10).build()).build();
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import com.graphhopper.jsprit.core.analysis.SolutionAnalyser;
|
|||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager;
|
||||
import com.graphhopper.jsprit.core.problem.cost.TransportDistance;
|
||||
import com.graphhopper.jsprit.core.problem.job.Job;
|
||||
import com.graphhopper.jsprit.core.problem.solution.SolutionCostCalculator;
|
||||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
|
|
@ -203,7 +204,7 @@ public class BuildAlgorithmFromScratch {
|
|||
|
||||
@Override
|
||||
public double getCosts(VehicleRoutingProblemSolution solution) {
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new SolutionAnalyser.DistanceCalculator() {
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
return vrp.getTransportCosts().getTransportCost(from, to, 0., null, null);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.graphhopper.jsprit.core.algorithm.selector.SelectBest;
|
|||
import com.graphhopper.jsprit.core.analysis.SolutionAnalyser;
|
||||
import com.graphhopper.jsprit.core.problem.Location;
|
||||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.cost.TransportDistance;
|
||||
import com.graphhopper.jsprit.core.problem.io.VrpXMLReader;
|
||||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
|
||||
|
|
@ -97,7 +98,7 @@ public class PickupAndDeliveryExample {
|
|||
plotter.plot("output/pd_solomon_r101_solution.png", "pd_r101");
|
||||
|
||||
//some stats
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new SolutionAnalyser.DistanceCalculator() {
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.graphhopper.jsprit.core.problem.Location;
|
|||
import com.graphhopper.jsprit.core.problem.VehicleRoutingProblem;
|
||||
import com.graphhopper.jsprit.core.problem.constraint.ConstraintManager;
|
||||
import com.graphhopper.jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
|
||||
import com.graphhopper.jsprit.core.problem.cost.TransportDistance;
|
||||
import com.graphhopper.jsprit.core.problem.io.VrpXMLReader;
|
||||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
|
||||
|
|
@ -122,7 +123,7 @@ public class VRPWithBackhaulsExample2 {
|
|||
// plotter.setLabel(Plotter.Label.SIZE);
|
||||
plotter.plot("output/vrpwbh_christophides_vrpnc1_solution.png", "vrpwbh_vrpnc1");
|
||||
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new SolutionAnalyser.DistanceCalculator() {
|
||||
SolutionAnalyser analyser = new SolutionAnalyser(vrp, solution, new TransportDistance() {
|
||||
|
||||
@Override
|
||||
public double getDistance(Location from, Location to) {
|
||||
|
|
|
|||
|
|
@ -60,12 +60,6 @@ public class CordeauReader {
|
|||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public CordeauReader(VehicleRoutingProblem.Builder vrpBuilder, boolean penaltyVehicles) {
|
||||
super();
|
||||
this.vrpBuilder = vrpBuilder;
|
||||
}
|
||||
|
||||
public void read(String fileName) {
|
||||
vrpBuilder.setFleetSize(FleetSize.FINITE);
|
||||
BufferedReader reader = getReader(fileName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue