In [1]:
# coding: UTF-8
%matplotlib inline
import matchfuncs as mf
import matplotlib.pyplot as plt
In [2]:
prop_prefs = [[0, 1, 2],
[0, 2, 1],
[2, 0, 1]]
resp_prefs = [[2, 0, 1],
[2, 0, 1],
[1, 2, 0]]
In [3]:
prop_matched, resp_matched = mf.BOS(prop_prefs, resp_prefs)
mf.Graph(prop_matched, resp_matched, prop_name=["1", "2", "3"], resp_name=["A", "B", "C"])
plt.savefig("2-truth.png")
In [4]:
sub_prefs = [[0, 1, 2],
[2, 0, 1],
[2, 0, 1]]
In [5]:
prop_matched, resp_matched = mf.BOS(sub_prefs, resp_prefs)
mf.Graph(prop_matched, resp_matched, prop_name=["1", "2", "3"], resp_name=["A", "B", "C"])
plt.savefig("2-nottruth.png")
In [6]:
prop_matched, resp_matched = mf.BOS(prop_prefs, resp_prefs)
mf.Graph(prop_matched, resp_matched, prop_name=["1", "2", "3"], resp_name=["A", "B", "C"])
plt.savefig("2-da.png")
In [7]:
prop_prefs = [[0, 1, 2],
[0, 2, 1],
[2, 0, 1]]
resp_prefs = [[2, 0, 1],
[2, 0, 1],
[1, 2, 0]]
prop_caps = [2, 2, 2]
resp_caps = [2, 2, 2]
In [8]:
prop_matched, resp_matched, prop_indptr, resp_indptr = mf.BOS(prop_prefs, resp_prefs, resp_caps, prop_caps)
mf.Graph(prop_matched, resp_matched, prop_indptr, resp_indptr, prop_name=["1", "2", "3"], resp_name=["A", "B", "C"])
plt.savefig("2-shou1.png")
In [9]:
prop_matched, resp_matched, prop_indptr, resp_indptr = mf.DA(prop_prefs, resp_prefs, resp_caps, prop_caps)
mf.Graph(prop_matched, resp_matched, prop_indptr, resp_indptr, prop_name=["1", "2", "3"], resp_name=["A", "B", "C"])
plt.savefig("2-shou2.png")
In [10]:
sub_prefs = [[0, 1, 3],
[2, 3, 3],
[2, 0, 3]]
In [11]:
prop_matched, resp_matched, prop_indptr, resp_indptr = mf.BOS(sub_prefs, resp_prefs, resp_caps, prop_caps)
mf.Graph(prop_matched, resp_matched, prop_indptr, resp_indptr, prop_name=["1", "2", "3"], resp_name=["A", "B", "C"])
plt.savefig("2-shou3.png")
応募数制約
In [12]:
prop_prefs = [[0, 1, 2],
[0, 2, 1],
[2, 0, 1]]
resp_prefs = [[2, 0, 1],
[2, 0, 1],
[1, 2, 0]]
prop_caps = [2, 2, 2]
resp_caps = [2, 2, 2]
list_length = 2
In [13]:
prop_matched, resp_matched, prop_indptr, resp_indptr = mf.DA(prop_prefs, resp_prefs, resp_caps, prop_caps, list_length)
mf.Graph(prop_matched, resp_matched, prop_indptr, resp_indptr, prop_name=["p1", "p2", "p3"], resp_name=["q1", "q2", "q3"])
plt.savefig("3-seiyaku1.png")
In [14]:
sub_prefs = [[0, 1, 2],
[2, 1, 0],
[2, 0, 1]]
In [15]:
prop_matched, resp_matched, prop_indptr, resp_indptr = mf.DA(sub_prefs, resp_prefs, resp_caps, prop_caps, list_length)
mf.Graph(prop_matched, resp_matched, prop_indptr, resp_indptr, prop_name=["p1", "p2", "p3"], resp_name=["q1", "q2", "q3"])
plt.savefig("3-seiyaku2.png")