2

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:

enter image description here

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:

enter image description here

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.

Community
  • 1
  • 1

4 Answers4

2

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.
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.

EhsanK
  • 226
  • 1
  • 5
  • 11
0

In CPLEX_Studio128\opl\examples\opl\models\TravelingSalesmanProblem you can find a small example of what you need, which is subtour elimination.

halfer
  • 19,824
  • 17
  • 99
  • 186
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
0

Thank you for the answers. I found The Tucker formulation for subtour elimination which works good.

Ui-Uj+nXij<=n-1.
halfer
  • 19,824
  • 17
  • 99
  • 186