public class SurvoPuzzle extends ExampleFD
http://en.wikipedia.org/wiki/Survo_Puzzle """ Survo puzzle is a kind of logic puzzle presented (in April 2006) and studied by Seppo Mustonen. The name of the puzzle is associated to Mustonen's Survo system which is a general environment for statistical computing and related areas.
In a Survo puzzle the task is to fill an m * n table by integers 1,2,...,m*n so that each of these numbers appears only once and their row and column sums are equal to integers given on the bottom and the right side of the table. Often some of the integers are given readily in the table in order to guarantee uniqueness of the solution and/or for making the task easier. """
See also http://www.survo.fi/english/index.html http://www.survo.fi/puzzles/index.html
References: - Mustonen, S. (2006b). "On certain cross sum puzzles" http://www.survo.fi/papers/puzzles.pdf - Mustonen, S. (2007b). "Enumeration of uniquely solvable open Survo puzzles." http://www.survo.fi/papers/enum_survo_puzzles.pdf - Kimmo Vehkalahti: "Some comments on magic squares and Survo puzzles" http://www.helsinki.fi/~kvehkala/Kimmo_Vehkalahti_Windsor.pdf
Constructor and Description |
---|
SurvoPuzzle() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
It executes the program to solve the specified SurvoPuzzle.
|
void |
model()
model()
|
static void |
printMatrix(IntVar[][] matrix,
int rows,
int cols)
It prints a matrix of variables.
|
void |
readFile(String file)
readFile()
|
creditSearch, getSearch, getSearchVariables, getStore, search, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch
public static void printMatrix(IntVar[][] matrix, int rows, int cols)
matrix
- matrix containing the grounded variables.rows
- number of elements in the first dimension.cols
- number of elements in the second dimension.public void readFile(String file)
Reads a Survo puzzle in the following format
% From http://www.survo.fi/puzzles/280708.txt % Survo puzzle 128/2008 (1700) #364-35846 A B C D E F 1 * * * * * * 30 2 * * 18 * * * 86 3 * * * * * * 55 22 11 42 32 27 37
file
- the filename containing the problem description.public static void main(String[] args)
args
- the first argument specifies the filename containing the puzzle to be solved.Copyright © 2022. All rights reserved.