Travelling Salesman Problem source code | Dynamic Programming | Graph Theory

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 พ.ย. 2024

ความคิดเห็น • 13

  • @omkar6107
    @omkar6107 6 ปีที่แล้ว

    nice solution. I finally found answer to how we can save a set as key.

  • @NabilSAHIFA
    @NabilSAHIFA 4 ปีที่แล้ว

    Thank you so much for you explanations :)

  • @MykolaDolgalov
    @MykolaDolgalov 4 ปีที่แล้ว +2

    Hi William. Thank you, as always, for your wonderful work! This is fantastic. I tried your code on a 25-cities problem. It was hanging up, eventually erroring out with Out Of Heap memory error. The change that made it work was: I changed this:
    Double[][] memo = new Double[N][1

    • @WilliamFiset-videos
      @WilliamFiset-videos  4 ปีที่แล้ว +3

      For debugging I like Double because it'll throw a NPE if I'm doing something wrong. In this case, I think a primitive double[][] also works, so no reason to use Double[][]. As you've seen, primitives are better if you're trying to boost performance. Tip: a primitive double also plays nicely with Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY which can be used as placeholder values when you're trying to find a min/max value.

  • @rayanayache5652
    @rayanayache5652 5 ปีที่แล้ว

    How can we modify the code to have the end node different from the start node. As if we don’t know the end node, but we need to find it

  • @genie365
    @genie365 5 ปีที่แล้ว +1

    good job bud

  • @iqbalibrahim4713
    @iqbalibrahim4713 6 ปีที่แล้ว

    So how to use the codes, I mean what input should we put to see the effectiveness of the code

  • @RhinoBlindado
    @RhinoBlindado 4 ปีที่แล้ว +4

    Hello, I'd like to ask a sort of dumb question, but is this an implementation of the Held-Karp Algorithm?

  • @user-xr4dx2nq1b
    @user-xr4dx2nq1b 6 ปีที่แล้ว

    In combinations(set,at,r,n,subsets), Dont u have to make another recursive call to combinations after u backtrack on line 153?

    • @WilliamFiset-videos
      @WilliamFiset-videos  6 ปีที่แล้ว

      Looks correct to me. You flip off the bit before moving to the next position. Try adding the call and see what happens :)

    • @user-xr4dx2nq1b
      @user-xr4dx2nq1b 6 ปีที่แล้ว

      WilliamFiset thank u!Will plan 2 take another look

  • @AfiifatutsTsaaniyah
    @AfiifatutsTsaaniyah 6 ปีที่แล้ว +1

    and how result of that code?