简体   繁体   中英

Linear programming of vehicle routing

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:

  1. Solve the problem.
  2. Analyse the solution. If there are no subtours then the solution is optimal. Otherwise, add constraints on the subtours that you have to the original problem (in your example, x_01+x_12+x_20 <= 2 and x_34+x_45+x_53 <= 2). Go to 1.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM