1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

simplify and remove redundant stuff

This commit is contained in:
oblonski 2019-04-10 22:12:59 +02:00
parent fda4500302
commit 26a9ecfdfa
No known key found for this signature in database
GPG key ID: 179DE487285680D1
12 changed files with 61 additions and 102 deletions

View file

@ -406,7 +406,6 @@ public class Jsprit {
vehicleFleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager(); vehicleFleetManager = new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();
} else { } else {
FiniteFleetManagerFactory finiteFleetManagerFactory = new FiniteFleetManagerFactory(vrp.getVehicles()); FiniteFleetManagerFactory finiteFleetManagerFactory = new FiniteFleetManagerFactory(vrp.getVehicles());
finiteFleetManagerFactory.setRandom(random);
vehicleFleetManager = finiteFleetManagerFactory.createFleetManager(); vehicleFleetManager = finiteFleetManagerFactory.createFleetManager();
} }
} }

View file

@ -17,10 +17,7 @@
*/ */
package com.graphhopper.jsprit.core.problem.vehicle; package com.graphhopper.jsprit.core.problem.vehicle;
import com.graphhopper.jsprit.core.util.RandomNumberGeneration;
import java.util.Collection; import java.util.Collection;
import java.util.Random;
/** /**
* Factory that creates a finite fleetmanager. * Factory that creates a finite fleetmanager.
@ -31,8 +28,6 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory {
private Collection<Vehicle> vehicles; private Collection<Vehicle> vehicles;
private Random random = RandomNumberGeneration.getRandom();
/** /**
* Constucts the factory. * Constucts the factory.
* *
@ -43,10 +38,6 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory {
this.vehicles = vehicles; this.vehicles = vehicles;
} }
public void setRandom(Random random) {
this.random = random;
}
/** /**
* Creates the finite fleetmanager. * Creates the finite fleetmanager.
* *
@ -58,7 +49,6 @@ public class FiniteFleetManagerFactory implements VehicleFleetManagerFactory {
if (vehicles == null) throw new IllegalStateException("vehicles is null. this must not be."); if (vehicles == null) throw new IllegalStateException("vehicles is null. this must not be.");
if (vehicles.isEmpty()) throw new IllegalStateException("vehicle-collection is empty. this must not be"); if (vehicles.isEmpty()) throw new IllegalStateException("vehicle-collection is empty. this must not be");
VehicleFleetManagerImpl vehicleFleetManager = new VehicleFleetManagerImpl(vehicles); VehicleFleetManagerImpl vehicleFleetManager = new VehicleFleetManagerImpl(vehicles);
vehicleFleetManager.setRandom(random);
vehicleFleetManager.init(); vehicleFleetManager.init();
return vehicleFleetManager; return vehicleFleetManager;
} }

View file

@ -32,7 +32,7 @@ public class InfiniteFleetManagerFactory implements VehicleFleetManagerFactory {
/** /**
* Constructs the factory. * Constructs the factory.
* *
* @param vehicles * @param vehicles that are used to initialize the fleet manager
*/ */
public InfiniteFleetManagerFactory(Collection<Vehicle> vehicles) { public InfiniteFleetManagerFactory(Collection<Vehicle> vehicles) {
super(); super();

View file

@ -34,11 +34,10 @@ class InfiniteVehicles implements VehicleFleetManager {
private static Logger logger = LoggerFactory.getLogger(InfiniteVehicles.class); private static Logger logger = LoggerFactory.getLogger(InfiniteVehicles.class);
private Map<VehicleTypeKey, Vehicle> types = new HashMap<VehicleTypeKey, Vehicle>(); private Map<VehicleTypeKey, Vehicle> types = new HashMap<>();
// private List<VehicleTypeKey> sortedTypes = new ArrayList<VehicleTypeKey>();
public InfiniteVehicles(Collection<Vehicle> vehicles) { InfiniteVehicles(Collection<Vehicle> vehicles) {
extractTypes(vehicles); extractTypes(vehicles);
logger.debug("initialise " + this); logger.debug("initialise " + this);
} }
@ -85,7 +84,7 @@ class InfiniteVehicles implements VehicleFleetManager {
@Override @Override
public Collection<Vehicle> getAvailableVehicles(Vehicle withoutThisType) { public Collection<Vehicle> getAvailableVehicles(Vehicle withoutThisType) {
Collection<Vehicle> vehicles = new ArrayList<Vehicle>(); Collection<Vehicle> vehicles = new ArrayList<>();
VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType.getType().getTypeId(), withoutThisType.getStartLocation().getId(), withoutThisType.getEndLocation().getId(), withoutThisType.getEarliestDeparture(), withoutThisType.getLatestArrival(), withoutThisType.getSkills(), withoutThisType.isReturnToDepot()); VehicleTypeKey thisKey = new VehicleTypeKey(withoutThisType.getType().getTypeId(), withoutThisType.getStartLocation().getId(), withoutThisType.getEndLocation().getId(), withoutThisType.getEarliestDeparture(), withoutThisType.getLatestArrival(), withoutThisType.getSkills(), withoutThisType.isReturnToDepot());
for (VehicleTypeKey key : types.keySet()) { for (VehicleTypeKey key : types.keySet()) {
if (!key.equals(thisKey)) { if (!key.equals(thisKey)) {

View file

@ -35,50 +35,50 @@ public interface Vehicle extends HasId, HasIndex {
* *
* @return earliest departure time * @return earliest departure time
*/ */
public abstract double getEarliestDeparture(); double getEarliestDeparture();
/** /**
* Returns the latest arrival time at this vehicle's end-location which should be the upper bound of this vehicle's arrival times at end-location. * Returns the latest arrival time at this vehicle's end-location which should be the upper bound of this vehicle's arrival times at end-location.
* *
* @return latest arrival time of this vehicle * @return latest arrival time of this vehicle
*/ */
public abstract double getLatestArrival(); double getLatestArrival();
/** /**
* Returns the {@link VehicleType} of this vehicle. * Returns the {@link VehicleType} of this vehicle.
* *
* @return {@link VehicleType} of this vehicle * @return {@link VehicleType} of this vehicle
*/ */
public abstract VehicleType getType(); VehicleType getType();
/** /**
* Returns the id of this vehicle. * Returns the id of this vehicle.
* *
* @return id * @return id
*/ */
public abstract String getId(); String getId();
/** /**
* Returns true if vehicle returns to depot, false otherwise. * Returns true if vehicle returns to depot, false otherwise.
* *
* @return true if isReturnToDepot * @return true if isReturnToDepot
*/ */
public abstract boolean isReturnToDepot(); boolean isReturnToDepot();
public abstract Location getStartLocation(); Location getStartLocation();
public abstract Location getEndLocation(); Location getEndLocation();
public abstract VehicleTypeKey getVehicleTypeIdentifier(); VehicleTypeKey getVehicleTypeIdentifier();
public abstract Skills getSkills(); Skills getSkills();
/** /**
* @return User-specific domain data associated with the vehicle * @return User-specific domain data associated with the vehicle
*/ */
public Object getUserData(); Object getUserData();
public abstract Break getBreak(); Break getBreak();
// Switch to this as soon as we switct to Java 8: // Switch to this as soon as we switct to Java 8:
// default Object getUserData() { // default Object getUserData() {
// return null; // return null;

View file

@ -27,31 +27,31 @@ public interface VehicleFleetManager {
* <p> * <p>
* <p>This indicates that this vehicle is being used. Thus it is not in list of available vehicles. * <p>This indicates that this vehicle is being used. Thus it is not in list of available vehicles.
* *
* @param vehicle * @param vehicle to lock
*/ */
public abstract void lock(Vehicle vehicle); void lock(Vehicle vehicle);
/** /**
* Unlocks vehicle. * Unlocks vehicle.
* <p> * <p>
* <p>This indicates that this vehicle is not being used anymore. Thus it is in list of available vehicles. * <p>This indicates that this vehicle is not being used anymore. Thus it is in list of available vehicles.
* *
* @param vehicle * @param vehicle to unlock
*/ */
public abstract void unlock(Vehicle vehicle); void unlock(Vehicle vehicle);
/** /**
* Returns true if locked. * Returns true if locked.
* *
* @param vehicle * @param vehicle vehicle to lock
* @return * @return true if locked
*/ */
public abstract boolean isLocked(Vehicle vehicle); boolean isLocked(Vehicle vehicle);
/** /**
* Unlocks all locked vehicles. * Unlocks all locked vehicles.
*/ */
public abstract void unlockAll(); void unlockAll();
/** /**
* Returns a collection of available vehicles. * Returns a collection of available vehicles.
@ -61,11 +61,11 @@ public interface VehicleFleetManager {
* This is to avoid returning too many vehicles that are basically equal. * This is to avoid returning too many vehicles that are basically equal.
* <p>Look at {@link VehicleTypeKey} to figure out whether two vehicles are equal or not. * <p>Look at {@link VehicleTypeKey} to figure out whether two vehicles are equal or not.
* *
* @return * @return collection of available vehicles
*/ */
public abstract Collection<Vehicle> getAvailableVehicles(); Collection<Vehicle> getAvailableVehicles();
public Collection<Vehicle> getAvailableVehicles(Vehicle withoutThisType); Collection<Vehicle> getAvailableVehicles(Vehicle withoutThisType);
public Vehicle getAvailableVehicle(VehicleTypeKey vehicleTypeIdentifier); Vehicle getAvailableVehicle(VehicleTypeKey vehicleTypeIdentifier);
} }

View file

@ -19,6 +19,6 @@ package com.graphhopper.jsprit.core.problem.vehicle;
public interface VehicleFleetManagerFactory { public interface VehicleFleetManagerFactory {
public VehicleFleetManager createFleetManager(); VehicleFleetManager createFleetManager();
} }

View file

@ -23,7 +23,6 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Random;
class VehicleFleetManagerImpl implements VehicleFleetManager { class VehicleFleetManagerImpl implements VehicleFleetManager {
@ -40,7 +39,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
TypeContainer() { TypeContainer() {
super(); super();
vehicleList = new ArrayList<Vehicle>(); vehicleList = new ArrayList<>();
} }
void add(Vehicle vehicle) { void add(Vehicle vehicle) {
@ -56,8 +55,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
Vehicle getVehicle() { Vehicle getVehicle() {
if(index >= vehicleList.size()) index = 0; if(index >= vehicleList.size()) index = 0;
Vehicle vehicle = vehicleList.get(index); return vehicleList.get(index);
return vehicle;
} }
void incIndex(){ void incIndex(){
@ -80,8 +78,6 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
private Vehicle[] vehicleArr; private Vehicle[] vehicleArr;
private Random random;
VehicleFleetManagerImpl(Collection<Vehicle> vehicles) { VehicleFleetManagerImpl(Collection<Vehicle> vehicles) {
super(); super();
this.vehicles = vehicles; this.vehicles = vehicles;
@ -90,10 +86,6 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
vehicleArr = new Vehicle[arrSize]; vehicleArr = new Vehicle[arrSize];
} }
void setRandom(Random random) {
this.random = random;
}
void init(){ void init(){
initializeVehicleTypes(); initializeVehicleTypes();
logger.debug("initialise {}",this); logger.debug("initialise {}",this);
@ -142,10 +134,10 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
*/ */
@Override @Override
public Collection<Vehicle> getAvailableVehicles() { public Collection<Vehicle> getAvailableVehicles() {
List<Vehicle> vehicles = new ArrayList<Vehicle>(); List<Vehicle> vehicles = new ArrayList<>();
for(int i=0;i< vehicleTypes.length;i++){ for (TypeContainer vehicleType : vehicleTypes) {
if(!vehicleTypes[i].isEmpty()){ if (!vehicleType.isEmpty()) {
vehicles.add(vehicleTypes[i].getVehicle()); vehicles.add(vehicleType.getVehicle());
} }
} }
return vehicles; return vehicles;
@ -153,7 +145,7 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
@Override @Override
public Collection<Vehicle> getAvailableVehicles(Vehicle withoutThisType) { public Collection<Vehicle> getAvailableVehicles(Vehicle withoutThisType) {
List<Vehicle> vehicles = new ArrayList<Vehicle>(); List<Vehicle> vehicles = new ArrayList<>();
for(int i=0;i< vehicleTypes.length;i++){ for(int i=0;i< vehicleTypes.length;i++){
if(!vehicleTypes[i].isEmpty() && i != withoutThisType.getVehicleTypeIdentifier().getIndex()){ if(!vehicleTypes[i].isEmpty() && i != withoutThisType.getVehicleTypeIdentifier().getIndex()){
vehicles.add(vehicleTypes[i].getVehicle()); vehicles.add(vehicleTypes[i].getVehicle());
@ -218,8 +210,8 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
unlock(vehicleArr[i]); unlock(vehicleArr[i]);
} }
} }
for(int i=0;i<vehicleTypes.length;i++){ for (TypeContainer vehicleType : vehicleTypes) {
vehicleTypes[i].incIndex(); vehicleType.incIndex();
} }
} }

View file

@ -21,8 +21,6 @@ import com.graphhopper.jsprit.core.problem.AbstractVehicle;
import com.graphhopper.jsprit.core.problem.Location; import com.graphhopper.jsprit.core.problem.Location;
import com.graphhopper.jsprit.core.problem.Skills; import com.graphhopper.jsprit.core.problem.Skills;
import com.graphhopper.jsprit.core.problem.job.Break; import com.graphhopper.jsprit.core.problem.job.Break;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection; import java.util.Collection;
@ -48,9 +46,6 @@ public class VehicleImpl extends AbstractVehicle {
private VehicleType type = VehicleTypeImpl.Builder.newInstance("noType").build(); private VehicleType type = VehicleTypeImpl.Builder.newInstance("noType").build();
public NoVehicle() {
}
@Override @Override
public double getEarliestDeparture() { public double getEarliestDeparture() {
return 0; return 0;
@ -110,8 +105,6 @@ public class VehicleImpl extends AbstractVehicle {
*/ */
public static class Builder { public static class Builder {
static final Logger log = LoggerFactory.getLogger(Builder.class.getName());
private String id; private String id;
private double earliestStart = 0.0; private double earliestStart = 0.0;
@ -143,7 +136,7 @@ public class VehicleImpl extends AbstractVehicle {
/** /**
* This can be used to initialize the new vehicle (to be built) with another vehicle. * This can be used to initialize the new vehicle (to be built) with another vehicle.
* *
* @param baseVehicle * @param baseVehicle vehicle to build from
*/ */
private Builder(Vehicle baseVehicle) { private Builder(Vehicle baseVehicle) {
this.id = baseVehicle.getId(); this.id = baseVehicle.getId();
@ -312,8 +305,8 @@ public class VehicleImpl extends AbstractVehicle {
/** /**
* Returns new instance of vehicle builder and initializes every attribute with a attributes of baseVehicle * Returns new instance of vehicle builder and initializes every attribute with a attributes of baseVehicle
* *
* @param baseVehicle * @param baseVehicle base vehicle that is used to initialize the vehicle builder
* @return * @return this builder
*/ */
public static Builder newInstance(Vehicle baseVehicle) { public static Builder newInstance(Vehicle baseVehicle) {
return new Builder(baseVehicle); return new Builder(baseVehicle);
@ -333,8 +326,8 @@ public class VehicleImpl extends AbstractVehicle {
/** /**
* Returns a simple copy of vehicle. * Returns a simple copy of vehicle.
* *
* @param vehicle * @param vehicle to copy
* @return * @return copied vehicle
*/ */
public static Vehicle copyOf(Vehicle vehicle) { public static Vehicle copyOf(Vehicle vehicle) {
return VehicleImpl.Builder.newInstance(vehicle).build(); return VehicleImpl.Builder.newInstance(vehicle).build();

View file

@ -31,38 +31,34 @@ public interface VehicleType {
* *
* @return typeId * @return typeId
*/ */
public String getTypeId(); String getTypeId();
/** /**
* Returns capacity dimensions. * Returns capacity dimensions.
* *
* @return {@link com.graphhopper.jsprit.core.problem.Capacity} * @return {@link com.graphhopper.jsprit.core.problem.Capacity}
*/ */
public Capacity getCapacityDimensions(); Capacity getCapacityDimensions();
/** /**
* Returns maximum velocity of this vehicle-type. * Returns maximum velocity of this vehicle-type.
* *
* @return max velocity * @return max velocity
*/ */
public double getMaxVelocity(); double getMaxVelocity();
/** /**
* Return the cost-parameter of this vehicle-type. * Return the cost-parameter of this vehicle-type.
* *
* @return parameter * @return parameter
*/ */
public VehicleTypeImpl.VehicleCostParams getVehicleCostParams(); VehicleTypeImpl.VehicleCostParams getVehicleCostParams();
public String getProfile(); String getProfile();
/** /**
* @return User-specific domain data associated with the vehicle type * @return User-specific domain data associated with the vehicle type
*/ */
public Object getUserData(); Object getUserData();
// Switch to this as soon as we switct to Java 8:
// default Object getUserData() {
// return null;
// };
} }

View file

@ -42,8 +42,7 @@ public class VehicleTypeImpl implements VehicleType {
} }
public final double fix; public final double fix;
@Deprecated
public final double perTimeUnit;
public final double perTransportTimeUnit; public final double perTransportTimeUnit;
public final double perDistanceUnit; public final double perDistanceUnit;
public final double perWaitingTimeUnit; public final double perWaitingTimeUnit;
@ -52,7 +51,6 @@ public class VehicleTypeImpl implements VehicleType {
private VehicleCostParams(double fix, double perTimeUnit, double perDistanceUnit) { private VehicleCostParams(double fix, double perTimeUnit, double perDistanceUnit) {
super(); super();
this.fix = fix; this.fix = fix;
this.perTimeUnit = perTimeUnit;
this.perTransportTimeUnit = perTimeUnit; this.perTransportTimeUnit = perTimeUnit;
this.perDistanceUnit = perDistanceUnit; this.perDistanceUnit = perDistanceUnit;
this.perWaitingTimeUnit = 0.; this.perWaitingTimeUnit = 0.;
@ -61,7 +59,6 @@ public class VehicleTypeImpl implements VehicleType {
public VehicleCostParams(double fix, double perTimeUnit, double perDistanceUnit, double perWaitingTimeUnit) { public VehicleCostParams(double fix, double perTimeUnit, double perDistanceUnit, double perWaitingTimeUnit) {
this.fix = fix; this.fix = fix;
this.perTimeUnit = perTimeUnit;
this.perTransportTimeUnit = perTimeUnit; this.perTransportTimeUnit = perTimeUnit;
this.perDistanceUnit = perDistanceUnit; this.perDistanceUnit = perDistanceUnit;
this.perWaitingTimeUnit = perWaitingTimeUnit; this.perWaitingTimeUnit = perWaitingTimeUnit;
@ -70,7 +67,6 @@ public class VehicleTypeImpl implements VehicleType {
public VehicleCostParams(double fix, double perTimeUnit, double perDistanceUnit, double perWaitingTimeUnit, double perServiceTimeUnit) { public VehicleCostParams(double fix, double perTimeUnit, double perDistanceUnit, double perWaitingTimeUnit, double perServiceTimeUnit) {
this.fix = fix; this.fix = fix;
this.perTimeUnit = perTimeUnit;
this.perTransportTimeUnit = perTimeUnit; this.perTransportTimeUnit = perTimeUnit;
this.perDistanceUnit = perDistanceUnit; this.perDistanceUnit = perDistanceUnit;
this.perWaitingTimeUnit = perWaitingTimeUnit; this.perWaitingTimeUnit = perWaitingTimeUnit;
@ -128,7 +124,6 @@ public class VehicleTypeImpl implements VehicleType {
} }
private String id; private String id;
private int capacity = 0;
private double maxVelo = Double.MAX_VALUE; private double maxVelo = Double.MAX_VALUE;
/** /**
* default cost values for default vehicle type * default cost values for default vehicle type
@ -176,7 +171,7 @@ public class VehicleTypeImpl implements VehicleType {
* Sets the maximum velocity this vehicle-type can go [in meter per * Sets the maximum velocity this vehicle-type can go [in meter per
* seconds]. * seconds].
* *
* @param inMeterPerSeconds * @param inMeterPerSeconds in m/s
* @return this builder * @return this builder
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if velocity is smaller than zero * if velocity is smaller than zero
@ -193,7 +188,7 @@ public class VehicleTypeImpl implements VehicleType {
* <p> * <p>
* <p>by default it is 0. * <p>by default it is 0.
* *
* @param fixedCost * @param fixedCost fixed cost of vehicle type
* @return this builder * @return this builder
* @throws IllegalArgumentException if fixedCost is smaller than zero * @throws IllegalArgumentException if fixedCost is smaller than zero
*/ */
@ -208,7 +203,7 @@ public class VehicleTypeImpl implements VehicleType {
* <p> * <p>
* <p>by default it is 1.0 * <p>by default it is 1.0
* *
* @param perDistance * @param perDistance cost per distance
* @return this builder * @return this builder
* @throws IllegalArgumentException if perDistance is smaller than zero * @throws IllegalArgumentException if perDistance is smaller than zero
*/ */
@ -224,7 +219,7 @@ public class VehicleTypeImpl implements VehicleType {
* <p> * <p>
* <p>by default it is 0.0 * <p>by default it is 0.0
* *
* @param perTime * @param perTime cost per time
* @return this builder * @return this builder
* @throws IllegalArgumentException if costPerTime is smaller than zero * @throws IllegalArgumentException if costPerTime is smaller than zero
* @deprecated use .setCostPerTransportTime(..) instead * @deprecated use .setCostPerTransportTime(..) instead
@ -241,7 +236,7 @@ public class VehicleTypeImpl implements VehicleType {
* <p> * <p>
* <p>by default it is 0.0 * <p>by default it is 0.0
* *
* @param perTime * @param perTime cost per time
* @return this builder * @return this builder
* @throws IllegalArgumentException if costPerTime is smaller than zero * @throws IllegalArgumentException if costPerTime is smaller than zero
*/ */
@ -256,7 +251,7 @@ public class VehicleTypeImpl implements VehicleType {
* <p> * <p>
* <p>by default it is 0.0 * <p>by default it is 0.0
* *
* @param perWaitingTime * @param perWaitingTime cost per waiting time
* @return this builder * @return this builder
* @throws IllegalArgumentException if costPerTime is smaller than zero * @throws IllegalArgumentException if costPerTime is smaller than zero
*/ */
@ -286,8 +281,8 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* Adds a capacity dimension. * Adds a capacity dimension.
* *
* @param dimIndex * @param dimIndex dimension index
* @param dimVal * @param dimVal dimension value
* @return the builder * @return the builder
* @throws IllegalArgumentException if dimVal < 0 * @throws IllegalArgumentException if dimVal < 0
* @throws IllegalArgumentException if capacity dimension is already set * @throws IllegalArgumentException if capacity dimension is already set
@ -310,7 +305,7 @@ public class VehicleTypeImpl implements VehicleType {
* your dimensions with <code>addCapacityDimension(int dimIndex, int dimVal)</code> or set the already built dimensions with * your dimensions with <code>addCapacityDimension(int dimIndex, int dimVal)</code> or set the already built dimensions with
* this method. * this method.
* *
* @param capacity * @param capacity capacity of vehicle type
* @return this builder * @return this builder
* @throws IllegalArgumentException if capacityDimension has already been added * @throws IllegalArgumentException if capacityDimension has already been added
*/ */
@ -358,8 +353,6 @@ public class VehicleTypeImpl implements VehicleType {
private final String typeId; private final String typeId;
private final int capacity;
private final String profile; private final String profile;
private final VehicleTypeImpl.VehicleCostParams vehicleCostParams; private final VehicleTypeImpl.VehicleCostParams vehicleCostParams;
@ -373,12 +366,11 @@ public class VehicleTypeImpl implements VehicleType {
/** /**
* priv constructor constructing vehicle-type * priv constructor constructing vehicle-type
* *
* @param builder * @param builder vehicle type builder
*/ */
private VehicleTypeImpl(VehicleTypeImpl.Builder builder) { private VehicleTypeImpl(VehicleTypeImpl.Builder builder) {
this.userData = builder.userData; this.userData = builder.userData;
typeId = builder.id; typeId = builder.id;
capacity = builder.capacity;
maxVelocity = builder.maxVelo; maxVelocity = builder.maxVelo;
vehicleCostParams = new VehicleCostParams(builder.fixedCost, builder.perTime, builder.perDistance, builder.perWaitingTime, builder.perServiceTime); vehicleCostParams = new VehicleCostParams(builder.fixedCost, builder.perTime, builder.perDistance, builder.perWaitingTime, builder.perServiceTime);
capacityDimensions = builder.capacityDimensions; capacityDimensions = builder.capacityDimensions;

View file

@ -84,10 +84,8 @@ public class VehicleTypeKey extends AbstractVehicle.AbstractTypeKey {
@Override @Override
public String toString() { public String toString() {
StringBuilder stringBuilder = new StringBuilder(); return type + "_" + startLocationId + "_" + endLocationId +
stringBuilder.append(type).append("_").append(startLocationId).append("_").append(endLocationId) "_" + Double.toString(earliestStart) + "_" + Double.toString(latestEnd);
.append("_").append(Double.toString(earliestStart)).append("_").append(Double.toString(latestEnd));
return stringBuilder.toString();
} }