academic course: 08 pattern-based design of autonomic systems
DESCRIPTION
By Giacomo Cabri, Giovanna Di Marzo Serugendo and Jose Luis Fernandez-MarquezTRANSCRIPT
Pattern-based design of autonomic systems
Giacomo Cabri - [email protected]
Giovanna Di Marzo Serugendo–[email protected]
Jose Luis Fernandez-Marquez –[email protected]
Outline
• Design patterns
– Reuse
– Composition
• Bio-inspired patterns for autonomic computing
• A classification of patterns for autonomic computing
• References
GiacomoCabri
Design patterns
• While designing systems, some problems are frequent
• Having solutions that can be reused allows to save time and to rely on tested experiences
• A design pattern is acommon solution to different yet very similar problems
GiacomoCabri
Design for the reuse
• The design patterns describe generic solutions that can be applied to specific recurrentproblems
• Do not reinvent the wheel!
• Usually, patterns are collected in a catalogue
GiacomoCabri
Pattern description
• For each pattern, the following pieces of information are usually reported:– Name
– Aliases
– Problem
– Solution
– Applicability
– Implementation
– … other useful information
GiacomoCabri
Composition of patterns
• Patterns can be composed, in order to solve different problems (sometimes at different levels)
• The catalogue can provide some suggestions
GiacomoCabri
From components to ensembles
• Single components can be autonomous
– Or at least exhibit a certain degree of autonomy
• When they are put together in ensembles, there are different architectural choices to make the ensembles autonomic
GiacomoCabri
Patterns for autonomic systems
• Also in autonomic systems there are some frequent problems that are likely to be already faced and solved
GiacomoCabri
BIO-INSPIRED PATTERNS
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Computational Model
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Computational Model
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Computational Model
• Software agents– Active autonomous entities (services, information, etc.)
• Host– Computing device hosting agent execution
• E.g. sensors, PDAs, computers, …
• Environmental agents– Autonomous entity working on behalf of infrastructure
• E.g. evaporating pheromone, updating gradients
• Environment– Anything else on which agents have no control
• E.g. user switching device off, temperature, humidity, etc.
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Bio-inspired Design Patterns
• Bio-inspired design patterns’ Catalogue
– Self-organising mechanisms recurrent and frequently involved in more complex mechanisms
– Identification of:• Inter-relations between mechanisms
• Boundaries of each mechanism
– Classification into three levels
[FMDMSM+12]
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Self-Organising Design Patterns
• Description– Abstract Transition Rule
– Sequence Diagram, Implementation details, Explanations
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Self-Organising Design Patterns
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Spreading
http://ergodd.zoo.ox.ac.uk/eurasia/Eurasian%20Street%20Web/Studies/animations/Sim_30_608_393_smoothed.gif
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Spreading
• Problem– in systems, where agents perform only local interactions, agents’ reasoning suffers
from the lack of knowledge about the global system.
• Solution– a copy of the information (received or held by an agent) is sent to neighbours and
propagated over the network from one node to another. Information spreads progressively over the system and reduces the lack of knowledge of the agents while keeping the constraint of the local interaction.
• Entities – Dynamics – Environment
• Usage– Information dissemination
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Spreading
• Implementation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Aggregation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
• Problem– Excess of information produces overloads. Information must be distributively
processed in order to reduce the amount of information and to obtain meaningful information.
• Solution– Aggregation consists in locally applying a fusion operator to synthesise macro
information (filtering, merging, aggregating, or transforming)
• Entities – Dynamics – Environment
• Usage– Aggregation of pheromones, fusion of information, context-awareness
Aggregation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Aggregation
• Implementation
Host
InfrastucturalAgent or
Agentdata_req()
send_data()
Apply Aggregation
send_data_aggr()
StoreAggregated
Data
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Evaporation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Evaporation
• Problem– Outdated information cannot be detected and it needs to be removed, or its detection
involves a cost that needs to be avoided. Agent decisions rely on the freshness of the
information presented in the system, enabling correct responses to dynamic environments.
• Solution– Evaporation is a mechanism that periodically reduces the relevance of information. Thus,
recent information becomes more relevant than older information.
• Entities – Dynamics – Environment
• Usage– Digital pheromone, context-awareness (ageing information)
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Evaporation
• Implementation
Rel(Inf) > 0 ?
Start
Apply Evap.Stop
YesNo
rev?
yesNo
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Repulsion
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
• Problem– Agents’ movements have to be coordinated in a decentralised manner in order to achieve a
uniform distribution and to avoid collisions among them
• Solution– The Repulsion Pattern creates
a repulsion vector that guides agents to move from regions with high concentrations of agents to regions with lower concentrations. Thus, after few iterations agents reach a more uniform distribution in the environment
• Entities – Dynamics – Environment
• Usage– Shape formation
Repulsion
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Repulsion
• Implementation
Start
Calculate
Repulsion()
Received
Positions?
yesNo
SendPositionReque
stToNeighbours()
CalculateDesired
Position()
MoveToHostClosest
ToNewPosition()
HostAgent NeighbouringHosts
SendPositionRequest()
SendPositionRequest()
SendPosition()SendPosition()
CalculateRepulsionVector()
CalculateDesiredPosition()
MoveToHostClosestToNewPosition() MoveToHostClosest
ToNewPosition()
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Self-Organising Design Patterns
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Gossip
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Gossip
• Problem– in large-scale systems, agents need to reach an agreement, shared among all agents,
with only local perception and in a decentralised way
• Solution– information spreads to neighbours, where it is aggregated with local information.
Aggregates are spread further and their value progressively reaches the agreement
• Entities – Dynamics – Environment
• Usage– Computation of sums, averages
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Gossip
• Implementation
Start
Broadcast aggregated Information
Stop
input events?
yes
no
Same value broadcasted
before?
yes
no
Apply aggregation
operator
apply aggr. operator
HostAgent or
Infras. AgentNeighbour
Hosts
send(inf)send(inf)
send(aggr)
send(aggr)
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Gradient
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
• Problem– agents belonging to large systems suffer from lack of global knowledge to estimate the consequences of
their actions or the actions performed by other agents beyond their communication range
• Solution– information spreads from the location it is initially deposited and aggregates when it meets other
information. During spreading, additional information about the sender’s distance and direction is provided: either through a distance value (incremented or decremented); or by modifying the information to represent its concentration (lower concentration when information is further away).
• Entities – Dynamics – Environment
• Usage– Routing in ad-hoc networks
Gradient
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Gradient
• ImplementationStart
Broadcastinf. incrementing
counter
Stop
input events?
yes
No
Distance is lower than local one?
no
yes
Aggregated inf. (The one with lower distance stays stored)
HostAgent
check inf andAggregate.
NeighbourHosts
send(inf,0)
send(inf,0)
HostAgent or
Infras. AgentNeighbour
Hosts
send(inf,d)send(inf,d)
send(inf, d+1)
send(inf, d+1)
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Digital Pheromone
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Digital Pheromone
• Problem– coordination of agents in large scale environments using indirect communication
• Solution– digital pheromone provides a way to coordinate agent’s behaviour using indirect
communication in high dynamic environments. Digital pheromones create gradients that spread over the environment, carrying information about their distance and direction. Thus, agents can perceive pheromones from the distance and increase the knowledge about the system. Moreover, as time goes by digital pheromones evaporate, providing adaptation to environmental changes
• Usage– Autonomous coordination of swarms (UAV)
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Digital Pheromone
• Entities – Dynamics – Environment
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Self-Organising Design Patterns
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Ant Foraging
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Ant Foraging
• Problem– large scale optimisation problems that can be transformed into the
problem of finding the shortest path on a weighted graph.
• Solution– the Ant Foraging Pattern provides rules to explore the environment
in a decentralised manner and to exploit resources
• Entities – Dynamics – Environment
• Usage– Ant Colony Optimisation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Ant Foraging
• Implementation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Morphogenesis
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Morphogenesis
• Problem– in large-scale decentralised systems, agents decide on their roles or plan their
activities based on their spatial position
• Solution– specific agents spread morphogenetic gradients. Agents assess their positions in
the system by computing their relative distance to the morphogenetic gradients sources
• Entities – Dynamics – Environment
• Usage– Meta-morphic robots, shape formation
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Morphogenesis
• Implementation
Start
No
Gradients Received?
yes
Estimate relative position based on received gradients
Change role according to the relative position
HostAgentNeighbour
Hosts
GradInf()
GradInf()
Estimate relative position
ChangeAgent's role
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Chemotaxis
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Chemotaxis
• Problem– decentralised motion coordination aiming at detecting sources or boundaries of
events
• Solution– agents locally sense gradient information and follow the gradient in a specified
direction (i.e. follow higher gradient values, lower gradient values, or equipotential lines of gradients).
• Entities – Dynamics – Environment
• Usage– Routing messages
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Chemotaxis
• Implementation
Start
yes
No Inf. Received?
yes
Move to host with highest gradient
Send concetration
request to n
neighbouring hosts
HostAgentNeighbour
Hosts
GradRequest()
GradRequest()
Send_grad()
Send_grad()
Choose hostwith highest
concentration
MoveToHost(h)MoveToHost(h)
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Quorum Sensing
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
• Problem– collective decisions in large-scale decentralised systems, requiring a threshold number
of agents or estimation of the density of agents in a system, using only local interactions.
• Solution– the Quorum Sensing Pattern allows to take collective decisions through an estimation
by individual agents of the agents’ density (assessing the number of other agents they interact with) and by determination of a threshold number of agents necessary to take the decision
• Entities – Dynamics – Environment– Gradient, Morphogenesis
• Usage– Power saving in wireless sensor networks, swarms decisions
Quorum Sensing
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Quorum Sensing
• Implementation
Start
No
Gradients
Receved?
yes
Trigger collaborative
task
Gradient's
concentration higher
than threshold?
No
yes
HostAgentNeighbour
Hosts
GradInf()
GradInf()
if Grad > threstrigger task
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Flocking
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
Flocking
• Problem– Dynamic motion coordination and pattern formation of swarms
• Solution– The Flocking Pattern provides a set of rules for moving groups of agents over the
environment while keeping the formation and interconnections between them
• Entities – Dynamics – Environment– Cohesion (group)
– Separation
– Alignment (velocity, direction)
– Group objective (target)
• Usage– Movies, advertisement, games, modelling crowds
G.DiMarzoSerugendo – J.L. Fernandez-Marquez
CLASSIFICATION OF PATTERNS
GiacomoCabri
Why a classification?
• Classification of the existing patterns
• Suggestions to developers
GiacomoCabri
The considered components
• Service component (SC)
– It is the basic component of ensembles
– It provides some services
– It can be reactive or goal-driven
• Autonomic manager (AM)
– It is the component that adds autonomicity to the ensemble
– It is goal-driven
GiacomoCabri
The considered components
Service Component
AutonomicManager
GiacomoCabri
Classification mechanisms
• Two orthogonal directions
– Component level
– Ensemble level
• Component level
– Relates to the addition of autonomic manager(s) to a component
• Ensemble level
– Relates to the aggregation of more service components in an ensemble
GiacomoCabri
Component level
• One or more AM can be added
• When more AMs are present, there can be two relations:
– P2P, in which AMs work in parallel on different aspects
– Hierarchical, in which one AM manages another AM
GiacomoCabri
Ensemble level
• An ensemble can be made of different SCs
• They can
– Interact directly
– Interact by means of the environemnt
– Interact by means of the AM
GiacomoCabri
Component and ensemble levels
• Putting together the two directions, we can have a “table”, where each cell represents a step related to components along with a step related to ensembles
GiacomoCabri
The complete taxonomy
SC
ENVIRONMENT
SC SC
SC
AM
SC
SC
SC
AM
AM
SC
AM
SC
AM
SC
ENVIRONMENT
AM
SC
AM
SC
AM
SC
AM
AM
SC
AM
AM
SC
AM
AM
SC
AM
AM
SC
AM
ENVIRONMENT
AM
SC
AM
AM
SC
AM
SC
AM
SC
ENVIRONMENT
AM
AM
AM
AM
SC
AM
SC
AM
SC
AM
AM
AM
AM
SC
AM
SC
AM
SC
AM
AM
AM
SC
AM
SC
AM
SC
AM
AM
AM
AM
Reactive
ENVIRONMENT
Proactive
ENVIRONMENT
ENVIRONMENTENVIRONMENT ENVIRONMENT
ENVIRONMENTENVIRONMENT ENVIRONMENT
AM
SC
AM
SC
AM
SC
ENVIRONMENT ENVIRONMENT
Pro
active
Pro
active
Pro
active
ENVIRONMENT
GiacomoCabri
Examples of classified patterns
• Reactive Stigmergy Service Components Ensemble
• Cognitive Stigmergy Service Components Ensemble
GiacomoCabri
Reactive Stigmergy Service Components Ensemble
• Pattern Name: Reactive Stigmergy Service Components Ensemble.• Classification: Pattern for Service Components Ensemble.• Intent: There are a large amount of components that are not able
to directly interact one to each other. The components simply react to the environment and sense the environment changes.
• Context: This patterns has to be adopted when:– there are a large amount of components acting together;– the components need to be simple component, without having a lot of
knowledge;– the environment is frequently changing;– the components are not able to directly communicate one with the
other.
GiacomoCabri
Reactive Stigmergy Service Components Ensemble (2)
• Behaviour: This pattern has not a direct feedback loop. Each single component acts like a bioinspired component (e.g. an ant). To satisfy its simple goal, the SC acts in the environment that senses with its “sensors” and reacts to the changes in it with its “effectors”. The different components are not able to communicate one with the other, but are able to propagate information (their actions) in the environment. Than they are able to sense the environment changes (other components reactions) and adapt their behaviour due to these changes.
GiacomoCabri
Reactive Stigmergy Service Components Ensemble (3)
Service Component
SENSOR
EFFECTOR
INPUT (service request)
OUTPUT(serviceresponse)
ENVIRONMENT
Service Component
SENSOR
EFFECTOR
INPUT (service request)
OUTPUT(serviceresponse)
Service Component
SENSOR
EFFECTOR
INPUT (service request)
OUTPUT(serviceresponse)
GiacomoCabri
Cognitive Stigmergy Service Components Ensemble
• Pattern Name: Cognitive Stigmergy Service Components Ensemble.• Classification: Pattern for Service Components Ensemble.• Intent: In this pattern each component needs an external feedback
loop because it is not able to fully adapt alone. The component (and its AM) is not able to direct communicate with the others components. It reacts to the environment changes and uses its AM to choose how to act.
• Context: This patterns has to be adopted when:– there are a large amount of components acting together;– the components are simple and necessitate an external AM to manage
adaptation;– the components and the AMs are not be able to directly communicate one
to the other;– the environment is frequently changing.
GiacomoCabri
Cognitive Stigmergy Service Components Ensemble (2)
• Behaviour: Each single components acts like an autonomic component: the SC has an explicit feedback loop managed by an external AM. The different components and the AMs are not able to directly communicate one with the other, but are able to propagate information in the environment via “effectors”. Than, using “sensors”, they are able to sense the environment changes (other components reactions) and adapt their behaviour due to these changes.
GiacomoCabri
Cognitive Stigmergy Service Components Ensemble (3)
AutonomicManager
ServiceComponent
EMITTERCONTROL
SENSOREFFECTOR
EFFECTOR SENSOR
AutonomicManager
ServiceComponent
EMITTERCONTROL
SENSOREFFECTOR
EFFECTOR SENSOR
AutonomicManager
ServiceComponent
EMITTERCONTROL
SENSOREFFECTOR
EFFECTOR SENSOR
ENVIRONMENTGiacomoCabri
Classifying patterns
• The pattern «Ant foraging» can be classified as Reactive Stigmergy Service Components Ensemble
• If an AM is added to the Ant foraging, this can be classified as Cognitive Stigmergy Service Components Ensemble
GiacomoCabri
Going further
• Multi-level architecture
– Autonomic managers
– Service components
– Environemt AM layer
SC layer
ENVIRONMENT
GiacomoCabri
References
• E. Gamma, R. Helm, R. Johnson, J. Vlissides, “Design Patterns”, Pearson • Fernandez-Marquez, Jose Luis and Di MarzoSerugendo, Giovanna and
Montagna, Sara and Viroli, Mirko and Arcos, JosepLluis, “Description and composition of bio-inspired design patterns: a complete overview”, Natural Computing, 2012, Springer Verlag
• G. Cabri, M. Puviani, F. Zambonelli , “Towards a Taxonomy of Adaptive Agent-based Collaboration Patterns for Autonomic Service Ensembles”, The 2011 International Workshop on Adaptive Collaboration at the International Conference on Collaboration Technologies and Systems (AC/CTS 2011), Philadelphia, Pennsylvania, USA, May 2011
• M. Puviani, G. Cabri, L. Leonardi , “Adaptive Patterns for Intelligent Distributed Systems: a Swarm robotics Case Study”, The 6th International Symposium on Intelligent Distributed Computing - IDC 2012, Calabria, Italy, September 2012, Springer Verlag
GiacomoCabri