How to optimally empty your bucket?
Introduction
This is an IBM Ponder This Challenge .
The Bucket Empty Sequence (BES) problem is a type of mathematical optimization problem that can be formulated as a Mixed Integer Linear Programming (MILP) problem. In this problem, we are given a set of buckets, each with a certain capacity, and a sequence of tasks, each requiring a certain amount of fluid to be poured into or out of a specific bucket. The objective of the problem is to find a sequence of tasks that will empty all/some/any buckets.
Consider N buckets, there are ni balls in backet i. The goal is to empty any of the backets, but we can only perform one type of move: Choose two backets, p and m transfer balls from p to m until the total balls in m is doubled.
For example: assume the initial content of the buckets is [3, 4, 8]
Step --> Bucket content ,
1 [3, 4, 8]
2 [6, 1, 8]
3 [6, 2, 7]
4 [4, 4, 7]
5 [0, 8, 7]
For a given initial content find the required steps to empty one bucket.
Looks easy ? if Yes then do the formulation by yourself and then you can compare it with mine.
If not, let's investigate the required model altogether.
There are different things which should be formulated.
1- What to calculate ?
2- What is the objective function?
Model development
Let's do some math:
We need:
Recommended by LinkedIn
Pyomo code Github code
Results:
Let's try it for a bigger number of buckets N = 8:
[319, 980, 986, 570, 949, 153, 979, 308, 780]
The algorithm decided to empty the bucket 9 to minimize the required time.
Now let's try to empty a specific bucket 1-->5 (what should be changed in the model?) :
Applications:
Practical applications of the Bucket Empty Sequence problem include:
Don't forget to subscribe to the github channel and Optimization in Open-source
You may also contact me !
PyomoChannel تلگرام
Senior Power Systems Researcher at the Department of the Electrical & Electronic Engineering at University College Dublin (UCD).
1yvery interesting
Decisiones basadas en modelos matemáticos y datos. Al servicio del sector sociosanitario. |Inteligencia Artificial | Análisis Avanzado de Datos | Optimización | Simulación Matemática | Diseño de Algoritmos
1yAs always, very interesting. Thank you very much for sharing
Realtor Associate @ Next Trend Realty LLC | HAR REALTOR, IRS Tax Preparer
1yThanks for posting.