ExamplesJaCoP
Class CrossWord

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

public class CrossWord
extends Example

It is an example of the power of ExtensionalSupportMDD constraint which can be used to efficiently model and solve CrossWord puzzles.

Author:
: Radoslaw Szymanek This program uses problem instances and dictionary obtained from Hadrien Cambazard.

Nested Class Summary
 class CrossWord.PrintListener
          It is a simple print listener to print every tenth solution encountered.
 
Field Summary
 
Fields inherited from class ExamplesJaCoP.Example
cost, search, store, vars
 
Constructor Summary
CrossWord()
           
 
Method Summary
static void main(java.lang.String[] args)
          It executes the program to create a model and solve crossword problem.
 void model()
          model()
 void printSolution()
          It prints a variable matrix.
 void readDictionaryFromFile(java.lang.String file, java.util.ArrayList<java.lang.Integer> wordSizes)
          It reads a dictionary.
 boolean searchAllAtOnceNoRecord()
          It searches for all solutions.
 
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
 

Constructor Detail

CrossWord

public CrossWord()
Method Detail

model

public void model()
model()

Specified by:
model in class Example

printSolution

public void printSolution()
It prints a variable matrix.


readDictionaryFromFile

public void readDictionaryFromFile(java.lang.String file,
                                   java.util.ArrayList<java.lang.Integer> wordSizes)
It reads a dictionary. For every word length specified it reads a dictionary and creates an MDD representation of it for use by an extensional constraint.

Parameters:
file - filename containing dictionary
wordSizes -

searchAllAtOnceNoRecord

public boolean searchAllAtOnceNoRecord()
It searches for all solutions. It does not record them and prints every tenth of them.

Returns:
true if any solution was found, false otherwise.

main

public static void main(java.lang.String[] args)
It executes the program to create a model and solve crossword problem.

Parameters:
args - no arguments used.