Black-box Function Approximation and Optimization