diff --git a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java index 8a2bf8fd..67919155 100644 --- a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java +++ b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java @@ -25,9 +25,7 @@ import java.util.Map; import jsprit.core.problem.cost.VehicleRoutingActivityCosts; import jsprit.core.problem.cost.VehicleRoutingTransportCosts; import jsprit.core.problem.driver.Driver; -import jsprit.core.problem.job.Delivery; import jsprit.core.problem.job.Job; -import jsprit.core.problem.job.Pickup; import jsprit.core.problem.job.Service; import jsprit.core.problem.job.Shipment; import jsprit.core.problem.solution.route.activity.TourActivity; @@ -64,9 +62,11 @@ public class VehicleRoutingProblem { * *

DELIVERIES_FIRST corresponds to the vehicle routing problem with back hauls, i.e. before a vehicle is not entirely unloaded, no pickup can be made. * + * @deprecated define constraint directly - since constraints are too diverse to put them in an enum * @author stefan * */ + @Deprecated public enum Constraint { DELIVERIES_FIRST } @@ -186,7 +186,12 @@ public class VehicleRoutingProblem { }; } - + /** + * + * @deprecated use .addConstraint(new ServiceDeliveriesFirstConstraint()) + * @param constraint + */ + @Deprecated public void addProblemConstraint(Constraint constraint){ if(!problemConstraints.contains(constraint)) problemConstraints.add(constraint); } @@ -313,9 +318,11 @@ public class VehicleRoutingProblem { /** * Sets the neighborhood. * + * @deprecated use HardRoute- or ActivityLevelConstraint instead * @param neighborhood * @return */ + @Deprecated public Builder setNeighborhood(Neighborhood neighborhood){ this.neighborhood = neighborhood; return this; diff --git a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java index 5105b27e..defe942d 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java @@ -28,6 +28,7 @@ import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem.Constraint; +import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -62,7 +63,8 @@ public class VRPWithBackhaulsExample { /* * Finally, the problem can be built. By default, transportCosts are crowFlyDistances (as usually used for vrp-instances). */ - vrpBuilder.addProblemConstraint(Constraint.DELIVERIES_FIRST); +// vrpBuilder.addProblemConstraint(Constraint.DELIVERIES_FIRST); + vrpBuilder.addConstraint(new ServiceDeliveriesFirstConstraint()); VehicleRoutingProblem vrp = vrpBuilder.build(); diff --git a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java index 8e611a48..10840db6 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java +++ b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java @@ -28,6 +28,7 @@ import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem.Constraint; +import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; @@ -62,7 +63,7 @@ public class VRPWithBackhaulsExample2 { /* * add the backhaul constraint to the problem */ - vrpBuilder.addProblemConstraint(Constraint.DELIVERIES_FIRST); + vrpBuilder.addConstraint(new ServiceDeliveriesFirstConstraint()); /* * Finally, the problem can be built. By default, transportCosts are crowFlyDistances (as usually used for vrp-instances).