Class CrossWord


  • public class CrossWord
    extends ExampleFD
    It is an example of the power of ExtensionalSupportMDD constraint which can be used to efficiently model and solve CrossWord puzzles.
    Version:
    4.7

    This program uses problem instances and dictionary obtained from Hadrien Cambazard.

    • Field Detail

      • r

        int r
      • c

        int c
      • wordSizesPrimitive

        int[] wordSizesPrimitive
      • wordSizes

        java.util.List<java.lang.Integer> wordSizes
      • defaultDictionary

        java.lang.String defaultDictionary
      • mapping

        java.util.Map<java.lang.String,​java.lang.Integer> mapping
      • mappingReverse

        java.util.Map<java.lang.Integer,​java.lang.String> mappingReverse
      • mdds

        java.util.Map<java.lang.Integer,​MDD> mdds
      • crosswordTemplate

        char[][] crosswordTemplate
    • Constructor Detail

      • CrossWord

        public CrossWord()
    • Method Detail

      • model

        public void model()
        model()
        Specified by:
        model in class ExampleFD
      • printSolution

        public void printSolution​(char[][] crossWordTemplate)
        It prints a variable crosswordTemplate.
        Parameters:
        crossWordTemplate - the template
      • readDictionaryFromFile

        public void readDictionaryFromFile​(java.lang.String file,
                                           java.util.List<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 - 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

        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.