From 200d6c000d9376fe9dd549a535a09cf62f0f0069 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Thu, 4 May 2023 15:04:51 -0700 Subject: [PATCH] reformat --- go_benchmark_it.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/go_benchmark_it.py b/go_benchmark_it.py index 52f8bfc..85c49cf 100644 --- a/go_benchmark_it.py +++ b/go_benchmark_it.py @@ -55,9 +55,7 @@ def make_objective(problem, n_dim, *, fix_stuff=0): # and which is `b` between the equations and the code. # hmm it seems like the code is right, judging by this: # https://www.itl.nist.gov/div898/strd/nls/data/LINKS/DATA/MGH09.dat - helper = lambda x: np.where(x < 0, -1, 1) * ( - np.abs(x) + tiny_offset - ) + helper = lambda x: np.where(x < 0, -1, 1) * (np.abs(x) + tiny_offset) # 1.0 - 1e-16 == 0.9999999999999999 # 1.0 + 1e-16 == 1.0 # 1.0 + 2e-16 == 1.0000000000000002 @@ -303,7 +301,7 @@ if __name__ == "__main__": run_anyway = 3 always_run_anyway = False - #percents = dict(frugal_percent=0.1, greedy_percent=1.5) + # percents = dict(frugal_percent=0.1, greedy_percent=1.5) percents = dict(frugal_percent=1.0, greedy_percent=2.0) book = book_of_optimizers @@ -400,8 +398,7 @@ if __name__ == "__main__": prices.setdefault(opt_name, 0.0) sorted_res = sorted(all_res) score_insignificance = sum( - len(all_res[fopt]) - for _, fopt in zip(range(len(place_scores)), sorted_res) + len(all_res[fopt]) for _, fopt in zip(range(len(place_scores)), sorted_res) ) price_insignificance = sum( len(all_res[fopt]) @@ -466,7 +463,9 @@ if __name__ == "__main__": # if opt_score < 1: continue stats = f"{opt_score:18.16f}" name = opt_name.removesuffix("_cube") - color = "\033[1m" if opt_score > 1.0 else "\033[33m" if opt_score < 1.0 else "" + color = ( + "\033[1m" if opt_score > 1.0 else "\033[33m" if opt_score < 1.0 else "" + ) s = f"{mark(opt_name)} {name:<32}{reset} with {color}{stats}{reset}" # s += f" {color}{float(delta):+.0f}{reset}" print(s)