Implement a program for determining

1) [GRADED] Implement a program for determining whether an assigtunent of women to men is stable or not as discussed in class. For this assignment you must use Python 3 or higher to implement your algorithm as it is relatively straightforward. Further, the goal is to help you understand the notion of stability, on make sure to test it adequately. For an efficient implementation, minimize the number of “potential cause of instability” checks, that is, the number of (woman, man) pairs to be checked to ensure that the solution is (un)stable. Name your main Python script as assignmentl.py, and make sure your code is well-documented.
(a) Assume that the input file (stablelnput.bct) is a sequence of (2 + + n*m)-lines, with (i) n in the first line on its own signifying the number of women and men, (ii) m in the second line signifying the number of assignments to be tested, (iii) the following (2.n) lines encoding the preference lists — n lines for women and n fines for men — each containing space separated list of (n+ l) names as required in the stable marriage problem, and (iv) and n*m lines encoding m-assignments, each assignment given as n-lines, each line containing a woman-man pair, as follows:
For example: 2 3 Alice Xavier Zeus Carol Zeus Xavier Xavier Alice Carol Zeus Alice Carol Alice Xavier Carol Zeus Alice Xavier Carol Zeus Alice Zeus Carol Xavier
(b) Write the output as m-lines, each line containing three numbers, with either I or 0 to signify whether or not the assignment is a stable match, followed by n2, followed by the number of unassigned pairs the algorithm checks to determine stability or rule out instability. You must name input file, output file, and the Python program as follows: stablelnput.txt, stableOutPut.txt, assignmentl.py. Points will be deducted if you do not follow this naming convention and file extension.

AssignmentTutorOnline

The post Implement a program for determining appeared first on My Blog.

✍️ Get Writing Help