Attachment 'Stable-Marriage-ENCODING.txt'
Download 1 % guess matching
2 match(M,W) :- manAssignsScore(M,_,_), womanAssignsScore(W,_,_), not nonMatch(M,W).
3 nonMatch(M,W) :- manAssignsScore(M,_,_), womanAssignsScore(W,_,_), not match(M,W).
4
5 % no polygamy
6 :- match(M1,W), match(M,W), M <> M1.
7 :- match(M,W), match(M,W1), W <> W1.
8
9 % no singles
10 jailed(M) :- match(M,_).
11 :- manAssignsScore(M,_,_), not jailed(M).
12
13 % strong stability condition
14 :- match(M,W1), manAssignsScore(M,W,Smw), W1 <> W, manAssignsScore(M,W1,Smw1), Smw > Smw1,
15 match(M1,W), womanAssignsScore(W,M,Swm), womanAssignsScore(W,M1,Swm1), Swm >= Swm1.
Attached Files
You are not allowed to attach a file to this page.