Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide source code for the task along with step-by-step explanation. Using Java write a program to permute the columns of a square matrix so

image text in transcribedimage text in transcribed

Please provide source code for the task along with step-by-step explanation.

Using Java write a program to permute the columns of a square matrix so as to minimize the sum of elements on the main diagonal. 883762038164295422815937596291758190156427502481 If we number the columns in this matrix from 0 through 4 and then rearrange them so that they appear in the order then we get the matrix 159375962164295422864275024818837620389175819015 The sum of the elements on the main diagonal of this matrix is 15+42+50+20+15=142 and no other permutation of the columns can yield a lower sum. This problem is known as the assignment problem, and it arises in a great many industrial applications. For example, the columns might represent jobs and the rows might represent workers, with the matrix entry representing the number of hours it takes the corresponding worker to complete the job. The solution to the assignment problem tells us how to assign the workers to the jobs so as to minimize the total number of hours worked. In the example above, if we also label the rows from 0 to 4 , then the given solution says that we should assign job 2 to worker 0 , job 1 to worker 1, job 4 to worker 2 , job 0 to worker 3 , and job 3 to worker 4 to get a total minimum of 142 hours worked. Input and Output format. Assume that the matrix is on standard input: the dimension N followed by N lines with N integers per line. You may assume that the entries are all between 0 and 999999 . Print the permutation and the total cost. For N less than 25 , also print the permuted output matrix

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

What perspective or approach to talent would be appropriate?

Answered: 1 week ago