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

added javadocs

This commit is contained in:
oblonski 2014-07-29 20:36:37 +02:00
parent a989338b18
commit 63cd55ebb7
2 changed files with 20 additions and 26 deletions

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.core.util; package jsprit.core.util;
import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts; import jsprit.core.problem.cost.AbstractForwardVehicleRoutingTransportCosts;
import jsprit.core.problem.driver.Driver; import jsprit.core.problem.driver.Driver;
import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.Vehicle;
@ -29,8 +28,8 @@ import java.util.Map;
/** /**
* CostMatrix that allows pre-compiled time and distance-matrices to be considered as {@link VehicleRoutingTransportCosts} * CostMatrix that allows pre-compiled time and distance-matrices to be considered as {@link jsprit.core.problem.cost.VehicleRoutingTransportCosts}
* in the {@link VehicleRoutingProblem}. * in the {@link jsprit.core.problem.VehicleRoutingProblem}.
* <p>Note that you can also use it with distance matrix only (or time matrix). But ones * <p>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 * 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 * for a particular time. If the method getTransportCosts(...) is then invoked for a relation, where no distance can be found, an
@ -39,7 +38,6 @@ import java.util.Map;
* *
*/ */
public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRoutingTransportCosts { public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRoutingTransportCosts {
static class RelationKey { static class RelationKey {
static RelationKey newKey(String from, String to){ static RelationKey newKey(String from, String to){
@ -116,8 +114,8 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo
/** /**
* Creates a new builder returning the matrix-builder. * Creates a new builder returning the matrix-builder.
* <p>If you want to consider symmetric matrices, set isSymmetric to true. * <p>If you want to consider symmetric matrices, set isSymmetric to true.
* @param isSymmetric * @param isSymmetric true if matrix is symmetric, false otherwise
* @return * @return builder
*/ */
public static Builder newInstance(boolean isSymmetric){ public static Builder newInstance(boolean isSymmetric){
return new Builder(isSymmetric); return new Builder(isSymmetric);
@ -129,10 +127,10 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo
/** /**
* Adds a transport-distance for a particular relation. * Adds a transport-distance for a particular relation.
* @param from * @param from from loactionId
* @param to * @param to to locationId
* @param distance * @param distance the distance to be added
* @return * @return builder
*/ */
public Builder addTransportDistance(String from, String to, double distance){ public Builder addTransportDistance(String from, String to, double distance){
RelationKey key = RelationKey.newKey(from, to); RelationKey key = RelationKey.newKey(from, to);
@ -150,10 +148,10 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo
/** /**
* Adds transport-time for a particular relation. * Adds transport-time for a particular relation.
* @param from * @param from from locationId
* @param to * @param to to locationId
* @param time * @param time the time to be added
* @return * @return builder
*/ */
public Builder addTransportTime(String from, String to, double time){ public Builder addTransportTime(String from, String to, double time){
RelationKey key = RelationKey.newKey(from, to); RelationKey key = RelationKey.newKey(from, to);
@ -171,7 +169,7 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo
/** /**
* Builds the matrix. * Builds the matrix.
* @return * @return matrix
*/ */
public VehicleRoutingTransportCostsMatrix build(){ public VehicleRoutingTransportCostsMatrix build(){
return new VehicleRoutingTransportCostsMatrix(this); return new VehicleRoutingTransportCostsMatrix(this);
@ -226,9 +224,9 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo
/** /**
* Returns the distance fromId to toId. * Returns the distance fromId to toId.
* *
* @param fromId * @param fromId from locationId
* @param toId * @param toId to locationId
* @return * @return the distance from fromId to toId
* @throws IllegalStateException if distance of fromId -> toId is not found * @throws IllegalStateException if distance of fromId -> toId is not found
*/ */
public double getDistance(String fromId, String toId) { public double getDistance(String fromId, String toId) {

View file

@ -16,8 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.util.Collection;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter;
import jsprit.core.algorithm.VehicleRoutingAlgorithm; 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.cost.VehicleRoutingTransportCosts;
import jsprit.core.problem.job.Service; import jsprit.core.problem.job.Service;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.core.problem.vehicle.Vehicle;
import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl;
import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; import jsprit.core.problem.vehicle.VehicleTypeImpl;
@ -35,6 +32,8 @@ import jsprit.core.util.Solutions;
import jsprit.core.util.VehicleRoutingTransportCostsMatrix; import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import jsprit.util.Examples; import jsprit.util.Examples;
import java.util.Collection;
/** /**
* Illustrates how you can use jsprit with an already compiled distance and time matrix. * 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 { public class CostMatrixExample {
/**
* @param args
*/
public static void main(String[] args) { public static void main(String[] args) {
/* /*
* some preparation - create output folder * some preparation - create output folder
@ -54,7 +50,7 @@ public class CostMatrixExample {
Examples.createOutputFolder(); Examples.createOutputFolder();
VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0, 2).setCostPerDistance(1).setCostPerTime(2).build(); 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 s1 = Service.Builder.newInstance("1").addSizeDimension(0, 1).setLocationId("1").build();
Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("2").build(); Service s2 = Service.Builder.newInstance("2").addSizeDimension(0, 1).setLocationId("2").build();