I was seeing this code of the Vehicle Routing Problem and for the terms I want I only need these variables and restrictions:code and restrictions but I cannot understand what and how to interpret the TravelTimes data and the result that the problem gives, doesn't it go through all the nodes? and what is the route? results. Are there 3 nodes? which is the node of the deposit. In the end I can't understand the Time between the nodes and the result. I would appreciate someone to explain.
I want to know what is the route that is made from the deposit node and that goes through all the other nodes.
This MiniZinc model contains a linear model for a vehicle routing problem.
The model looks for a path represented by the variables x
. If x[i,j]
equals 1
, then it means that that route contains the path from Node i
to Node j
. A special Node 0
represent the depot (starting/end point for the vehicle).
In this particular model you can travel from all any node to any other node, however the travel time between them is not equal. The TravelTime
array contains the time it takes to travel between different nodes. TravelTime[i,j]
is the time it takes to travel from Node i
to Node j
. The goal of the model is to minimize the travel time for the picked paths in x
.
To complete the model, the "indegree" constraint forces that 1 incoming path is chosen for every node (including the depot) and the "outdegree" constraint forces that 1 outgoing path is chosen for every node (including the depot). These constraints make sure you visit every node and the vehicle returns to the starting point.
As I noted in the beginning, this model looks like it has been written for a linear solver, such as MIP solvers. Solvers like CBC and Gurobi will probably do well on this model, but other won't. To make it more accessible to other solvers you could look into the circuit
global, which would replace both the "indegree" and "outdegree" constraints. A global constraint allows the solver to choose how to enforce a specific constraint in the best way possible for the solver.