Two Generals' Problem Explained

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • The Two Generals' Problem, also known as the Two Generals' Paradox or the Two Armies Problem, is a classic computer science and computer communication thought experiment that we're going to talk about in this video.
    Also, please check the related blog post
    finematics.com/two-generals-pr...
    "Some constraints and tradeoffs in the design of network communications" paper ►
    hydra.infosys.tuwien.ac.at/tea...
    Website ► finematics.com
    Follow me on Twitter ► / finematics
    Donations:
    Bitcoin ► 18ngQa7qzfg9RpstBz3ZCSm2fAzm6tqaa4
    Lightning ► tippin.me/@finematics
    Referral links:
    Brave Browser ► brave.com/fin661 (ads-free browsing)
    Ledger Nano S ► shop.ledger.com?r=2af228941155 (hardware wallet for crypto)
    If you like this video, give it a like, share it and subscribe to my channel.
    Thanks for watching!

Komentáře • 91

  • @123chrysalis
    @123chrysalis Před 4 lety +23

    Thanks Finematics for explaining so well! We need people like you in CS who make it easier for others like us to understand the concept. Visual approach works best.

    • @Finematics
      @Finematics  Před 4 lety +1

      Thank you Pooja!

    • @AFPinerosG
      @AFPinerosG Před 9 měsíci

      @@Finematics Hey, in the last strategy wouldn't the interval to send messengers be 40m? Otherwise they'd be sending an extra messenger. Or is that extra messenger expected? I guess that works because it's just a single extra message but it cuts the communication time in half.

  • @alexandrughiurutan5839
    @alexandrughiurutan5839 Před 5 lety +17

    Can't wait for the generalized version. Byzantine generals problem.

  • @zhouyou8551
    @zhouyou8551 Před 4 lety

    Best video for two generals' problem. thanks for your solution!

  • @tobiprivat8878
    @tobiprivat8878 Před 3 lety +6

    great! totally underrated content!!

  • @faizalmakhrus8645
    @faizalmakhrus8645 Před 4 lety +2

    Wow...i really appreciate this explanation.

  • @caseylocke4474
    @caseylocke4474 Před 4 lety +7

    Thank you so much for making such a clear video! I love Tom Scott, but I think your video is better explained.

  • @zihuatanejo7741
    @zihuatanejo7741 Před 3 lety +1

    awesome video ,thank you

  • @joeduffyy
    @joeduffyy Před 5 lety +126

    Anyone here from tom scott?

  • @JB-nw1ix
    @JB-nw1ix Před 6 lety +4

    Loving your work Finematics!

  • @cRAYonhere
    @cRAYonhere Před 5 lety +1

    Thank you.

  • @roberts1782
    @roberts1782 Před 3 lety +2

    Thank you

  • @Spoonfork1
    @Spoonfork1 Před 2 lety +2

    Nice video. I don't think you ever created the follow video about the "Byzantines Generals Problem"

  • @zilla83
    @zilla83 Před 2 lety

    Hi Finematics! I love your vids, and seen dozens of them. Can someone please let me know where I can find the Byzantine's Generals' Problem ("next video") that doesnt show up anywhere? thanks

  • @moamber1
    @moamber1 Před 4 lety +6

    I think I have at least two approaches to this problem, but if people are saying there is no solution, then perhaps I'm wrong :)
    In short: Alice sends Bob a message to attack. Bob replies with agreement and a first secret. Alice replies with second secret. Bob replies with same second secret, and they send that second secret a few times until it's clear that both parties are on the same page. Messengers are sent every 20 minutes with their own message and information about the last message their general got, with time stamp. If either party haven't heard about another for 3 hours, the session expires. I mean - they postpone the attack to another day. Simple.

    • @Christopher-of-Columbus
      @Christopher-of-Columbus Před 2 lety +1

      Or, they can just use their cell phones to communicate directly with each other in real time, right?

    • @TadeleAsitatikie
      @TadeleAsitatikie Před 2 lety

      @@Christopher-of-Columbus Their telephone call could also be caught by enemies :)

    • @alexgonzo5508
      @alexgonzo5508 Před rokem

      ... or Alice sends Bob 2 or 3 messengers (the more messengers the better) at the same time with the same message memorized while also carrying a paper or scroll with a fake message in case of capture. Bob repeats the same procedure and sends 2 or 3 messengers back with memorized reply and fake paper reply. If the fake messages are designed effectively to produce a certain effect if read by the enemy then it can confer advantage to Alice and Bob.

  • @JosiahWarren
    @JosiahWarren Před 2 lety +1

    Best explanation video

  • @MuradBeybalaev
    @MuradBeybalaev Před 4 lety +2

    5:30 There ARE a few practical approaches.
    6:35 MessEngers.

  • @yaakovgrunsfeld
    @yaakovgrunsfeld Před 2 lety

    Suppose there's a probability p that a given message Makes it through is there a strategy which maximizes the chances of coordination

  • @thefluffyshark5202
    @thefluffyshark5202 Před 4 lety +6

    wouldn't it work if the general A jut sends back 3rd a message confirming the confirmation because A has agreed a time and B responded therefore the 2 parties are already in agreement so the 3rd message just confirms to B that attack is a go, am I wrong?

    • @LumiDeluxe
      @LumiDeluxe Před 4 lety +2

      Realistically, that would probably happen, but if we take absolute certainty into account, that doesn't work. Because General B can't be certain that the 3rd messanger returned to A.

    • @diegowang9597
      @diegowang9597 Před 7 měsíci

      If B did not get the 3rd message from A, B thinks A may not have received B's second confirmation message, B thinks A may not attack.

  • @Raph.q
    @Raph.q Před 3 lety

    6:22...how does the general know there was 100 messages sent ?

  • @dudeofchicken
    @dudeofchicken Před 3 lety +19

    let the generals whatsapp each other they confirm with two blue tick mark

    • @osmanio
      @osmanio Před 3 lety

      I will write that in my exam!

  • @lherfel
    @lherfel Před 2 lety

    thanks

  • @AmitKumar-cp1oz
    @AmitKumar-cp1oz Před 3 lety

    why not send more than 1 messenger at different times

  • @kieranthompson171
    @kieranthompson171 Před rokem

    Can't you use smoke signals.

  • @JohnDeibler
    @JohnDeibler Před 3 lety

    How am I able to coordinate plans with any friend over text in this case ?!

    • @Qichar
      @Qichar Před 3 lety

      Text messages are delivered via SMS (short message service), and many implementations of SMS do not guarantee delivery. However, in practical terms about 99.9% of text messages are delivered successfully, so the actual incidence of failed delivery is relatively low. With such a high reliability rate, you can simply use the pragmatic solution offered in the video: send your plan to your friend, and wait for a response. If your friend does not respond within a pre-agreed upon period of time, simply send your message again until you get a response. Your friend will tell you that he got it (ack), and if your friend does not receive another message from you, he can safely (with low probability of failure) assume that you got his ack (because if you didn't, you'd keep sending your plans to him).
      Where this system falls apart is if suddenly the reliability of communication drops suddenly, for example if there is a national emergency or a storm takes out a cell tower. But maybe then you and your friend would have bigger things to worry about.

  • @sirpentplayz8732
    @sirpentplayz8732 Před 4 lety +5

    Each side send 1 scout, when they meet up in the middle they will either both die because one is spotted so botg die, or both survive. If they die, both sides send new scouts

    • @gasnryo9805
      @gasnryo9805 Před 4 lety +1

      Same problem there. How would they both know when to send scouts?

  • @PedroOjeda
    @PedroOjeda Před 3 lety +1

    Did you ever make the byzantine problem video?

    • @Finematics
      @Finematics  Před 3 lety +2

      No, might have to come back to this at some point.

    • @lipedu3k
      @lipedu3k Před 3 lety

      @@Finematics Please Do!

  • @jimflagg4009
    @jimflagg4009 Před 2 lety +2

    Gen A says I will keep sending messages until you reply and I will stop. Gen B sends the ACK back and if after 40 minutes no new messengers come then Gen B knows it was received. He will get new messages in that time but should stop after the time has passed. You can even put time stamps on the messages so Gen B know how long it took to get the message there and how long to wait.

  • @kerbe3
    @kerbe3 Před 3 lety

    What if they both send a messenger at the same time? Or at least attempt to send some at the same time?

    • @thomasb.5643
      @thomasb.5643 Před 3 lety

      you can't be certain the messager you sent arrived.

    • @kerbe3
      @kerbe3 Před 3 lety

      @@thomasb.5643 Yea, I realize that.

  • @danny1229c
    @danny1229c Před rokem

    Long distance visible signals were created for this very purpose

  • @robertobenedit
    @robertobenedit Před rokem

    EPIC!

  • @lockscad
    @lockscad Před rokem +1

    I'm pretty sure you're incorrect. If general a sends the time and date of the attack and general b sends back the same message to confirm, general a can then send back a confirmation saying I got your confirmation of the date and time. If general b then sends back confirmation saying I'm glad you got my confirmation message. General a can send one last message saying me too. They would then without a doubt know that each other got the message. It's not infinite like you suggested....

    • @lockscad
      @lockscad Před rokem +1

      I should clarify, yes if any of those messages don't go through then it fails, but that wasn't the problem statement originally you mentioned considering a perfect scenario. In computer programming this can be done by trying to have that kind of a conversation and if any of the messages fail you just start over again from the beginning and try again...

  • @esckey123
    @esckey123 Před rokem

    bro draws like a freaking printer, like its so clean and... sharp idk how

  • @jackbridges5913
    @jackbridges5913 Před 2 lety

    It would end on an Even number of confirmations sent / Odd number of messages, 9 11 or 13 messages

  • @clintmontgomery5108
    @clintmontgomery5108 Před 2 lety +1

    This is not unsolvable. As long as both A, and B receive 1 reply receipt for Any message sent by anyone then consensus has bin reached. With the stipulation that neither A or B can change there reply once it is sent.
    With that stipulation, it effectively terminates the infinite regress of uncertainty.

    • @tharindu79
      @tharindu79 Před 2 lety

      Unfortunately it's complicated than that. When both A and B receive 1 reply receipt each, it's still not sufficient to reach a consensus. Because the every receipt is also a message and they are connected like links on a chain. A (sends message) -> B (sends reply) -> A (now A knows B got his message but to let B know that, A sends confirmation) -> B (now B knows A got his reply but needs to let A know that his confirmation is also received, B sends reply confirmation)

    • @clintmontgomery5108
      @clintmontgomery5108 Před 2 lety

      @@tharindu79 you missed the immutable law of my suggestion. For any original message each participant can only expect 1 reply. So A sends an original message ->B. B then sends reply of receipt and expects 1 reply. This also counts as the reply A expects. A then sends the reply to B that terminates expected replies. This law makes a distinction between a reply and a message. For added security replies could be of a different inscription then is used in the original message.

    • @tharindu79
      @tharindu79 Před 2 lety

      @@clintmontgomery5108 i see. so you terminates the conversation when B gets a reply, to his reply. all is good if the channel is reliable. when it's not, how does this work? because B is expecting a reply to his reply to confirm the attack. even though B gets one, there is no way for A to know that his reply got through to B. so A is still in a dilemma to attack. and this goes on... or is it not?

    • @clintmontgomery5108
      @clintmontgomery5108 Před 2 lety

      @@tharindu79 no because A already received 1 confirmation. that’s all that is needed to act.

  • @MrLorenzoBernini
    @MrLorenzoBernini Před 3 lety +1

    so much easier today, just pick up the phone and call him

  • @gobleturky6192
    @gobleturky6192 Před 4 lety +3

    Solution: stand there and wait for everyone in the valley to die

  • @xx_Ashura_xx
    @xx_Ashura_xx Před 4 lety +8

    take your whole army, go to the other general, confirm, go back, done

    • @mrflip-flop3198
      @mrflip-flop3198 Před 4 lety +1

      Did you not understand the situation? The only way you can go to the other is to pass by the castle. The castle might see the army and get killed.

    • @xx_Ashura_xx
      @xx_Ashura_xx Před 4 lety +1

      @@mrflip-flop3198 go around the castle

    • @esophagoose
      @esophagoose Před 4 lety +2

      Techy Savage that's beyond the scope of the problem id think

    • @faizalmakhrus8645
      @faizalmakhrus8645 Před 4 lety +3

      The solution of sending bunch of mesg is just the exact implementation of your idea. 👍🏻

    • @BamBoJam
      @BamBoJam Před 3 lety

      This is so autistic dude, there’s a reason Generals are not your typical computer geek. Humans have battled and won wars for millennia without considering or solving this “paradox”

  • @Carebear_Pooh
    @Carebear_Pooh Před 5 lety +3

    One way to solve the problem is to send the general as a messenger. So my thoughts: general A goes to general b together with a small escort, leaving a message behind for the rest of his army: no matter what happens, we will attack over two days at dawn. The chances of them getting captured are significantly reduced because they are with multiple men and they have decided to only travel at night. They also have the general with them and there is no way for the castle to know what they are up to. If they do get attacked, one or two of the men must have the priority to immediately flee while the others of the escort hold off the attackers. as soon as the message gets delivered to general b, b knows that army a will attack, no matter what happens, over two days at dawn. Therefore a confirmation is not needed, because it won't change the actions of army a anyway.

    • @jort281
      @jort281 Před 4 lety +1

      It's possible that General A and escort dies along the way meaning Army A attacks alone and loses. Army A can ask for more troops 1 by 1. They'll know the message got through when the first person returns, if not send another message. It's not 100% effective though as many will die leaving 1.1x to 1.9x army strength at A roughly instead of 2x as the problem requires. Basically a 99% chance of this or that counts as a system fail even though it would work in the real world. Sending a messenger there and back twice would probably be enough in the real world, army B would know their first acknowledge got through to A. Army A would know their time got through to B twice. Still no good though :/

  • @samehedi
    @samehedi Před 3 lety +2

    finally a video that explains the problem and possible solutions! thank you! and fuck all those videos about bitcoin solving it

  • @f5boDag
    @f5boDag Před 4 lety

    Have the two messengers be order to tell of their message to the eachother outside of the range of the castle and then return to their respective general with the information.

  • @thegymteachersgrandma
    @thegymteachersgrandma Před 3 lety

    cant like one go to the general and say
    light a white fire and then we will attack
    light a yellow fire to let our other general know that you got the information

    • @tharindu79
      @tharindu79 Před 2 lety

      how would you know if they actually lighted a fire AFTER receiving your message? they could also light a white (or yellow) one just for the kicks and you are fucked.

  • @isaiahsea3248
    @isaiahsea3248 Před 4 lety +5

    It can be solved by adding the human element of intent. The generals have to know each other (themselves) better then their momma does so as to accurately predict (decide) when to strike and it will get thru the defenses of the target. This is a 2 minute summary answer not a real one

  • @adriansrfr
    @adriansrfr Před 2 lety

    Apparently, an absence of messengers solves the problem. Don't worry, another vid stated the answer was: math.

  • @ThePunkBuster
    @ThePunkBuster Před 2 lety +1

    2:24 Just stop at n number of confirmations., two are sufficient. This is not necessarily infinite. 🙄

    • @BoredDan7
      @BoredDan7 Před 2 lety

      If you stop at any number of confirmations n, then whoever sent the last confirmation will be uncertain if the other party received the last confirmation.

  • @jaiyeolademilade5002
    @jaiyeolademilade5002 Před 2 lety

    Why was the gangster black? He could have been any colour but black. Thank you
    for the knowledge though.

  • @jalyndixon9352
    @jalyndixon9352 Před rokem

    Why don’t the generals just FaceTime?

  • @fmalexander5555
    @fmalexander5555 Před 4 lety

    Gentlemen, stake your HEX.

  • @Cookedfrfrfr
    @Cookedfrfrfr Před 3 lety

    Tom Scott plagiarized you.