Skip to content

Commit

Permalink
v__0.1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredgalichon committed Dec 16, 2023
1 parent 1f02c36 commit 85a024b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions mec/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_mec_lp_Tableau():
########################################################
########################################################
########################################################
def test_mec_ot_OTProblem():
def test_mec_ot_OTProblem(limited=False):
from mec.ot import OTProblem
[data_X,data_Y,A_k_l] = mec.data.load_DupuyGalichon_data().values()
sdX,sdY = data_X.std().values, data_Y.std().values
Expand All @@ -49,15 +49,19 @@ def test_mec_ot_OTProblem():
nbx,nbk = feats_x_k.shape
nby,nbl = feats_y_l.shape
Φ_x_y = feats_x_k @ A_k_l @ feats_y_l.T
if limited:
Φ_x_y = Φ_x_y[0:10,0:10]
marriageEx = OTProblem(Φ_x_y)
(μ_x_y,u_x,v_y) = marriageEx.solve_full_lp()
print('Man 0 matches with woman '+str(np.argwhere(μ_x_y[0,:] != 0)[0][0])+'.' )
(μ_x_y,u_x,v_y) = marriageEx.solve_partial_lp()
print(μ_x_y.sum())
u_x,v_y = marriageEx.solve_dual_partial_multiobj_lp(favor_Y=True)
print(u_x.min(),v_y.min())

nbx,nby = 50,30
if limited:
nbx,nby = 10,8
else:
nbx,nby = 50,30
marriage_ex = OTProblem(Φ_x_y[:nbx,:nby],np.ones(nbx) / nbx, np.ones(nby) / nby)
nrow , ncol = min(8, nbx) , min(8, nby)
marriage_ex.solve_full_lp()
Expand Down Expand Up @@ -129,8 +133,8 @@ def test_mec_lp():
return


def test_mec_ot():
test_mec_ot_OTProblem()
def test_mec_ot(limited=False):
test_mec_ot_OTProblem(limited)
test_mec_ot_TULogit()

return
Expand All @@ -141,11 +145,11 @@ def test_mec_gt():

return

def test_mec():
def test_mec(limited=False):
print('Linear programming tests:\n'+'*'*30)
test_mec_lp()
print('*'*30+'\nOptimal transport tests:\n'+'*'*30)
test_mec_ot()
test_mec_ot(limited)
print('*'*30+'\nGame theory tests:\n'+'*'*30)
test_mec_gt()
print('*'*30+'\n'+'*'*30+'\nAll tests completed successfully.')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="mec",
version="0.0.9.11",
version="0.1.0.0",
authors=["Alfred Galichon"],
author_email="ag133@nyu.edu",
licence="",
Expand Down

0 comments on commit 85a024b

Please sign in to comment.