The Munkres Assignment Algorithm (Hungarian Algorithm)

In this video lesson, we will attempt to solve the assignment problem by using the Munkres assignment algorithm, and give insight into the algorithms time complexity.
Music: "Fretless" - Kevin MacLeod

Пікірлер: 77

  • @vishavjeetsingh7862
    @vishavjeetsingh78626 жыл бұрын

    The snap thing didn't work for me

  • @SophiaFeng
    @SophiaFeng5 жыл бұрын

    The details of the heavy-lifting steps of covering zeros with minimum lines and the final assignment based on the zeros are omitted.

  • @mateusmelo5095

    @mateusmelo5095

    4 жыл бұрын

    The same happens everywhere I search. Do you have some material over this topic? I've been searching for days.

  • @MartinVotruba4

    @MartinVotruba4

    4 жыл бұрын

    You can find the final assignment by searching for maximum cardinality matching of graph, which is induced by edges with zero cost. To do this: 1) having the table with zeros create a graph, where the nodes are jobs and worker. Create an edge between worker and job whenever there is zero cost in the matrix. 2) find the maximum cardinality matching - you are trying to select maximum possible subset of edges so that no node has more than one edge incident (you wont every worker to work at one task and every task to have assigned one worker). This can be solved by Ford Fulkerson algorithm - add source node connecting to all workers, add sink node connecting to all jobs, set upper bounds to all edges to u=1, solve the maximum flow problem, the edges going from workers to jobs with non zero flow are the matching. 3) If the found matching is perfect (all workers/jobs have an incident edge], you are done. Otherwise go to step 4.

  • @christopherstein2024

    @christopherstein2024

    Жыл бұрын

    I have never seen this properly explained in any video but I think I figured it out. Read this while following the instructions on paper after you have created a zero in every row and column: Drawing the lines: You may only draw along the grid. Look for the column or row that has the most un covered zeros. That's your first line, then repeat until all zeros are covered. Do you have more lines that there are rows? You have made a mistake. Do you have fewer lines as there are rows? You shall procede as shown in the video. Do you have as many lines as there are rows? You can start selecting your final zeros Selecting the zeros: For this you have to start with the zeros with the fewest "neighbor zeros". Finding neighbors for the zeros: Choose a zero. Look at it's row and colum. You will look at a cross or L shaped area containing the zero of your choice plus it's neighboring zeros. (If you know chess you can imagine that your zero is a rook and see how many over zeros it can reach.) Selecting: Select one of the zeros with the fewest neighbor, then cross out it's neighbors, they can't be selected because each row and column may only have one marked zero. Proceed with the remaining zero(s) that has/have the fewest neighbors. There can be multiple right answer with you can check by calculating if they end up with the same cost.

  • @senak9000
    @senak90003 жыл бұрын

    i literally loved everything about this video. i can say this is the first video lesson that made me feel positive and the explanation was really nice. i finally understood.

  • @enderesting
    @enderesting Жыл бұрын

    Cool explanation!! Honestly also mesmerized by how you edited the explanation, it feels very snappy and fun to watch

  • @stoneshou
    @stoneshou6 жыл бұрын

    Thank you for the video! Time complexity regarding step 3 is a little confusing. Some explanation on how to find the minimum lines required to cover all zeros would be helpful.

  • @8Trails50
    @8Trails507 жыл бұрын

    Thank you for this video. Finally had that aha moment for this algorithm regarding picking the assignments.

  • @ShaharTVS
    @ShaharTVS Жыл бұрын

    THANK YOU SO MUCH , i needed this for a test i have in 2 days from now , and it covered everything i need to know about this !

  • @bohneneintopf
    @bohneneintopf6 жыл бұрын

    You editing is super good, thanks!

  • @Expertzero6Dingley
    @Expertzero6Dingley4 жыл бұрын

    That was very well explained, thanks!

  • @ottovonsperling3797
    @ottovonsperling37976 жыл бұрын

    Great and simple explanation. Keep up the good work! You've just gotten a new subscriber! I'll spread the word around. Cheers!

  • @harshitjain6241
    @harshitjain62417 жыл бұрын

    Guys make more videos like this. This just saved my time...!!

  • @8eck
    @8eck2 жыл бұрын

    Returning to this second time, very very helpful. Thank you!

  • @nastarankianersi104
    @nastarankianersi1043 жыл бұрын

    Thank you it was very helpful! I used it for reassigning labels for k-means clustering.

  • @jeenusss7264
    @jeenusss72647 жыл бұрын

    i see this video only one time and i learn a lot.very nice style to teach nice job ;)

  • @sh11death
    @sh11death4 жыл бұрын

    Dude, this was awesome. Saved me on my assignment.

  • @EngelHamer
    @EngelHamer5 жыл бұрын

    Many thanks for the clear explanation!

  • @mrfred456123
    @mrfred4561235 жыл бұрын

    *Thanos* My child you will achieve what I could not with that snap

  • @zhikangdeng3619
    @zhikangdeng36197 жыл бұрын

    A very lovely video. Thank you!

  • @sirinyagmurabac5826
    @sirinyagmurabac58263 жыл бұрын

    Such a great explanation!

  • @tridoan7383
    @tridoan7383 Жыл бұрын

    Really good explanation. Thank you for this video

  • @mfonabasi1
    @mfonabasi13 жыл бұрын

    Thank you very much! This was so helpful

  • @IgraphyRupage
    @IgraphyRupage6 жыл бұрын

    Great work. Thanks!

  • @rashilalamichhane9750
    @rashilalamichhane9750 Жыл бұрын

    Nice explanation!

  • @baltac1
    @baltac1 Жыл бұрын

    thank you for the clear explanation brother

  • @saschahans5326
    @saschahans53265 жыл бұрын

    This was amazing, when you know that you have to find zeros that are alone in step 3 then this is the perfect video ;)

  • @gabek.2952
    @gabek.29522 жыл бұрын

    perfect explanation! thanks

  • @wenshulee6713
    @wenshulee67132 жыл бұрын

    Thank you for the video!

  • @duckmasterflex
    @duckmasterflex7 жыл бұрын

    subscriber for life after this

  • @muelladresse10
    @muelladresse107 ай бұрын

    This is a very nice explanatio

  • @albarkhan3951
    @albarkhan3951 Жыл бұрын

    Thank you.

  • @maan_tech001
    @maan_tech0016 жыл бұрын

    thanks a lot for the help

  • @madhukiranattivilli2321
    @madhukiranattivilli23212 жыл бұрын

    Fantastic graphics. Please make videos on SYSTEM DESIGN topic

  • @Andratos95
    @Andratos954 жыл бұрын

    But won't it still be very hard to find the correct zeros in nxn matrices when n is very large? Anyway great video

  • @sachinmohanmohite
    @sachinmohanmohite4 жыл бұрын

    Can somebody share the final C code for this? StackOverflow is not pointing to one answer.

  • @shourabhpayal1198
    @shourabhpayal11982 жыл бұрын

    Wonderful

  • @hello_hellohello447
    @hello_hellohello4475 ай бұрын

    What happens when the number of lines it takes to cover all zeros exceeds n?

  • @werewolf-hb4xp
    @werewolf-hb4xp3 жыл бұрын

    Thanks, you just saved me for a test tomorow 😂

  • @khazza930
    @khazza9308 жыл бұрын

    Question 1: How do you find the least number of lines to cover all zeros in Step 3? Question 2: What if there are multiple solutions to step 3 (different ways to cover zeros with the same number of lines)? Will they all result in optimal solutions to the assignment problem?

  • @compsci711

    @compsci711

    8 жыл бұрын

    1. Here we are simply doing it by 'eye'. There are, however, various algorithms out there for completing this step. 2. Yes, they will both result in the same solution!

  • @khazza930

    @khazza930

    8 жыл бұрын

    Thanks for the reply. Could you give examples (or links) of some of these algorithms, please?

  • @compsci711

    @compsci711

    8 жыл бұрын

    This should get you going in the right direction: stackoverflow.com/questions/23379660/hungarian-algorithm-finding-minimum-number-of-lines-to-cover-zeroes

  • @khazza930

    @khazza930

    8 жыл бұрын

    awesome, thanks!

  • @IamDionvl
    @IamDionvl6 жыл бұрын

    perfect explanation and animations! Tip: Set your voice volume a little higher or the sound effects a little lower.

  • @XXX-nd2zz
    @XXX-nd2zz5 жыл бұрын

    is the Algorithm only works N * N grid? does it work for N * M grid? If yes, step 3, the numbers of lines should be determined by the total row or total of column ?

  • @garrettryan701

    @garrettryan701

    5 жыл бұрын

    You can add extra numbers to make it square and just assign them as really small numbers while noting they are not "real" assignments in the solutions.

  • @darcipeeps
    @darcipeeps3 жыл бұрын

    For step 3, how can we ensure that an assignment is optimal. I’m convinced that finding some assignment is O(n**2) but I don’t know how you’d find an optimal one in that time. What could I look up to understand this?

  • @davidenzler1691

    @davidenzler1691

    2 жыл бұрын

    first add up the number of 0s in each row and column. Then select rows and columns to "draw" a line through starting with the row or column with the highest number of 0s. After every line is drawn, recalc the number of 0s in each row and column excluding the ones with lines drawn through them.. I realize this post is over a year old but I hope it helps future people!

  • @senak9000
    @senak90003 жыл бұрын

    THANK YOUUUUUUUUU

  • @johndouma3407
    @johndouma34072 жыл бұрын

    What algorithm is used to find a minimum covering of the zeros? I have seen many instances of this algorithm but that detail is glossed over. It may be easy to come up with the covering using a pencil and my eyes but this seems like a useless algorithm without that step.

  • @kuqiu5003
    @kuqiu5003 Жыл бұрын

    Please make more tutorial videos!!!!

  • @DigimonFan99
    @DigimonFan996 жыл бұрын

    Mate make more videos please.

  • @roberthonig5840
    @roberthonig58408 жыл бұрын

    Good one! Will you start making algorithm videos on a regular basis?

  • @compsci711

    @compsci711

    8 жыл бұрын

    This video was actually made for a uni assignment, although we're open to making more!

  • @khazza930

    @khazza930

    8 жыл бұрын

    Yeah, it would be great if you would start making more more of these! You never when you'd end up saving a student's entire degree with a video on an algorithm!

  • @shiyiyin3403
    @shiyiyin34032 жыл бұрын

    I could be wrong but I think I would add 10 to the cross two line value

  • @filiprc3030
    @filiprc30303 жыл бұрын

    amaazing

  • @joehaddad5986
    @joehaddad59862 жыл бұрын

    Step three took me some time to get it right. you should've explained it better. But overall good job!!

  • @DanielaSantos-tv8tt
    @DanielaSantos-tv8tt8 жыл бұрын

    big thaaaankkkkk you!!! you just saved me.

  • @compsci711

    @compsci711

    8 жыл бұрын

    No problem!

  • @MrNgovanmao
    @MrNgovanmao6 жыл бұрын

    step 3 in example 2 looks not correct. The first line should be the last column line not the first-row line.

  • @leesweets4110
    @leesweets4110 Жыл бұрын

    0:48 I dont see whats wrong with those matrices. Obviously no two workers work one job, and no two jobs are given to the same worker. But in 0:55 I dont see whats different about the "correct" matrix.

  • @BlackGuardian2045
    @BlackGuardian20453 жыл бұрын

    Clutch

  • @Placid_Cat
    @Placid_Cat7 жыл бұрын

    maybe overdoing the sound effects...

  • @ricardocruz392
    @ricardocruz3926 жыл бұрын

    Bombs Away. 3 . Consecutives. Tree. Now.

  • @user-ty8us7fm8l
    @user-ty8us7fm8l Жыл бұрын

    1:54

  • @yanfengliu
    @yanfengliu7 жыл бұрын

    The sound effects are way louder than your voice. I have to close this because it is way too loud to watch at school.

  • @martinn.6082

    @martinn.6082

    5 жыл бұрын

    Use headphones? Why do you watch it at school anyway? In a class or something?

  • @nullkothenature-lovingbear2308
    @nullkothenature-lovingbear23083 жыл бұрын

    Not helpful at all If there are no implementation details explained. How am I supposed to know how to select fewest lines to cover all zeros?

  • @darcipeeps
    @darcipeeps2 жыл бұрын

    I don’t get why the algorithm works

  • @Jgauvin921
    @Jgauvin9213 жыл бұрын

    started out great but confused the hell out of me with the stupid snap crap. People use youtube because they are visual learners.

  • @exe.m1dn1ght
    @exe.m1dn1ght2 ай бұрын

    I have no idea what this dude is talking about

  • @The-qc6ck
    @The-qc6ckАй бұрын

    You get views because of savva

  • @fulljsu3glitches
    @fulljsu3glitches29 күн бұрын

    Horrible snapping ruins the video