メインコンテンツへスキップ

Travelling Salesman with Time Windows

回答済み

コメント

5件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Silke Horn
    • Gurobi Staff

    Hi Niels,

    Thanks for posting your code. Your distance constraint seems to me as though you are summing up the edges adjacent to farm j when you actually want those that come before it. Is that correct?

    At this point of your code, we don't know about any order of the edges though. I would suggest that the easiest way to include the distances in your code would be via additional lazy constraints. It shouldn't be too difficult to modify the subtour method so that it also sums up the distances driven until a certain node and compares this with the node's maximum allowed distance.

    Also note that the original TSP example code is working with an undirected graph while for your application the direction of the edges/tour matters a lot. So you should also adapt the code to work on a directed graph.

    Silke

    0
  • Silke Horn
    • Gurobi Staff

    I have given this some more thought and my previous suggestions might a bit too easy... While you can easily spot violations of the distance constraint in the lazy constraint code, it is not that easy to come up with a good constraint to cut off this solution. In fact, I would assume that the additional distance constraints may make it  difficult to even find any feasible solution. So lazy constraints are probably not a wise approach here at all. On the contrary, I would expect that the solver would then just blindly walk through the entire branch-and-bound tree until it accidentally hits a solution that is not cut off by a lazy constraint. I hope that makes sense.

    I guess you will need a different approach -- and a much bigger model/graph. For example, with discrete time steps, introduce one node for each combination of farm and time step, then model the path in this bigger graph.

    0
  • Niels Strande
    • Gurobi-versary
    • First Question
    • First Comment

    Hi Silke,

    Thank you for the replies. I am very beginner at Gurobi and currently experimentering with Gurobi for eventually adoption at my work. Could you like to refer to some example in the Gurobi examples library which I can use as a start point for the modelling?

    Niels

    0
  • Silke Horn
    • Gurobi Staff

    Hi Niels,

    To get started with Gurobi, you can find many resources under the Resources tab on the Gurobi website. The code and modelling examples, demos, and webinars and especially anything related to scheduling could be interesting for you.

    As a commercial user, you can also submit a support request if you have any specific questions.

    Silke

    0

投稿コメントは受け付けていません。