Traveling Salesman Problem Dynamic Programming Held-Karp

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024

Комментарии • 140

  • @suhasc9418
    @suhasc9418 8 лет назад +47

    I appreciate it ... it's a good video... But there are a lot of words that use , for instance "That vertex" , "This vertex"... it would be clear to follow if u'd instead say "Vertex A" or "Vertex B". I mean being precise and clear would benefit more. Good job though!

  • @kranthikumar1357
    @kranthikumar1357 7 лет назад

    Nice Video Bro...... This Very Helpful to me......Thank A Lot Bro.....................

  • @cch8155
    @cch8155 8 лет назад

    great video~

  • @Thedeadlyheavens
    @Thedeadlyheavens 8 лет назад

    thank-you tushar sir it helped a lot ;_;)/

  • @MaroThabet
    @MaroThabet 7 лет назад

    thanks hello france, please thank sabeeka for me ^_^

  • @PrakashSathiyamoorthyHere
    @PrakashSathiyamoorthyHere 7 лет назад +43

    Let the salesman just open a website and not travel ! Just kidding, awesome tutorial btw !

    • @narendrayadav71
      @narendrayadav71 5 лет назад +3

      "Travelling deliveryman's Problem" will become the name.

  • @prashanthvaidya1358
    @prashanthvaidya1358 7 лет назад +12

    I watched this one hour before my exam. Thanks a lot for helping me nail a 12 marker. :)
    Much appreciated! Subscribed.

  • @amitavamozumder73
    @amitavamozumder73 3 года назад +1

    The greedy algorithm would be wrong to solve this but ironically the example you choose greedy algo would've given the same answer LOL

    • @art-sauce
      @art-sauce 3 года назад

      could you please direct me to any books for better understanding of DSA :-]

  • @partht.a.3295
    @partht.a.3295 7 лет назад +1

    Is it possible for the code to be written in C and not Java. If so, could u pls demonstrate?

  • @kemalilgun4470
    @kemalilgun4470 3 года назад +2

    I rarely comment on these kind of videos but the way you performed the algorithm was really intuitive, thank you

  • @art-sauce
    @art-sauce 3 года назад +1

    I watched this tutorial a week ago and I couldn't understand a thing because I **ONLY** WATCHED
    Today I did so again but this time I followed along the calculations by writing and when he was calculating [1,{2,3}], I had already calculated [2,{1,3}]
    Knowing it is awesome(to be honest)
    Summary:
    0➡️1➡️3➡️2➡️0

  • @dohyun0047
    @dohyun0047 4 года назад +2

    wow it is so amazing that you implemented this... knowing algorithm and implementing is so so soooooooo much different thankyou!

  • @shivanisrivarshini180
    @shivanisrivarshini180 7 лет назад +2

    does space complexity and time complexity is same O(n^2 *2^n)
    nut I read in book as space complexity is O(n*2^n)
    please explain clearly about time complexity and space. complexity
    Thank u

  • @Kaldor-Draigo-h6q
    @Kaldor-Draigo-h6q 7 лет назад +22

    *wortex*

  • @puneetkumar-vv9go
    @puneetkumar-vv9go 4 года назад +1

    you deserve a medal sirji .....salute from MNNIT, allahabad

  • @golupatwardhan
    @golupatwardhan 5 лет назад

    NO NEED TO COMPUTE SET {0,{1,2,3}} DESTINATION CAN CONTAIN ALL THE VERTICES EXCEPT THE SOURCE.WITH EACH HOP OPTIMAL SUBSTRUCTURE CONTAINS AT LEAST ONE OR MORE THAN ONE
    VERTICES IN ITS FINAL POSITION SO WITH HOP COUNT = N ALL THE VERTICES WILL BE IN THEIR FINAL POSITION AND ROUTE FROM LAST VERTEX HERE WITH HOP COUNT = N TO SOURCE VERTEX IS THE
    SHORTEST PATH COVERING ALL THE VERTICES.IF SET {0,{1,2,3}}(CONTAINING N+1 VERTICES) BEING COMPUTED IT INDICATES THAT SET WITH N VERTICES IS NOT SUFFICIENT TO COMPUTE SHORTEST
    PATH AND MAY BE DISRUPTED BY SET WITH THE SIZE(N+1) THIS WILL LEAD TO AMBIGUITY WHERE NO VERTEX BEING FINALIZED IN THE EVOLUTION OF HOPS.

  • @purushotamrawat3235
    @purushotamrawat3235 6 лет назад +3

    Sunglasses 👓 🤣

  • @vishalmahavratayajula9658
    @vishalmahavratayajula9658 4 года назад

    Dislikers, did you follow the problem every second along with Tushar and dislike or did you dislike coz you never concentrated?

  • @sandeepKumar-hc1co
    @sandeepKumar-hc1co 7 лет назад +1

    how did the n^2 term come in time complexity...can u plz explain

  • @AjayKumar-cn6zy
    @AjayKumar-cn6zy 8 лет назад +8

    East or West Tushar u r the best :) made clear and easy.

  • @kcgajula
    @kcgajula 5 лет назад +6

    "Whatever it takes.." u know the end game plot years ahead :)

  • @bharatijawale7314
    @bharatijawale7314 8 лет назад +1

    Thank you!! plzz make a video on TSP by Branch and bound

  • @cch8155
    @cch8155 8 лет назад +1

    This is a great video! But I am wondering if you know how to solve traveling salesman using branch and bound ? Thanks a lot!

  • @badjin999
    @badjin999 7 лет назад +8

    thhooo :D

  • @KrishnaMurthy-cw2mm
    @KrishnaMurthy-cw2mm 7 лет назад +3

    can u pls tell, how did u construct d cost matrix??

    • @cesaregb
      @cesaregb 7 лет назад +4

      did you find out?
      my guess is that the matrix has not the same values as the graph is shown at the beginning.

    • @vamshi6195
      @vamshi6195 7 лет назад

      yaa

    • @rituraj889
      @rituraj889 7 лет назад

      you can just apply floyd-warshall to construct the cost matrix

  • @ajazahmed5452
    @ajazahmed5452 7 лет назад +1

    Thank You.. It's really helpful before a day of exam.. :-)

  • @eralperat7348
    @eralperat7348 7 лет назад +1

    this is really great one of videos about the topic..Thank you for your effort to create this understandable video for viewers.. I'm 100% sure about that they like it as much as me.Thank you.

  • @vishalnakum4269
    @vishalnakum4269 7 лет назад +1

    can you give example of some more traveling salesmen city more then 4 or 5 city

    • @stark258
      @stark258 6 лет назад

      Vishal Nakum stop asking stupid questions. also learn grammar

  • @markschumacher3157
    @markschumacher3157 8 лет назад +1

    The code is excellent. Comparators, collections, static inner class, hashcode override, you sure know how to code java .
    Question:
    Line 153,
    Collections.sort(allSets, new SetSizeComparator());
    Could your comparator just be implemented as a final static member variable of the class TravelingSalesmanHeldKarp ? This would avoid the a ton of object creations.

    • @markschumacher3157
      @markschumacher3157 8 лет назад

      +Tushar Roy yah your right.

    • @SHADOW5487
      @SHADOW5487 8 лет назад

      Do you have an account in Codeforces or Topcoder?)

  • @anmol4746
    @anmol4746 3 года назад

    sir can you create a video for 5 cities explaining it step by step there are is some confusion like in 5 cities there will be 3 possibilities for each city when dealing with 3 cities at a time like 3 variables a312 a314 a324
    where a312 is a variable name in which we are going to city 3 in which the parent city can be 1 or 2, now coming back to the 3 variables a312 a314 and a 324 what will we do with these 3 will we compare them also to have the smallest path, like how will we operate.

  • @fanglinlu5781
    @fanglinlu5781 Год назад

    Great video. I do have a questions about the code. Why do you have to remove the preVertex and then add it back in the getCost method?

  • @bendavies4081
    @bendavies4081 8 лет назад +2

    Honestly the best video I have found on held karp! And you've uploaded it with just enough time to fully understand it before my exam! Thank you so much!! :)

    • @bendavies4081
      @bendavies4081 8 лет назад

      +Tushar Roy One quick question though! If say you added on one extra node, would you look through the combinations in this order?
      A
      B
      C
      D
      E
      AB
      AC
      AD
      AE

      ABC

      ABD

      ABE

      ACB

      ACD

      ACE

      ADB

      ADC

      ADE

      AEB

      AEC

      AED

      ABCD

      ABCE

      ABDC

      ABDE

      ABEC

      ABED

      ACBD

      ACBE

      ACED

      ACEB

      ADBC

      ADBE

      ADCB

      ADCE

      ADEB

      ADEC

      AEBC

      AEBD

      AECD

      AECB

      AEDB

      AEDC
      Apologies for the long comment, but am I looking at too many combinations?
      Cheers!

    • @bendavies4081
      @bendavies4081 8 лет назад

      Ok cheers! The thing that has confused me though is that these combinations will look past 2^n and will check over 40! Is the 2^n almost a rough estimate or have I done something wrong?! haha! Cheers! :)

    • @TWiStErRob
      @TWiStErRob 8 лет назад

      It's not right! ABE and AEB is the same set: order doesn't matter in a set. Try 4 elements, you should get 2^4=16 subsets (nil, A, B, C, D, AB, AC, AD, BC, BD, CD, ABC, ABD, ACD, BCD, ABCD). In your generating the subsets either take the current one or not, but stick to that decision when doing the next step.
      An easy to understand algo is [for n

    • @bendavies4081
      @bendavies4081 8 лет назад

      +Róbert Papp (TWiStErRob) Thanks! I thought something was up with it! However what confuses me is that if order doesn't matter then how is the problem solved? Because what if AEB leads to a shorter path in the end but it's been completely disregarded? I am confused haha!

    • @TWiStErRob
      @TWiStErRob 8 лет назад

      +Ben Davies hmm, I didn't think that far, your count of subsets were off, so that had to be fixed. Your generated subsets will most likely be in lexicographical order, or equivalent (you can redefine the alphabet with a bijection). The dynamic programming part of this algorithm only depends on lengths one less than the current subset's length, so as long as the subsets are in increasing order of length you're fine. Notice that AEB has recursive steps of A+EB/E+AB/B+AE; and BEA would have B+EA/E+BA/A+BE; which are the same if they're sets. Within the same length it can be any order because the minimum always selects the smallest one... notice that the pairings are the same.

  • @Raymaster7482
    @Raymaster7482 3 года назад

    So is this the value of the lower bound? And do you have to repeat the algorithm with each possible starting-nod?
    Thx for your help

  • @Vendettaaaa666
    @Vendettaaaa666 4 года назад

    Only salesman that explained the concept + time complexity + code!!
    Other videos only explain the concept.

  • @sreekanthnarayana
    @sreekanthnarayana 8 лет назад

    Please could you help me TSP with Source and Destination are different? (Directed grapth, a node or edge can be visited any number of times)

  • @pradipacharjee4915
    @pradipacharjee4915 8 лет назад

    Hi @Tushar Roy
    Please provide some video for this problrm "Partition a set into two subsets such that the difference of subset sums is minimum"
    There is two variation ......>1 both subset can be of any size
    > 2 both subset of equal size or max size difference is 1 in case given array is odd by length.

  • @drishtantkumar6531
    @drishtantkumar6531 7 лет назад

    Its like watching a video on fast forward.......cud u please slow down a bit??

  • @true_human_007
    @true_human_007 5 лет назад

    How the number of subset is exponential -- which is 2 ^ n
    As per my understanding, it should be n ^2 ~~ approx (n-1)(n-2) +2.
    Please correct me if I am going wrong

  • @ronaknmodi
    @ronaknmodi 8 лет назад

    good... but your speed is very high in teaching...pls...speak slowly

  • @SonuSonu-tk5pk
    @SonuSonu-tk5pk 7 лет назад +1

    Gazab ka explanation dete hai aap tothanks for it

  • @adhishmalviya2408
    @adhishmalviya2408 4 года назад

    East or West, Tushar is the best :) .

  • @avinashbengeri
    @avinashbengeri 7 лет назад

    Very nicely illustrated. Instead of java, I was looking for implementing it in C. Any luck?

  • @ahmadbodayr7203
    @ahmadbodayr7203 Год назад

    read about islam man❤

  • @ksrikanth1353
    @ksrikanth1353 7 лет назад

    Too fast unable to follow bt nice slang and gd video about concept pls slow down little bit

  • @cashflow9156
    @cashflow9156 8 лет назад

    For a future video, can you explain how to do a max flow/min cut for a graph?

  • @pr1493
    @pr1493 8 лет назад

    does greedy approach work for tsp? if yes, when does it fail?

  • @Sparklegoat11
    @Sparklegoat11 8 лет назад

    is this the best current attempt at this algorithm, I see there has been clustering, 2-opt, and simulated annealing, etc ? or is this just an example algorithm to solve it. Great video , I watch many of your videos , they are plainly explained, making the example most easy to understand. Thank you!

  • @59sharmanalin
    @59sharmanalin 7 лет назад

    Awesome!! Great Work Tushar!! just one feedback, please use something like 0->1->2->3 instead of saying if a vertex from subset precedes this vertex, that will be much better!

  • @jamalahmedmaaz
    @jamalahmedmaaz 6 лет назад

    Appreciate the video, always helps. But this time you are running really fast. Please slow down.

  • @chinmayjoshi5554
    @chinmayjoshi5554 2 года назад

    Brilliant explanation..

  • @volekvolek1
    @volekvolek1 6 лет назад

    don't scream please talk slower

  • @vishalmishra1937
    @vishalmishra1937 5 лет назад

    how last zero of completing cycle cam from 1 plz explain

  • @Bradcopo
    @Bradcopo 5 лет назад

    thanks . everything was clear 😘😘. i worked out on the same time on another problem watching this video

  • @AviatorBro
    @AviatorBro 6 лет назад

    please speak a bit slow, unless you are late to catch a train

  • @ankk98
    @ankk98 6 лет назад +5

    You have left many questions unanswered and skipped many logics like why are we making these sets? or why you made those tables and noted costs and parent? and many more.

  • @yuyaochen9794
    @yuyaochen9794 7 лет назад

    it is really good, better than my professor explained it.

  • @LightYagami-jt2xg
    @LightYagami-jt2xg 2 года назад

    Sir u are king👑👑👑

  • @cats_lao_jiao
    @cats_lao_jiao 3 года назад

    Too hard for me...😢

  • @ankishbansal420
    @ankishbansal420 5 лет назад

    How to design or think about such solution?

  • @MosheHanukoglu
    @MosheHanukoglu 6 лет назад

    An excellent video that clearly explains the problem and the solution

  • @vm1662
    @vm1662 4 года назад

    Thanks Tushar! Had been looking for the code implementation. :)

  • @lawrenceamadi800
    @lawrenceamadi800 7 лет назад

    For the last subset {1,2,3} you checked for 3 permutations: (1,2,3), (2,1,3) and (3,1,2). Why didn't you check for the three remaining permutations: (1,3,2), (2,3,1) and (3,2,1)?

    • @adhirajajathasathru5272
      @adhirajajathasathru5272 7 лет назад +3

      he already considered these cases in previous step by choosing minimum path.
      e.g. for (1,2,3), min of {2,3} or {3,2}.

  • @6shobhit
    @6shobhit 8 лет назад

    I really appreciate your work and effort you put to explain the solution. thank you

  • @pikeshpatel6199
    @pikeshpatel6199 6 лет назад

    how you are generating the possible subsets?

  • @chiranjeeb1986
    @chiranjeeb1986 8 лет назад

    Nicely explained! Tushar

  • @supriyapriyadarshani7744
    @supriyapriyadarshani7744 6 лет назад

    very clear explanation... thanks a lot!!!

  • @sumitsahu4153
    @sumitsahu4153 7 лет назад

    beautifully explained. thanks and appreciate your effort

  • @srividyakrishnakumar6895
    @srividyakrishnakumar6895 3 года назад

    This playlist is a gem. Thanks Tushar! Please do continue making more videos.

  • @amanmalhotra724
    @amanmalhotra724 7 лет назад

    Hey Mr Tushar Roy really thanks for the videos uh explain veery well but can uh b lil slow while speaking its tough to understand uh speak really fast

  • @saima61ful
    @saima61ful 8 лет назад

    Hey u use graph in starting and distance matrix .this matrix is from that graph or both are different???

    • @saima61ful
      @saima61ful 8 лет назад

      +Tushar Roy ok :) i also think so

  • @manpreetsinghrana7751
    @manpreetsinghrana7751 7 лет назад

    Thank u very much for such a brilliant explanation.

  • @AvishekDe
    @AvishekDe 8 лет назад

    Thank you so much. Helped me a lot before my exams

  • @TheMooninvader
    @TheMooninvader 6 лет назад

    thanks
    good explanation for the Held-Karp algorithm

  • @learningtech9472
    @learningtech9472 7 лет назад

    can you tell me where can i get this code in cpp

  • @mcanitta6701
    @mcanitta6701 7 лет назад

    what about undirected graph in TSP

  • @henryjapardi
    @henryjapardi 7 лет назад

    Thankyou so much for the video :)

  • @kitthadatulyaanukij7912
    @kitthadatulyaanukij7912 8 лет назад

    Awesome, Tushar!
    Your sample applies to only 1 vehicle, without capacity constraint.
    Is there any similar video with "Capacity vehicle routing"?

    • @kitthadatulyaanukij7912
      @kitthadatulyaanukij7912 8 лет назад

      like multiple travelling salesman, reading research maybe the solution is genetic algorithm ... ? can you share if you have ... Thanks lot my friend

  • @intisarchy7059
    @intisarchy7059 8 лет назад

    i learn a lot from your videos. Thanks a lot :)

  • @art-sauce
    @art-sauce 3 года назад

    the video is really helpful though i noted when performing union of 2 sets, you went ahead and did {1,3} before attempting {2,3}

    • @chinmayjoshi5554
      @chinmayjoshi5554 2 года назад +1

      If you mean to say at 7:05 , then he is doing the right thing. He is doing the TSP iterations for
      {vertex, {remainingSet}}
      in the ascending order of remainingSet. Like first through Phi, then through {1}, and then {2} and then {3} and then {1,2}, {2,3}, {1,3}, and lastly {1,2,3}.

    • @art-sauce
      @art-sauce 2 года назад +1

      @@chinmayjoshi5554 it's been 10 month I have to rewatch again 😩😩😩😩

  • @prakashshettigar1072
    @prakashshettigar1072 7 лет назад

    too fast unable to understand

  • @lukeroberts7469
    @lukeroberts7469 7 лет назад

    Very helpful, thank you very much!

  • @fexx404
    @fexx404 3 года назад

    Dude, you just saved my assignment, thank you!

  • @ankitsrivastava682
    @ankitsrivastava682 6 лет назад

    It's awesome 👍... Thanks🙏

  • @vineethald9908
    @vineethald9908 8 лет назад

    thanks a lot for this video sir

  • @shuvendubikash3792
    @shuvendubikash3792 8 лет назад

    Will you please provide a main function in your Github link for this post

  • @aamisubha
    @aamisubha 8 лет назад

    The best :) thank u :)

  • @pratikmore4044
    @pratikmore4044 8 лет назад

    thanks for helping!!!

  • @prathyushavelpula8794
    @prathyushavelpula8794 5 лет назад

    tq sir

  • @mohammedshahidsultan8607
    @mohammedshahidsultan8607 6 лет назад

    Amazing, Thank you :)

  • @sushmitagoswami2033
    @sushmitagoswami2033 8 лет назад

    really good one!

  • @florianreichelt
    @florianreichelt 7 лет назад

    awesome:)

  • @abhidee8318
    @abhidee8318 6 лет назад

    bhaiiii jada aagraje ho gayee ap

  • @kuljeetjhala7
    @kuljeetjhala7 8 лет назад

    You're amazing man.

  • @gauravsethi8083
    @gauravsethi8083 6 лет назад

    Awesome tutorial..

  • @jagannathaaralikatteramara3790
    @jagannathaaralikatteramara3790 7 лет назад

    awesome video

  • @rahulrajput-qy6hq
    @rahulrajput-qy6hq 6 лет назад

    dark spots kam karo sir

  • @saptadeepdas4281
    @saptadeepdas4281 5 лет назад

    😍

  • @ruzanpithawala9052
    @ruzanpithawala9052 7 лет назад +2

    great video &explanation. Loved it

  • @watchnow8169
    @watchnow8169 6 лет назад

    if u r speaking in English then no need to give subtitle its unable to view the board and mostly your speaking style rare complicated

  • @WhiteBerry
    @WhiteBerry 4 года назад

    Could someone provide me with the pseudocode representation of this algorithm?