# How To Use A Formula For A Column In Excel Solving the Sudoku Using Integer Programming

You are searching about How To Use A Formula For A Column In Excel, today we will share with you article about How To Use A Formula For A Column In Excel was compiled and edited by our team from many sources on the internet. Hope this article on the topic How To Use A Formula For A Column In Excel is useful to you.

Muc lục nội dung

## Solving the Sudoku Using Integer Programming

The 9 X9 SUDOKU puzzle has the following rules. Each row and column should contain numbers between 1 and 9, and each inner box should contain numbers between 1 and 9. Each number should appear only once in each column and row and in each small box.

We simply define Xijk if all values ​​of I, j, and k between 1 and 9 are 1. If cell (I,j) contains the number k, where I, j, and k are all between 1 and 9. Here I is the row and j represent the jth column and k represents an integer between 1 and 9. If X134 = 1, this means that cell (1,3) contains the number 4. This also means that no other row 1 or column 3, field including cell (1,3) can be equal to 4.

We use a total of 729 variables to model SUDOKU.

We now formulate all three classes of rules algebraically.

Each row should contain a number between 1 and 9 exactly once.

For the first line, this rule appears as (in integer programming language, this is called a “constraint”).

1 to 9 for each I and 1 to 9 for each k (I is the mathematical representation of the counter variable)

sum (Xijk) for all j between 1 and 9 = 1;

Written in verbose form on line 1 for each number from 1 to 9

X111 + X121 + X131 + X141 + X151 + X161 + X171 + X181 + X191 = 1.

X112 + X122 + X132 + X142 + X152 + X162 + X172 + X182 + X192 = 1.

X113 + X123 + X133 + X143 + X153 + X163 + X173 + X183 + X193 = 1.

X114 + X124 + X134 + X144 + X154 + X164 + X174 + X184 + X194 = 1.

These equations follow the variables starting from X115 to X119.

Similarly, we formulate equations between each number 1 and 9, which appear only once in each of the 9 columns.

Written in mathematical notation,

sum X for each j between 1 and 9 ( for all I and k between 1 and 9 ) = 1

Written in detail for a few columns for each number from 1 to 9

Column 1

X111 + X211 + X311 + X411 + X511 + X611 + X711 + X811 + X911 = 1.

X112 + X212 + X312 + X412 + X512 + X612 + X712 + X812 + X912 = 1.

X113 + X213 + X313 + X413 + X513 + X613 + X713 + X813 + X913 = 1.

This must be completed for all other numbers 4 to 9.

Column 2

X121 + X221 + X321 + X421 + X521 + X621 + X721 + X821 + X921 = 1.

X122 + X222 + X322 + X422 + X522 + X622 + X722 + X822 + X922 = 1.

X123 + X223 + X323 + X423 + X523 + X623 + X723 + X823 + X923 = 1.

This must be completed for all other numbers between 4 and 9.

Now let’s imagine small boxes ( 3 x 3 ) with a total of 9 squares.

So each 3 x 3 square must have only one 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 etc.,

Cells are between columns (1 to 3) and rows (1 to 3), columns (4 to 6) and rows (1 to 3). Between columns (7 to 9) rows (1 to 3). Also for the same set of columns, they occur in rows (4 to 6) and (6 to 9). So let’s formulate the equations for just one small square between the columns (1 to 3) and the rows (1 to 3). The decision variables corresponding to the number “1” are (9 in total)

X111, X121, X131, X211, X221, X231, X311, X321, X331.

Let’s formulate the equation that there is only one “1” in this (3 x 3) square.

So the equation is

X111 + X121 + X131 + X211 + X221 + X231 + X311 + X321 + X331 = 1.

The above equation implies that only one of these 9 variables or only one of these nine cells can take the value 1.

Similarly, restrictions must be formulated for the number “2”, for the number “3”, and so on up to 9.

For integer programming problems, in addition to the equations describing the constraints, integer constraints should also be imposed on each variable, so that eventually, when the system of equations is solved, the variable Xijk becomes either 0 or 1 .

The geometric equivalent of a linear programming problem with an objective function and some constraints is nothing but a dimensional polyhedron, where n represents the number of constraints in the problem. Usually the optimal solution is found at the vertices of the polytope, also the rules of some methods like SIMPLEX require the polytope to be convex in order to move along the edges from vertex to vertex and find the optimal solution.

Adding integer constraints would mean that the optimal solution is not at the vertices of the polytope, since the solution found at the vertex may not be integer. Thus, given that the optimal solution must be 0 or 1, this means that geometrically the solution is somewhere in the feasible region of the convex polytope and on one of the many lines originating from the hyperplane equivalent to integer values ​​of Xi and jk.

Note that the above solution has used 729 decision variables and 81 row constraints. 81 column constraints and 729 small square constraints for a total of 901 constraints. There can be many objective functions, but the objective function can also be formulated to find a value (the sum of all 729 variables). The number of constraints can be reduced by finding some redundancy.

These above equations cannot be solved with programming languages ​​like Visual Basic, Pascal or C. Integer programming problems can be solved with optimization software like CPLEX Optimizer, Excel Add-in for Solving Linear Programming Problems, Lingo, etc.

## Question about How To Use A Formula For A Column In Excel

If you have any questions about How To Use A Formula For A Column In Excel, please let us know, all your questions or suggestions will help us improve in the following articles!

The article How To Use A Formula For A Column In Excel was compiled by me and my team from many sources. If you find the article How To Use A Formula For A Column In Excel helpful to you, please support the team Like or Share!

Rate: 4-5 stars
Ratings: 6257
Views: 28578566

## Search keywords How To Use A Formula For A Column In Excel

How To Use A Formula For A Column In Excel
way How To Use A Formula For A Column In Excel
tutorial How To Use A Formula For A Column In Excel
How To Use A Formula For A Column In Excel free
#Solving #Sudoku #Integer #Programming

Source: https://ezinearticles.com/?Solving-the-Sudoku-Using-Integer-Programming&id=9107720

Bài viết đã được tạo 2736

## What Happens If You Put An Extra Scoop Of Formula Family Summertime Budgeting

Bắt đầu nhập từ khoá bên trên và nhấp enter để tìm kiếm. Nhấn ESC để huỷ.

Trở lên trên