Class PerfectSquare


  • public class PerfectSquare
    extends ExampleFD
    It specifies an example where squares of the given size must be placed within a square of a given size.
    Version:
    4.7
    • Field Detail

      • varsX

        IntVar[] varsX
        It specifies which of the pre-defined problems should be solved.
    • Constructor Detail

      • PerfectSquare

        public PerfectSquare()
    • Method Detail

      • squares

        public static final int[][][] squares()
        Returns:
        The following table contains all the data for all problems instances. Each entry (line)within a three dimensional table is one problem. The first one element int array contains the size of the master square. The master square is the square which must accommodate all other squares. The squares which must fit inside the master square are listed in the second array.
      • test

        public static void test​(java.lang.String[] args)
        It runs a perfect square problem. If no problemNo specified as input argument it will solve all the problems given in square matrix.
        Parameters:
        args - program parameters, the first one denotes the problem no to be solved.
      • testUsingGeost

        public static boolean testUsingGeost​(java.lang.String[] args)
        It runs a perfect square problem. If no problemNo specified as input argument it will solve all the problems given in square matrix.
        Parameters:
        args - program parameters, the first one denotes the problem no to be solved.
        Returns:
        true if the solution was found, false otherwise.
      • main

        public static void main​(java.lang.String[] args)
        It runs a perfect square problem. If no problemNo specified as input argument it will solve all the problems given in square matrix.
        Parameters:
        args - program parameters, the first one denotes the problem no to be solved.
      • modelBasic

        public void modelBasic​(int problemNo)
        It specifies the model using mostly PrimitiveConstraints. It does not use diff2 constraint which is very useful for placing 2-dimensional rectangles.
        Parameters:
        problemNo - the problem number to be fetched from the array of problem descriptions provided by squares() function.
      • model

        public void model​(int problemNo)
      • modelGeost

        public void modelGeost​(int problemNo)
      • model

        public void model()
        Description copied from class: ExampleFD
        It specifies a standard way of modeling the problem.
        Specified by:
        model in class ExampleFD
      • search

        public boolean search()
        Description copied from class: ExampleFD
        It specifies simple search method based on input order and lexigraphical ordering of values.
        Overrides:
        search in class ExampleFD
        Returns:
        true if there is a solution, false otherwise.
      • printLaTex

        public java.lang.String printLaTex​(long runtime,
                                           int problemNo)
        Enclose the output of this function inside a simple latex document like the one below. Remove additional "\" before usepackage as it was added to avoid conflict with Doxygen.

        \documentclass[]{article} \\usepackage{color} \hyphenation{} \makeatother \begin{document} \thispagestyle{empty} \include{figure} \end{document}

        Parameters:
        runtime - it specifies the time required to find a solution.
        problemNo - problem number to be used for which the latex generation is taking place.
        Returns:
        latex representation of the solution in a single string.