mirror of
https://github.com/larstvei/SMT-for-IN3070.git
synced 2024-11-26 11:38:31 +00:00
Update prettyprinter
This commit is contained in:
parent
05f32f6364
commit
fd206302d7
141
committees.org
141
committees.org
@ -320,19 +320,19 @@ cry for help.
|
|||||||
Calling ~check_instance(example_instance())~ returns a model:
|
Calling ~check_instance(example_instance())~ returns a model:
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
[frozenset({0, 1}) = 150,
|
[frozenset({2, 4}) = 0,
|
||||||
frozenset({0, 2}) = 10,
|
frozenset({0, 2}) = 0,
|
||||||
frozenset({2, 3}) = 56,
|
frozenset({2, 3}) = 0,
|
||||||
frozenset({1, 3}) = 0,
|
frozenset({1, 3}) = 0,
|
||||||
frozenset({2, 5}) = 7,
|
frozenset({2, 5}) = 0,
|
||||||
frozenset({3, 5}) = 0,
|
frozenset({3, 5}) = 0,
|
||||||
frozenset({0, 5}) = 0,
|
frozenset({0, 5}) = 13,
|
||||||
frozenset({1, 2}) = 0,
|
frozenset({1, 2}) = 110,
|
||||||
frozenset({4, 5}) = 23,
|
frozenset({4, 5}) = 0,
|
||||||
frozenset({1, 5}) = 0,
|
frozenset({1, 5}) = 17,
|
||||||
frozenset({0, 3}) = 0,
|
frozenset({0, 3}) = 60,
|
||||||
frozenset({0, 4}) = 0,
|
frozenset({0, 4}) = 60,
|
||||||
frozenset({2, 4}) = 37,
|
frozenset({0, 1}) = 23,
|
||||||
frozenset({3, 4}) = 0,
|
frozenset({3, 4}) = 0,
|
||||||
frozenset({1, 4}) = 0]
|
frozenset({1, 4}) = 0]
|
||||||
#+END_EXAMPLE
|
#+END_EXAMPLE
|
||||||
@ -346,10 +346,11 @@ cry for help.
|
|||||||
comms = committees(C)
|
comms = committees(C)
|
||||||
exams = [sum(m[comms[c]].as_long() for c in comms if i in c)
|
exams = [sum(m[comms[c]].as_long() for c in comms if i in c)
|
||||||
for i in range(len(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))])
|
for i in range(len(C))])
|
||||||
cs = [(c, m[comms[c]].as_long()) for c in sorted(comms, key=sorted)]
|
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])
|
for c, cv in cs if cv > 0])
|
||||||
print(examiners + '\n\n' + csstr)
|
print(examiners + '\n\n' + csstr)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@ -357,19 +358,19 @@ cry for help.
|
|||||||
This outputs the something like:
|
This outputs the something like:
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
0: 160/160
|
A: 156/160
|
||||||
1: 150/150
|
B: 150/150
|
||||||
2: 110/110
|
C: 110/110
|
||||||
3: 56/60
|
D: 60/60
|
||||||
4: 60/60
|
E: 60/60
|
||||||
5: 30/30
|
F: 30/30
|
||||||
|
|
||||||
0, 1: 150
|
A, B: 23
|
||||||
0, 2: 10
|
A, D: 60
|
||||||
2, 3: 56
|
A, E: 60
|
||||||
2, 4: 37
|
A, F: 13
|
||||||
2, 5: 7
|
B, C: 110
|
||||||
4, 5: 23
|
B, F: 17
|
||||||
#+END_EXAMPLE
|
#+END_EXAMPLE
|
||||||
|
|
||||||
Note the /something like/. There are multiple ways to satisfy this set of
|
Note the /something like/. There are multiple ways to satisfy this set of
|
||||||
@ -419,19 +420,19 @@ cry for help.
|
|||||||
example).
|
example).
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
0: 160/160
|
A: 160/160
|
||||||
1: 150/150
|
B: 150/150
|
||||||
2: 110/110
|
C: 110/110
|
||||||
3: 60/60
|
D: 56/60
|
||||||
4: 60/60
|
E: 60/60
|
||||||
5: 26/30
|
F: 30/30
|
||||||
|
|
||||||
0, 1: 137
|
A, B: 57
|
||||||
0, 5: 23
|
A, D: 43
|
||||||
1, 4: 13
|
A, E: 60
|
||||||
2, 3: 60
|
B, C: 93
|
||||||
2, 4: 47
|
C, F: 17
|
||||||
2, 5: 3
|
D, F: 13
|
||||||
#+END_EXAMPLE
|
#+END_EXAMPLE
|
||||||
|
|
||||||
** Dealing with /should/
|
** Dealing with /should/
|
||||||
@ -475,19 +476,19 @@ cry for help.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
0: 160/160
|
A: 156/160
|
||||||
1: 150/150
|
B: 150/150
|
||||||
2: 106/110
|
C: 110/110
|
||||||
3: 60/60
|
D: 60/60
|
||||||
4: 60/60
|
E: 60/60
|
||||||
5: 30/30
|
F: 30/30
|
||||||
|
|
||||||
0, 1: 87
|
A, B: 90
|
||||||
0, 2: 43
|
A, C: 43
|
||||||
0, 5: 30
|
A, F: 23
|
||||||
1, 2: 3
|
B, E: 60
|
||||||
1, 3: 60
|
C, D: 60
|
||||||
2, 4: 60
|
C, F: 7
|
||||||
#+END_EXAMPLE
|
#+END_EXAMPLE
|
||||||
|
|
||||||
** Optimize for capacities
|
** Optimize for capacities
|
||||||
@ -567,35 +568,35 @@ cry for help.
|
|||||||
We now get something like:
|
We now get something like:
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
0: 158/158
|
A: 158/160
|
||||||
1: 158/150
|
B: 158/150
|
||||||
2: 110/108
|
C: 110/110
|
||||||
3: 60/60
|
D: 65/60
|
||||||
4: 65/60
|
E: 60/60
|
||||||
5: 15/15
|
F: 15/30
|
||||||
|
|
||||||
0, 1: 158
|
A, B: 158
|
||||||
2, 3: 45
|
C, D: 65
|
||||||
2, 4: 65
|
C, E: 45
|
||||||
3, 5: 15
|
E, F: 15
|
||||||
#+END_EXAMPLE
|
#+END_EXAMPLE
|
||||||
|
|
||||||
If we were to prioritize the /should/ requirement over minimizing the number
|
If we were to prioritize the /should/ requirement over minimizing the number
|
||||||
of committees, then we would get something like:
|
of committees, then we would get something like:
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
0: 158/158
|
A: 158/160
|
||||||
1: 151/150
|
B: 158/150
|
||||||
2: 109/108
|
C: 109/110
|
||||||
3: 64/60
|
D: 65/60
|
||||||
4: 61/60
|
E: 60/60
|
||||||
5: 23/15
|
F: 16/30
|
||||||
|
|
||||||
0, 1: 26
|
A, B: 98
|
||||||
0, 2: 109
|
A, C: 44
|
||||||
0, 5: 23
|
A, F: 16
|
||||||
1, 3: 64
|
B, E: 60
|
||||||
1, 4: 61
|
C, D: 65
|
||||||
#+END_EXAMPLE
|
#+END_EXAMPLE
|
||||||
|
|
||||||
* COMMENT Local variables
|
* COMMENT Local variables
|
||||||
|
Loading…
Reference in New Issue
Block a user