Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # doctors Choice Function if True or hospitals otherwise
- def C(L, doctors):
- pass
- # Lower Ideal of L
- def Li(L):
- lowerIdeal = set()
- for x in AllContracts:
- for y in L:
- if isComparable(x, y) and x <= y:
- lowerIdeal.add(x)
- break
- return lowerIdeal
- # Lower Ideal of C(L, doctors)
- def C_star(L, doctors):
- return Li(C(L, doctors))
- # antitone function U for the choice function C_star(L, doctors)
- def U_star(L, doctors):
- u = set()
- for x in AllContracts:
- if x in L:
- u.add(x)
- else:
- L.add(x)
- if x in C_star(L, doctors):
- u.add(x)
- L.remove(x)
- return u
- # one mapping of L1 and L2 with antitone function for hospitals/doctors
- def f(L1, L2):
- return (U_star(L2, hospitals), U_star(L1, doctors))
- def solve(L1, L2):
- nextL1, nextL2 = f(L1, L2)
- if (L1, L2) == (nextL1, nextL2):
- # (L1, L2) is a fixed Point
- return (L1, L2)
- return solve(nextL1, nextL2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement