mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add some comments
This commit is contained in:
parent
cea61b104e
commit
b63a4af6cf
4 changed files with 9 additions and 7 deletions
|
|
@ -461,12 +461,12 @@ public class Jsprit {
|
|||
private VehicleRoutingAlgorithm create(final VehicleRoutingProblem vrp) {
|
||||
ini(vrp);
|
||||
if (vehicleFleetManager == null) {
|
||||
// this allow us to serialize the vra as vrp.getVehicles() return unmodifiable collection
|
||||
Set<Vehicle> vehicles = new HashSet<>();
|
||||
vehicles.addAll(vrp.getVehicles());
|
||||
if (vrp.getFleetSize().equals(VehicleRoutingProblem.FleetSize.INFINITE)) {
|
||||
vehicleFleetManager = new InfiniteFleetManagerFactory(vehicles).createFleetManager();
|
||||
} else {
|
||||
|
||||
FiniteFleetManagerFactory finiteFleetManagerFactory = new FiniteFleetManagerFactory(vehicles);
|
||||
finiteFleetManagerFactory.setRandom(random);
|
||||
vehicleFleetManager = finiteFleetManagerFactory.createFleetManager();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class IterationWithoutImprovementTermination implements PrematureAlgorith
|
|||
|
||||
private int noIterationWithoutImprovement;
|
||||
|
||||
protected int iterationsWithoutImprovement = 0;
|
||||
private int iterationsWithoutImprovement = 0;
|
||||
|
||||
/**
|
||||
* Constructs termination.
|
||||
|
|
|
|||
|
|
@ -41,14 +41,16 @@ import com.graphhopper.jsprit.core.problem.solution.SolutionCostCalculator;
|
|||
import com.graphhopper.jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.FiniteFleetManagerFactory;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.Vehicle;
|
||||
import com.graphhopper.jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||
import com.graphhopper.jsprit.core.reporting.SolutionPrinter;
|
||||
import com.graphhopper.jsprit.core.util.Solutions;
|
||||
import com.graphhopper.jsprit.instance.reader.CordeauReader;
|
||||
import com.graphhopper.jsprit.util.Examples;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BuildAlgorithmFromScratch {
|
||||
|
||||
|
|
@ -127,9 +129,8 @@ public class BuildAlgorithmFromScratch {
|
|||
|
||||
|
||||
public static VehicleRoutingAlgorithm createAlgorithm(final VehicleRoutingProblem vrp) {
|
||||
Set<Vehicle> vehicles = new HashSet<>();
|
||||
vehicles.addAll(vrp.getVehicles());
|
||||
VehicleFleetManager fleetManager = new FiniteFleetManagerFactory(vehicles).createFleetManager();
|
||||
|
||||
VehicleFleetManager fleetManager = new FiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();
|
||||
StateManager stateManager = new StateManager(vrp);
|
||||
ConstraintManager constraintManager = new ConstraintManager(vrp, stateManager);
|
||||
|
||||
|
|
|
|||
|
|
@ -667,6 +667,7 @@ public class VehicleRoutingAlgorithms {
|
|||
return new InfiniteFleetManagerFactory(vrp.getVehicles()).createFleetManager();
|
||||
|
||||
} else if (vrp.getFleetSize().equals(FleetSize.FINITE)) {
|
||||
// this allow us to serialize the vra as vrp.getVehicles() return unmodifiable collection
|
||||
Set<Vehicle> vehicles = new HashSet<>();
|
||||
vehicles.addAll(vrp.getVehicles());
|
||||
return new FiniteFleetManagerFactory(vehicles).createFleetManager();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue