+ All Categories
Home > Documents > Linear Programming - Assignment Problem (1)

Linear Programming - Assignment Problem (1)

Date post: 18-Oct-2015
Category:
Upload: smexiilori
View: 72 times
Download: 0 times
Share this document with a friend
Description:
programming

of 25

Transcript
  • 5/28/2018 Linear Programming - Assignment Problem (1)

    1/25

    Linear ProgrammingLinear Programmingas a ann ng ooas a ann ng oo

    Slide 1 of 27Slide 1 of 27Dr. Thomas Thompson IIDr. Thomas Thompson II

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    2/25

    Introduction to Assignment ProblemIntroduction to Assignment Problem

    LetLetCCbebe anannxnnxnmatrixmatrix representingrepresenting thethe costscosts ofof eacheach ofofnnworkersworkers toto performperform anyany ofofnn

    obsobs.. TheThe assi nmentassi nment roblemroblem isis toto assi nassi n obsobs toto workersworkers soso asas toto minimizeminimize thethe totaltotal

    costcost.. SinceSince eacheach workerworker cancan performperform onlyonly oneone jobjob andand eacheach jobjob cancan bebe assignedassigned toto onlyonly

    oneone workerworker thethe assignmentsassignments constituteconstitute ananindependentindependent setsetofof thethe matrixmatrixCC..

    AnAn arbitraryarbitrary assignmentassignment isis shownshown aboveabove inin whichwhich workerworkeraaisis assignedassigned jobjob qq,, workerworkerbb

    isis assignedassigned jobjobssandand soso onon.. TheThe totaltotal costcost ofof thisthis assignmentassignment isis2323..CanCan youyou findfind aa lowerlower costcost assignment?assignment?

    CanCan youyou findfind thethe minimalminimal costcost assignment?assignment?

    Slide 2 of 27Slide 2 of 27

    RememberRemember thatthat eacheach assignmentassignment mustmust bebe uniqueunique inin itsits rowrow andand columncolumn..

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    3/25

    Assignment ProblemAssignment Problem

    AnAn assignment problemassignment problem seeks to minimize the total costseeks to minimize the total costassignment ofassignment of mm workers toworkers to mmjobs, given that the costjobs, given that the cost

    o wor ero wor er per orm ng oper orm ng o ss ccijij

    ..

    It assumes all workers are assigned and each job isIt assumes all workers are assigned and each job is

    An assignment problem is a special case of aAn assignment problem is a special case of a

    transportation problem in which all supplies and alltransportation problem in which all supplies and alleman s are equa to 1; ence assignment pro emseman s are equa to 1; ence assignment pro ems

    may be solved as linear programs.may be solved as linear programs.

    with three workers and three jobs is shown on the nextwith three workers and three jobs is shown on the nextslide.slide.

    Slide 3 of 27Slide 3 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    4/25

    Assignment ProblemAssignment Problem

    Network RepresentationNetwork Representation

    1111

    cc1111

    cc1212

    cc

    22 22

    cc2121

    cc2222

    cc2323

    cc cc3232

    33 33

    cc3333

    Slide 4 of 27Slide 4 of 27

    WORKERSWORKERS JOBSJOBS

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    5/25

    Assignment ProblemAssignment Problem

    Linear Programming FormulationLinear Programming Formulation

    MinMin ccii xxiii ji j

    s.t.s.t. xxijij = 1 for each resource (row)= 1 for each resource (row) ii

    xxijij = 1 for each job (column)= 1 for each job (column)jj

    iixxijij = or or a= or or a anan ..

    Note:Note: A modification to the rightA modification to the right--hand side of the firsthand side of the first

    constraint set can be made if a worker is permitted to workconstraint set can be made if a worker is permitted to workmore than 1 job.more than 1 job.

    Slide 5 of 27Slide 5 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    6/25

    Linear Programming (LP) problems can be solved onLinear Programming (LP) problems can be solved onthe computer using Matlab, and many others.the computer using Matlab, and many others.

    There are special classes of LP problems such as theThere are special classes of LP problems such as theassignment problem (AP).assignment problem (AP).

    . .

    AP can be formulated as an LP and solved by generalAP can be formulated as an LP and solved by general

    purpose LP codes.purpose LP codes.

    However, there are many computer packages, whichHowever, there are many computer packages, whichcontain separate computer codes for these modelscontain separate computer codes for these models

    structure.structure.

    Slide 6 of 27Slide 6 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    7/25

    From en.wikipedia.org/wiki/From en.wikipedia.org/wiki/Hungarian_algorithmHungarian_algorithm

    The Hungarian method is a combinatorial optimizationThe Hungarian method is a combinatorial optimizationa gorit m w ic so ves t e assignment pro em in po ynomiaa gorit m w ic so ves t e assignment pro em in po ynomiatime. It was developed and published by Harold Kuhn in 1955,time. It was developed and published by Harold Kuhn in 1955,who ave the name "Hun arian method" because thewho ave the name "Hun arian method" because the

    algorithm was largely based on the earlier works of twoalgorithm was largely based on the earlier works of twoHungarian mathematicians: DnesHungarian mathematicians: Dnes KnigKnig and Jenand JenEgervryEgervry..

    amesames un resun res rev ewe e a gor m n an o serverev ewe e a gor m n an o servethat it is (strongly) polynomial. Since then the algorithm hasthat it is (strongly) polynomial. Since then the algorithm has

    been known also as Kuhnbeen known also as Kuhn--MunkresMunkres oror MunkresMunkres assignmentassignmentalgorithm. The time complexity of the original algorithm wasalgorithm. The time complexity of the original algorithm wasO(nO(n44)), however later it was noticed that it can be modified to, however later it was noticed that it can be modified toachieve anachieve an O nO n33 runnin time.runnin time.

    In 2006, it was discovered that Carl Gustav Jacobi had solvedIn 2006, it was discovered that Carl Gustav Jacobi had solvedthe assignment problem in the 19th century, and publishedthe assignment problem in the 19th century, and published

    Slide 7 of 27Slide 7 of 27

    post umous y in 1890 in Latin.post umous y in 1890 in Latin.

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    8/25

    Hungarian MethodHungarian Method

    TheThe Hungarian methodHungarian method solves minimizationsolves minimizationassignment problems withassignment problems with mm workers andworkers and mmjobs.jobs.

    Special considerations can include:Special considerations can include: number of workers does not equal the number ofnumber of workers does not equal the number of

    costs as neededcosts as needed

    workerworker ii cannot do jobcannot do jobjj assignassign ccii = += +MM

    maximization objectivemaximization objective create an opportunity losscreate an opportunity lossmatrix subtracting all profits for each job from thematrix subtracting all profits for each job from the

    Hungarian methodHungarian method

    Slide 8 of 27Slide 8 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    9/25

    Hungarian MethodHungarian Method

    Step 1:Step 1: For each row, subtract the minimum number inFor each row, subtract the minimum number inthat row from all numbers in that row.that row from all numbers in that row.

    ep :ep : or eac co umn, su rac e m n mum num eror eac co umn, su rac e m n mum num er

    in that column from all numbers in that column.in that column from all numbers in that column. Step 3:Step 3: Draw the minimum number of lines to cover allDraw the minimum number of lines to cover all

    zeroes. If this number =zeroes. If this number = mm, STOP, STOP an assignment canan assignment canbe made.be made.

    Ste 4:Ste 4: Determine the minimum uncovered numberDetermine the minimum uncovered number(call it(call it dd).).

    SubtractSubtract dd from uncovered numbers.from uncovered numbers.

    o num ers covere y wo nes.o num ers covere y wo nes. Numbers covered by one line remain the same.Numbers covered by one line remain the same.

    Then GO TO STEP 3.Then GO TO STEP 3.

    Slide 9 of 27Slide 9 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    10/25

    Hungarian MethodHungarian Method

    Finding the Minimum Number of Lines andFinding the Minimum Number of Lines andDetermining the Optimal SolutionDetermining the Optimal Solution

    ep :ep : n a row or co umn w on y one un nen a row or co umn w on y one un ne

    zero and circle it. (If all rows/columns have two orzero and circle it. (If all rows/columns have two ormore unlined zeroes choose an arbitrary zero.)more unlined zeroes choose an arbitrary zero.)

    Step 2:Step 2: If the circle is in a row with one zero, draw aIf the circle is in a row with one zero, draw aline through its column. If the circle is in a columnline through its column. If the circle is in a columnwith one zero, draw a line through its row. Onewith one zero, draw a line through its row. Oneapproach, when all rows and columns have two orapproach, when all rows and columns have two ormore zeroes, is to draw a line through one with themore zeroes, is to draw a line through one with themost zeroes, breaking ties arbitrarily.most zeroes, breaking ties arbitrarily.

    Step 3:Step 3: Repeat step 2 until all circles are lined. If thisRepeat step 2 until all circles are lined. If thisminimum number of lines equalsminimum number of lines equals mm, the circles, the circles

    rovide the o timal assi nment.rovide the o timal assi nment.

    Slide 10 of 27Slide 10 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    11/25

    Example 1: APExample 1: AP

    con rac or pays s su con rac ors a xe ee p us m eage orcon rac or pays s su con rac ors a xe ee p us m eage orwork performed. On a given day the contractor is faced with threework performed. On a given day the contractor is faced with threeelectrical jobs associated with various projects. Given below areelectrical jobs associated with various projects. Given below arethe distances between the subcontractors and the ro ects.the distances between the subcontractors and the ro ects.

    ProjectProjectAA BB CC

    estsideestside 50 36 1650 36 16

    SubcontractorsSubcontractors FederatedFederated 28 30 1828 30 18

    GoliathGoliath 35 32 2035 32 20

    How should the contractors be assigned to minimize total costs?How should the contractors be assigned to minimize total costs?

    ..dummy project Dum, which will be assigned to one subcontractordummy project Dum, which will be assigned to one subcontractor(i.e. that subcontractor will remain idle)(i.e. that subcontractor will remain idle)

    Slide 11 of 27Slide 11 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    12/25

    Example 1: APExample 1: AP

    Network Representation (note the dummy project)Network Representation (note the dummy project)

    3636

    161600

    West.West.

    28283030

    1818BBFed.Fed.

    3535 3232

    2020

    00

    2525 2525

    ..

    Slide 12 of 27Slide 12 of 27

    1414

    00

    Dum.Dum.Univ.Univ.

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    13/25

    Example 1: APExample 1: AP

    Initial Tableau SetupInitial Tableau Setup

    Since the Hungarian algorithm requires that thereSince the Hungarian algorithm requires that therebe the same number of rows as columns, add a Dummybe the same number of rows as columns, add a Dummycolumn so that the first tableau is (the smallest elementscolumn so that the first tableau is (the smallest elements

    AA BB CC DummyDummyWestsideWestside 5050 3636 1616 00

    FederatedFederated 2828 3030 1818 00

    GoliathGoliath 3535 3232 2020 00UniversalUniversal 2525 2525 1414 00

    Slide 13 of 27Slide 13 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    14/25

    Example 1: APExample 1: AP

    Step 1:Step 1: Subtract minimum number in each row from allSubtract minimum number in each row from allnumbers in that row. Since each row has a zero, wenumbers in that row. Since each row has a zero, wes mp y generate t e or g na matr x t e sma ests mp y generate t e or g na matr x t e sma est

    elements in each column are marked red). This yields:elements in each column are marked red). This yields:

    AA BB CC DummyDummy

    Westside 50 36 16 0Westside 50 36 16 0Federated 28 30 18 0Federated 28 30 18 0

    Goliath 35 32 20 0Goliath 35 32 20 0

    UniversalUniversal 2525 2525 1414 00

    Slide 14 of 27Slide 14 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    15/25

    Example 1: APExample 1: AP

    Step 2:Step 2: Subtract the minimum number in each columnSubtract the minimum number in each columnfrom all numbers in the column. For A it is 25, for B itfrom all numbers in the column. For A it is 25, for B its , or t s , or ummy t s . s y e s:s , or t s , or ummy t s . s y e s:

    Westside 25 11 2 0Westside 25 11 2 0

    Federated 3 5 4 0Federated 3 5 4 0

    Goliath 10 7 6Goliath 10 7 6 00

    Universal 0 0 0 0Universal 0 0 0 0

    Slide 15 of 27Slide 15 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    16/25

    Example 1: APExample 1: AP

    Step 3:Step 3: Draw the minimum number of lines to cover all zeroesDraw the minimum number of lines to cover all zeroes(called minimum cover). Although one can "eyeball" this(called minimum cover). Although one can "eyeball" thisminimum, use the following algorithm. If a "remaining" row hasminimum, use the following algorithm. If a "remaining" row hasonly one zero, draw a line through the column. If a remainingonly one zero, draw a line through the column. If a remaining

    column has only one zero in it, draw a line through the row. Sincecolumn has only one zero in it, draw a line through the row. Sincethe number of lines that cover all zeros is 2 < 4 (# of rows), thethe number of lines that cover all zeros is 2 < 4 (# of rows), the

    ..

    AA BB CC DummyDummy

    Federated 3 5 4 0Federated 3 5 4 0

    Goliath 10 7 6 0Goliath 10 7 6 0

    Step 4:Step 4: The minimum uncovered number is 2 (circled).The minimum uncovered number is 2 (circled).

    Slide 16 of 27Slide 16 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    17/25

    Example 1: APExample 1: AP

    Step 5:Step 5: Subtract 2 from uncovered numbers; add 2 to allSubtract 2 from uncovered numbers; add 2 to allnumbers at line intersections; leave all other numbersnumbers at line intersections; leave all other numbersntact. s g ves:ntact. s g ves:

    Westside 23 9 0 0Westside 23 9 0 0

    Federated 1 3 2 0Federated 1 3 2 0

    Goliath 8 5 4 0Goliath 8 5 4 0

    Universal 0 0 0Universal 0 0 0 22

    Slide 17 of 27Slide 17 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    18/25

    Example 1: APExample 1: AP

    Step 3:Step 3: Draw the minimum number of lines to cover allDraw the minimum number of lines to cover allzeroes. Since 3 (# of lines) < 4 (# of rows), the currentzeroes. Since 3 (# of lines) < 4 (# of rows), the currentso ut on s not opt ma .so ut on s not opt ma .

    AA BB CC DummyDummy

    Federated 1 3 2 0Federated 1 3 2 0

    Goliath 8 5 4 0Goliath 8 5 4 0

    Universal 0 0 0 2Universal 0 0 0 2

    Step 4:Step 4: The minimum uncovered number is 1 (circled).The minimum uncovered number is 1 (circled).

    Slide 18 of 27Slide 18 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    19/25

    Example 1: APExample 1: AP

    Step 5:Step 5: Subtract 1 from uncovered numbers. Add 1 toSubtract 1 from uncovered numbers. Add 1 tonumbers at intersections. Leave other numbers intact.numbers at intersections. Leave other numbers intact.

    s g ves:s g ves:

    Westside 23 9 0Westside 23 9 0 11

    Federated 0 2 1 0Federated 0 2 1 0

    Goliath 7 4 3 0Goliath 7 4 3 0

    Universal 0 0 0Universal 0 0 0 33

    Slide 19 of 27Slide 19 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    20/25

    Example 1: APExample 1: AP

    Find the minimum cover:Find the minimum cover:

    AA BB CC DummyDummyWestside 23 9 0Westside 23 9 0 11

    Federated 0 2 1 0Federated 0 2 1 0

    Goliath 7 4 3 0Goliath 7 4 3 0

    n versan versa

    ''four. Thus, the current solution is optimal (minimumfour. Thus, the current solution is optimal (minimumcost) assignment.cost) assignment.

    Slide 20 of 27Slide 20 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    21/25

    Example 1: APExample 1: AP

    The optimal assignment occurs at locations of zerosThe optimal assignment occurs at locations of zerossuch that there is exactly one zero in each row and eachsuch that there is exactly one zero in each row and eachco umn:co umn:

    Westside 23 9Westside 23 9 00 11

    FederatedFederated 00 2 1 02 1 0

    Goliath 7 4 3Goliath 7 4 3 00

    Universal 0Universal 0 00 00 33

    Slide 21 of 27Slide 21 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    22/25

    Example 1: APExample 1: AP

    The optimal assignment is (go back to the original tableThe optimal assignment is (go back to the original tablefor the distances):for the distances):

    SubcontractorSubcontractor ProjectProject DistanceDistance

    es s ees s e

    Federated A 28Federated A 28

    Goliath (unassigned)Goliath (unassigned)

    Total Distance = 69 milesTotal Distance = 69 miles

    Slide 22 of 27Slide 22 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    23/25

    Example 1: AP via LPExample 1: AP via LP

    n our examp e e ormu a on s:n our examp e e ormu a on s:Min z = 50xMin z = 50x1111 + 36x+ 36x1212 + 16x+ 16x1313 + 0x+ 0x1414 + 28x+ 28x2121 + 30x+ 30x2222 + 18x+ 18x2323 + 0x+ 0x2424 ++

    35x35x3131 + 32x+ 32x3232 + 20x+ 20x3333 + 0x+ 0x3434 + + 25x+ + 25x4141 + 25x+ 25x4242 + 14x+ 14x4343 + 0x+ 0x4444s.t.s.t.

    xx1111 + x+ x1212 + x+ x1313 + x+ x1414 = 1= 1 (row 1)(row 1)

    xx + x+ x + x+ x + x+ x = 1= 1 (row 2)(row 2)xx3131 + x+ x3232 + x+ x3333 + x+ x3434 = 1= 1 (row 3)(row 3)

    xx4141

    + x+ x4242

    + x+ x4343

    + x+ x4444

    = 1= 1 (row 4)(row 4)

    1111 2121 3131 4141xx1212 + x+ x2222 + x+ x3232 + x+ x4242 = 1= 1 (column 2)(column 2)

    xx1313 + x+ x2323 + x+ x3333 + x+ x4343 = 1= 1 (column 3)(column 3)

    xx1414 + x+ x2424 + x+ x3434 + x+ x4444 = 1= 1 (column 4)(column 4)xxijij >= 0 for i = 1, 2, 3, 4 and j = 1, 2, 3, 4 (nonnegativity)>= 0 for i = 1, 2, 3, 4 and j = 1, 2, 3, 4 (nonnegativity)

    Slide 23 of 27Slide 23 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    24/25

    Example 1: AP via LPExample 1: AP via LP

    The solver formulation is:The solver formulation is:

    Distances FromContractors to Projects at:

    Contractor A B C Dummy

    West Side 50 36 16 0

    e ss gnmen ro em

    Federated 28 30 18 0

    Gol iath 35 32 20 0

    Universal 25 25 14 0

    Assignm ent o f Contracto rs

    to Projects at:

    Contractor A B C Dummy Assigned Available

    West Side 0 0 0 0 0 1

    Federated 0 0 0 0 0 1

    Goliath 0 0 0 0 0 1

    Universal 0 0 0 0 0 1

    Assigned 0 0 0 0

    Capacity 1 1 1 1

    Total Distance: 0

    Slide 24 of 27Slide 24 of 27

  • 5/28/2018 Linear Programming - Assignment Problem (1)

    25/25

    Example 1: AP via LPExample 1: AP via LP

    The solver solution is:The solver solution is:

    Distances FromContractors to Projects at:

    Contractor A B C Dummy

    West Side 50 36 16 0

    e ss gnmen ro em

    Federated 28 30 18 0

    Goliath 35 32 20 0

    Universal 25 25 14 0

    Assignm ent o f Contracto rs

    to Projects at:

    Contractor A B C Dummy Assigned Available

    West Side 0 0 1 0 1 1

    Federated 1 0 0 0 1 1

    Goliath 0 0 0 1 1 1

    Universal 0 1 0 0 1 1

    Assigned 1 1 1 1

    Capacity 1 1 1 1

    Total Distance: 69

    Slide 25 of 27Slide 25 of 27


Recommended