1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2002 Problem Set 9

advertisement
1.00/1.001 Introduction to Computers and Engineering
Problem Solving
Fall 2002
Problem Set 9
Due: Day 32
Problem 1. Dating Service (Part 1) – Design (100%)
You are to come up with a matching algorithm that will work for a dating service. This
problem is similar to medical residency matching procedure. To make this problem
easier, you will only be considering matching females with males and vice versa.
You will be given a sample of data from six people who took the following surve y:
Name (first name and last name only):_____________________
Mutiple Choice Questions: (choose the one best answer that applies)
Personal Profile: (Information about you)
__ 1. What is your age range? 1) 15-20 2) 20-30 3) 30-40 4) 40-50
__ 2. Which Java® construct describes you best?
1) anonymous inner class 2) if-else clause 3) public static final
4) do-while loop
__ 3. What is your desired education level?
1) Undergrad 2) Masters 3) Ph.D or more 4) Med school 5) MBA
__ 4. What is your religion?
1) non-believer 2) MacOS 3) Linux 4) Windows 5) PalmOS 6) Other
__ 5. During a busy time, I first sacrifice:
1) sleep 2) food 3) problem sets 4) social life 5) small animals
__ 6. Where do you go looking for a date?
1) Student Center 2) Nightclub 3) Athena Cluster
4) Library 5) Laundry room 6) java.util package
__ 7. Favorite comment style? 1) /* */
2) //
__ 8. What is your race? 1) white 2) black 3) asian 4) Hispanic 5) Klingon
1.00 PS#9
1/4
Fall 2002
What profile would you prefer your ideal mate to have?
__ 1. Age range? 0) Any 1) 15-20 2) 20-30 3) 30-40 4) 40-50
__ 2. Which Java® construct personality type?
0) Any 1) anonymous inner class 2) if-else clause 3) public static
final 4) do-while loop
__ 3. Desired education level?
0) Any 1) Undergrad 2) Masters 3) Ph.D or more 4) Med school 5) MBA
__ 4. Religion?
0)Any 1) non-believer 2) MacOS 3) Linux 4) Windows 5) PalmOS 6) Other
__ 5. First to sacrifice during a busy period?
0)Any 1) sleep 2) food 3) problem sets 4) social life 5) small animals
__ 6. Where to go to find a date?
0) Any 1) Student Center 2) Nightclub/Party 3) Athena Cluster
4) Library 5) Laundry room 6) java.util package
__ 7. Comment style? 0) Any
1) /* */
2) //
__ 8. Race? 0) Any 1) white 2) black 3) asian 4) Hispanic 5) Klingon
The data from filling out the surveys are recorded in two files, one is male.txt and the
other is female.txt. Each line of the file contains one record. An example of a record
is shown below.
John Doe 2 4 4 1 3 4 2 1 2 0 4 0 2 0 2 0
name
John Doe’s profile
profile of ideal mate
Each record will start with a person’s name (always a first and a last name). The eight
numbers after the name represent the seeker’s profile, while the last eight numbers
represent the profile of that person’s ideal mate.
Your algorithm should attempt to match up each female with one male in a way that
results in the highest compatibility. It’s okay if not everyone is matched, but your
program should output a list of names of people who were matched with their partners,
and a list of people who were not matched.
Please think of a design that will pair up these people. In your design, you do not need to
implement anything. However, you should list what data fields and methods are in each
1.00 PS#9
2/4
Fall 2002
of your classes (please include the signature of your methods). You should also explain
what each data field represents and what each method does.
Assignment
1. Class Design
Come up with a list of all the classes you think you will need to implement the dating service. Include a list of all the data members and all the methods you think you will need. Each data member and method should be prefaced with a short comment describing it. Write these in .java files. (Your .java files do not need to compile.)
2. Compatibility Algorithm
Write up a detailed description of the algorithm you will use to evaluate compatibility of potential mates. (You probably will assign some kind of compatibility score to a potential pair.)
3. Matching Algorithm
Write up a detailed description of how you will match people. You should strive to pair up females with males whose profiles are as compatible as possible (and vice versa). Your algorithm doesn’t necessarily have to arrive at the optimal solution, but it should try to match as many profile characteristics as possible. 4. Provide Sample Data
Provide us with one line of sample data for the survey (above). You don’t need to use your real name, and your profile does not need to match your true interests. But it must follow the format described above: a first name (no spaces), last name (no spaces) and sixteen numbers that correspond to answers to questions in the survey. Put the data into a file male.txt if you want to be a male, or in a file named female.txt if you want to
be a female. Please just provide us with one or the other (not both) and upload to your
1.00 Homework locker. We will use your data for problem set 10, so don’t give out any
information you don’t want to share with the rest of the class (i.e., your real name).
You can write your descriptions for (2) or (3) in eithe r in a .java file, text file, or
Microsoft Word file. As always, you will need to print out all your files and submit them
to the 1.00 Homework locker electronically.
Note for PS#10
You will be implementing your design for the dating service assignment in Problem Set
10. If you are working with a partner on PS#9, you should work with the same partner
for problem set 10. (If you cannot work with the same partner for some reason, let your
TA know as soon as possible.)
1.00 PS#9
3/4
Fall 2002
Turnin
Turnin Requirements
• Hardcopy and electronic copy of ALL source code (all .java files). Remember to
comment your code, points will be taken off for insufficient comments.
• Place a comment with your name, username, section, TA's name, assignment number,
and list of people with whom you have discussed the problem set on ALL files you
submit.
•
Do NOT turn in electronic or hardcopies of compiled byte code (.class files).
Collaboration
For this problem set, you may work together with your assigned partner in the class. If
you choose to work with your partner, you must include both of your names on your
submission. (If you have different TAs, be sure you write both TAs' names on your PS.)
You will not be allowed to add the name of your partner after submitting your problem
set. Only submit the problem set ONCE (choose either person). Both you and your
partner will get the same grade. Only 1 or 2 member teams, no exceptions.
Electronic Turnin
Use SecureFX (or another secure ftp or secure shell program) to upload your problem set
to your 1.00 homework locker.
Detailed instructions of how to upload are on the course website.
Since your problem set is due at the beginning of lecture, your uploaded problem should
have a timestamp of no later than morning on the due date.
Penalties
•
Missing Hardcopy: -10% off problem score if missing hardcopy.
•
Missing Electronic Copy: -30% off problem score if missing electronic copy.
•
Late Turnin: -30% off problem score if 1 day late. More than 1 day late = NO
CREDIT.
If your problem set is late, or if a professor has granted you an extension in advance, do
not submit a printed copy of your problem set.
1.00 PS#9
4/4
Fall 2002
Java® is a trademark or registered trademark of Sun Microsystems, Inc. in the United States and other countries.
Download