From ba8670bfad8468397e4b4118f8a18fe166298085 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 7 Jun 2022 17:52:56 +0200 Subject: [PATCH] direct: update birect.py --- direct/birect.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/direct/birect.py b/direct/birect.py index ca7548f..7336656 100644 --- a/direct/birect.py +++ b/direct/birect.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # based on hamming_exact3.py, but with all debug stuff removed + def birect( obj, lo, @@ -297,9 +298,22 @@ def birect( if __name__ == "__main__": - from arsd_objectives import objective2210 import numpy as np + def objective2210(x): + # another linear transformation of the rosenbrock banana function. + assert len(x) > 1, len(x) + a, b = x[:-1], x[1:] + + a = a / 4.0 * 2 - 12 / 15 + b = b / 1.5 * 2 - 43 / 15 + # solution: 3.60 1.40 + + return ( + np.sum(100 * np.square(np.square(a) + b) + np.square(a - 1)) + / 499.0444444444444 + ) + F = np.float64 res = birect( lambda a: objective2210(np.array(a, F)),