I have a GREAT problem, I have 2 types of vehicles, 34 vehicles (29 type 1 and 5 of type 2), I
also have 500 jobs between pick-ups and deliveries, when I look for the
solution, it tells me that I must use 22 vehicles, but I leave 51 jobs
unssigned, Why Do not use the other vehicles available?
I used these two statements but I get similar results (even using sepriority (1) in the jobs)
------- option 1 -----
VrpBuilder.setRoutingCost (costMatrix);
VrpBuilder.setFleetSize (VehicleRoutingProblem.FleetSize.FINITE);
VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance (vrp)
.setProperty (Jsprit.Parameter.THREADS, "5").
.buildAlgorithm ();
Collection <VehicleRoutingProblemSolution> solutions = vra.searchSolutions ();
VehicleRoutingProblemSolution solution = new SelectBest (). SelectSolution (solutions);
------ option 2 ---------
VehicleRoutingAlgorithm vra = Jsprit.Builder.newInstance (vrp)
.setStateAndConstraintManager (stateManager, constraintManager)
.setProperty (Jsprit.Parameter.THREADS, "5")
.setProperty (Jsprit.Parameter.FIXED_COST_PARAM, "1.5")
.setProperty (Jsprit.Strategy.CLUSTER_REGRET, "0.3")
.setProperty (Jsprit.Strategy.CLUSTER_BEST, "10.0")
.setProperty (Jsprit.Parameter.VEHICLE_SWITCH, "true")
.setProperty (Jsprit.Parameter.THRESHOLD_ALPHA, "0.0")
.setObjectiveFunction (new SolutionCostCalculator () {
@Override
Public double getCosts (VehicleRoutingProblemSolution solution)
Double costs = 0 .;
For (VehicleRoute route: solution.getRoutes ()) {
Costs + = route.getVehicle (). GetType (). GetVehicleCostParams (). Fix;
TourActivity prevAct = route.getStart ();
For (TourActivity act: route.getActivities ()) {
Costs + = vrp.getTransportCosts
(). GetTransportCost (prevAct.getLocation (), act.getLocation (),
prevAct.getEndTime (), route.getDriver (), route.getVehicle ());
Costs + = vrp.getActivityCosts (). GetActivityCost (act, act.getArrTime (), route.getDriver (), route.getVehicle ());
PrevAct = act;
}
Costs + = vrp.getTransportCosts ().
GetTransportCost (prevAct.getLocation (), route.getEnd ()) getLocation
(), prevAct.getEndTime (), route.getDriver (), route.getVehicle ());
}
Costs + = solution.getUnassignedJobs (). Size () * 200000;
Return costs;
}
})
.buildAlgorithm ();
Collection solutions = vra.searchSolutions ();
VehicleRoutingProblemSolution solution = new SelectBest (). SelectSolution (solutions);
thanks