From 993d3fde729dc794169ddb132848e1f489eb8017 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 12 Jun 2022 05:51:17 +0200 Subject: [PATCH] direct: update birect.py --- direct/birect.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/direct/birect.py b/direct/birect.py index 7336656..ac882bb 100644 --- a/direct/birect.py +++ b/direct/birect.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# based on hamming_exact3.py, but with all debug stuff removed def birect( @@ -22,8 +21,8 @@ def birect( ), "at least one stopping condition must be specified" # variables prefixed with v_ are to be one-dimensional vectors. [a, b, c] + # variables prefixed with w_ are to be one-dimensional vectors of pairs. [a, b] # variables prefixed with vw_ are to be two-dimensional vectors. [[a, b], [c, d]] - # variables prefixed with w_ are to be one-dimensional vectors of pairs. # aside: xmin should actually be called v_xmin, but it's not! def fun(w_t): @@ -67,12 +66,10 @@ def birect( def no_more_evals(): return max_evals is not None and n + 1 >= max_evals - # interesting. using cycle_funs = [max] seems optimal for objective2210. - def gather_potential(v_i): - # crappy algorithm for finding the convex hull of the plot where - # x = diameter of hyper-rectangle - # y = minimum loss of the two points (v_fl, v_fu) within it + # crappy algorithm for finding the convex hull of the plot, where + # x = diameter of hyper-rectangle, and + # y = minimum loss of the two points (v_fl, v_fu) within it. # TODO: make this faster. use a sorted queue and peek at the best for each depth. # start by finding the arg-minimum for each set of equal-diameter rects. @@ -150,10 +147,8 @@ def birect( len0, i0, f0 = new[i] new_slope = (f0 - offset) / len0 if K_slope is None or new_slope < K_slope: - # if new_slope >= 0: K_slope = new_slope start = i - # if start: print(end=f"[starting at {i} with slope {K_slope:.3f}]") new = new[start:] return [i for len, i, f in new] @@ -320,7 +315,6 @@ if __name__ == "__main__": [0, 0], [5, 5], min_diag=F(1e-8 / 5), - # max_evals=50_000, max_evals=2_000, F=F, by_longest=True,