r - Creating a 3x3 grid with constraints -


The purpose is to automatically solve the 3x3 grid problem below.

With a 3x3 grid elements:

  letters abcdefghi  

I can only have integers 1 to 9 and each integer Is used only once in the grid (for example A = 1, B = 2, C = 3, ..., H = 8 and I = 9. Additionally, there are 4 small 2x2 grids in the grid : The sum of all the elements of the 2x2 grid is equal to a few numbers (in this example it is a + b + d + e = 20, b + c + e + f = 17, d + e + g + H = 27 and E + F + H + I = 15).

I To solve this problem, I am trying to correct some code so that the linear programming tool.

In my thinking process, it was to create such obstacles, such as only integer (9 constraints) ), Every integer can be used only once (9 constraints) and 4 2x2 grid barriers, a little bit of deliberations, I may have gone completely down the wrong path, if someone drove me in the right direction Received and can point to, then I will be most grateful.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -