570 likes | 776 Views
Cupid’s Arrow. 電機一 b99901090 黃翔致 電機一 b99901117 吳名弘 電機 三 b96502031 李宗燁. men to women. The Basic Model – a Matrix. preference number 0 > 1 > 2. women to men. The Basic Model – a Matrix. sum!!. The Basic Model – a Matrix. min = 1 + 0 + 2 = 3 This is the best solution !. Notation.
E N D
Cupid’s Arrow 電機一 b99901090黃翔致 電機一 b99901117吳名弘 電機三 b96502031李宗燁
men to women The Basic Model – a Matrix preference number 0 > 1 > 2
women to men The Basic Model – a Matrix
sum!! The Basic Model – a Matrix min = 1 + 0 + 2 = 3 This is the best solution !
Notation The model absolutely has the solution. But the solution may not be unique.
Find The Best Solution • Standard Answer: C++ naïve method • Solution: • Best Choice Method • Worst Choice Method • Purpose: • Quick! • Accurate!
C++ naïve method 1 1 2 2 3 3 1 1 2 2 3 3 1 1 2 2 3 3
C++ Naïve Solution Answer: 1+0+2=3
C++ Naïve Solution Answer: 1+0+2=3
C++ Naïve Solution Answer: 1+2+2=5
C++ Naïve Solution Answer: 4+4+2=10
C++ Naïve Solution Answer: 4+2+1=7
C++ Naïve Solution Answer: 2+4+2=8
C++ Naïve Solution Answer: 2+0+1=3
C++ Naïve Solution Best: 3Worst:10
Best Choice Method • Each round, choose the best choice.
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Step 1: Find the best choice
Best Choice Method Again : Find the best choice
Best Choice Method Solution: 1+0+2=3
Improvement of Best Choice Method Finding best choice is a repeating step
Improvement of Best Choice Method • Using Sorting Algorithm: • 0(1,1) • 1(0,0) • 1(2,0) • 2(0,2) • 2(1,2) • 2(2,1) • 2(2,2) • 4(0,1) • 4(1,0)
Improvement of Best Choice Method • Using Sorting Algorithm: • 0(1,1) • 1(0,0) • 1(2,0) • 2(0,2) • 2(1,2) • 2(2,1) • 2(2,2) • 4(0,1) • 4(1,0)
Improvement of Best Choice Method • Using Sorting Algorithm: • 0(1,1) • 1(0,0) • 1(2,0) • 2(0,2) • 2(1,2) • 2(2,1) • 2(2,2) • 4(0,1) • 4(1,0)
Improvement of Best Choice Method • Using Sorting Algorithm: • 0(1,1) • 1(0,0) • 1(2,0) • 2(0,2) • 2(1,2) • 2(2,1) • 2(2,2) • 4(0,1) • 4(1,0) It doesn’t do the same step.
Worst Choice Method • The Defect of Best Choice Method is that it may choose a worst choice accidently.
Worst Choice Method Step1 : Find the worst choice
Worst Choice Method Step 2 : To prevent the worst choice
Worst Choice Method Step 2 : To prevent the worst choice,find the best choice on its row/column
Worst Choice Method Repeat the step1:Find the worst choice
Worst Choice Method Repeat the step2:Find the best choice on its row/column
Worst Choice Method Answer: 1+1+2=4Correct!
Answer=6 Answer=6 Answer=6 Answer=6 Answer=6 Answer=6
Homosexual A B C D A B C D
Homosexual A B C D A B C D