Grid of Bulbs Solutions
“Next best action” is a popular decision-making strategy. But how to define the “best” next action? This challenge may demonstrate it. Consider an NxN grid of lightbulbs. We are given an initial state where some of the bulbs are off and some are on. Then, at every step you need to choose a bulb in the off state. It will turned on, and every other bulb in the row and in the column of the bulb will be toggled: If it was on, it turns off, and vice versa. The goal is to reach a grid where all the light bulbs are on. This problem was proposed by IBM.
Here is an example of an initial grid state with all next actions that lead to the final state:

Please submit your solutions using your favorite decision modeling tool.
-
- OPL/CPLEX – submitted by Alex Fleischer
- Python – submitted by Julien Pradier
- …
P.S. We assume that submitted solutions will be able to handle much larger grids like this one:
000001000000000001110011 110100010110101000010011 011101110000001101001110 000110111000110101101100 101101011010010011101010 111000100101110100101000 110001011100000000000101 100000010001100000000010 000110010010110110101001 011101101011111011100000 011000101010111011111100 100011110010000100100111 000111010010100010001110 011001010001001111110101 110001000010111000100000 000000101100101000101001 111001010010010011110110 100000110001111111011010 110100000011100100110010 101000110111001110010000 110000000010011100100101 111111011011111100010101 000000000110101011100000 110001111100000011001111
You must be logged in to post a comment.