//builds a matrix based on euclidean distances; t_ij = euclidean(i,j) / 2; d_ij = euclidean(i,j);
VehicleRoutingTransportCostsMatrix costMatrix = createMatrix(vrpBuilder);
vrpBuilder.setRoutingCost(costMatrix);
VehicleRoutingProblem vrp = vrpBuilder.build();
VehicleRoutingAlgorithmBuilder vraBuilder = new VehicleRoutingAlgorithmBuilder(vrp,"input/algorithmConfig_solomon.xml");
// StateManager stateManager = new StateManager(vrp.getTransportCosts()); //v1.3.1
StateManager stateManager = new StateManager(vrp); //head of development - upcoming release (v1.4)
// StateFactory.StateId distanceStateId = StateFactory.createId("distance"); //v1.3.1
StateId distanceStateId = stateManager.createStateId("distance"); //head of development - upcoming release (v1.4)
stateManager.addStateUpdater(new DistanceUpdater(distanceStateId, stateManager, costMatrix));
// stateManager.updateLoadStates();
ConstraintManager constraintManager = new ConstraintManager(vrp,stateManager);
constraintManager.addConstraint(new DistanceConstraint(120.,distanceStateId,stateManager,costMatrix), ConstraintManager.Priority.CRITICAL);
// constraintManager.addLoadConstraint();
// vraBuilder.addCoreConstraints();
vraBuilder.addDefaultCostCalculators();
vraBuilder.setStateAndConstraintManager(stateManager,constraintManager);
VehicleRoutingAlgorithm vra = vraBuilder.build();
// vra.setNuOfIterations(250); //v1.3.1
vra.setMaxIterations(250); //head of development - upcoming release (v1.4)
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();