ExamplesJaCoP
Class MagicSquares

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

public class MagicSquares
extends Example

It solves a Magic squares problem.

Author:
Radoslaw Szymanek MagicSquare problem consists of filling the square of size n with numbers from 1 to n^2 in such a way that all rows, all columns, and main diagonals are equal to the same number K. K can be computed to be equal to (n * (n^2 + 1)) / 2.

Field Summary
 java.util.ArrayList<Constraint> guidingShaving
          It specifies the list of constraints which can be used for guiding shaving.
 int number
          It specifies the number
 
Fields inherited from class ExamplesJaCoP.Example
cost, search, store, vars
 
Constructor Summary
MagicSquares()
           
 
Method Summary
static void main(java.lang.String[] args)
          It executes the program which solves the MagicSquare problem.
 void model()
          It specifies a standard way of modeling the problem.
 void model4Shaving()
          It creates the model with specification of what constraint can help in guiding shaving.
 void modelBound()
          It specifies the model which uses only variables with BoundDomain.
 void modelDual()
          IT creates a dual model.
static void test(java.lang.String[] args)
          It executes the program which solves the MagicSquare problem using many different model and searches.
 
Methods inherited from class ExamplesJaCoP.Example
creditSearch, getSearch, getSearchVariables, getStore, printMatrix, search, 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

number

public int number
It specifies the number


guidingShaving

public java.util.ArrayList<Constraint> guidingShaving
It specifies the list of constraints which can be used for guiding shaving.

Constructor Detail

MagicSquares

public MagicSquares()
Method Detail

model

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

Specified by:
model in class Example

modelBound

public void modelBound()
It specifies the model which uses only variables with BoundDomain.


model4Shaving

public void model4Shaving()
It creates the model with specification of what constraint can help in guiding shaving.


modelDual

public void modelDual()
IT creates a dual model.


test

public static void test(java.lang.String[] args)
It executes the program which solves the MagicSquare problem using many different model and searches.

Parameters:
args - the first argument allows to specify the size of magic square.

main

public static void main(java.lang.String[] args)
It executes the program which solves the MagicSquare problem.

Parameters:
args - the first argument allows to specify the size of magic square.