Global-to-Local Programming Emer by fjzhangweiqun


									  Global-to-Local Programming:
 Design and Analysis for Amorphous Computers

               Radhika Nagpal and Daniel Yamins
       School of Engineering and Applied Sciences (Computer Science)
                           Harvard University

                        SASO 2007 Tutorial
                   First IEEE International Conference on
                 Self-Adaptive and Self-Organizing Systems
                          July 8, 2007, Boston, USA

         Emerging Technologies                                              Multi-agent Systems in Nature





      MIT Media Lab


                          Motivation                                          Global-to-Local Challenge
• Emerging Engineered Systems
  –   Massive numbers of agents                                             • How do we program robust global
  –   Simple, cheap, interchangeable and expendable                           behavior from the cooperation of vast
  –   Embedded in space                                                       numbers of limited and unreliable agents?
  –   Local interactions, sensing, and actuation
  –   Fault-tolerance without external intervention
                                                                            • How do we program complex desired
                                                                              global goals from the local interactions
                                                                              amongst ensembles of comparatively
• Plethora of similar systems in nature                                       simple agents?
  – Can we learn “engineering principles” for self-
    organization by looking at these systems?

              Tutorial Outline
• Part 1: Global-to-Local Programming
  – Amorphous Computing Model
  – Two Spatial Amorphous Computing Languages
     • Demonstrate global-to-local compilation                                        Amorphous Computing
     • Inspired by principles from developmental biology
     • Encode self-repair and scale-invariance                                              Model
  – Applications

• Part 2: Global-to-Local Theory
  – Formal framework for addressing fundamental
     • When do global-to-local compilers exist?
     • What is the minimal complexity of local rules?

    An Amorphous Computer                                                                   A Simple Pattern:
                                            -- Irregularly placed
                                            (not a regular lattice)
                                                                                               Polka Dots
                                            -- No global clock,
                                            no unique IDs



                                    [Abelson, Knight, Sussman, 1996]

 Example: A Simple Pattern                                                       Example: A Simple Pattern


                                                                          [Wolpert, Principles of Development]

 Polka Dot Program          Polka Dot Program

                                         Global Properties
                                         •   Dot spacing
                                         •   Self-repair

                                         Agent Behaviors
                                         •   State (differentiation)
                                         •   Randomness
                                         •   Gradients and

   “Lateral Inhibition”   How would you make a
                            bull’s eye pattern?

How much more complex           Or These?
     are these?

                                                                        Suppose we want to create an
                                                                              arbitrary pattern

 Global-to-local Compilation
for Pattern/Shape Formation
       Two Examples from Amorphous Computing
       • Origami Shape Language
       • Directed Growth Language
         [for others, see Abelson et al CACM 2000]

Origami Shape Language (OSL)
                        Nagpal, 2001                                              An Inverter Program
             Global Shape Description
             using a language based on geometry axioms from                    e12 c2
                                                                          c1                                          v1
             paper-folding (origami)
                                                                         e41       e23   e41         e23   e41                  e23         IN MID OUT
                                                                                                                 v2        v3
                                                                          c4   e34 c3

             Agent Program
             (all agents have identical program)
             using biologically-inspired primitives

                                                                                                                                      At this level of
                                                                                                                                      description, there
                                                                                                                                      are no “agents”

 A Set of Construction Rules                                          A "Generative" Global Program
             (Huzita’s Axioms of Origami)
                                                                      OSL Program for Drawing a CMOS Inverter              c1     e12 c2
                                                                      (define v1 (crease-l2l e23 e41))                                                     v1
                         (A2) crease-p2p             intersect                                                             e41              e23 e41             e23
  (A1) crease-lbp                                                     (define v2 (crease-l2l v1 e23))
                           p1                                         (define v3 (crease-l2l v1 e41))                      c4     e34 c3
                p2                                          p         (define IN (create-region e41 v3))
                                                                      (define OUT (create-region e23 v1))                              v1
  p1                                    p2
                                                                      (define MID (create-region v1 (or v2 v3))            e41                   e23   IN MID OUT
                                                                      ;; Similarly create horizontal regions...                   v2        v3
  (A3) crease-l2l        (A4) crease-l2self           region
                                                                      ;; Lay down Material (differentiate)
        L1                                                            (within-region IN (color h1 "poly"))
                                                                      (within-region MID (color (or h2 h3) "poly"))
                                                                 p1   (within-region OUT (color h1 "poly"))
        L2                       L1
                                                                      (within-region CNTR (color v3 "poly"))

                                                                      (within-region UP (color v1 "n-diff"))
                                                                      (within-region DOWN (color v1 "p-diff"))
                                                                      (define contacts (intersect v1 (or e12 h1 e34))
                                                                      (color contacts "contacts")

    Compilation from Global                                            Initial Conditions:
  Description to Local Program                                          “Determinants”

                                                             c1                  e12           c2
 • Points and lines are groups of agents
                                                                                                           Point of agents

 • Each global construction rule maps to a                                                                                         Agent Local State
     local agent behavior that uses a composition                                                                                  c2 = #t
     of primitives (e.g. state, gradients, etc)       e41                                            e23                           c3 = #f

 Agent program is a sequence of local rules +                                                                Line of agents
  local state
                                                              c4                 e34           c3

          Morphogen Gradients                                      Implementing the Rules

                                                      “Balancing Gradients”                                                             L1
 Agent Rule              2
 Implemented using           3
                                 4                            p1
   local messages    1                                                                                                                             L2
   between agents

 source                                                “Chemotropism”
                                         impassable                                      p2

                                         gradient                            p2
                                         source p1


          Individual Element
                                                                      An Inverter Program
(define (axiom2-rule i1 i2 g1 g2 gend)
   (if i1 (create-gradient g1))                             c1     e12 c2                                          v1
   (if i2 (begin (wait-for-gradient g1)                                                   v1
                                                         e41                       e41         e23     e41                   e23      IN MID OUT
                 (create-gradient g2)))                                e23
                                                                                                              v2        v3
   (if i1 (begin (wait-for-gradient g1)
                                                         c4        e34 c3
                 (wait local-delay)
                 (create-gradient gend)))

    (wait-for-gradients gend)

    (if (<= (abs (- g1 g2)) threshold)

(define d1 (axiom2-rule c1 c3 gc1 gc2 gend))

Pattern-Formation on an                                                OSL Cup Program
 Amorphous Computer                                OSL Cup Program
                                                                                                                          c2           c1

                                                   (define d1 (crease-p2p c3 c1))                        e41             e23
                                                   (define front(create-region c3 d1))                                                             d1
                                                   (define back (create-region c1 d1))                                                          front
                                                   (execute-fold d1 apical landmark=c3)                 c4                 c3                                c3
                                                   (define d2 (crease-l2l e23 d1))
                                                   (define p1 (intersect d2 e34))                                                        d2
                                                   (define d3 (crease-p2p c2 p1))                                       p1
                                                   (execute-fold d3 apical landmark=c2)                                                d1

                                                   (define p2 (intersect d3 e23))                                            p2
                                                   (define d4 (crease-p2p c4 p2))                                                             l1
                                                   (execute-fold d4 apical mark=c4)
                                                                                                        c2                             p1
                                                   (define l1 (crease-lbp p1 p2))                                   d4
                                                   (within-region front                                      c4
                                                    (execute-fold l1 apical landmark=c3))
                                                   (within-region back                                                    c1
                                                    (execute-fold l1 basal landmark=c1))                                          c3

                                                         Example: Cup Formation

Many Shapes and Patterns                                       Analyzable Properties
                                                     •   Resource consumption
                                                         –   Local state: Boolean per distinct crease, point, region
                                                         –   Gradients: Many, but short-lived (~Storage for 6 Gradients)

                                                     •   Agent code conservation

                                                                    Primitives            Local      Shape
                                                                    (gradients,           Rules      (local state+ sequence)
                                                                    neighborhood query)   (axioms,
• Abstract Global Description
   – Local agent behavior automatically compiled     •   Robustness
• Significant descriptive power                          –   Geometric patterns in the face of irregular grids, limited and
   – Any 2D Euclidean rule pattern (Huzita),                 variable numbers of agents, asynchronous timing, random agent
     tree-based shapes (Lang)                                death, etc

            Scale-invariance                                                                                              Scale-invariance
       and Variations in Morphology

                                                                                                                                               pattern scales with number of cells

                                                                                                                                                  2000          4000          8000

 [Lawrence, “The Making of a Fly”] [Ridley, “Evolution”]   [Wolpert, “Principles of Development”]]

                                                                                                                         Related Shapes
                     Scale-invariance                                                                                and Asymmetric Scaling
  Same agent program

                                                                                                     [D'Arcy W.Thompson, On Growth and Form]

                       Repeating Patterns                                                                         Another Arbitrary Shape

;; Segment into

;; Execute
;; inverter pattern program
;; within a region

(within-region r1

 Directed Growth Language                                           Directed Growth Language
                     Kondacs, 2003                                                     Kondacs, 2003

                                                                              Global Shape Description
                                                                              Network of overlapping “circles”


                                                                               Agent Program
                                                                               Single agent that “grows” the shape

                  Agent can reproduce and/or die

    Constructing a 2D shape                                           Constructing a 2D shape

                                         N                                                                       N

                                                              Global Description
                                                              •   Construct using overlapping circles
                                                                  with different radii
                                                              •   Each parent circle locates children in
                                                                  its internal coordinate system
                                                              •   Network represents “growth order”

Global-to-Local Compilation                                                 Self-Assembly
                                                                        using directed growth

Global to local mapping
• Grow circle of given radii;
   Circle color represents agents’ state in circle
• Agents compete to become reference points and new
  circle centers; Reference points emit “active gradients”
• Shape = Set of rules (proportional to # distinct circles)
                                                                                                                     Kondacs, Chang, 2003

Self-Repair and Regeneration                                                   Global-to-Local Programming
                             Regenerating structures
“Rule of Normal Neighbors”                                                    • Amorphous Computing Research
                                              Absence of neighbor causes        – Growing Point Language (Coore, 1999)         domain
                                              circle to recreate its
                                              neighbor, which in turn           – Origami Shape Language (Nagpal, 2001)        Increasingly
                                                                                                                               abstract global
                                              recreates its neighbor - thus
                                              regenerating the broken
                                                                                – Directed Growth (Kondacs, 2002)              descriptions

                                                                                – Paintable Computing Language (Butera, 2002)
                             Self-repairing patterns                            – Proto Language (Bachrach and Beal, 2006) More general
                                                                                                                               languages for
                                                If a line is broken, one
                                                part dies off and the
                                                other regrows

  Global-to-Local Programming
• Amorphous Computing Research
   –   Growing Point Language (Coore, 1999)
   –   Origami Shape Language (Nagpal, 2001)
   –   Directed Growth (Kondacs, 2002)
   –   Paintable Computing Language (Butera, 2002)
   –   Proto language (Bachrach and Beal, 2006)

• Other Global-to-local examples
   – Graph Grammars for self-assembly (Klavins, et al)
   – DNA self-assembly (Winfree et al)
   – Macroprogramming for Sensor Networks (e.g.
     Madden et al, Newton and Welsh)

    Global-to-Local Challenge                            Amorphous Computing Approach
                                                                High-level Programming Languages
                                                                     in terms of Goals / Tasks
  • How do we program robust global                                                                 Biologically-inspired
    behavior from the cooperation of vast                                                               primitives for
    numbers of limited and unreliable agents?                            Global-to-Local             Robust Collective
  • How do we program complex desired
    global goals from the local interactions
    amongst ensembles of comparatively
    simple agents?                                                  Program for Myriads of Agents

                Contributions                            Biologically-Inspired Primitives
Amorphous Computing Research:
                                                           1.   Morphogen Gradients
1. Provided a small but powerful catalog of                2.   Neighborhood query
   robust, analyzable, bio-inspired local                  3.   Local Inhibition
   behaviors (“primitives”)                                4.   Local Monitoring
                                                           5.   Agent Differentiation
2. Demonstrated high-level languages and                   6.   Agent-to-agent Contact
   global-to-local compilation, by                         7.   ..
   composing primitives
                                                           Useful local behaviors in many contexts,
                                                              robust, simple and analyzable

   Global-to-Local Compilation                                             Conclusion
 • High level languages solve complex global             Amorphous Computing showed that one can design
   tasks by using principled ways to compose               domain-specific high-level languages that compile
   simpler primitives                                      abstract global descriptions into robust local rules for
                                                           identically-programmed agents.
    – Easily express large (possibly infinite) classes
      of complex global goals                            • Open Questions:
    – Robustness through bio-inspired primitives
                                                            – When do such global-to-local compilers exist?
    – Analysis becomes tractable and reusable
                                                            – How complex must an agent be? (in state, local
    – Encode complex notions, such as scale-                  radius, time) in order to solve a given problem
      invariance and regeneration, into the language

                                                          Applications of Gradients
                                                  • Pervasive Computing
                                                        – Gradient-based languages for localization and
                      Some                                coordination (e.g. Mamei and Zambonelli)

                    Applications                  • Sensor Networks and Robot Swarms
                                                        – Gradient-based localization, tracking and
                                                          movement coordination (e.g. Proto, McLurkin)

                                                  • Synthetic Biology
                                                        – Genetically engineer pattern formation and
                                                          control in bacteria (e.g. Weiss et al)

                  Proto Language                   Applications of Self-Assembly
                    (Bachrach and Beal, 2006)

Programming Spatial Computers
                                                 • Many problems in robotics are related to
•   Global abstraction is                          pattern and shape formation
    continuous space and time
•   Compiler takes care of discretization
    into local agent behaviors                   • Examples
•   General-purpose functional                         – Self-reconfiguration and self-assembly in
    language, with primitives like active                modular robots (e.g. Stoy et al)
    gradients and streams
                                                       – Collective construction by simple robots
                                                         (e.g. Werfel et al)
                                                       – Formation control in robot swarms
                                                         (e.g. Cheng et al, Belta et al)

                                                       Decentralized control exploits parallelism, robustness,
                                                         simple agents. Global-to-local compilers allow flexible
                                                         user-specified goals

       Self-Assembly in Robotics                             Collective Construction
                 using “Directed Growth”
                                                Werfel et al, 2006
Self-Reconfigurable Robots
•   (Stoy and Nagpal, 2004)                     Hardware demonstrations of
                                                simple robot behaviors for 2D
•   Structure “grows” by recruiting             collective construction
    wandering modules using a
    recruitment gradient                        Use RFID-based “stigmergy”
Collective Construction                         for indirect interaction between
                                                robots through the structure
•   (Werfel, 2006)
•   Structure “grows” by robots
    bringing materials

Global-to-local approach
•   Both allow user-specified global
    shapes & rely on decentralized,
    simple, and robust agent behaviors           [Justin Werfel, Matt Valente, Crystal Schuil]


To top