ExamplesJaCoP
Class PerfectSquare

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

public class PerfectSquare
extends Example

It specifies an example where squares of the given size must be placed within a square of a given size.

Version:
3.0
Author:
Krzysztof Kuchcinski and Radoslaw Szymanek

Field Summary
static int problemNo
          It specifies which of the pre-defined problems should be solved.
static int[][][] squares
          The following table contains all the data for all problems instances.
 
Fields inherited from class ExamplesJaCoP.Example
cost, search, store, vars
 
Constructor Summary
PerfectSquare()
           
 
Method Summary
static void main(java.lang.String[] args)
          It runs a perfect square problem.
 void model()
          It specifies a standard way of modeling the problem.
 void modelBasic()
          It specifies the model using mostly PrimitiveConstraints.
 void modelGeost()
           
 java.lang.String printLaTex(long runtime)
          Enclose the output of this function inside a simple latex document like the one below.
 boolean search()
          It specifies simple search method based on input order and lexigraphical ordering of values.
static void test(java.lang.String[] args)
          It runs a perfect square problem.
 
Methods inherited from class ExamplesJaCoP.Example
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, 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

problemNo

public static int problemNo
It specifies which of the pre-defined problems should be solved.


squares

public static int[][][] squares
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.

Constructor Detail

PerfectSquare

public PerfectSquare()
Method Detail

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.

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()
It specifies the model using mostly PrimitiveConstraints. It does not use diff2 constraint which is very useful for placing 2-dimensional rectangles.


model

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

Specified by:
model in class Example

modelGeost

public void modelGeost()

search

public boolean search()
Description copied from class: Example
It specifies simple search method based on input order and lexigraphical ordering of values.

Overrides:
search in class Example
Returns:
true if there is a solution, false otherwise.

printLaTex

public java.lang.String printLaTex(long runtime)
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.
Returns:
latex representation of the solution in a single string.