# Excel Formula For Difference Between Two Columns For All Rows Solving the Sudoku Using Integer Programming

You are searching about Excel Formula For Difference Between Two Columns For All Rows, today we will share with you article about Excel Formula For Difference Between Two Columns For All Rows was compiled and edited by our team from many sources on the internet. Hope this article on the topic Excel Formula For Difference Between Two Columns For All Rows 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 must contain a number between 1 and 9, and each inner box must contain a number between 1 and 9. Each number must appear only once in each column and row and in each small box.

Let Xijk be defined to be 1 for all values ​​of I, j and k from 1 to 9. If cell (I,j) contains number k where I, j and k all range between 1 and 9. Here I explain. the ith row and j denotes the jth column and k denotes an integer between 1 and 9. When X134 = 1, it means the number in cell (1,3) is 4. It also indicates that there are no other elements. The first row or third column can be equal to 4, except for cells (1,3).

We will use a total of 729 variables to model SUDOKU.

Let us now formulate each of the three classes of laws algebraically.

Each row must contain a number between 1 and 9 only once.

For the first line, this will appear as a rule (called a “constraint” in Integer Programming parlance).

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 from 1 to 9 = 1;

For each number between 1 and 9 written in verbose form for the first line

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 for the variables starting with X115 through X119.

Similarly, for each number rule between 1 and 9, form equations that occur only once in each of the 9 columns.

written in mathematical notation,

Sum X for each j from 1 to 9 (all I and k between 1 to 9) = 1

Written in verbose form for a few columns for each number between 1 and 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.

It should be filled 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 should be filled in for all other numbers from 4 to 9.

Now let us represent the small box (3 x 3) as a whole 9 square number.

So in every 3 x 3 square, there should be 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), columns (7 to 9) and rows (1 to 3). Also for the same set of columns they are in rows (4 to 6) and (6 to 9). So just do the equations for a small square between the columns (1 to 3) and the rows (1 to 3). The corresponding decision variables for digit “1” are (9 in total)

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

Make an equation such that there is only one “1” in this (3 x3) square.

So the equation is

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

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

Similarly odds should be prepared for number “2”, number “3” up to 9.

In addition to the equations describing the constraints, for integer programming problems, integer constraints must also be imposed on each variable so that eventually when the system of equations is solved, 0 or 1 is obtained as the solution to the variable Xijk. .

The geometric equivalent of a linear programming problem with an objective function and some constraints is simply a one-dimensional polyhedron where n represents the number of constraints in the problem. In general the optimal solution will be found at the vertices of the polytope, and the rules of some methods such as SIMPLEX also require that the polytope be convex so that one can traverse from vertex to vertex along the edges and find the optimal solution.

In addition, applying integer constraints means that the optimal solution will not be at the vertices of the polytope because the solution found at the vertex may not be integer. So given that the optimal solution must be 0 or 1, this means geometrically that the solution will lie somewhere within the feasible region of the convex polytope and on one of the many straight lines arising from the hyperplane equal to the integer Xi jk. values.

Note that the above solution used 729 decision variables and 81 row constraints. 81 column obstacles and 729 small square obstacles totaling 901 obstacles. There can be many objective functions, but one can construct the objective function as finding the minimum of (the sum of all 729 variables). One can reduce the number of constraints by finding some redundancy.

These equations above cannot be solved using programming languages ​​like Visual Basic, Pascal or C. Integer programming problems can be solved using optimization softwares like CPLEX Optimizer, Excel Addin to solve linear programming problems, Lingo etc.

## Question about Excel Formula For Difference Between Two Columns For All Rows

If you have any questions about Excel Formula For Difference Between Two Columns For All Rows, please let us know, all your questions or suggestions will help us improve in the following articles!

The article Excel Formula For Difference Between Two Columns For All Rows was compiled by me and my team from many sources. If you find the article Excel Formula For Difference Between Two Columns For All Rows helpful to you, please support the team Like or Share!

Rate: 4-5 stars
Ratings: 6853
Views: 73279548

## Search keywords Excel Formula For Difference Between Two Columns For All Rows

Excel Formula For Difference Between Two Columns For All Rows
way Excel Formula For Difference Between Two Columns For All Rows
tutorial Excel Formula For Difference Between Two Columns For All Rows
Excel Formula For Difference Between Two Columns For All Rows free
#Solving #Sudoku #Integer #Programming

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