0

I have used an Integer Linear Program (ILP) to generate a path from source to sink in a graph. Each variable Pij in the solution represents a transition from node i to j in the path. Unfortunately, the result is a collection of 2 or more disconnected directed subtours, that do not have a transition from one to the other, thereby making the path useless.

There are ways to prevent subtours from happening, but they first require the detection of such disconnected subtours in primitive solution. Now here's my question: how do I detect disconnected subtours?

Some features of the problem:

  • I have the primitive solution in the form of both, an adjacency matrix and adjacency list
  • The source and sink vertices are distinct. No looping back to source
  • Any vertex in the graph may be traversed any number of times. No rule that it should be traversed only once

My thoughts:

  • If there are disconnected subtours, then they are actually acting as independent, directed graphs on their own, and hence the problem can be restated as detecting all graphs within an adjacency matrix/list
  • My first instict was to detect all Strongly Connected Components (SCC's) in the graph, but I retracted after realising that Kosaraju's and other such algorithms are infeasible over disconnected subtours. I can apply such algorithms within each subtour, though.

What could solve the problem (According to me):

  • Modification of existing SCC detection algorithms to operate on disconnected graphs
  • Adaptation of graph traversal algorithms to operate on disconnected graphs
  • Any existing method (of course)
  • Experience of anyone to have faced a similar issue.
SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
  • 3
    What is an ILP? Why are you not using the Dijkstra algorithm? – ravenspoint Jun 07 '22 at 15:31
  • 1
    I assume "ILP" means "Integer Linear Programming". Can you describe the integer linear program in a bit more detail, and what "result" it gives you? – Stef Jun 07 '22 at 16:36
  • 1
    The way I understand the question, you have a list of edges, and you know that this list of edges corresponds to disjoint cycles/paths, and you want to identify those distinct components? Since they're cycles/paths, it's very easy. Pick an edge from the list. Pick a node from that edge. Then "follow the path" starting from that node and using the edges from the list. If you come back to the initial node, then you've completed a cycle. If there is no next edge, then you've completed a path. – Stef Jun 07 '22 at 16:39
  • 1
    You can add so-called Subtour Elimination Constraints to the model. You don't need to detect subtours. These constraints will never allow subtours. – Erwin Kalvelagen Jun 08 '22 at 06:15
  • @ErwinKalvelagen I believe you are talking about MTZ Constraints. The other way is through DFG constraints, which require a lot less compute, but involve the detection of subtours externally in a primitive solution. I am trying to detect subtours to be able to apply DFG constraints (lazy). – Raghav Thakar Jun 08 '22 at 14:25

0 Answers0