Question: This problem to be done in C++, or Mathematica, or Matlab. Problem: Martha is a matchmaker. She likes pairing up men and women hoping they
This problem to be done in C++, or Mathematica, or Matlab.
Problem: Martha is a matchmaker. She likes pairing up men and women hoping they will find romance together. At the moment Martha has five unmatched male friends
Al Bob Carl Don Egbert
and five unmatched female friends
Alice Barb Carol Doreen Ellen
She is going to pair up these five men and five women so that they will hopefully find happiness with their partners.
In order to increase the chances of success she does the following. First she asks each of the men how much they desire each of the five women. She records their responses as a number from 1 to 10 with 1 low and 10 high. The results are as follows.
|
| Alice | Barb | Carol | Doreen | Ellen |
| Al | 1 | 3 | 6 | 7 | 10 |
| Bob | 2 | 4 | 8 | 3 | 10 |
| Carl | 10 | 7 | 5 | 1 | 9 |
| Don | 5 | 3 | 1 | 9 | 7 |
| Egbert | 4 | 6 | 7 | 3 | 8 |
She stores these numbers in a matrix A as follows.
A = 
Note that she is implicitly assigning each of the men a number from 1 to 5 so that Al is 1, Bob is 2, etc. Similarly she is assigning each of the women a number from 1 to 5 so that Alice is 1, Barb is 2, etc. She also asks each of the women how much they desire each of the five men. Again she records their responses as a number from 1 to 10. The results are
|
| Al | Bob | Carl | Don | Egbert |
| Alice | 8 | 2 | 4 | 5 | 10 |
| Barb | 4 | 1 | 2 | 5 | 8 |
| Carol | 7 | 9 | 4 | 2 | 5 |
| Doreen | 2 | 1 | 4 | 8 | 3 |
| Ellen | 6 | 8 | 1 | 9 | 2 |
She stores these numbers in a matrix B as follows.
B =
A possible pairing of the five men and five women corresponds to a permutation p of the numbers 1 through 5 so that man i is paired with woman pi. For example, if Al is paired with Carol, Bob with Doreen, Carl with Ellen, Don with Alice and Egbert with Barb, then the corresponding permutation p would be p = (3, 4, 5, 1, 2).
Given a possible pairing of the five men and women, she computes the total amount the men and women desire each other. This is
S = A1,p1 + A2,p2 + A3,p3 + A4,p4 + A5,p5 + Bp1,1 + Bp2,2 + Bp3,3 + Bp4,4 + Bp5,5
For example, if p = (3, 4, 5, 1, 2) then
S = A1,3 + A2,4 + A3,5 + A4,1 + A5,2 + B3,1 + B4,2 + B5,3 + B1,4 + B2,5
= 6 + 3 + 9 + 5 + 6 + 7 + 1 + 1 + 5 + 8
= 51
Martha wants to find the pairing that gives the highest value of S and this is the one that she will use to pair up her friends. Needless to say, Martha doesn't want to run through all 5! = 120 permutations of the numbers 1 through 5 and compute the value of S for each one to find the one with the highest S.
Luckily you are on hand to write a computer program that will do this for her. Your program should go through the 120 permutations of the numbers 1 through 5 and compute the value of S for each one and find the permutation with the highest value of S. If you write it in Mathematica, you can make some modifications to the one in section 4.4 of the online Notes. Turn is a program listing and the program output. Make sure it is something I can read. If I can't figure out what you are doing, you will not get a good score.
00978 73193 68517 34736 12 10 5 4 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
