Solves Linear algebra problem

© All Rights Reserved

4 views

Solves Linear algebra problem

© All Rights Reserved

- The Crystal Connection, A Guidebook for Personal and Planetary Ascension by Randall N. and Vickie V. Baer, 1986
- list of C++ program using function class XI
- CBSE Class 12 Maths Online Classes- Matrix
- 2d Isoparametric Fem in Matlab
- Prestressed Concrete Naman Errata (1)
- Matrix Algebra
- Group Theory
- classpad
- Decentralised Security Constrained DC-OPF Of
- a
- Exam1_Practice.pdf
- Sage for Lineal Algebra
- Cian1.pdf
- 20094em3 Exercise 12
- Computer Concepts C Programming June 2012
- bba_syllabus_240715.pdf
- Week26 Parametric Studies
- B.SC_19.pdf
- UCSFA_2
- UCSFA

You are on page 1of 6

(a)

Time Complexity in brute force approach for Step 3, we need to check every row if there is a

line which can be drawn though it so that line cover all 0s. So each row takes O(n 2) time to

scan and check whether there is still a 0 which is uncovered. So for each row it will take

O(n3) time.

(b)

{

for every row

count zeros which are still uncovered

if number of zeros that are uncovered is more than 0

find row with maximum number of uncovered 0

count zeros which are still uncovered

if number of zeros that are uncovered is more than 0

find column with maximum number of uncovered 0

add row to rows array

else

add column to cols array

}

We search for an uncovered entry of 0 in each row and column, in this operation we can

either do linear search or make a Hash table to store current rows and column which has been

covered and then while searching it is less time consuming since searching in a Hash Table

can be done in O(logn) time. So total complexity will be O(n2logn)

(c)

In step 4 we first find the minimum in the uncovered numbers, which could be done in O(n2).

After that we subtract minimum from all uncovered elements and add it to all elements

covered twice.

Initialize min with 0

for every row

for every column

min = matrix[row][col]

for every column

if lines [row][col] == 0

matrix[row][col]-= min

else if lines[row][col] == 2

matrix[row][col] += min

(d)

P1 P2 P3 P4

T1 10 7 8 2

T2 1 5 6 3

T3 2 10 3 9

T4 4 3 2 3

Applying step I and II, subtract a constant from any row or column without changing the

solution to the problem. Take the first row (the costs associated with A). All of these numbers

are at least two. Since you must assignT1 to some passenger, you must pay at least two no

matter what. If we'd like, think of that as a fixed cost and further costs as variable costs

depending on the job assigned to the first person. Hence if We reduce all of the entries in the

first row by two, We do not change the optimal assignment (We lower the total cost by two).

Doing so leaves this table:

P1 P2 P3 P4

T1 8 5 6 0

T2 1 5 6 3

T3 2 10 3 9

T4 4 3 2 3

Again, the solution to the problem described by the second table is exactly the same as the

solution to the first problem. Continuing in this way we can subtract the fixed cost for the

other three taxis (rows) so that there is guaranteed to be at least one zero in each row. We

obtain:

P1 P2 P3 P4

T1 8 5 6 0

T2 0 4 5 2

T3 0 8 1 7

T4 2 1 0 1

We are not done using this observation yet. Just as I can subtract a constant from any row, we

can subtract a constant from any column. Take the second column. It says that no matter who

we assign to the second job, it will cost at least 1. Treat the 1 as a fixed cost and subtract it.

Since it cannot be avoided it does not in influence our solution (it does in influence the value

of the solution). Once we make this reduction we get:

P1 P2 P3 P4

T1 8 4 6 0

T2 0 3 5 2

T3 0 7 1 7

T4 2 0 0 1

This is the end of what we can do with the simple observation. Now it is time to use the

observation. The last table is simpler that the original one. It has the property that there is a

zero in every row and in every column. All of the entries are non-negative. Since we want to

find an assignment that minimizes total cost, it would be ideal if we could find an assignment

that only pairs people to jobs when the associated cost is zero. Keep this in mind: The goal of

the computation is to write the table in a way that is equivalent (has the same solution) as the

original problem and has a zero-cost assignment. We have just finished the step in which we

reduce the costs so that there is at least one zero in every row and every column. The example

demonstrates that this is not enough .

If we think about the table, you will see that this is not possible. If we try to come up with a

zero cost assignment, you must assign T1 to P4 (the only zero in the row for T1 is in the 4

column) and we must assign T2 to P1. However, the only way to get a zero cost from T 3 is to

assign it to P1 as well. We can't do this, because We have already assigned T2 to P1. If we have

followed up until now, we will be able to conclude that we should do the next best thing:

assign T3 to job P3 (at the cost 1) and then T4 to P2. This yields the solution to the problem (T1

to P4; T2 to P1; T3 to P4; T4 to P2). It is not, however, an algorithm. We made the final

assignments by guessing. (We should be sure that this is the solution. We argued that it is

impossible to solve the problem at cost zero, but then demonstrated that it is possible to solve

the problem at the next best cost, one.)

To turn the intuition into an algorithm, we need a trick. When we subtracted a constant from

each row, we did so in order to make the smallest element of each row 0. What we would like

to do is to continue to create new cheap assignments without changing the essence of the

problem. The trick is to eliminate the zeroes in the table and then try to reduce the remaining

values. Here we repeat the last table:

P1 P2 P3 P4

T1 8 4 6 0

T2 0 3 5 2

T3 0 7 1 7

T4 2 0 0 1

We have crossed out two rows and one column. Doing so covers up all of the zeros. Now

look at the uncovered cells and find the smallest number (it turns out to be one). If we

subtracted one from each cell in the entire matrix, then we would leave the basic problem

unchanged (that is, we would not change the optimal assignment) and we would create a new

low cost route (T3 to P3). That is the good news. The bad news is that some entries (covered

by lines) would become negative. This is bad news because if there are negative entries, there

is no guaranteed that a zero-cost assignment really minimizes cost. So reverse the process by

adding the same constant you subtracted from every entry (1) to each row and column with a

line through it. Doing so creates this cost matrix:

P1 P2 P3 P4

T1 9 4 6 0

T2 0 2 4 1

T3 0 6 0 6

T4 3 0 0 1

The beauty of this table is that it again is non-negative. It turns out that using this matrix it is

possible to make another minimum cost assignment. In fact, using this table, we can come up

with an optimal assignment with cost zero. It agrees with our intuition (T1 to P4; T2 to P1; T3

to P3; T4 to P2). You can go back to the original matrix of costs to figure out what the total

cost is: 9=2+1+3+3.

5 0ms

10 0ms

20 2ms

30 3ms

40 5ms

50 7ms

60 7ms

70 9ms

80 13ms

90 15ms

100 18ms

- The Crystal Connection, A Guidebook for Personal and Planetary Ascension by Randall N. and Vickie V. Baer, 1986Uploaded byVenaria
- list of C++ program using function class XIUploaded byKanchan Khurana
- CBSE Class 12 Maths Online Classes- MatrixUploaded byTakshila learning
- 2d Isoparametric Fem in MatlabUploaded bydomingocattoni
- Prestressed Concrete Naman Errata (1)Uploaded byagnayel
- Matrix AlgebraUploaded bySylvia Cheung
- Group TheoryUploaded byMinhaz Pathan
- classpadUploaded byBladimir Soliz Pardo
- Decentralised Security Constrained DC-OPF OfUploaded byFABIANCHO2210
- aUploaded byJessica Lewis
- Exam1_Practice.pdfUploaded bychellamv
- Sage for Lineal AlgebraUploaded byreivajmc
- Cian1.pdfUploaded bypakbilal1
- 20094em3 Exercise 12Uploaded byapi-25895802
- Computer Concepts C Programming June 2012Uploaded byPrasad C M
- bba_syllabus_240715.pdfUploaded byJyoti Singh
- Week26 Parametric StudiesUploaded byDeepak Chachra
- B.SC_19.pdfUploaded byDinesh Gdk
- UCSFA_2Uploaded byMa Hdi Choudhury
- UCSFAUploaded byEndla Nurhikmah
- C ArrayUploaded bySiva Chandhiran
- mc40Uploaded byChris Antoniou
- Introduction to Finite Elements Lecture 7Uploaded byDanniel Roumian
- DSmT in ChineseUploaded byAnonymous 0U9j6BLllB
- p132Uploaded byHamid Mojiry
- GeneralUploaded byrad rum
- MOdul DUploaded byBadarulIbrahim
- Lecture09 CaiUploaded byWilliam Sin Chau Wai
- IEEE TAC97 PolyMultnoiseUploaded byNagulapati Kiran
- Rational Iterative Methods for the Matrix Sign FunctionUploaded byesterdelat

- Result FileUploaded bychezwickc
- Homework 4Uploaded byAndreea-Gabriela Ionica
- Knauf-PartitionSystemUploaded byBoy Galih
- Minutes of 20th CCM Final 03.07.2013Uploaded byAmaresh Mallick
- Technical_Specification SF CustUploaded byArpit Badaya
- Injection MouldingUploaded byHarry Hans
- Ass 2 Essay 1Uploaded byZhaohui Wang
- Chapter 9 - Production PlanningUploaded byJohn Tuah
- diodos1N4001-4007Uploaded byColectivin
- HB 158-2010 Delivering Assurance Based on ISO 31000-2009 - Risk Management - Principles and GuidelinesUploaded bySAI Global - APAC
- aircraft ITUploaded bysuhrid02
- At_pipe Part 1Uploaded byBlanca Lopez
- Flight Manual Lockheed U-2Uploaded bydavorf
- Broadgate Bg-20 Iomm a05 v14 EnUploaded byCount_Z
- Preliminaries BESMM 4Uploaded byEbuka Patrick Osakwe
- UntitledUploaded bymithunbahaar
- CRM – Oracle Deport Repair Setups and ProcessUploaded byPreethi Kishore
- VW Diesel GateUploaded byMarius Andrieș
- northwind database sql queriesUploaded byshyam15287
- Speeddome Ultra 8 Install Service Guide Lt en (2)Uploaded byHenry Miranda Salazar
- Annual Training ScheduleUploaded byAgnivesh Sharma
- Mustafa ResumeUploaded byMoustafaAhmedAbdelMoniem
- Application of AISC Design Provisions for Tapered MembersUploaded byismael.lorandi623
- PUE EnhancementUploaded byRajesh Debnath
- ASTM F90-14Uploaded byRafael Scatolin
- Joginder FinalUploaded byGaurav Kumar
- AGILE FOR DUMMIES - eBOOK.pdfUploaded bypallavjulka
- ch01rwc4Uploaded bythuhong0001
- Business Intelligence: A Managerial Perspective on AnalyticsUploaded bymeme_qana
- RectimatUploaded byfndproject