Given the following data points sampled from a convex function, how could I construct a convex function that can be minimized using ConvexOptimization
?
mypts = {{0, 0, 2}, {0, 1, 1}, {0, 2, 2.01}, {1, 0, 1}, {1, 1, 0}, {1, 2, 1}, {2, 0, 2}, {2, 1, 1}, {2, 2, 2}};
g = Interpolation[ mypts, InterpolationOrder -> 2 ];
Plot3D[ g[x, y], {x, 0, 2}, {y, 0, 2} ]
ConvexOptimization[ g[x, y] + x + y, {x >= 0, x <= 2, y >= 0, y <= 2}, {x, y} ]
The error message is:
ConvexOptimization: The function InterpolatingFunction[...] is neither convex or concave so the curvature of the objective function ... cannot be determined.
I tried option InterpolationOrder -> 1
, but got the same error message.
I could use NMinimize
, but I hope to use ConvexOptimization
, which should be considerably faster for larger problems.
I am considering generating a convex hull using the data points:
R = ConvexHullRegion[mypts]
Show[ListPlot3D[mypts], HighlightMesh[R, Style[2, Opacity[0.5]]]]
Can anyone help on how to convert a subset of the surfaces of a convex hull into a convex function that can then serve as an input for ConvexOptimization
? Perhaps this is a long shot. I hope there is a shortcut to construct a convex function from data points and then apply ConvexOptimization
. The function doesn't need to be smooth, just need to be acceptable by ConvexOptimization
. Thank you for your read and help.
NMinimize[{g[x, y] + x + y, {x >= 0, x <= 2, y >= 0, y <= 2}}, {x, y}]
$\endgroup$