In [1]:
using Matching
In [2]:
module EikiTakigawa
include("EikiTakigawa/DA_1to1.jl")
deferred_acceptance = Match
end
module IoriS
include("IoriS/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end
module keiikegami
include("keiikegami/ikegamida.jl")
deferred_acceptance = ikegamida
end
module M_okb
include("M_okb/one-to-one.jl")
deferred_acceptance = DA_algo
end
module myuuuuun
include("myuuuuun/matching.jl")
deferred_acceptance = Matching.gale_shapley_T
end
module NlGG
include("NlGG/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end
module nswa17
include("nswa17/da.jl")
deferred_acceptance = DA.call_match
end
module oyamad
deferred_acceptance = Main.Matching.deferred_acceptance
end
module R_Tsushima
include("R_Tsushima/deffered_acceptance.jl")
deferred_acceptance = def_acc
end
module oyataku1
include("oyataku1/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end
module SUZUKITAISHI
include("SUZUKITAISHI/my_Gale_Shap.jl")
deferred_acceptance = my_Gale_Shap
end
module taneaki
include("taneaki/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end
module tsuyoshi
include("tsuyoshi/deferred_acceptance.jl")
deferred_acceptance = deferred_acceptance
end;
In [3]:
modules = [
EikiTakigawa,
IoriS,
keiikegami,
M_okb,
myuuuuun,
NlGG,
nswa17,
oyamad,
R_Tsushima,
SUZUKITAISHI,
taneaki,
tsuyoshi,
];
In [4]:
m, n = 10, 5
srand(1234)
m_prefs, f_prefs = random_prefs(m, n)
prop_matches_oy, resp_matches_oy = oyamad.deferred_acceptance(m_prefs, f_prefs)
for m in modules
println(m)
@time prop_matches, resp_matches = getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
@time getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
@time getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
if prop_matches == prop_matches_oy && resp_matches == resp_matches_oy
println(" OK")
else
println(" returned: $prop_matches; expected: $prop_matches_oy")
println(" returned: $resp_matches; expected: $resp_matches_oy")
end
end
In [5]:
function performance(m::Int, n::Int, rng::AbstractRNG)
m_prefs, f_prefs = random_prefs(rng, m, n)
times = Array(Float64, length(modules))
allocs = Array(Int, length(modules))
for (i, m) in enumerate(modules)
getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
_, time, alloc, _ = @timed getfield(m, :deferred_acceptance)(m_prefs, f_prefs)
times[i] = time
allocs[i] = alloc
end
indices = sortperm(times)
for i in indices
println(modules[i])
@printf(" %0.9f seconds\n", times[i])
end
end
performance(m::Int, n::Int, seed::Int) = performance(m, n, MersenneTwister(seed))
performance(m::Int, n::Int) = performance(m, n, Base.GLOBAL_RNG)
Out[5]:
In [6]:
seed = 1234
Out[6]:
In [7]:
performance(100, 100, seed)
In [8]:
performance(200, 200, seed)
In [9]:
performance(500, 500, seed)
In [10]:
performance(1000, 1000, seed)
In [ ]: