Need help for linear programming of vehicle routing problem. In vehicle routing problem (VRP), a vehicle will serve a set of nodes such that the total travelling cost is minimized. My decision variable is:Xij=1 if node j is visited after node i. The parameter dij is the distance between nodes i and j. So, the model is as follows:
note that the vehicle starts a tour from the warehouse (node number 0) and finally returns to the warehouse (constraints 11 and 12). All the nodes should be visited (constraint 13), and when entering a node, it should leave that node (constraint 14). But, when I solve this in cplex for a large number of nodes, sometimes the solution is invalid because of loops like this one:
In case of this solution, all the constraints are satisfied but this solution is not valid because the routes are not connected. Now, my question is what constraint I should add to complete the model.
As @Erwin mentioned, you need to add subtour elimination constraints. Briefly:
Although this question is old, there is one important detail in @alex answer which needs emphasis. The subtour elimination (SE) in his link are implemented on the fly by lazy constraint callback. That's important to keep in mind since in larger examples, creating all the SE constraints may not be possible and it's better to evaluate them lazily.
在CPLEX_Studio128\\opl\\examples\\opl\\models\\TravelingSalesmanProblem
您可以找到您需要的一个小示例,即 subtour 消除。
Thank you for the answers. I found The Tucker formulation for subtour elimination which works good.
Ui-Uj+nXij<=n-1.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.