Package org.jacop.examples.fd.crosswords
Class CrossWord
java.lang.Object
org.jacop.examples.fd.ExampleFD
org.jacop.examples.fd.crosswords.CrossWord
It is an example of the power of ExtensionalSupportMDD constraint which can be used
to efficiently model and solve CrossWord puzzles.
- Version:
- 4.10
This program uses problem instances and dictionary obtained from Hadrien Cambazard.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
CrossWord.PrintListener<T extends Var>
It is a simple print listener to print every tenth solution encountered. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
It executes the program to create a model and solve crossword problem.void
model()
model()void
printSolution
(char[][] crossWordTemplate) It prints a variable crosswordTemplate.void
readDictionaryFromFile
(String file, List<Integer> wordSizes) It reads a dictionary.boolean
It searches for all solutions.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
-
Constructor Details
-
CrossWord
public CrossWord()
-
-
Method Details
-
model
public void model()model() -
printSolution
public void printSolution(char[][] crossWordTemplate) It prints a variable crosswordTemplate.- Parameters:
crossWordTemplate
- the template
-
readDictionaryFromFile
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 dictionarywordSizes
- size of the words
-
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
It executes the program to create a model and solve crossword problem.- Parameters:
args
- no arguments used.
-