420 likes | 585 Views
Large-scale adaptive systems. Lecture 6: Programming and modeling of large scale networks. Dr. Stefan Dulman s.o.dulman@tudelft.nl. Review previous lecture. Introduction: design methodologies Alternatives to traditional design Example #1 Amorphous computing – global-2-local compiler
E N D
Large-scale adaptive systems Lecture 6: Programming and modeling of large scale networks Dr. Stefan Dulman s.o.dulman@tudelft.nl
Review previous lecture • Introduction: design methodologies • Alternatives to traditional design • Example #1 • Amorphous computing – global-2-local compiler • Example #2 • ASH Clustering scheme
Related work • This lecture is based on: • Michael De Rosa, et al.: Programming Modular Robots with Locally Distributed Predicates, in Proc. ICRA 2008http://www.cs.cmu.edu/~claytronics/papers/derosa-icra08.pdf • Adaptive Systems by prof. Giovanna diMartzoSerugendohttp://www.dcs.bbk.ac.uk/~dimarzo/courses/as.html
Lecture overview • Programming for distributed systems • Example: LDP • Modeling – introduction and examples • Project overview • Summary
Programming in distributed env. • Issues: • Large scale network • Number of devices not known • Churn is basic characteristic • Code spreads virally • Code in various execution levels across network • Global state unknown • Basic assumptions: • HW/SW failures, heterogeneity, dynamics of all sorts • Central controlling entity missing • Devices may contain actuators, changing the environment • Question: how to program such a network?
Goals can be counter-intuitive! Lecture on Pario by Todd Mowry(http://www.youtube.com/watch?v=4Ixc-DaAm1k)
State of the art • Various solutions • Amorphous computing: global-to-local compiler • WSN field: macro programming • Swarm robotics • Logical declarative languages (P2, Meld) • Reactive programming techniques (subsumption architecture) • Functional approaches (Regiment, Proto) • We focus on Locally distributed predicates (LDP) Michael De Rosa: Programming Modular Robots with Locally Distributed Predicates (ICRA 2008)
LDP • LDP operates on finite size neighborhoods • Searching in the local vicinity is cheaper • Reality (swarm robotics) is built like that • Natural for large scale modular robots (local decisions) • Syntax: data declaration and statements • Statements: predicate clause and action clauses • No explicit control structures • Architecture • Each robot has a collection of threads (one for each statement) • PatternMatchers created on clock ticks, sensor events… • Objects migrating though the network
LDP • Triggering actions • Setting a state variable • Changing topology of the system • Calling an arbitrary function on the robot
More examples (Meld) M. Ashley-Rollman - Meld: A declarative approach to programming ensembles, IROS 2007
Lecture overview • Programming for distributed systems • Example: LDP • Modeling – introduction and examples • Project overview • Summary
Modeling • Steps to take • Descriptive of the collective process • Identification of the lower-level units and interactions • Formulation of a model hypothesis • Generation of predictions of the model • Comparison of the predictions of the model with the collective process
Experimental investigation • Modeling of a complex system has an increased difficulty level • Modeling should not be targeted at obtaining the global pattern • Modeling must target the components and their interaction • Dangers: • It is tempting to tweak the model parameters to obtain a pattern • Ad-hoc interpretation of the specific value of the parameter
Models • Description of the system • Simplified description • Assumptions • Examples • Static models • City maps • Architectural diagrams • Scale models • Dynamic models • Weather models • Games rules descriptions • Ant/termites behavior models
Example: • Ant nest + one food source – simplified problem • 100 ants • Ant spends an average 1/rN minutes in the nest before foraging • Ant usually finds food within 1/rD minutes after leaving nest • If unsuccessful it spends roughly 1/rS minutes before returning • If successful it spends roughly 1/rF minutes to load and return • No learning is assumed (parameters stay constant) • Q: how many ants end up (in average) in each state?
Modeling with differential equations N, F, S – number of ants in nest, feeder, search rN, rF, rS, rD – rates of ants in various stages
Modeling with differential equations • Model predicts an equilibrium state • Characteristics: • Non-integer results (12.2 ants in search state) • Continuous time model • Easy to test various initial conditions
Monte Carlo simulations • Differential-equation models work well for large populations • Continuous model becomes a good approximation • Simulation models use often a discrete approach • Example: • Keep track of each ant • Probabilistically decide what they do • Aggregate results
Cellular automata models • Regular grid of cells (multidimensional) • Each cell has a finite number of states • Evolves with time • State of a cell at time t: • Function of the states of a finite number of neighbors at time t-1 • Neighbor cells are fixed • Same rule is applied by every cell in order to change its state
Example • Conway’s game of life • 2D cellular automata • Each cell can be “dead” or “alive” • Rules: • Live cell with less than two neighbors dies of loneliness • Live cell with more than three neighbors dies of crowding • Dead cell with three neighbors comes to life • Live cell with two or three neighbors lives Video cellular automata
Cellular automata • What can be simulated? • Large number of physics processes • Gas and fluid dynamics • Optics phenomena • Tearing and ripping of solids • Increasing number of applications relevant to us • Radio propagation in city environments • Routing and scheduling strategies in MANETs and WSNs • What’s next: particle systems, physics engines, …?
Computer-based models • Executable program • Clearly described program • Advantages • Can be stopped, restarted under new conditions • Monitoring of data: analysis of data off-line • Disadvantages • Calculations limited by computer power • Approximations provided by numerical analysis • Due to common practice of bad modeling it lost credibility in various fields of computer science
Computer-based models • What is described in the program? • Building blocks: elements/agents • Behavioral rules • Interactions rules • Important when whole system behavior is not the sum of the behavioral rules • What is the model? • Set of all possible states • Set of all possible transitions from one state to another • Defined by behavioral and interaction rules
Examples • Swarms • Algorithms • transition rules with probabilities and random variations • No specific learning • Cellular automata (to some extent) • Agent-based models • Programs with learning capabilities • Neural networks • Game bots • Building blocks = strategies • Experience used for modifying and improving strategies • Game theory + reinforcement learning
Agent-based models • Object/elements = social agents • Interacting rules between agents • Agents are: • Intelligent and purpose-full • Situated in space and time • Behavior of agents encoded in an algorithm • Programs • NetLogo, StarLogo, Swarm, Repast, Mason, etc. • Ns2, Omnet++, Opnet, etc.
Machine learning • Several approaches – AI domain • Examples: • Unsupervised learning • Find patterns in an input stream • Supervised learning • Classification or numerical regression • Reinforcement learning • Adapt actions to continuously maximize the gain • Expert systems • Set of rules in the form “if … else …”
Lecture overview • Programming for distributed systems • Example: LDP • Modeling – introduction and examples • Project overview • Summary
Project overview • Assignment • Create a static overlay of software agents on top of a mobile mesh-alike network (use Netlogo for simulations) • Deliver zip file containing: • .netlogo file • Written report – pdf format (Approx.1500 words) • Section 1: Explanation of basic mechanism • Section 2: Mechanism implementation details • Section 3: Analysis of the cost/overhead • Section 4: Analysis of the robustness • Individual work - hand in by CPM by Jan. 23rd • Later submissions strictly NOT ACCEPTED
Project overview • Constraints on algorithmic design • Centralized solutions not accepted • One device collects all data and delivers order to all others • Local broadcasting only • Time-to-live of messages maximum twice the size of the cell • Messages must have limited size O(size_local_neighborhood) • Algorithm should be robust/adaptive • Failure of nodes should trigger reconfiguration
Project overview • Design considerations • Initialization phase needs to be built in • Where does it start? How many nodes start it? • What if half of the network suddenly disappears? • What if the network nodes get shuffled because of mobility? • Possible answers • User initializes one/more nodes, at random explicitly • Each node decides with a certain small probability to start • A “growing” process around one seed is triggered • Be creative!
Project overview • Design considerations • Adaptation/robustness • Dynamics will push the system into unstable states • What brings it back into stable regime? • Possible answers • Lattice points check their lattice neighbors • Each node checks its neighborhood for the list oflattice points • Could a “virtual” coordinate system be used on top? • Maybe lattice points have a lifetime associated and die anyhow -> reconfiguration is periodically triggered • Be creative!
Project overview • Netlogo project • You may reuse code you have used in the lab • Lattice shape not specified • You may choose one: triangular, orthogonal, hexagonal or else? • Netlogo has additional commands that give neighborhood • It’s not necessary to construct the graph as you did in the lab! • Any simplifying assumption costs you points • A static node in the middle of the design? Etc. • Controls need to be added for • Initialization and running of the network • Changing basic parameters: number of nodes, speed, transmission range, lattice dimensions • Emulating failures • E.g. a button that disables a number of nodes, etc.
Lecture overview • Programming for distributed systems • Example: LDP • Modeling – introduction and examples • Project overview • Summary
Thank you for following the course! Good luck in your future careers! Good luck in your future careers!