In [1]:
include("test_deferred_acceptance.jl")


Test Summary:       | Pass  Total
Testing matching.jl |   10     10
Out[1]:
BaseTestNext.DefaultTestSet("Testing matching.jl",Any[BaseTestNext.DefaultTestSet("gale_shapley_T: one-to-one",Any[Test Passed
  Expression: m_matched_computed == m_matched_expected
   Evaluated: [1,2,3,0] == [1,2,3,0],Test Passed
  Expression: f_matched_computed == f_matched_expected
   Evaluated: [1,2,3] == [1,2,3],Test Passed
  Expression: m_matched_computed == m_matched_expected
   Evaluated: [1,2,3,0] == [1,2,3,0],Test Passed
  Expression: f_matched_computed == f_matched_expected
   Evaluated: [1,2,3] == [1,2,3]],false),BaseTestNext.DefaultTestSet("gale_shapley_T: many-to-one with caps 1",Any[Test Passed
  Expression: m_matched_computed == m_matched_expected
   Evaluated: [1,2,3,0] == [1,2,3,0],Test Passed
  Expression: f_matched_computed == f_matched_expected
   Evaluated: Integer[1,2,3] == [1,2,3],Test Passed
  Expression: indptr_computed == indptr_expected
   Evaluated: Integer[1,2,3,4] == [1,2,3,4]],false),BaseTestNext.DefaultTestSet("gale_shapley_T: many-to-one",Any[Test Passed
  Expression: s_matched_computed == s_matched_expected
   Evaluated: [3,1,4,3,1,3,2,1,4,1,5] == [3,1,4,3,1,3,2,1,4,1,5],Test Passed
  Expression: indptr_computed == indptr_expected
   Evaluated: Integer[1,5,6,9,11,12] == [1,5,6,9,11,12],Test Passed
  Expression: c_matched_computed == c_matched_expected
   Evaluated: Integer[2,5,8,10,7,1,4,6,3,9,11] == [2,5,8,10,7,1,4,6,3,9,11]],false)],false)

In [1]:
include("matching_tools.jl")
include("matching.jl")


Out[1]:
Matching

In [2]:
srand(711)
m_prefs, f_prefs = random_prefs(5, 10, allow_unmatched=true)
println(m_prefs)
println(f_prefs)
println(Matching.gale_shapley(m_prefs, f_prefs))


[1 9 5 5 4
 0 0 3 4 7
 8 6 2 2 0
 5 8 0 6 1
 4 1 8 3 10
 3 10 4 0 2
 7 3 10 8 8
 10 5 9 7 5
 9 7 6 10 9
 2 2 1 9 6
 6 4 7 1 3]
[2 2 5 4 3 1 4 4 2 4
 4 0 3 1 4 3 1 3 4 0
 1 5 1 3 2 2 2 2 1 2
 5 3 0 0 1 5 0 1 5 5
 3 1 2 5 0 4 5 5 3 3
 0 4 4 2 5 0 3 0 0 1]
1,1
worst: 1
3,8
LoadError: BoundsError: attempt to access 6-element Array{Int64,1}:
 1
 1
 1
 1
 1
 1
  at index [8]
while loading In[2], in expression starting on line 5

 in gale_shapley at /Users/akira/oyama_seminar2016/exercise/ex03/matching.jl:142
 in gale_shapley at /Users/akira/oyama_seminar2016/exercise/ex03/matching.jl:208

In [ ]: