Select Page
Puzzle box problem ### Problem

You are being held captive in a bunker with no possible way to communicate with any other life form. There is only one way to escape from this prison. You see a wooden box in front of you that has 8 knobs. It looks like the lock of the bunker. Each knob has a pointer that can point in 4 directions: up, right, down or left. On the box there is a note which states: ‘This box can be solved by turning every knob in the upright position, so all 8 knobs must be in the “up” position. This will unlock the bunker for you to escape. However, when turning a knob, the adjacent knobs turn the other way around. For example, when turning knob 4 clockwise, knob 3 and knob 5 turn counterclockwise. To make it a little bit harder, knob 1 and knob 8 are also adjacent to each other. So if you turn knob 1 clockwise, knob 2 and knob 8 turn counterclockwise. On top of that, you can only turn each knob once. When you have solved the puzzle, you are free to escape the bunker, otherwise you are left here for eternity.’
When looking at the box you see that the knobs are in different positions. Here is an illustration: So knob 1, 2 and 5 are pointing down, knob 3, 4 and 6 are up and knob 7 and 8 are left.
Which knobs should you turn and in which direction to get them all facing up in order to escape the cave?
Hint: Use your OR knowledge to solve this problem, try to think of an objective function and constraints.

### Solution

Solving this problem requires some knowledge of linear algebra and operations research. Let be the number of times we turn knob clockwise. Our objective is to find the minimal number of moves such that all knobs point upwards. We can make a non-linear model to help understand the problem a bit better.
First we have to come up with some constraints for our model. If we look at what happens when for example knob 1 is turned clockwise, we know knob 8 and knob 2 turn counterclockwise. Therefore our left-hand side of the first equation will become something like   , because when we turn knob 1, knob 2 and 8 must be exactly the opposite. Then we move on to the second knob. If we turn this one clockwise, knob 1 and 3 will turn counterclockwise. Therefore the second constraint will be +  . We will do this until we have reached the final knob.
Now we must determine the right-hand side of each constraint. Note that when a knob is turned clockwise 4 times it will be in the same position as it started in. So we need to make sure that our cannot take on a value of 4 because that would be useless. Moreover, a knob that is turned three times clockwise will give the same result as turning the knob one time counterclockwise. Basically what this means is that cannot exceed a value of 2 for all . This will bring us closer to our optimal solution, since our objective is to find the minimal number of turns such that all knobs face upwards.
At last, we need to find out how many times and in which direction each knob must be turned. This is fairly easy to see from the figure above. Knobs 1, 2 and 5 must be turned 2 times clockwise, knobs 3, 4 and 6 must stay in the same position and the last two knobs must be turned once clockwise. Using all of this information we should get a non-linear model that would look like this:
Minimize

(1) Subject to

(2) (3) (4) (5) (6) (7) (8) (9) And , integer for To solve this model we need to linearize the objective function. We can do so by introducing two new variables and . Where =  and , 0 and integer. To explain the variables a bit more; means that if its value is for example 1, the knob will be turned clockwise once. If has a value of 1 it will turn counterclockwise. Now our model can be linearized by substituting every with  . So our objective function would look like this:
Minimize

(10) Note that the new objective value is valid since in the optimal solution, either or equals 0 for all . Now we can actually solve this problem in excel by using the “excel solver”. This will give you the solution to the problem: knob 1 should be turned once clockwise, knob 2 should not be turned, knob 3 should be turned once clockwise, knob 4 should be turned once clockwise, knob 5 should not be turned, knob 6 should be turned once clockwise, knob 7 should be turned once clockwise and knob 8 should be turned once counterclockwise.
What is so interesting about this problem is that it does not seem like an OR problem, but you can certainly use your knowledge of OR to come up with a solution. There are other possible ways to find the solution, but I think it is very interesting to see that we can use our knowledge of modelling to come up with simple solutions to difficult problems.
Credits to Dion Hoek for making the mathematical model for this problem and solving it. 