Questions tagged [latin-square]

Use this tag for programming questions about Latin squares. A Latin square is a N x N square array, populated with N distinct symbols. Each symbol occurs exactly once in each row, and it occurs exactly once in each column.

A Latin square is a N x N array filled with N distinct symbols. Each symbol appears exactly once in every row and exactly once in every column. This term was inspired by Leonhard Euler.

A reduced Latin square is one in which the symbols in the first row are in their natural order. The number of reduced Latin squares is thus fewer then the number of overall Latin squares, except for the trivial case N = 1.

The formula for computing the exact number of Latin squares for a size N is not easily computable.

Solutions to Sudoku puzzles are special cases of Latin squares.

Links

24 questions
0
votes
1 answer

Need help shifting latin square in Java

I'm currently making a latin square that starts with a user-set number but for simplicity's sake I'll exclude Scanner code. public static void main(String[] args){ int first = 2; // starting integer on square int order = 4; //max integer …
0
votes
1 answer

A way of reduction skyscrapper (latin square with height clues) to SAT

I'm trying to implement a reduction from the skyscrapper latin-square problem to SAT. The skyscrapper problem is the same of Latin-sqaure but in addition, the skyscraper puzzle asks the player to place buildings of varying & unique heights on a grid…
Noam Paz
  • 13
  • 3
0
votes
1 answer

Why this program find only one solution?

I want to code a program which finds all solutions for latin square. I want to do it using backtracking. I solved the n-queens problem using a similar method and it works. This code finds only the first solution and it doesn't back track. public…
0
votes
1 answer

Using MATLAB to create a latin square matrix

I'm pretty rusty at MATLAB and I'm trying to brush up by automating some Latin square problems. The code I'm working on is as follows: counter=1; for i=1:10 for j=1:10 if A(i,j)=0 A(i,j)=[This is where I'm stuck]; …
emka
  • 105
  • 6
0
votes
1 answer

How to analyze a latin square design in IBM SPSS?

I conducted an experiment with a latin square design. How do I arrange the data in IBM SPSS to analyze it in one file? I've watched this video https://www.youtube.com/watch?v=APvlPjYSSaI, where groups (e.g., Block 1 = Group 1, Block 2 = Group 2,…
Raphael
  • 673
  • 1
  • 9
  • 27
0
votes
1 answer

create a matrix and permutate each line

i can create a list from 0 to N and permutation it. But how can i make it into matrix and permutation each line just from matrix(2,L). add(X,L,[X|L]). add(X,[L|H],[L|R]):- add(X,H,R). permut([],[]). permut([L|H],R):-…
user2947488
  • 39
  • 2
  • 9
0
votes
2 answers

Latin squares generator? (Sudoku-like constraint problem)

Purpose We're designing a Latin square (sudoku-like sequence) for an experimental design that needs to follow these constraints: Values cannot be repeated in a row Values cannot be repeated in a column Values cannot be repeated pairwise in any two…
Benjamin Oakes
  • 12,262
  • 12
  • 65
  • 83
0
votes
1 answer

How to tell if a tri dimensional square is a Latin Square

I need to design an algorithm that tells if a given matrix of integers is a valid latin square or not. I've never worked with Latin Sqares before so I don't know where to begin. After some research I only found algorithms for writing a Latin square.…
Buradi
  • 63
  • 1
  • 2
  • 9
-2
votes
1 answer

in Java I have to check if a given matrix is a latin square or not

my teacher has given us a matrix and we are supposed to write a code that checks if it is a latin square or not. I have all of the pieces but I am having trouble putting them in order so they work. this is what she has given us to read the matrix…
Lisa S
  • 47
  • 1
  • 3
1
2