mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
removed addConstraint in core.problem.VehicleRoutingProblem
This commit is contained in:
parent
1f96eefc4d
commit
b991793aba
10 changed files with 128 additions and 147 deletions
|
|
@ -158,7 +158,7 @@ public class VehicleRoutingAlgorithmBuilder {
|
|||
*/
|
||||
public VehicleRoutingAlgorithm build() {
|
||||
if(stateManager == null) stateManager = new StateManager(vrp);
|
||||
if(constraintManager == null) constraintManager = new ConstraintManager(vrp,stateManager,vrp.getConstraints());
|
||||
if(constraintManager == null) constraintManager = new ConstraintManager(vrp,stateManager);
|
||||
//add core updater
|
||||
stateManager.addStateUpdater(new UpdateEndLocationIfRouteIsOpen());
|
||||
// stateManager.addStateUpdater(new OpenRouteStateVerifier());
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ public class VehicleRoutingAlgorithms {
|
|||
* define constraints
|
||||
*/
|
||||
//constraint manager
|
||||
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager,vrp.getConstraints());
|
||||
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
|
||||
constraintManager.addTimeWindowConstraint();
|
||||
constraintManager.addLoadConstraint();
|
||||
constraintManager.addSkillsConstraint();
|
||||
|
|
|
|||
|
|
@ -102,9 +102,6 @@ public class VehicleRoutingProblem {
|
|||
|
||||
private Set<Vehicle> uniqueVehicles = new HashSet<Vehicle>();
|
||||
|
||||
@Deprecated
|
||||
private Collection<jsprit.core.problem.constraint.Constraint> constraints = new ArrayList<jsprit.core.problem.constraint.Constraint>();
|
||||
|
||||
private JobActivityFactory jobActivityFactory = new JobActivityFactory() {
|
||||
|
||||
@Override
|
||||
|
|
@ -500,20 +497,6 @@ public class VehicleRoutingProblem {
|
|||
return Collections.unmodifiableCollection(vehicleTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds constraint to problem.
|
||||
*
|
||||
* @param constraint constraint to be added
|
||||
* @return this builder
|
||||
* @deprecated use ConstraintManager instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Builder addConstraint(jsprit.core.problem.constraint.Constraint constraint){
|
||||
//noinspection deprecation
|
||||
constraints.add(constraint);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds penaltyVehicles, i.e. for every unique vehicle-location and type combination a penalty-vehicle is constructed having penaltyFactor times higher fixed and variable costs
|
||||
* (see .addPenaltyVehicles(double penaltyFactor, double penaltyFixedCosts) if fixed costs = 0.0).
|
||||
|
|
@ -615,12 +598,7 @@ public class VehicleRoutingProblem {
|
|||
* An enum that indicates type of fleetSize. By default, it is INFINTE
|
||||
*/
|
||||
private final FleetSize fleetSize;
|
||||
|
||||
/**
|
||||
* contains all constraints
|
||||
*/
|
||||
private final Collection<jsprit.core.problem.constraint.Constraint> constraints;
|
||||
|
||||
|
||||
private final Locations locations;
|
||||
|
||||
private Map<Job,List<AbstractActivity>> activityMap;
|
||||
|
|
@ -644,8 +622,6 @@ public class VehicleRoutingProblem {
|
|||
this.initialVehicleRoutes = builder.initialRoutes;
|
||||
this.transportCosts = builder.transportCosts;
|
||||
this.activityCosts = builder.activityCosts;
|
||||
//noinspection deprecation
|
||||
this.constraints = builder.constraints;
|
||||
this.locations = builder.getLocations();
|
||||
this.activityMap = builder.activityMap;
|
||||
this.nuActivities = builder.activityIndexCounter;
|
||||
|
|
@ -719,18 +695,7 @@ public class VehicleRoutingProblem {
|
|||
public VehicleRoutingActivityCosts getActivityCosts(){
|
||||
return activityCosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable collection of constraints.
|
||||
*
|
||||
* @return collection of constraints
|
||||
* @deprecated use ConstraintManager instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Collection<jsprit.core.problem.constraint.Constraint> getConstraints(){
|
||||
return Collections.unmodifiableCollection(constraints);
|
||||
}
|
||||
|
||||
|
||||
public Locations getLocations(){
|
||||
return locations;
|
||||
}
|
||||
|
|
@ -743,14 +708,12 @@ public class VehicleRoutingProblem {
|
|||
|
||||
public JobActivityFactory getJobActivityFactory(){
|
||||
return jobActivityFactory;
|
||||
};
|
||||
}
|
||||
|
||||
public List<AbstractActivity> copyAndGetActivities(Job job){
|
||||
List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
|
||||
if(activityMap.containsKey(job)) {
|
||||
for (AbstractActivity act : activityMap.get(job)) {
|
||||
acts.add((AbstractActivity) act.duplicate());
|
||||
}
|
||||
for (AbstractActivity act : activityMap.get(job)) acts.add((AbstractActivity) act.duplicate());
|
||||
}
|
||||
return acts;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue