コード例 #1
0
from stats import GroupStat

#constants...

SMALLEST_GROUP = 40
LARGEST_GROUP = 80

INCREMENT = 2

TESTS_PER_GROUP_SIZE = 8

# iterate over all group sizes in the testing range
for group_size in range(SMALLEST_GROUP,LARGEST_GROUP+1,INCREMENT):

	#create a GroupStat object for this group size
	group_stat = GroupStat(group_size)

	#and start testing...
	for test_number in range(0,TESTS_PER_GROUP_SIZE):		

		#generate a random matrix, execute the tests
		prefs = matrices.random_matrix(group_size)
		res = matchmaker.execute(prefs,False)
		
		# statify and print the results!
		res.statify(group_stat)
		res.print_nicely(group_size)

#print out the GroupStat object
GroupStat.print_nicely()
コード例 #2
0
# a script to manually test various preference matrices
# comment / uncomment as necessary

import matchmaker,matrices

# standard stable roommate preference array (from wikipedia)
# prefs = tests.wiki_roommate

# standard stable marriage preference array (from rosetta code)
# prefs = tests.rosetta_marriage

# random preference array generator in tests.py
prefs = matrices.random_matrix(20)

# execute the match!!
matchmaker.execute(prefs)