in ADBench/plot_graphs.py [0:0]
def vals_by_tool(objective, graph_files, function_type, in_dir):
'''Classifies file values by tools'''
def div_lists(alist, blist):
return [
a / b
if a != float("inf") and b != float("inf")
else float("inf")
for a,b in zip(alist,blist)
]
manual_times = None
for tool in tool_names(graph_files):
(n_vals, t_objective_vals, t_jacobian_vals, violation) = read_vals(objective, graph_files, tool, in_dir)
if manual_times is None and has_manual(tool):
manual_times = t_objective_vals
if function_type == 'objective':
t_vals = t_objective_vals
elif function_type == 'jacobian':
t_vals = t_jacobian_vals
elif function_type == 'objective ÷ Manual':
if manual_times is None:
print(f"Hmmm. Don't have manual_times yet {tool}")
raise Exception(f"Hmmm. Don't have manual_times yet {tool}")
t_vals = div_lists(t_objective_vals, manual_times)
elif function_type == 'jacobian ÷ objective':
t_vals = div_lists(t_jacobian_vals, t_objective_vals)
else:
raise Exception(f"Unknown function type {function_type}")
yield (tool, n_vals, t_vals, violation)