Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stable marriage

Author  Topic 

almanac
Starting Member

5 Posts

Posted - 2007-10-04 : 16:14:16
Hi,
I was wondering if any is clued up on how to write the stable marriage algorithm in a SQL stored proceedure. Basically i'm trying to match people based on their gender and a score or ranking they have been given.I've already writen a function to calculate their score it's the stable marriage algorithm i'm stuck on.

Cheers

almanac
Starting Member

5 Posts

Posted - 2007-10-04 : 16:18:45
Hi again, i thought i would post the walk through for the alorithm curtesy of wikipeadia

function stableMatching {
Initialize all m M and w W to free
while free man m who still has a woman w to propose to {
w = m's highest ranked such woman
if w is free
(m, w) become engaged
else some pair (m', w) already exists
if w prefers m to m'
(m, w) become engaged
m' becomes free
else
(m', w) remain engaged
}
}
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-04 : 16:22:55
Your pseudocode pretty much says it all...



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-10-04 : 16:25:42
And the result returned from the function is:

(m, w) get married and m finds out w is a magor bich and m's life is over.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-10-04 : 16:25:58
quote:
Originally posted by Peso

Your pseudocode pretty much says it all...



E 12°55'05.25"
N 56°04'39.16"




Still no code? You've had 4 minutes to write it.



CODO ERGO SUM
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-04 : 16:26:34
Is this a joke? There is no way to determine what a stable marriage is. It would be different per couple.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-10-04 : 16:31:29
The only variable missing in the algorithm is "figuring out women". If that variable can be determined then the algorithm to find "stable marriage" would be simple. But I think the good Lord himself is still working on figuring that variable out.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-04 : 16:37:14
The good Lord himself is working on "figuring out men" first.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-04 : 17:08:47
why figure out men if he's one of us?
not that i'm a religious person...

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-04 : 17:12:44
Well He's not. He's not man or woman as He's not human. We just address Him as a male.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-04 : 17:13:53
i was expecting that



_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-10-04 : 17:37:43
God made man and he made man in his own image...therefore man should worship God. God made woman out of man's rib...therefore woman should worship man.

Still trying to convince my wife on that one...
Go to Top of Page

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-10-04 : 17:41:19
Also, search in the Bible for an Angel with a woman's name and let me know what you come up with...
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-04 : 17:47:52
If I wanted to get in a religious debate, I'd participate in a religious forum. But I won't participate with someone who makes rude comments about women and marriage in his posts.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-10-04 : 18:06:58
I'm jk. And I wasn't trying to turn this into a religious debate at all. Just having a little fun and joking around. I wasn't being rude at all. And no...I don't personally have any of those beliefs about women or marriage...but it's fun to joke about sometimes.
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2007-10-04 : 20:13:11
I just want to second Tara's comments. Please refrain from any sexist or religious comments. This is not the place for them.

=================================================
Creating tomorrow's legacy systems today. One crisis at a time.
Go to Top of Page

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-10-05 : 11:27:57
Aight. Understood. Sorry if I offended you Tara. I was really just joking.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-10-05 : 12:46:19
Lighten up, people!

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -