r/AskComputerScience • u/thetan_free • Dec 07 '24
Combinatorial Optimisation - fridge/freezers during a blackout
Wondering if anyone has thoughts on solving a specific optimisation problem many encounter in real-life: how to save food in your fridge/freezer during a blackout.
The idea is to move items between the fridge and the freezer in an optimal way as the temperature drops. It seems like some sort of dual-Knapsack Problem.
One strategy is to move low-value items from the freezer to the fridge, to preserve high-value items in the fridge. (So as your frozen peas thaw in the fridge, they keep your salmon cold for longer.) Later, once the freezer is above freezing and all is lost, it makes sense to move high-value items from the fridge into the freezer.
How could I set up a combinatorial optimisation problem to solve this?
I'm thinking at the start, there are two sets of items, each with a value and a volume (known to you), in the fridge and freezer, respectively.. The fridge and freezer have different total volumes and temperatures. Temperature drops in a predictable way for both. Frozen food is lost when it exceeds zero. Fridge food is lost when it exceeds, say, ten degrees C. Hence, the fridge and freezer are two time-varying knapsacks, right? Your decision space at each time T is to move an item from one to the other. So maybe it's like a dynamic program?
Two variants:
- You do know when the power will come back on. How does that change the model?
- If you want to move an item, you have to open both the doors, which costs (a known) extra temperature increase on each.
Thoughts?
View all comments
Show parent comment
1
u/thetan_free Dec 07 '24
I agree the question "how quickly does the temperature drop?" is a differential equation. But it's the least interesting aspect (no offense, M. Laplace!).
The fridge and the freezer both have many items in them. I can move one or more items between them at any time I choose. The goal is to make a set of decisions over time about moving discrete items between the two options. Hence, it's a discrete maths problem.
I'm suggesting it's a type of combinatorial optimisation problem known as the Knapsack Problem, because the questions is about figuring out which items to put into a finite space, when each has a value and volume (or, equivalently, weight).