Optimizing a peanut butter and banana sandwich

How do you assemble a banana and peanut butter sandwich that maximizes the number of bites with the perfect ratio of bread, peanut butter, and banana? Ethan Rosenthal, in a quest to work on something truly meaningless, solved the problem over several months with a truly roundabout solution:

So, how do we make optimal peanut butter and banana sandwiches? It’s really quite simple. You take a picture of your banana and bread, pass the image through a deep learning model to locate said items, do some nonlinear curve fitting to the banana, transform to polar coordinates and “slice” the banana along the fitted curve, turn those slices into elliptical polygons, and feed the polygons and bread “box” into a 2D nesting algorithm.

Best.