An Algorithm to Construct Super-Symmetric Latin ...

0 downloads 0 Views 2MB Size Report
M. B. Wells, Elements of combinatorial computing. Pergamon Press (Oxford-New York-Toronto, 1971). [13]. Hinkelmann, Klaus and Kempthorne, Oscar (2008).
IJRIT International Journal of Research in Information Technology, Volume 1, Issue 4, April 2013, Pg. 38-50

International Journal of Research in Information Technology (IJRIT)

www.ijrit.com

ISSN 2001-5569

An Algorithm to Construct Super-Symmetric Latin Squares of Order 2n M.A.P.Chamikara1, S.R.Kodituwakku2, A.A.C.A.Jayathilake3, A.A.I.Perera4 1

Postgraduate Institute of Science, University of Peradeniya, Peradeniya, Sri Lanka. 2

Department of Statistics and Computer Science, Faulty of Science, University of Peradeniya, Sri Lanka

3

Department of Mathematics, University of Peradeniya, Peradeniya, Sri Lanka

4

Department of Mathematics, University of Peradeniya, Peradeniya, Sri Lanka

[email protected], [email protected] 2, [email protected], [email protected] 4

Abstract Literature shows that there are several ways of generating Latin squares, but there is not enough implementation about Supersymmetric Latin squares. This paper proposes a mathematical algorithm to construct Super-symmetric Latin squares of order 2 by substituting blocks of order 2n which has the basic properties of a recursive algorithm. The proposed algorithm was tested for a large number of orders and the results proved that the algorithm could be generalized for any input order n where n is a positive integer.

Keywords: Combinatorics, Design theory, Graph theory, Latin Square, Super-symmetry

1. Introduction The Latin squares have several applications in Combinatorics [11], Design theory [8], Graph theory [9], Statistics [10], Computer Science [12] etc. In algebra, the Latin squares are used to generalize groups. In fact, Latin squares are characterized as being the multiplication tables of quasi-groups. Further, Latin squares are a special case of row-column designs of two blocking factors which are frequently used in Statistics [13]. Moreover, sets of Latin squares that are orthogonal to each other have found an application as error correcting codes in situations where the communication is disturbed by more types of noise than simple noise [14]. Also, the popular Sudoku puzzles are a special case of Latin squares; any solution to a Sudoku puzzle is a Latin square.

Definition 1: (Latin square) A Latin Square is an n  n array containing n different symbols such that each symbol appears exactly once in each row and once in each column. Moreover, a Latin square of order n is a n  n matrix M  m with entries from an n-set V, where every row and every column is a permutation of V [1]. An example of a Latin Square of order 5 is: 0 1 2 3 4

M.A.P Chamikara, IJRIT

38

1 2 3 4 0 2 3 4 0 1 3 4 0 1 2 4 0 1 2 3

Definition 2: (Super-symmetric Latin square) Latin square is called super-symmetric, if all the permutations of the elements are in the corresponding Latin square [2]. Following Latin squares can be considered as super symmetric. If two lines are drawn connecting the diagonals, it makes four symmetric triangles of indices. order 2:

1 2 2 1 Tab: 1

order 4 :

1 2 3 4

2 1 4 3

3 4 1 2

4 3 2 1

Tab:2 order 8:

1 2 3 4 5 6 7 8

2 1 4 3 6 5 8 7

3 4 1 2

4 3 2 1

7 8 5 6

8 7 6 5

5 6 7 8 1 2 3 4

6 5 8 7 2 1 4 3

7 8 5 6 3 4 1 2

8 7 6 5 4 3 2 1

Tab: 3

1.1 Mathematical properties of Latin squares The classification of Latin squares up to isomorphism depends on the definition of isomorphism used [7]. We assume that the set of symbols is the same as the set of row and column indices, that is, {1,2, . . . , n}.Two Latin squares are said to be isotopic, if one can be obtained from the other by permuting rows, columns and symbols. The equivalence classes of this relation are called isotopy classes [6]. The number of Latin squares of order n is roughly cn n². This number is of a greater order of magnitude than the number of isomorphism’s, so the estimate is little affected by counting up to some notion of isomorphism [3]. 1.1.1 Automorphisms An automorphism is an isomorphism [5] from a Latin square to itself. The automorphisms of a Latin square form a group [3].

1.1.2 Partial Latin squares

M.A.P Chamikara, IJRIT

39

A partial Latin square of order n is an n  n array in which each cell either contains a symbol from the set {1,2, . . . , n} or is blank, so that each symbol occurs at most once in each row or column. It can be completed to a Latin square if it is possible to place symbols in the blank cells so as to produce a Latin square [2]. 1.1.3 Transversals A transversal to a Latin square of order n is a set of n cells with the property that one cell lies in each row, one in each column, and one contains each symbol. A Latin square has an orthogonal mate if and only if it possesses a set of n transversals which partition the n cells of the square [4]. This paper proposes a mathematical algorithm to construct Super-symmetric Latin squares of order 2 by substituting blocks of order 2n for all positive integers greater than or equal 1.

2. Methodology The methodology of generating super-symmetric Latin squares of order 2n which is explained under this paper involves a set of significant steps that works as a recursive algorithm. This section explains the construction of those steps together in to one composite algorithm which ultimately provide the capability of generating super-symmetric Latin squares of order 2n.

2.1 Steps of the Proposed Algorithm Step 01 Construct the first row of the Latin square by placing the integers in increasing order. For an example, the first row of the Latin square of order 8 is the array of numbers given by 1 2 3 4 5 6 7 8 .

Step 02 Separate the pairs of integers and interchange the arranging order of each pair (21) to form the 2nd row of the Latin square. In the above example, the second row can be formed as 2 1 4 3 6 5 8 7. This completes two rows of the Latin square as follows: 1 2

2 1

3 4

4 3

5 6

6 5

7 8

8 7

Step 03 By considering both rows, separate these rows into 4 (22) blocks as follows.

1 2

2 1

3 4

4 3

5

6

Tab:64 5

7 8

8 7

Then apply the cross multiplication or interchange method as depicted below.

1 2

2 1

3 4

4 3

5 6

6 5

7 8

8 7

3 4

4 3

1 2

2 1

7 8

8 7

5 6

6 5

Tab: 5 This concludes four rows of the corresponding Latin square.

M.A.P Chamikara, IJRIT

40

Step 04 In the similar manner separate these rows in to blocks of matrices of order 4 as given below. 1 2 3 4

2 1 4 3

3 4 1 2

4 3 2 1

5 6 7 8

6 5 8 7

7 8 5 6

8 7 6 5

Tab: 6 Using the cross multiplication method, the Latin square of order 8 (23) can be constructed as follows.

1 2 3 4

2 1 4 3

3 4 1 2

4 3 2 1

5 6 7 8

6 5 8 7

7 8 5 6

8 7 6 5

5 6 7 8

6 5 8 7

7 8 5 6

8 7 6 5

1 2 3 4

2 1 4 3

3 4 1 2

4 3 2 1

Tab: 7 Thus, in general, the super symmetric Latin square of order 2 can be constructed by the method of cross multiplication of blocks of 2 where k  1,2,3, … , n. Following diagram depicts the way of executing the proposed algorithm on the order 25(=32) Latin square.

1 2 2 1

3 4 4 3

5 6 6 5

7 8 8 7

3 4 4 3

1 2 2 1

7 8 8 7

5 6 6 5

11 12

12 11

9 10

4 3 2 1

13 14 15 16

14 13 16 15

15 16 13 14

5 6 7 8

9 10 11 12 13 14 15 16

6 5 8 7

10 9 12 11 14 13 16 15

7 8 5 6

11 12 9 10 15 16 13 14

1 2 3 4

8 7 6 5

12 11 10 9 16 15 14 13

13 14 15 16 9 10 11 12

2 1 4 3

14 13 16 15 10 9 12 11

3 4 1 2

15 16 13 14 11 12 9 10

9 10 11 12 10 9 12 11

1 2 3 4 5 6 7 8

16 15 14 13 12 11 10 9

2 1 4 3 6 5 8 7

3 4 1 2 7 8 5 6

13 14

14 13

15 16

16 15

10 9

15 16

16 15

13 14

14 13

16 15 14 13

9 10 11 10 9 12 11 12 9 12 11 10

4 3 2 1 8 7 6 5

5 6 7 8 1 2 3 4

6 5 8 7 2 1 4 3

7 8 5 6 3 4 1 2

12 11 10 9

8 7 6 5 4 3 2 1

Tab: 8

M.A.P Chamikara, IJRIT

41

2.2 Pseudo code of the implemented proposed algorithm. var N,noOflev,p,power,count,count2,r:integer; //Declaring the variable N, which is the order of the Latin square var L:Array[N][N]; //Defining a 2D array for the Latin square (2D array named L with the order N) Const SIZE:=N; //Taking a constant variable named SIZE with the same size of N begin noOflev:=1; //Initializing the noOflev (number of levels) variable with value 1. writeln(' Enter the order of the Latin square:'); read(N); for ii:=2 to N //Calculating the number of phases needed or finding the 2's exponent of the given order ex: if N is 8 the 2's exponent is 3 begin ii=ii*2; noOflev=noOflev+1; end for m0:=0 to N //Phase 0=> Filling the first raw of L[N][N] with numbers in the ascending order starting from 1 ex: 1 2 3 4 5 6 7 8. begin L[0][m0]=m0+1; end for n:=0 to noOflev //Main loop that loops for the number of levels begin for k:=0 to 2n //Loop for no of levels (ex: level one only 1, level 2 only 2,3, level 3, only 4,5,6,7, etc...) begin count2:=count2+1; power=2n; if(count2==1)then //limiting the calculation only to the first iteration p:=power; //Calculating the number of additions and subtractions from the index, needed. for j:=0 to N begin if (j%p==0) then count=count+1; //Increment the count variable only in the first iteration of one phase if (count%2!=0) then L[k+power][j]=L[k][j+p]; //Selecting the increment to add or deduct using the phase else L[k+power][j]=L[k][j-p]; end count=0; end

M.A.P Chamikara, IJRIT

42

count2=0; end end;

2.3. C++ Implementation of the proposed algorithm #include #include #include #include #include int main() { int N=0; coutN; const int SIZE=N; int noOflev=1; int p=0; int power=0; int count=0; int count2=0; int r=0; long int** L = (long int**)malloc(SIZE*sizeof(*L)); for(int m=0;m

Suggest Documents