Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
erelsgl committed Jul 10, 2024
1 parent 12df72f commit 26832f0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def compare_heterogeneous_matroid_constraints_algorithms_egalitarian_utilitarian
expr.run_with_time_limit(run_experiment,input_ranges_1,5)
expr.run_with_time_limit(run_experiment, input_ranges_2, 5)
expr.run_with_time_limit(run_experiment, input_ranges_3, 5)

def run_experiment(equal_capacities:bool,equal_valuations:bool,binary_valuations:bool,category_count:int,item_capacity_bounds:int,random_seed_num:int,num_of_agents:int,algorithm:callable,num_of_items:int):
# Mapping of algorithms to their specific argument sets
algo_args = {
Expand Down Expand Up @@ -92,9 +92,11 @@ def run_experiment(equal_capacities:bool,equal_valuations:bool,binary_valuations
min_egalitarian_algorithm_value_denominator=min_egalitarian_algorithm_value if min_egalitarian_algorithm_value!=0 else min_egalitarian_algorithm_value+epsilon
#experiments_csv.logger.info(f'valuation_matrix -> {valuation_matrix} \n and egalitarian allocation ->{not_rounded_egal} \n min value of it is -> {min_egalitarian_algorithm_value}')
#running current algorithm with the appropriate arguments
algorithm(**filtered_kwargs)

algorithm(**filtered_kwargs) # results are kept in allocc
min_algorithm_bundle_value=min(alloc.agent_bundle_value(agent,bundle) for agent,bundle in alloc.bundles.items())# to compare with egalitarian algorithm
# Utilitarian algorithm

alloc_utilitarian=AllocationBuilder(instance)
utilitarian_matching(alloc_utilitarian)
utilitarian_bundle_sum=sum(alloc_utilitarian.agent_bundle_value(agent,bundle)for agent,bundle in alloc_utilitarian.bundles.items())
Expand Down

0 comments on commit 26832f0

Please sign in to comment.