diff --git a/committees.org b/committees.org index ba3dff1..5ca2a90 100644 --- a/committees.org +++ b/committees.org @@ -320,19 +320,19 @@ cry for help. Calling ~check_instance(example_instance())~ returns a model: #+BEGIN_EXAMPLE - [frozenset({0, 1}) = 150, - frozenset({0, 2}) = 10, - frozenset({2, 3}) = 56, + [frozenset({2, 4}) = 0, + frozenset({0, 2}) = 0, + frozenset({2, 3}) = 0, frozenset({1, 3}) = 0, - frozenset({2, 5}) = 7, + frozenset({2, 5}) = 0, frozenset({3, 5}) = 0, - frozenset({0, 5}) = 0, - frozenset({1, 2}) = 0, - frozenset({4, 5}) = 23, - frozenset({1, 5}) = 0, - frozenset({0, 3}) = 0, - frozenset({0, 4}) = 0, - frozenset({2, 4}) = 37, + frozenset({0, 5}) = 13, + frozenset({1, 2}) = 110, + frozenset({4, 5}) = 0, + frozenset({1, 5}) = 17, + frozenset({0, 3}) = 60, + frozenset({0, 4}) = 60, + frozenset({0, 1}) = 23, frozenset({3, 4}) = 0, frozenset({1, 4}) = 0] #+END_EXAMPLE @@ -346,10 +346,11 @@ cry for help. comms = committees(C) exams = [sum(m[comms[c]].as_long() for c in comms if i in c) for i in range(len(C))] - examiners = '\n'.join(['%d: %d/%d' % (i, exams[i], C[i]) + examiners = '\n'.join(['%s: %d/%d' % (chr(ord('A') + i), exams[i], C[i]) for i in range(len(C))]) cs = [(c, m[comms[c]].as_long()) for c in sorted(comms, key=sorted)] - csstr = '\n'.join([', '.join(map(str, sorted(c))) + ': ' + str(cv) + csstr = '\n'.join([', '.join(map(lambda i: chr(ord('A') + i), + sorted(c))) + ': ' + str(cv) for c, cv in cs if cv > 0]) print(examiners + '\n\n' + csstr) #+END_SRC @@ -357,19 +358,19 @@ cry for help. This outputs the something like: #+BEGIN_EXAMPLE - 0: 160/160 - 1: 150/150 - 2: 110/110 - 3: 56/60 - 4: 60/60 - 5: 30/30 + A: 156/160 + B: 150/150 + C: 110/110 + D: 60/60 + E: 60/60 + F: 30/30 - 0, 1: 150 - 0, 2: 10 - 2, 3: 56 - 2, 4: 37 - 2, 5: 7 - 4, 5: 23 + A, B: 23 + A, D: 60 + A, E: 60 + A, F: 13 + B, C: 110 + B, F: 17 #+END_EXAMPLE Note the /something like/. There are multiple ways to satisfy this set of @@ -419,19 +420,19 @@ cry for help. example). #+BEGIN_EXAMPLE - 0: 160/160 - 1: 150/150 - 2: 110/110 - 3: 60/60 - 4: 60/60 - 5: 26/30 + A: 160/160 + B: 150/150 + C: 110/110 + D: 56/60 + E: 60/60 + F: 30/30 - 0, 1: 137 - 0, 5: 23 - 1, 4: 13 - 2, 3: 60 - 2, 4: 47 - 2, 5: 3 + A, B: 57 + A, D: 43 + A, E: 60 + B, C: 93 + C, F: 17 + D, F: 13 #+END_EXAMPLE ** Dealing with /should/ @@ -475,19 +476,19 @@ cry for help. #+END_SRC #+BEGIN_EXAMPLE - 0: 160/160 - 1: 150/150 - 2: 106/110 - 3: 60/60 - 4: 60/60 - 5: 30/30 + A: 156/160 + B: 150/150 + C: 110/110 + D: 60/60 + E: 60/60 + F: 30/30 - 0, 1: 87 - 0, 2: 43 - 0, 5: 30 - 1, 2: 3 - 1, 3: 60 - 2, 4: 60 + A, B: 90 + A, C: 43 + A, F: 23 + B, E: 60 + C, D: 60 + C, F: 7 #+END_EXAMPLE ** Optimize for capacities @@ -567,35 +568,35 @@ cry for help. We now get something like: #+BEGIN_EXAMPLE - 0: 158/158 - 1: 158/150 - 2: 110/108 - 3: 60/60 - 4: 65/60 - 5: 15/15 + A: 158/160 + B: 158/150 + C: 110/110 + D: 65/60 + E: 60/60 + F: 15/30 - 0, 1: 158 - 2, 3: 45 - 2, 4: 65 - 3, 5: 15 + A, B: 158 + C, D: 65 + C, E: 45 + E, F: 15 #+END_EXAMPLE If we were to prioritize the /should/ requirement over minimizing the number of committees, then we would get something like: #+BEGIN_EXAMPLE - 0: 158/158 - 1: 151/150 - 2: 109/108 - 3: 64/60 - 4: 61/60 - 5: 23/15 + A: 158/160 + B: 158/150 + C: 109/110 + D: 65/60 + E: 60/60 + F: 16/30 - 0, 1: 26 - 0, 2: 109 - 0, 5: 23 - 1, 3: 64 - 1, 4: 61 + A, B: 98 + A, C: 44 + A, F: 16 + B, E: 60 + C, D: 65 #+END_EXAMPLE * COMMENT Local variables