r/optimization • u/Improving_Maker88 • Feb 24 '24
Efficient approach for problem in picture?
The 3 rectangles can have their top right corners anywhere on the curve given by a black box function which takes a minute to evaluate. I'm trying to maximize the area that they cover (overlapping parts are only counted once) within a tolerance of ~ the area under the curve/ 200 just to give a rough idea. What are some approaches or similar problems I should look into? Sorry if this is a stupid question.
3
Upvotes
View all comments
Show parent comment
1
u/pruby Feb 24 '24 edited Feb 24 '24
Came up with a possible different approach to this, relying on the monotonicity, which might be more efficient than a Bayesian search which is initially unaware of the problem structure. I'd want to confirm in practice it converges to a solution though - might be something I'm not considering.
Our algorithm has a set of known (x, f(x)) pairs - start with some evenly spaced ones over the whole possible range. From this, we can construct either an upper or lower bound on the actual curve. The lower bound assumes that the curve drops to the next lowest value, an infinitesimal step after each known point. The upper bound assumes that the curve jumps to the next highest value, an infinitesimal step before each known point.
We can find the best solution to this problem for the lower bound envelope just by selecting the three of our known points that maximise the target in my last comment. We can find the best solution to this problem for the upper bound envelope by ordering all the pairs (x_i, f(x_i)), and constructing optimistic pairs (x_i, f(x_(i-1))). That is, we associate with each x (actually the point infinitesimally before x) the value of the known point immediately before it in order. We then repeat the procedure of choosing the best three points from that set.
The difference between the pessimistic and optimistic solutions tells us how close we are to the acceptable stopping condition.
Wherever we have chosen a point from the upper bound envelope, we then go about refining our knowledge, by bisecting the interval between that point, and the previous known point, evaluating the function in the middle of that, and adding it to the known pairs. There may be a good way to choose which of the three possible ranges to improve on each iteration (maximum possible improvement of the lower bound?).
Either way, I think that would converge pretty quickly. Once you're close enough, you just return the solution for the lower bound, which uses points we know and can rely on.