análisis de soluciones (m+m)

Upload: lonchito006

Post on 02-Jun-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Anlisis de soluciones (m+m)

    1/11

    Heuristics: The Role of Direction in Controlling Search Space 41

    volume 3, no. 1 (Fall 2010)

    Appendix A

    Solution sequence for the binary 4+4 puzzle.

    Start state: XXXXOOOO

    Move 1: X___XOOOOXX

    Move 2: XOOX___OOXX

    Move 3: XOOXOXO___X

    Move 4 (Goal state): OXOXOXOX

    Solution sequence for the labeled 4+4 puzzle.

    Start state: FDHBGAEC

    Move 1: F___BGAECDH

    Move 2: FGAB___ECDH

    Move 3: FGABCDE___H

    Move 4 (Goal state): ABCDEFGH

    Solution sequence for the binary 5+5 puzzle.

    Start state: XXXXXOOOOO

    Move 1: X___XXOOOOOXX

    Move 2: XOOXXOO___OXX

    Move 3: XOOX___OXOOXX

    Move 4: XOOXOXOXO___X

    Move 5 (Goal state): OXOXOXOXOX

  • 8/11/2019 Anlisis de soluciones (m+m)

    2/11

    The Journal of Problem Solving

    42 Yun Chu, Zheng Li, Yong Su, and Zygmunt Pizlo

    Appendix B

    This appendix mainly provides a proof that the m+m puzzle can be solved in mmoves

    for any m3. First, we prove a lower bound on the number of operations to solve the

    puzzle. Next, we derive a guideline to achieve the bound with the optimization principle.

    Then, a recursive solution for the general case is presented and proved by mathematical

    induction. With elementary combinatorics analysis, we also count the number of differ-

    ent solutions.

    1 The Puzzle

    The elements in the puzzle are simply two different tiles and we denote them by 0 and

    1;* thus the puzzle is binary. The puzzle starts from a binary sequence of contiguous seg-

    ments of m0s and m1s as shown below, where m3.

    0 01 1

    m m

    m

    0s 1s

    2 tiles

    (1)

    The valid operations of the puzzle are simple. Each operation is defined as shifting two

    consecutive tiles to the end of the sequence or the vacant places left by previous move-

    ments. For example, the following is one operation by shifting two tiles at the center to

    the left end of the sequence.

    0 0 0 1 1 1

    0 0 1 1 0 1

    Solution sequence for the labeled 5+5 puzzle.

    Start state: HDJBFGEIAC

    Move 1: H__BFGEIACDJ

    Move 2: HIABFGE__CDJ

    Move 3: HIAB__EFGCDJ

    Move 4: HIABCDEFG__J

    Move 5 (Goal state): ABCDEFGHIJ

    * OX tiles in the binary version of the m+m puzzle are represented as 01 in this proof.

  • 8/11/2019 Anlisis de soluciones (m+m)

    3/11

    Heuristics: The Role of Direction in Controlling Search Space 43

    volume 3, no. 1 (Fall 2010)

    The goal of the puzzle is to reach the state in (2) from the state in (1) with no more than

    moperations.

    1010 102 tiles

    10s

    m

    m

    (2)

    The reader is cautioned that the movement of the pair of tiles can only be performed by

    shifting, not rotating. The shifted tiles can only be placed at the end of the sequence or

    the vacant places left by previous movements, not inserting between two adjacent tiles.

    A complete solution for the case m= 3 is shown in Table I. For m= 4, a little bit more effort

    will lead to the answer shown in Table II. The solutions for m= 5 and 6 are presented in

    Tables III and IV, respectively.

    Table I. A Solution with m= 3

    0 0 0 1 1 1

    0 1 1 1 0 0

    0 1 1 0 1 0

    1 0 1 0 1 0

    Table II. A Solution with m= 4

    0 0 0 0 1 1 1 1

    0 0 1 1 1 1 0 0

    0 1 1 0 1 1 0 0

    0 1 1 0 1 0 1 0

    1 0 1 0 1 0 1 0

    Table III. A Solution with m= 5

    0 0 0 0 0 1 1 1 1 1

    0 0 0 1 1 1 1 1 0 0

    0 1 1 0 0 1 1 1 0 0

    0 1 1 0 1 0 1 1 0 0

    0 1 1 0 1 0 1 0 1 0

    1 0 1 0 1 0 1 0 1 0

    Table IV.A Solution with m= 6

    0 0 0 0 0 0 1 1 1 1 1 1

    0 0 0 0 1 1 1 1 1 1 0 0

    0 1 1 0 0 0 1 1 1 1 0 0

    0 1 1 0 1 0 0 1 1 1 0 0

    0 1 1 0 1 0 1 0 1 1 0 0

    0 1 1 0 1 0 1 0 1 0 1 0

    1 0 1 0 1 0 1 0 1 0 1 0

  • 8/11/2019 Anlisis de soluciones (m+m)

    4/11

    The Journal of Problem Solving

    44 Yun Chu, Zheng Li, Yong Su, and Zygmunt Pizlo

    2 The Guideline

    To find the solution for large m systematically, we begin with the definition of several

    terms.

    Definition 1.The relationship between adjacent two tiles is an i-relation if the tiles are

    identical. That two-tile pair is called an i-pair. The relationship between adjacent two tiles is a

    ni-relation if the tiles are not identical. That two-tile pair is called a ni-pair.

    Now, letiandibe the decrement of the number of i-relations and increment of the num-

    ber of ni-relations in the ith operation, respectively. Clearly,iand ibelong to {0, 1, 2}.

    The negative value of i refers to the increment of the number of i-relations and the

    negative value of irefers to the decrement of the number of ni-relations. For a general

    case with 2melements, there are (2m 2) i-relations and 1 ni-relation at the beginning

    as shown in (1). There are 0 i-relations and (2m 1) ni-relations in the end as shown in (2).Thus, to accomplish the transition from (1) to (2) in noperations, we must have

    ii

    n

    i

    i

    n

    m

    1 1

    2 2, (3)

    where nm. However,iand icould never be negative by (3) and the pigeonhole prin-

    ciple. Moreover, we have

    Theorem 1.m is the minimum number of operations that could accomplish the transi-

    tion from the state in (1) to the state in (2).

    Proof. By the rules of the puzzle, it is obvious that 11 since the pair could only

    be placed at the end of the sequence in the first operation, which creates only one new

    relationship. Assuming the transition takes noperations, we have

    2 1 2 32

    n mi

    i

    n

    ,

    since i2 and (3). Therefore,

    n m

    1

    2 ,

    which is equivalent to nmsince both nand mare integers.

    Next, let us deduce a guideline to solve the puzzle with the minimum moperations. Since

    the essential goal of each operation is to replace the i-relation with the ni-relation, we

    have the notation of the score of ith operation as:

  • 8/11/2019 Anlisis de soluciones (m+m)

    5/11

    Heuristics: The Role of Direction in Controlling Search Space 45

    volume 3, no. 1 (Fall 2010)

    Si i i .

    Because of (3), we have

    S mii

    m

    4 41

    . (4)

    On the other hand Si4 for all the operations since each operation can create at most two

    new relationships and remove at most two old relationships. Before going any further, we

    should give the definition of gaps.

    Definition 2. A gap is a two-tile vacant space left by taking a pair from the inner part

    of the sequence. If the boundary tiles of a gap are identical, that gap is called an i-gap. If the

    boundary tiles of a gap are not identical, that gap is called a ni-gap.

    For an operation with an optimal score of Si= 4, we must either shift an i-pair to fill an i-

    gap and create an i-gap or shift a ni-pair to fill a ni-gap and create a ni-gap. However, the

    starting state (1) and the ending state (2) do not contain any gap. It is easy to verify that

    Si3 for the operation creating the first gap and filling the last gap. Therefore, creating

    each gap will cost a score of at least 2. Moreover, it is easy to verify that we must shift an

    i-pair in the first operation and a ni-pair in the last operation. Hence, there is a discontinu-

    ity in which we start to shift a ni-pair instead of an i-pair. Such a discontinuity will cost a

    score of at least 2. Thus,

    S mii

    m

    4 41 . (5)

    Comparing (4) and (5), we draw the conclusion that there is at most one gap at any point

    of the puzzle. Additionally, we must shift an i-pair in the first operation and continue to do

    so. Starting from certain number of operations later, we shift the ni-pairs until solution.

    To determine when we shift the first ni-pair, we should take the absolute position of each

    tile in the sequence into account. Since only pairs can be moved, the sequence in (1) will

    be shifted to the sequence in (2) by even tiles. Hence, the desired tile in each position of

    the sequence is fixed. If a certain tile is not the desired tile in that position, we call that tilewrongly positioned. It is obvious that the number of wrongly positioned tiles at the be-

    ginning is equal to the Hamming distance between the 2m-tuple in (1) and the 2m-tuple

    in (2), which equals to 2m2

    , where xmin {n : nx}.

    Clearly, operation on i-pair does not decrease the number of wrongly positioned tiles. The

    number of wrongly positioned tiles will be decreased by 2 only if we shift a ni-pair from

  • 8/11/2019 Anlisis de soluciones (m+m)

    6/11

    The Journal of Problem Solving

    46 Yun Chu, Zheng Li, Yong Su, and Zygmunt Pizlo

    a wrong position to a correct position. Therefore, we must have at least m2such opera-

    tions for a valid solution. Since shifting correctly positioned ni-pair makes the solution

    not minimum in mmoves, we conclude that all the operations on the ni-pair should be

    on wrongly positioned ni-pair. Accordingly, we have exactly m2

    such operations.

    In summary, the operations in solving the puzzle could be divided into two phases. The

    first phase takes m2operations, where xmax {n : nx}. The second phase takes

    m2

    operations. In the first phase, we only shift i-pairs, and fill out the i-gap after the first

    operation for m> 3. We will alternatively shift i-pair with 0s and i-pair with 1s. The i-pair

    must be picked from the middle of 0000 or 1111 before the m2th operation. If we cannot

    find such a pattern in the sequence or there is still such a pattern after m2th operation,

    there will be no solution for that trial. In the second phase, we only shift the wrongly

    positioned ni-pair to fill out the ni-gap. The first tile of wrongly positioned ni-pair must

    alternatively be 0 and 1. The ni-pair should be picked from the middle of 0011 or 1100. Ifwe cannot find such a pattern in the sequence before the last operation, there will be no

    solution for that trial. With such a guideline, we can directly find a solution for the case of

    m= 7 and the result is listed in Table V.

    Table V.A Solution with m= 7

    0 0 0 0 0 0 0 1 1 1 1 1 1 1

    0 0 0 0 0 1 1 1 1 1 1 1 0 0

    0 1 1 0 0 0 0 1 1 1 1 1 0 0

    0 1 1 0 0 1 1 1 0 0 1 1 0 0

    0 1 1 0 1 0 0 1 1 0 1 1 0 00 1 1 0 1 0 1 0 1 0 1 1 0 0

    0 1 1 0 1 0 1 0 1 0 1 0 1 0

    1 0 1 0 1 0 1 0 1 0 1 0 1 0

    3 The Solution

    Although the guideline facilitates the procedure to find the solution, there are still am-

    biguities in both phases. Now, we provide the second main result in Theorem 2. The con-

    structive proof of the theorem provides a recursive algorithm that guarantees a general

    simple solution.

    Theorem 2.There always exists a transition from the state in (1) to the state in (2) with

    the minimum m operations.

    Proof. We prove it by mathematical induction. First, we find the solutions for m=

    3, 4, 5, 6, 7 in Tables I, II, III, IV, and V, respectively. For m8, let us consider the transition

    listed in Table VI.

  • 8/11/2019 Anlisis de soluciones (m+m)

    7/11

    Heuristics: The Role of Direction in Controlling Search Space 47

    volume 3, no. 1 (Fall 2010)

    Table VI.A General Solution

    0 0 0 0 0 0 0 0 . . . 1 1 1 1 1 1 1 1

    0 0 0 0 0 0 . . . 1 1 1 1 1 1 1 1 0 0

    0 1 1 0 0 0 0 0 . . . 1 1 1 1 1 1 0 0

    0 1 1 0 1 0 . . . 1 0 1 0 1 0 1 1 0 0

    0 1 1 0 1 0 1 0 . . . 1 0 1 0 1 0 1 0

    1 0 1 0 1 0 . . . 1 0 1 0 1 0 1 0 1 0

    In Table VI, each of the first three ellipses represents a binary sequence of continued seg-

    ments of (m 8) 0s and (m 8) 1s, while each of the last three ellipses represents a binary

    sequence of continued segments of (m 8) 10s. The step between two horizontal lines is

    from the induction assumption on the (2m 8)-element subsequence situated at the center

    of original sequence. Such a step could be accomplished in m 4 operations. Therefore,

    the whole transition takes exactly moperations.

    With Theorems 1 and 2, we can solve the puzzle in the minimum moperations recursively.

    One of the solutions for m= 19 is listed in Table VII.

    Table VII.A Solution withm= 19

    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0

    0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0

    0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 0 00 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0

    0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0

    0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 0

    0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

    1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

  • 8/11/2019 Anlisis de soluciones (m+m)

    8/11

  • 8/11/2019 Anlisis de soluciones (m+m)

    9/11

    Heuristics: The Role of Direction in Controlling Search Space 49

    volume 3, no. 1 (Fall 2010)

    i

    mi m

    1

    2

    2 ,

    otherwise

    and

    i

    m

    i

    1 1

    2

    2

    otherwise,,

    where 1

    0

    The gap is an I-gap.

    otherwise

    .

    Next, it is straightforward to conclude that the next outer four tiles must be either 0110

    or 1100 and either 1100 or 1001 for the left end and right end of every state in . The

    same restriction applies if we remove those eight tiles and collapse the gap, and so on.

    Since 0110 or 1001 renders a wrongly positioned 01 ni-pair while 1100 renders a wrongly

    positioned 10 ni-pair. The number of times 1100 appears in the sequence could be cal-culated by the number of wrongly positioned 10 ni-pair needed in the second phase of

    the transition. Therefore,

    22

    1

    2 2

    1

    2 2

    1

    2 1

    4

    4 1

    4

    q

    q

    q

    q

    q

    q

    m q

    m q

    m q

    22

    4 32 1q

    qm q

    , (8)

    where 00 01 1.

    In the second phase, we shift wrongly positioned ni-pairs to the correct positions, and

    ni-pairs starting with 0s and ni-pairs starting with 1s must be shifted alternatively. The

    last shifted ni-pair must be 01 which must be at either end of the sequence. Thus, except

    that ni-pair, all the ni-pairs starting with 0s or all the ni-pairs starting with 1s could be

    interchangeable. Also, the number of all the ni-pairs shifted is m2

    . Therefore, the number

    of possible shifting order from a state in to the ending state is

    3 2

    1 4

    4 1

    q q m q

    q m q

    q m

    ! !

    !

    !

    2

    44 2

    1 4 3

    q

    q q m q

    ! !

    . (9)

  • 8/11/2019 Anlisis de soluciones (m+m)

    10/11

    The Journal of Problem Solving

    50 Yun Chu, Zheng Li, Yong Su, and Zygmunt Pizlo

    Consequently, by (6), (7), (8), and (9), the number of different solutionsfor case m> 3

    is

    M

    1 2 3 1 21 22 3

    24 2 2 2 4q q q m! ! qq

    q q q q m q

    q q q

    4 2 2 2 4 1

    4 2 2 1

    2

    ! !

    ! !

    2

    2

    4 2

    4 2 2 1 1 4

    q m q

    q q q q q m q

    ! !

    3

    .

    For m= 19, there are 812851200 solutions.

    Endnotes

    1. This can only work in the case of simple problems such as Tower of Hanoi, where thenumber of states is fairly small. In the case of moderately complex problems, such as the15-puzzle, the number of states is about the same as the number of neurons in the brain,making it unlikely that a person can store all states in long-term memory. For more com-plex problems, such as chess, the number of states is larger than the number of atomsin the universe. Clearly, storing all states of a problem and exploring the entire problemspace is unrealistic.

    References

    Beilock, S. L., & DeCaro, M. S. (2007). From poor performance to success under stress: Work-ing memory, strategy selection, and mathematical problem solving under pressure.Journal of Experimental Psychology: Learning, Memory, and Cognition, 33(6),983998.

    Bhner, M., Krner, S., & Ziegler, M. (2008). Working memory, visual-spatial-intelligence andtheir relationship to problem solving.Intelligence, 36, 672680.

    Chronicle, E. P., MacGregor, J. N., & Ormerod, T. C. (2004). What makes an insight problem? Therole of heuristics, goal conception, and solution recoding in knowledge-lean problems.Journal of Experimental Psychology: Learning, Memory, and Cognition, 30(1),1427.

    Chu, Y. (2009). Human insight problem solving: performance, processing, and phenomenology.

    Berlin: VDM Verlag.Chu, Y., Dewald, A. D., & Chronicle, E. P. (2007). Theory-driven hints in the cheap necklaceproblem: A preliminary investigation. The Journal of Problem Solving, 1(2), 1832.

    Fleck, J. I. (2008). Working memory demands in insight versus analytic problem solving.European Journal of Cognitive Psychology, 20(1),139176.

    Kotovsky, K., Hayes, J. R., & Simon, H. A. (1985). Why are some problems hard? Evidence fromTower of Hanoi. Cognitive Psychology, 17, 248294.

  • 8/11/2019 Anlisis de soluciones (m+m)

    11/11

    Heuristics: The Role of Direction in Controlling Search Space 51

    volume 3, no. 1 (Fall 2010)

    Kotovsky, K., & Simon, H. A. (1990). Why are some problems really hard: Explorations in theproblem space of difficulty. Cognitive Psychology, 22, 143183.

    Larkin, J. H., & Simon, H. A. (1987). Why a diagram is (sometimes) worth ten thousand words.Cognitive Science, 11, 6599.

    MacGregor, J. N., Ormerod, T. C., & Chronicle, E. P. (2001). Information-processing and insight:A process model of performance on the nine-dot and related problems.Journal ofExperimental Psychology: Learning, Memory and Cognition,27, 176201.

    Maier, N. R. F. (1930). Reasoning in humans: I. On direction.Journal of Comparative Psychol-ogy, 10, 115143.

    Newell, A., & Ernst, C. (1965). The search for generality.Proceedings of the IFIP Congress.

    Newell, A., & Simon, H. A. (1972). Human problem solving. Englewood Cliffs, NJ: Prentice.

    llinger, M., Jones, G., & Knblich, G. (2006). Heuristics and representational change in two-move matchstick arithmetic tasks.Advances in Cognitive Psychology, 2(4), 239253.

    zcan, E., Bilgin, B., & Korkmaz, E. E. (2008). A comprehensive analysis of hyper-heuristics.Intelligent Data Analysis, 12, 323.

    Patra, S., Goswami, S. K., & Goswami, B. (2009). Fuzzy based fast dynamic programmingsolution of unit commitment with ramp constraints.Expert Systems, 26(4), 307319.

    Pizlo, Z., & Li, Z. (2003). Pyramid algorithms as models of human cognition. Proceedings ofIS and T/SPIE Conference on Computational Imaging, 5016,112.

    Pizlo, Z., & Li, Z. (2005). Solving combinatorial problems: 15-puzzle.Memory and Cognition,33(6),106984.

    Pizlo, Z., Stefanov, E., Saalweachter, J., Li, Z., Haxhimusa, Y., & Kropatsch, W. (2006). Travel-ing salesman problem: A foveating pyramid model. Journal of Problem Solving, 1,

    83101.Pushkin, V. N., & Saltykov, G. F. (1972). Some mechanisms in solutions of problems involving

    movement of objects under restrictive conditions. In V. N. Pushkin (Ed.), Problems ofheuristics(pp. 7386). Jerusalem: Israel Program for Scientific Translations.

    Renkl, A., Hilbert, T., & Schworm, S. (2008). Example-based learning in heuristic domains: Acognitive load theory account. Educational Psychology Review, 21,6778.

    Tolman, E. C. (1932). Purposive behavior in animals and men.New York: Century.

    Shepard, R. N. (1987). Toward a universal law of generalization for psychological science.Science, 237, 13171323.

    Vrakas, D., & Vlahavas, I. (2005). Hybrid ace: Combining search directions for heuristic plan-ning. Computational Intelligence, 21(3), 306331.

    Zhang, J., Johnson, T. R., & Wang, H. (1998). Isomorphic representations lead to the discoveryof different forms of a common strategy with different degrees of generality.Proceed-ings of the Twentieth Annual Conference of the Cognitive Science Society. Hillsdale, NJ:Lawrence Erlbaum.