KatInterview

Minimize Black-Box Unimodal Function Without Derivatives

Heaps, Sorting & SearchModel answer
MediumModel answerHeaps, Sorting & Searchbinary searchoptimizationunimodal

Last updated

Find the minimum of a convex/unimodal function over continuous and discrete intervals using zero-order optimization.

Suppose you are given access to a black-box evaluation function $F(x)$ that returns a numerical value for any real scalar $x$. You are also given a search boundary $[a, b]$.

Assume that $F$ is strictly unimodal (or strictly convex) over $[a, b]$, meaning it has a unique global minimum within this interval, strictly decreases to the left of the minimum, and strictly increases to the right. You have no access to derivatives, gradients, or analytical expressions; your only primitive is evaluating $F(x)$ at specific points.

  1. Continuous Domain: Design an algorithm to estimate the optimal minimizer $x^$ such that $|x - x^| \le \epsilon$, where $\epsilon > 0$ is a given tolerance. Explain how to minimize the total number of calls to $F(x)$.
  2. Integer Domain: Adapt your approach for an integer domain $x \in {a, a+1, \dots, b}$ to find the exact integer minimizer.
  3. Complexity & Edge Cases: Detail the time complexity, evaluation counts, and numerical stability limits for both cases.

Hints

Hint 1

If you pick two interior points m1 < m2 in the interval, how do F(m1) and F(m2) help you eliminate one portion of the search space?

Hint 2

Compare Ternary Search (which drops 1/3 of the interval per iteration using 2 evaluations) with Golden-Section Search. How can Golden-Section Search reduce the number of new evaluations per step to 1?

Hint 3

For the integer case, can you reformulate the problem into finding the boundary where the discrete slope F(k+1) - F(k) changes sign?