The Jigsaw Puzzle Project by kellena88


									DECOI 2007          Assignment for Digital Biology: The Jigsaw Puzzle Project

             Assignment for Digital Biology
                        by Peter J. Bentley

             The Jigsaw Puzzle Project


                           Regina Frei
                          Cliona Quigley
                           Felix Dreyer
                         Jeroen Heijmans


                       RePast and NetLogo

DECOI 2007                    Assignment for Digital Biology: The Jigsaw Puzzle Project

This report is an informal collection of ideas and considerations made during the
practical part of the DECOI 2007 Summer School in Amsterdam. Within the limited
scope of the project afternoons, only a small proportion of the ideas could be
implemented and tested – however, many potential strategies were investigated on

Goals and basic approach
The aim of this project was to create a digital jigsaw puzzle, without being limited to the
reality of a physical jigsaw puzzle. The supporting infrastructure consists of a 2D circular
arena, which is the zone where the puzzle pieces can flow around. Each piece is
represented by an agent. The pieces may take various forms and characteristics
depending on the initial settings for each run. Examples are squares, hexagons
(honeycomb pattern) or other regular geometries, simple colours and patterns or real
pictures. Only pieces with corresponding sides can link.

The pieces move around randomly and can have inelastic shocks with the arena borders
as well with each other. For reasons of simplicity, the speed of the pieces is always the
same – only its direction is variable. Precise modelling of the physical reality is not
required. If two pieces collide, they either stick to each other and continue on a common
trajectory being the average direction of their previous individual directions, or they are
repulsed and continue each in the opposite direction of their arrival.

There are two basic possibilities for a digital jigsaw puzzle: either there is a unique
solution (like in reality) with each piece being unique, or there are many identical or
similar pieces which can be combined in various ways. Another important decision is if a
picture or an object (like a Chess board) shall be recreated in its exact form or if any
approximate solution is acceptable.

Frequently also the exact opposite or a slightly different version of the explained strategy
could be used and would also lead to interesting results. The statements made here are
thought to indicate the nature of the questions to answer when approaching this project.

Colour / nature of the border specification
   • In case of a real picture, each piece will carry a certain number of pixels. To
      define their side values, their RGB values of their border line pixels are averaged.
   • There can be more pieces than needed for the “perfect” solution, meaning the
      identical reconstruction of the initial object.
   • Also imperfect matches could be accepted: in case the average RGB values
      show a correspondence with a colliding piece, it can either be accepted right
      away or it can be decided to compare each border line pixel separately. The
      latter variant requires a higher computation effort and cannot grant for a 100%
      match of the pieces, neither. It is difficult to reach an always working perfect
      reconstruction of the original image.
   • Links could have different strengths meaning that the side values do not have to
      be equal for the link to be corresponding, but they could be accepted if they are
      inside a certain range and then have a certain strength (between 0.1 and 1, 0

DECOI 2007                             Assignment for Digital Biology: The Jigsaw Puzzle Project

            being no match and 1 being the strongest link) according to the proximity of their
    •       The characteristics of a piece border can consist of colour, form, magnetic
            properties or other features. For simplicity, they are all represented by numbers
            in this kind of simulation.

Geometrical linking rules
  • Each link has to be double-checked, meaning that both partners have to agree;
     otherwise the link cannot be formed.
  • Pieces have to check all of the links they will get with a match (see Figure 1).


Figure 1: check all of the links

    •       To favour compact forms, the pieces should prefer places where they can occupy
            more than one link, i.e. they get more than one neighbour. This could mean that
            a piece has an internal counter of refused “acceptable but less favourable”
            places. If this counter reaches a certain threshold value, such a place can be
            accepted. A piece would, for example, have to refuse two such places before
            accepting the third. In this way the probability of finding a better place increases
            and more compact aggregations should be formed.
    •       Potential strong matches can delete weaker matches and better suitable pieces
            therefore “kick out” less suitable ones as shown on Figure 2. One strong match
            can delete several weaker links. If two links of the same strength enter into
            competition, the winner is determined randomly. The degree of a piece’s “ease”
            at its place is expressed by the sum of its links’ values. Thus a piece with a
            potentially higher value can cause the departure of a less fitting piece.

                            Perfect match

                                   2    2
                            1               2
                                                   Weak match
 Perfect match                              1
                            No match

Figure 2: stronger against weaker links

        •    It can happen that aggregations with internal holes are formed. Obviously, this
             problem must somehow be avoided, without referring to the help of an

DECOI 2007                         Assignment for Digital Biology: The Jigsaw Puzzle Project

            “observer”. The rules needed could be: if there are more than 1 link to be filled,
            accept the position – if not check both sides of your potential mate and their 90
            degree neighbours (see Figure 3 a) and the immediate neighbouring links and
            their 90 degree neighbours (see Figure 3 b).

                                          ?                        b)          ?

Figure 3:         a) the sides and their 90 degree neighbours
                  b) the immediate neighbours and their 90 degree neighbours

     •      Two pieces which link to each other will form a new identity with a combined
            vision range and a common trajectory. This means that they can detect
            collisions synchronously at all of their edges. Again, double-checking with the
            collision partner is important (see Figure 4): synchronous collisions may happen
            with another big cluster as well as with single parts, by chance arriving at the
            same time. Case a) must be avoided because of the attraction-repulsion
            contradiction; in case b), the piece on the left hand side could be accepted while
            the one at the right hand side would be repelled.

      a)                                                b)

                          ?                                              ?

Figure 4: synchronous collisions at different edges of a cluster

   • Clusters do not need to carry a list of their members because the links between
       the pieces are formed in a recursive way: A is linked to B who is linked to C. The
       pieces can thus contact each other through their intermediate neighbours.
   • To avoid a situation with several incompatible big clusters, a cluster has to
       acquire new links at least every X seconds. After the expiration of this time limit,
       the cluster has to expel all of its pieces which have only one link occupied. If
       there are none, the pieces with only two occupied links are expelled after another
       X seconds.

DECOI 2007                     Assignment for Digital Biology: The Jigsaw Puzzle Project

    •   The distributed implementation of this concept could mean that each piece has
        its own time which is reset to zero whenever a connection is made. In this case,
        the piece will also send a message to its neighbours to do the same, and those
        will pass the message on until it reaches the end of the neighbourhood chains
        inside the cluster.
    •   Is a timer reaches the time limit X, the piece will check its number of occupied
        links. If there is only one, this one will be deleted and the piece will again float
        around freely. Otherwise the piece has another X seconds hoping for new
        connections. If none is acquired until the next time limit X, the piece will check if it
        has two (or less) occupied links. If this is the case, those will be deleted.
    •   Such a strategy assures that weakly connected pieces will not keep sticking to a
        cluster in a unfavourable position, blocking further growth.

Some of the basic ideas were implemented as shown on Figure 5, but their functionality
was limited due to the very modest programming skills of most group members.

Figure 5: RePast screen shot

For future assignments of this type, a software platform which already supports the basic
functionalities should be given. This would allow the team to focus on the strategic
questions at the core of the task.


To top