예제 #1
0
# print("*************************************")
# print(p1_rt.print_results())

# The O(n·v(amax)) dynamic programming algorithm from the textbook based on the MinCost version of the problem.
min_cost_results = min_cost(k_instances)
print("\n\nMIN COST ALGORITHM")
print("*************************************")
print(str(min_cost_results))

# p2_e = Totals(numpy.divide(min_cost_results.efficacy.eff,
#                            optimal_dynamic_programming_results.efficacy.eff))
#
# p2_rt = Totals(numpy.divide(min_cost_results.running_time.eff,
#                             optimal_dynamic_programming_results.running_time.eff))

p2_e = Totals(min_cost_results.efficacy.eff)
p2_rt = Totals(min_cost_results.running_time.eff)

print("\nQuality of Solutions")
print("*************************************")
print(p2_e.print_results())

print("\nQuality of Running Time")
print("*************************************")
print(p2_rt.print_results())

# The greedy 2-approximation from the textbook.
greedy_two_approximation_results = greedy_two_approximation(k_instances)
print("\n\nGREEDY TWO APPROXIMATION ALGORITHM")
print("*************************************")
print(str(greedy_two_approximation_results))