org.jacop.examples.fd

## Class SurvoPuzzle

• ```public class SurvoPuzzle
extends ExampleFD```
It solves Survo puzzle.

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. """

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

Version:
4.9
Author:

• ### Fields inherited from class org.jacop.examples.fd.ExampleFD

`cost, search, store, vars`
• ### Constructor Summary

Constructors
Constructor and Description
`SurvoPuzzle()`
• ### Method Summary

All Methods
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)`
• ### Methods inherited from class org.jacop.examples.fd.ExampleFD

`creditSearch, getSearch, getSearchVariables, getStore, search, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### SurvoPuzzle

`public SurvoPuzzle()`
• ### Method Detail

• #### model

`public void model()`
model()
Specified by:
`model` in class `ExampleFD`
• #### printMatrix

```public static void printMatrix(IntVar[][] matrix,
int rows,
int cols)```
It prints a matrix of variables. All variables must be grounded.
Parameters:
`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

Parameters:
`file` - the filename containing the problem description.
• #### main

`public static void main(String[] args)`
It executes the program to solve the specified SurvoPuzzle.
Parameters:
`args` - the first argument specifies the filename containing the puzzle to be solved.