Presentation is loading. Please wait.

Presentation is loading. Please wait.

Magic square An example of how to represent a problem An idea from Chris Beck.

Similar presentations


Presentation on theme: "Magic square An example of how to represent a problem An idea from Chris Beck."— Presentation transcript:

1 Magic square An example of how to represent a problem An idea from Chris Beck

2 put a number in each square each number is different a number is in the range 1 to 16 the sum of a column is the same as a sum of a row the same as the sum of a main diagonal

3

4

5

6

7

8

9

10

11

12 Back to CP

13

14 put a number in each square each number is different a number is in the range 1 to 16 the sum of a column is the same as a sum of a row the same as the sum of a main diagonal 1st stab Use sum(x) = sum(y) where x and y are - different rows - different columns - different diagonals Every element of the array is different - represent as a clique of not equals How does it go? For propagation and search?

15 put a number in each square each number is different a number is in the range 1 to 16 the sum of a column is the same as a sum of a row the same as the sum of a main diagonal 2nd stab Use allDiff But what is k? How does model perform?

16 Magic

17 Could edit this

18 Magic What is k?

19 Magic Just a counter

20 Magic S is actual square v is S flattened

21 Magic Create S, its transpose TS and S flattened into v

22 Magic That’s why we flattened S

23 Magic Transpose is neat (thanks Neil Moore)

24

25

26

27

28 Is this solution unique?

29 Magic square on the web http://mathforum.org/alejandre/magic.square.html http://mathworld.wolfram.com/MagicSquare.html

30 Is there an order 3 magic square with the number 5 in one of the outer corners?

31

32 Thanks to Chris Beck

33


Download ppt "Magic square An example of how to represent a problem An idea from Chris Beck."

Similar presentations


Ads by Google