Travelling Salesman Problem source code | Dynamic Programming | Graph Theory

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ม.ค. 2025

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

  • @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 ปีที่แล้ว +4

      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.

  • @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 :)

  • @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?

  • @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

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

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

  • @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

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

    good job bud

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

    and how result of that code?