-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.py
More file actions
36 lines (26 loc) · 733 Bytes
/
examples.py
File metadata and controls
36 lines (26 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import numpy as np
from src.chore_allocation import (
pEF1_fPO_three_agent_allocation,
ILP_pEF1_fPO_allocation,
fPO,
EF1,
EF_violations,
)
np.random.seed(0)
# Small 3 agent example
m, n = 6, 3
D = np.random.randint(1, 6, size=(m, n)).astype(float)
D[1, 1], D[5, 1] = 3, 1
X = pEF1_fPO_three_agent_allocation(m, n, D)
print(X)
print("Allocation is fPO:", fPO(X, D))
print("Allocation is EF1:", EF1(X, D))
print("EF violations:", EF_violations(X, D))
# Larger example
m, n = 80, 9
D = np.random.randint(1, 6, size=(m, n)).astype(float)
X = ILP_pEF1_fPO_allocation(m, n, D)
print(X)
print("Allocation is fPO:", fPO(X, D))
print("Allocation is EF1:", EF1(X, D))
print("EF violations:", EF_violations(X, D))