Relative Content

Tag Archive for or-toolstraveling-salesmanvehicle-routing

AddVariableMinimizedbyFinalizer not considered by the solver

I am working on a simple version of the VRP. The problem is very similar to the simplest example of the VRP found on the Google OR-Tools page; the only difference is that while in the example the objective is to minimize the difference in length between the various routes, in my case I want each of the different routes to be as close as possible to a certain target value. Considering 4 vehicles, the first one should cover about 2000 meters, the second 1500, while the third and fourth should cover 1000 each. To achieve the desired result, I thought of using the routing.AddWeightedVariableMinimizedByFinalizer command, inserting the absolute value of the difference between the target distance and the actual distance covered (abs(objective_distance[n_vehicle] - distance_dimension.CumulVar(routing.End(n_vehicle)),100)) as the minimized variable.

VRP time limit constraint

In my particular VRP (Vehicle Routing Problem), I have a certain number of locations to visit starting from the depot. Each vehicle has a maximum time to complete its journey. The objective is to find the minimum number of vehicles that allow visiting all locations while staying below the imposed time limit.
I started from a simple case based on the example proposed at the following link and defined the maximum time for the vehicles as follows:

No solution found even using AddDisjunction in VRP solved with google OR-Tools

I’m trying to implement a particular TSP (VRP with only one vehicle). I’ve used the standard distance matrix provided in the examples of the VRP on Google OR-Tools page (which has a total of 16 locations, 17 including the depot).
For my purposes, I have removed many connections in the graph. Specifically, from index 0 (index corresponding to the depot), I can only go to nodes (9 10 11 12 13 14 15 16). From nodes (1 2 3 4 5 6 7 8), I can only go to node i + 8 or to the depot (index number 17). Finally, from nodes (9 10 11 12 13 14 15 16), I cannot return to the depot (removed the connection between these nodes and index 17), and I cannot go to node i – 8 (e.g., from node 10, I cannot go to node 2). This is related to my previous question about the need to remove the depot (if interested, you can go back and read it).

Remove depot constraint in VRP solved using Google Or-Tools

Hi!
I’m currently working on a particular VRP. The goal is the same as the traditional VRP, which is to minimize the time associated with the longest route. The fundamental difference that is blocking me at the moment is that I need to remove the constraint related to the depot. Each vehicle can start from a different location, and once it has visited the last location of its assigned route, it must return to its starting location (two vehicles cannot depart from the same location).