I have a problem for which the solution is known to be a convex $f:[a,b]\times[c,d] \rightarrow \mathbb{R}$ over some rectangular domain ($a<b$ and $c<d$). There are many situations (e.g. finding solutions numerically, or generating data for machine learning applications) where one would like to perform some operation on such a function while maintaining convexity.
Question: What techniques exist for "minimally modifying a function to make it convex"?
For instance, suppose I numerically approximate the solution $f$ and the approximation turns out to not be convex. How can I find a "closest" convex function?
The most obvious thing I can think of is to take a convex hull of the graph of $f$, but this itself seems like a non-trivial problem. Any references are appreciated.