Package org.jacop.examples.fd.nonogram
Class Nonogram
java.lang.Object
org.jacop.examples.fd.ExampleFD
org.jacop.examples.fd.nonogram.Nonogram
It solves a nonogram example problem, sometimes also called Paint by Numbers.
- Version:
- 4.8
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
The value that represents a black dot.IntVar[][]
A board to be painted in white/black dots.int[][]
It specifies a rule for each column.boolean
It specifies if one extensional constraint based on MDD created from FSM should be used.boolean
It specifies if the regular constraint should be used.int[][]
It specifies a rule for each row.boolean
It specifies if the slide based decomposition of the regular constraint should be applied.int
The value that represents a white dot. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateAutomaton
(int[] sequence) It produces and FSM given a sequence representing a rule.static void
It executes the program which solves this simple problem.void
model()
It specifies a standard way of modeling the problem.void
printMatrix
(IntVar[][] matrix) It prints a matrix of variables.void
readFromFile
(String filename) boolean
It specifies simple search method based on most constrained static and lexigraphical ordering of values.static void
It executes the program which solves this simple problem.Methods inherited from class org.jacop.examples.fd.ExampleFD
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, search, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch
-
Field Details
-
black
public int blackThe value that represents a black dot. -
white
public int whiteThe value that represents a white dot. -
board
A board to be painted in white/black dots. -
slideDecomposition
public boolean slideDecompositionIt specifies if the slide based decomposition of the regular constraint should be applied. This decomposition uses ternary extensional support constraints. It achieves GAC if FSM is deterministic. -
regular
public boolean regularIt specifies if the regular constraint should be used. -
extensionalMDD
public boolean extensionalMDDIt specifies if one extensional constraint based on MDD created from FSM should be used. The translation process works if FSM is deterministic. -
row_rules
public int[][] row_rulesIt specifies a rule for each row. -
col_rules
public int[][] col_rulesIt specifies a rule for each column.
-
-
Constructor Details
-
Nonogram
public Nonogram()
-
-
Method Details
-
readFromFile
-
createAutomaton
It produces and FSM given a sequence representing a rule. e.g. [2, 3] specifies that there are two black dots followed by three black dots.- Parameters:
sequence
- a sequence representing a rule. e.g. [2, 3]- Returns:
- Finite State Machine used by Regular automaton to enforce proper sequence.
-
model
public void model()Description copied from class:ExampleFD
It specifies a standard way of modeling the problem. -
searchAll
public boolean searchAll()It specifies simple search method based on most constrained static and lexigraphical ordering of values. It searches for all solutions.- Returns:
- true if there is a solution, false otherwise.
-
printMatrix
It prints a matrix of variables. All variables must be grounded.- Parameters:
matrix
- matrix containing the grounded variables.
-
main
It executes the program which solves this simple problem.- Parameters:
args
- no arguments are read.
-
test
It executes the program which solves this simple problem.- Parameters:
args
- no arguments are read.
-