ExamplesJaCoP
Class Nonogram

java.lang.Object
  extended by ExamplesJaCoP.Example
      extended by ExamplesJaCoP.Nonogram

public class Nonogram
extends Example

It solves a nonogram example problem, sometimes also called Paint by Numbers.

Author:
Radoslaw Szymanek

Field Summary
 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.
 
Fields inherited from class ExamplesJaCoP.Example
cost, search, store, vars
 
Constructor Summary
Nonogram()
           
 
Method Summary
 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 ExamplesJaCoP.Example
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, search, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

Constructor Detail

Nonogram

public Nonogram()
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 -
Returns:
Finite State Machine used by Regular automaton to enforce proper sequence.

model

public void model()
Description copied from class: Example
It specifies a standard way of modeling the problem.

Specified by:
model in class Example

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.