mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
deprecate .addProblemConstraint(...)
This commit is contained in:
parent
3335f235a3
commit
b28753108c
3 changed files with 15 additions and 5 deletions
|
|
@ -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 {
|
|||
*
|
||||
* <p>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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue