diff --git a/zoopt/algos/opt_algorithms/racos/sracos.py b/zoopt/algos/opt_algorithms/racos/sracos.py index 88df0e3..863a6ab 100755 --- a/zoopt/algos/opt_algorithms/racos/sracos.py +++ b/zoopt/algos/opt_algorithms/racos/sracos.py @@ -143,7 +143,7 @@ def binary_search(self, iset, x, begin, end): return end + 1 if end == begin + 1: return end - mid = (begin + end) // 2 + mid = begin + (end - begin) // 2 if x_value <= iset[mid].get_value(): return self.binary_search(iset, x, begin, mid) else: @@ -369,7 +369,7 @@ def binary_search(self, iset, x, begin, end): return end + 1 if end == begin + 1: return end - mid = (begin + end) // 2 + mid = begin + (end - begin) // 2 if x_value <= iset[mid].get_value(): return self.binary_search(iset, x, begin, mid) else: