I'm using network analyst for the first time and am trying to solve a simple vehicle routing problem.
My problem is as follows: I have two sawmills and they both require "x" amount of orders (full truck loads of wood) each day. I have 2 trucks that start and end the day at a truck garage. These trucks can travel to 3 different wood storage locations where they can be loaded. The trucks then need to drop off a full load at one of the mills and return to a wood storage location for the next load.
In summary, a truck needs to 1) start at a garage, 2) drive to a wood storage location and load up fully, 3) drop a full load off at the mill, 4) return to a wood storage location and reload, 5) return to the mill and drop off a load....over and over again until the trucks have satisfied all the mill orders or exceeded their Max total time. I want to leave it up to the solver to decide what mills and wood storage locations each truck needs to go to throughout the day to satisfy the mills orders.
I've added the sawmills as orders, the truck garage and wood storage locations as depots, the wood storage locations as route renewal points, and my trucks as the routes.
My burning questions are: How do I tell the trucks that they need to go to a wood storage location to load and then return to a mill to fulfill an order? Does it have something to do with the sequencing? When I run the solver, the output says the trucks go straight to the sawmill and back without ever loading at a wood storage location.
Moreover, how do I specify how many truck loads (orders) the mills need each day? I tried setting the number of deliveries for each mill to 4 and the capacity of each route to 1....my thought process here was that a full truck load would be considered 1 and the mill needs 4 of these. However, I get errors saying that it violates capacity constraints.
In your problem, does each wood storage location have a capacity restriction? If not, this is a problem that VRP solver can handle. Here are my suggestions on how to setup the problem.
Create X orders for each of the two sawmill locations where every order has DeliveryQuantities property set to 1 (truckload) (you�??ll have 2X orders in total)
Create two vehicles where each has Capacities property set to 1 (truckload)
Add one depot for truck garage and one depot for each of the 3 wood storage locations (you�??ll have 4 depots in total)
Add the 3 wood storage locations as renewals for each of the two routes (so you will have 6 renewals in total)
Set vehicle StartDepotName property to Null and EndDepotName to the truck garage depot (VRP solver assumes that the start depot is a supply depot. In your case, it�??s not. Therefore, you can not include the truck garage as the route start depot)
With this setting, solver will return a solution that starts with one renewal depot and ends at the truck garage depot.
Thank you for the quick response! I used your suggestions and got the solver to work, but it still needs some tweaking to fit my specific situation.
It turns out that I do need capacity restrictions for my wood storage locations. The wood storage locations, for my problem, are the sites in the forest where timber is being harvested. Therefore, the amount of wood that can be produced at one of these locations is probably only 4 or 5 full truck loads per day. Without this restriction, the solver keeps sending both trucks to the nearest wood storage location before heading to a sawmill...which makes sense because it is minimizing cost, but in reality this location would be out of supply. It'd be great if I could convince the heuristic that all three wood storage locations need to be utilized.
Instead of using the wood storage locations as "depots" and "route renewals", can I call them "orders" and give them a PickupQuantity of 1? The only problem here is that I want my truck to start at the garage (where it should start empty), but Network Analyst assumes that it starts loaded. Therefore, capacity is exceeded when it makes the pickup because I have the truck capacity set to 1 (full truckload).
Which brings me to my next question....You mentioned leaving the StartDepot Name as null. When I leave it as <Null>, I get an error saying that my truck does not have a StartNameDepot value. Any thoughts?
The current VRP solver cannot handle the renewal with capacity constraint. Creating pickup orders at the wood storage locations will not work for you as well because VRP solver assumes that the pick-up orders will be delivered to the end depot instead of the delivery order location.
In your case, as long as there is enough supply, you would always want to pick up the wood from the closest wood storage location. I actually think you might want to use the Closet Facility solver in Network Analyst instead. Here are steps on how to solve your problem with Closest Facility solver:
Create 1 facility for each of the wood storage locations
Create 1 incident for each of the sawmill locations
Run the solver and find the closest facility for each sawmill location. In terms of the wood storage location capacity, manually assign sawmill to the nearest facility.
Remove the assigned sawmill and facility from the problem and rerun the solver to find the closet facility for the unassigned sawmill.