home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!cs.utexas.edu!torn!news.ccs.queensu.ca!qucis.queensu.ca!ember!pacolley
- From: pacolley@ember.UUCP (Paul Colley)
- Newsgroups: comp.theory
- Subject: Re: Reassembling a checkerboard jigsaw
- Message-ID: <15446@ember.UUCP>
- Date: 21 Nov 92 18:57:25 GMT
- References: <rreiner.722360646@yorku.ca>
- Reply-To: pacolley@ember.UUCP (Paul Colley)
- Organization: Ember---private system
- Lines: 103
-
- In article <rreiner.722360646@yorku.ca> rreiner@nexus.yorku.ca
- (Richard Reiner) writes:
-
- > - Given an n x n checkerboard which has been cut into pieces of
- > varing size along the edges of its squares (i.e. no diagonal
- > cuts),
- >
- > Efficiently reassemble the pieces into an n x n board (the rebuilt
- > board need not deploy the pieces exactly as the original did,
- > although this would be preferable; ideally, I would like to be
- > able to enumerate *all* the ways of rearranging the pieces into an
- > n x n board).
-
- The problem, "given a set of integers that sum to S, find a subset that
- sum to 0.5 S" is NP-complete.
-
- This problem can be reduced to the stated checkerboard problem as
- follows:
-
- Make an (S+1) x (S+1) square.
-
- For each of the integers i, Create a rectangular piece that is 2i long
- by 0.5 S wide.
-
- Add an additional piece that is T-shaped, with the "bars" one unit
- wide, such that the T's total height is S+1 and total width is S+1.
-
- I will give a small example to clarify the construction:
-
- Integers: 1,2,2,3 (sum S=8)
-
- The pieces for the integers:
-
- XX XXXX XXXX XXXXXX
- XX XXXX XXXX XXXXXX
- XX XXXX XXXX XXXXXX
- XX XXXX XXXX XXXXXX
-
- The T-shaped piece:
-
- XXXXXXXXX
- X
- X
- X
- X
- X
- X
- X
- X
-
- And the 9x9 board:
-
- .........
- .........
- .........
- .........
- .........
- .........
- .........
- .........
- .........
-
- The extra T-shaped piece only fits in one way (modulo rotations), dividing the
- board into two equal areas, like so:
-
- ........X
- ........X
- ........X
- ........X
- XXXXXXXXX
- ........X
- ........X
- ........X
- ........X
-
- The remaining pieces can be fitted in if and only if there is a subset
- that adds to 0.5 S (proof let as an exercise for the reader :-) ).
-
- Thus the checkerboard problem is NP-complete.
-
- Now, the original poster wasn't clear about whether the colouring
- of the squares was important (i.e., colour the pieces black and
- white in a checkerboard pattern when you create them, and be able
- to reassemble them back into a checkerboard colouring).
-
- The reduction I gave is still valid if colouring is important; Each
- piece is an even number of units wide ("2i"), and the orientation
- that the pieces will be put in is known (if there is a solution,
- there is a solution with the T bar dividing the board horizontally
- and the pieces being placed with the 2i side against the dividing
- bar of the T). So we can just colour the pieces so that they match
- a checkerboard when placed this way (and an even distance from the
- edge of the board)).
-
- ----------
-
- Thus the checkerboard problem is NP-hard.
-
- - Paul Colley
- University: colley@qucis.queensu.ca
- Home: pacolley@ember.uucp watmath!ember!pacolley +1 613 545 3807
- <Ring> [...] "Sorry, I'm all booked up." "Who was that?" "The library." - B.C.
-
-