0

I have a graph and I need to visit each and every node ni in the graph starting from a node of choice. There is a cost of not visiting a node, which is different for different nodes, ci and the there is a time gradient to the cost ci. In other words the costs of non visiting ci are a function of time. There is cost of transportation, that is linear in the distance between two nodes dij for two neighboring nodes i and j.

The problem is to determine the most optimal route that hits all nodes at the minimum cost.

The only idea I have is to brute force it, and select all possible routes and compute the cost. I was wondering if anyone can provide any general insights into tackling the problem. I am not looking for code/entire solution just some pointers or some papers that point to this problem. Please note that this is different from traveling salesman problem.

3
  • This is a traveling salesman problem. There are a number of existing questions on this problem. Long story short, its a hard problem to solve. Commented Dec 4, 2015 at 19:51
  • This problem is a variant of the Traveling salesman problem. Commented Dec 4, 2015 at 19:52
  • Still, Stack Overflow is not a "write code for me" resource. What have you tried? Commented Dec 4, 2015 at 19:52

1 Answer 1

1

As you answer Draco18s above, this is a variant of the "classical TSP".

Lets denote the classical version as cTSP; describing the problem of visiting all nodes in the graph (as well as finally returning to the starting node), where the cost function contains only the sum of the transportation costs---linear in the distance---for travelling between different nodes.

Lets denote your variant of cTSP as vTSP. Before tackling the problem, we should identify some important differences between cTSP and vTSP. For a cTSP instance of n nodes, there exists (n-1)!/2 distinct paths; for any certain path, neither direction nor starting node will affect the path cost. For an instance of vTSP, the problem is more complex, as both the choice of starting node as well as path direction will affect the path cost, due to the time-dependent costs of not (yet) visiting nodes. I will assume from here on that "time spent since start of travel" is defined as some relation to "distance travelled since start of travel", particularly, constant travel velocity. Furthermore, I assume that these time dependent cost functions are monotonically increasing.

I haven't encountered this specific variant in literature, so I cannot give you any pointers in that direction. As compared to brute force (which, for vTSP, should become intractable quite quickly with increasing problem size), I would suggest, however, approaching the problem using ant colony optimisation (ACO). Casting aside proving optimality, you could at least compare its results vs the brute force method, for some time cap on algorithm running time. With ACO, to make sure that the pheromone levels remain a quantitate measure for good paths even in the more complex vTSP, the problem should probably be separated into n subproblems, each with a fixed starting city. Initially, let these subproblems be independent, perhaps at a later point studying the possibility of letting them interact.

For each subproblem, just apply (standard) ACO, which is quite straightforward, see e.g. https://en.wikipedia.org/wiki/Ant_colony_optimization_algorithms#Example_pseudo-code_and_formula

The pheromone levels of different edges will---just as for ACO applied to cTSP---still just reflect if it's an edge that is "popular" among the ants. As the starting node is fixed and as time is relative to the distance travelled, ants should favour early visiting of nodes that are more penalising to late arrival. From the eyes of the ants, the additional constraint type in vTSP w.r.t. cTSP will just lead to a different scoring of favourable edges (in itself a kind of brute force way...).

Anyway, perhaps not the answer you were looking for (if rather preferring classical optimization methods?), but good luck!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.