Package org.jacop.examples.fd
Class PerfectSquare
java.lang.Object
org.jacop.examples.fd.ExampleFD
org.jacop.examples.fd.PerfectSquare
It specifies an example where squares of the given size must be placed within
a square of a given size.
- Version:
- 4.9
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
It runs a perfect square problem.void
model()
It specifies a standard way of modeling the problem.void
model
(int problemNo) void
modelBasic
(int problemNo) It specifies the model using mostly PrimitiveConstraints.void
modelGeost
(int problemNo) printLaTex
(long runtime, int problemNo) 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 final int[][][]
squares()
static void
It runs a perfect square problem.static boolean
testUsingGeost
(String[] args) It runs a perfect square problem.Methods inherited from class org.jacop.examples.fd.ExampleFD
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, searchAllAtOnce, searchAllOptimal, searchLDS, searchMasterSlave, searchMaxRegretOptimal, searchMiddle, searchMostConstrainedStatic, searchOptimal, searchSmallestDomain, searchSmallestMedian, searchSmallestMiddle, searchSmallestMin, searchWeightedDegree, searchWithMaxRegret, searchWithRestarts, shavingSearch
-
Field Details
-
Constructor Details
-
PerfectSquare
public PerfectSquare()
-
-
Method Details
-
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
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
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
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. -
search
public boolean search()Description copied from class:ExampleFD
It specifies simple search method based on input order and lexigraphical ordering of values. -
printLaTex
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.
-