Package org.jacop.examples.fd.nonogram
Class Nonogram
- java.lang.Object
-
- org.jacop.examples.fd.ExampleFD
-
- org.jacop.examples.fd.nonogram.Nonogram
-
public class Nonogram extends ExampleFD
It solves a nonogram example problem, sometimes also called Paint by Numbers.- Version:
- 4.7
-
-
Field Summary
Fields Modifier and Type Field Description int
black
The value that represents a black dot.IntVar[][]
board
A board to be painted in white/black dots.int[][]
col_rules
It specifies a rule for each column.boolean
extensionalMDD
It specifies if one extensional constraint based on MDD created from FSM should be used.boolean
regular
It specifies if the regular constraint should be used.int[][]
row_rules
It specifies a rule for each row.boolean
slideDecomposition
It specifies if the slide based decomposition of the regular constraint should be applied.int
white
The value that represents a white dot.
-
Constructor Summary
Constructors Constructor Description Nonogram()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FSM
createAutomaton(int[] sequence)
It produces and FSM given a sequence representing a rule.static void
main(java.lang.String[] args)
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(java.lang.String filename)
boolean
searchAll()
It specifies simple search method based on most constrained static and lexigraphical ordering of values.static void
test(java.lang.String[] args)
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 Detail
-
black
public int black
The value that represents a black dot.
-
white
public int white
The value that represents a white dot.
-
board
public IntVar[][] board
A board to be painted in white/black dots.
-
slideDecomposition
public boolean slideDecomposition
It 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 regular
It specifies if the regular constraint should be used.
-
extensionalMDD
public boolean extensionalMDD
It 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_rules
It specifies a rule for each row.
-
col_rules
public int[][] col_rules
It specifies a rule for each column.
-
-
Method Detail
-
readFromFile
public void readFromFile(java.lang.String filename)
-
createAutomaton
public FSM createAutomaton(int[] sequence)
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
public void printMatrix(IntVar[][] matrix)
It prints a matrix of variables. All variables must be grounded.- Parameters:
matrix
- matrix containing the grounded variables.
-
main
public static void main(java.lang.String[] args)
It executes the program which solves this simple problem.- Parameters:
args
- no arguments are read.
-
test
public static void test(java.lang.String[] args)
It executes the program which solves this simple problem.- Parameters:
args
- no arguments are read.
-
-