diff --git a/jsprit-core/src/main/java/jsprit/core/util/VehicleRoutingTransportCostsMatrix.java b/jsprit-core/src/main/java/jsprit/core/util/VehicleRoutingTransportCostsMatrix.java index a52eb70d..43d531a9 100644 --- a/jsprit-core/src/main/java/jsprit/core/util/VehicleRoutingTransportCostsMatrix.java +++ b/jsprit-core/src/main/java/jsprit/core/util/VehicleRoutingTransportCostsMatrix.java @@ -16,7 +16,6 @@ ******************************************************************************/ package jsprit.core.util; -import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts; import jsprit.core.problem.driver.Driver; import jsprit.core.problem.vehicle.Vehicle; @@ -29,8 +28,8 @@ import java.util.Map; /** - * CostMatrix that allows pre-compiled time and distance-matrices to be considered as {@link VehicleRoutingTransportCosts} - * in the {@link VehicleRoutingProblem}. + * CostMatrix that allows pre-compiled time and distance-matrices to be considered as {@link jsprit.core.problem.cost.VehicleRoutingTransportCosts} + * in the {@link jsprit.core.problem.VehicleRoutingProblem}. *

Note that you can also use it with distance matrix only (or time matrix). But ones * you set a particular distance, this expects distance-entries for all relations. This counts also * for a particular time. If the method getTransportCosts(...) is then invoked for a relation, where no distance can be found, an @@ -39,8 +38,7 @@ import java.util.Map; * */ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRoutingTransportCosts { - - static class RelationKey { + static class RelationKey { static RelationKey newKey(String from, String to){ return new RelationKey(from, to); @@ -116,8 +114,8 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo /** * Creates a new builder returning the matrix-builder. *

If you want to consider symmetric matrices, set isSymmetric to true. - * @param isSymmetric - * @return + * @param isSymmetric true if matrix is symmetric, false otherwise + * @return builder */ public static Builder newInstance(boolean isSymmetric){ return new Builder(isSymmetric); @@ -129,10 +127,10 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo /** * Adds a transport-distance for a particular relation. - * @param from - * @param to - * @param distance - * @return + * @param from from loactionId + * @param to to locationId + * @param distance the distance to be added + * @return builder */ public Builder addTransportDistance(String from, String to, double distance){ RelationKey key = RelationKey.newKey(from, to); @@ -150,10 +148,10 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo /** * Adds transport-time for a particular relation. - * @param from - * @param to - * @param time - * @return + * @param from from locationId + * @param to to locationId + * @param time the time to be added + * @return builder */ public Builder addTransportTime(String from, String to, double time){ RelationKey key = RelationKey.newKey(from, to); @@ -171,7 +169,7 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo /** * Builds the matrix. - * @return + * @return matrix */ public VehicleRoutingTransportCostsMatrix build(){ return new VehicleRoutingTransportCostsMatrix(this); @@ -226,9 +224,9 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo /** * Returns the distance fromId to toId. * - * @param fromId - * @param toId - * @return + * @param fromId from locationId + * @param toId to locationId + * @return the distance from fromId to toId * @throws IllegalStateException if distance of fromId -> toId is not found */ public double getDistance(String fromId, String toId) { diff --git a/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java b/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java index e09a8bce..d653ed81 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java @@ -16,8 +16,6 @@ ******************************************************************************/ package jsprit.examples; -import java.util.Collection; - import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; @@ -27,7 +25,6 @@ import jsprit.core.problem.VehicleRoutingProblem.FleetSize; import jsprit.core.problem.cost.VehicleRoutingTransportCosts; import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; @@ -35,6 +32,8 @@ import jsprit.core.util.Solutions; import jsprit.core.util.VehicleRoutingTransportCostsMatrix; import jsprit.util.Examples; +import java.util.Collection; + /** * Illustrates how you can use jsprit with an already compiled distance and time matrix. @@ -44,9 +43,6 @@ import jsprit.util.Examples; */ public class CostMatrixExample { - /** - * @param args - */ public static void main(String[] args) { /* * some preparation - create output folder @@ -54,7 +50,7 @@ public class CostMatrixExample { Examples.createOutputFolder(); VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0, 2).setCostPerDistance(1).setCostPerTime(2).build(); - Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("0").setType(type).build(); + VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("0").setType(type).build(); Service s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("1").build(); Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("2").build();