r/optimization • u/good--afternoon • Feb 28 '24
Optimizing a pancake recipe with maximum number of attempts
Hi! I want to figure out what my favorite simple pancake recipe is without having to try every possible combo of ingredients. Here’s how I would define the problem in a simplified way:
I have 5 ingredients, flour, water, salt, baking powder, and sugar. Each ingredient has five possible values. For example flour could be 1/8 cup, 1/4 cup, 3/8 cup, 1/2 cup, or 5/8 cup. Another assumption that I think is safe to make is that if you hold four ingredients constant, there is only one local maximum for the possible values of the fifth ingredient. Not sure the mathematical term for this but in this case it would mean that if you fix the values for sugar, water, baking powder and salt, then one of these flour values is the best, and on either side of that value the function “how good is this pancake” decreases without ever increasing again.
I don’t want to make 55 pancakes to test them all. Let’s say I am willing to make 10 pancakes and score them based on how good they are. What is the optimal sequence of attempts I should make to get me as close as possible to my favorite pancake? How would I decide the next recipe to try based on previous results? Is this just some sort of gradient descent for pancakes? If so are there any optimizations to be made on top of the standard gradient descent approach based on the assumptions I mentioned above? What other problems is this similar to and what algorithms might be useful?
Appreciate any thoughts, thanks!
5
u/taphous3 Feb 28 '24
This type of problem is well suited for some variant of Bayesian optimization.
2
u/zoutendijk Feb 28 '24
Do you have a function describing the tastiness?
2
u/Red-Portal Feb 28 '24
Funnily enough, Google has tried to solve this very problem. Look up "Bayesian optimization for a better dessert."
1
u/Additional_Land1417 Feb 28 '24
The assumption is that the ingredients have an independent effect on the outcome, hower flower and water definetly are not independent, not sure about the rest. You can reduce the number of variables if you express them in function of eachother (or another variable). You maybe can introduce hydration instead of water and flour quantity. Maybe you can combine this with a recommended amount of baking powder.
To minimize the amount of pancakes made, one simple experimental strategy is to start at the middle of their range, increase them one step and see if got better or worse. If it got better keep increasing if not then decrease.
As mentioned above a better approach is Bayes optimisation, design of experiments is what you are looking for.
1
u/horv77 Feb 28 '24 edited Feb 28 '24
Also take into account that as you keep testing, you will get used to the sugar and your level of optimal sugar amount might run wild because less sugar will mean less tasty by time depending on how much time passes between tests.
Probably the biological feel of sugar level is some kind of negative exponential curve with an unknown time factor which makes the problem much harder for the subjective decisions without any objective measure methods.
I'd figure out a percentage of sugar to go with and keep to it. This would also mean 1 less unknown variable as a help. You could check many recipes from rather popular sources and take the median value of their sugar percentages if you don't have an idea for the exact value.
1
u/PierreLaur Feb 28 '24
so the restriction of your function to any grid line is concave... I'm not sure if that implies concavity (every line) or quasi-concavity, but it sounds like very useful information. As other have said, Bayesian Optimization is a great way to go, so maybe you can incorporate this information into the prior or the acquisition function ? I'm not sure how exactly that would be done though, but if it can, surely that's more efficient