54
Compositional Blocks for Optimal Self-Healing Gradients Giorgio Audrito 1 Roberto Casadei 2 Ferruccio Damiani 1 Mirko Viroli 2 1 Computer Science Department and C3S University of Torino 2 Department of Computer Science and Engineering (DISI) Alma Mater Studiorum – Università of Bologna 11th IEEE International Conference on Self-Adaptive and Self-Organizing Systems, University of Arizona, Tucson, AZ · 18-22 September 2017 Slides @ http://www.slideshare.net/RobertoCasadei/presentations R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 1 / 38

Compositional Blocks for Optimal Self-Healing Gradients

Embed Size (px)

Citation preview

Page 1: Compositional Blocks for Optimal Self-Healing Gradients

Compositional Blocks for Optimal Self-Healing Gradients

Giorgio Audrito1 Roberto Casadei2 Ferruccio Damiani1 Mirko Viroli2

1Computer Science Department and C3SUniversity of Torino

2Department of Computer Science and Engineering (DISI)Alma Mater Studiorum – Università of Bologna

11th IEEE International Conference on Self-Adaptive and Self-OrganizingSystems, University of Arizona, Tucson, AZ · 18-22 September 2017

Slides @ http://www.slideshare.net/RobertoCasadei/presentations

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 1 / 38

Page 2: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 2 / 38

Page 3: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 3 / 38

Page 4: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

General problem: effective engineering SASO systems

Abstraction gap

⇒ layers of (predictably) composable SASO patterns

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 4 / 38

Page 5: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

General problem: effective engineering SASO systems

Abstraction gap

⇒ layers of (predictably) composable SASO patterns

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 4 / 38

Page 6: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

General problem: effective engineering SASO systems

Abstraction gap ⇒ layers of (predictably) composable SASO patterns

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 4 / 38

Page 7: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 5 / 38

Page 8: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

A key pattern: Gradient » what

Gradient: computation of the shortest paths from all nodes to a set of source nodes

• a fully distributed and adaptive process

3.3

1.5

0

3.1

6.5

2.9

5

0

2.7

1.9

3.3

0.8

1.5

2.5

2.74.1

3.5

0.2

3.6

2.1

2.9

Self-healing gradient: a gradient able to react to changes by correcting its values

• Iterative execution to promptly react to any change in the environment

• Two kinds of approaches: incremental-repair / invalidate-and-rebuild

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 6 / 38

Page 9: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

A key pattern: Gradient » what

Gradient: computation of the shortest paths from all nodes to a set of source nodes

• a fully distributed and adaptive process

3.3

1.5

0

3.1

6.5

2.9

5

0

2.7

1.9

3.3

0.8

1.5

2.5

2.74.1

3.5

0.2

3.6

2.1

2.9

Self-healing gradient: a gradient able to react to changes by correcting its values

• Iterative execution to promptly react to any change in the environment

• Two kinds of approaches: incremental-repair / invalidate-and-rebuild

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 6 / 38

Page 10: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

A key pattern: Gradient » why we care

The gradient: a basic building block for a variety of higher-level SASO behaviours

• Shortest path estimation (e.g., for steering mobile agents to PoI)

• Dynamic network partition (elect leaders on a spatial basis)

• Information broadcast

• Event forecasting (cf., anticipative gradient [MPV12])

• Distributed sensing

[FMSM+13]R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 7 / 38

Page 11: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 8 / 38

Page 12: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Approach: Aggregate Computing » “Engineering Stack” [BPV15]

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 9 / 38

Page 13: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

System model: logical (general) & AC instantiation (particular)

Basic model

• Network of devices working asynchronously• Devices interact with their neighbourhood via broadcast-like communication

Aggregate Computing execution model

Each device is given the same aggregate program and works at async rounds:

(1) Retrieve context⇐ Messages from neighbours & sensor values

(2) Aggregate program execution⇒ export (a tree-like repr of computation) & output (value-tree)

(3) Broadcast export to neighbourhood(4) Execute actuators

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 10 / 38

Page 14: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

System model: logical (general) & AC instantiation (particular)

Basic model

• Network of devices working asynchronously• Devices interact with their neighbourhood via broadcast-like communication

Aggregate Computing execution model

Each device is given the same aggregate program and works at async rounds:

(1) Retrieve context⇐ Messages from neighbours & sensor values

(2) Aggregate program execution⇒ export (a tree-like repr of computation) & output (value-tree)

(3) Broadcast export to neighbourhood(4) Execute actuators

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 10 / 38

Page 15: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Example: the “channel”

def channel(src: Boolean,dest: Boolean,width: Double) =

distTo(src) + distTo(dest) <=distBetween(src,dest) + width

• Key point #1: the gradient is a useful pattern for problems based on alogical/physical notion of distance• Key point #2: Aggregate Computing provides a formal framework for composing

building blocks into SASO behaviourR. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 11 / 38

Page 16: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 12 / 38

Page 17: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Gradient implementations

Different contexts

• computational models• synchronous vs. asynchronous• static vs. dynamic environment (e.g., node mobility)• resource constraints

• input/sensor availability (hop-count, relative distance, GPS, time)

Different goals

• reactivity (healing speed)• precision (value vs. shape precision)

• stability• wrt small and big perturbations

• communication cost

How are higher-level patterns/algorithms affected (especially during transients)?

• Key point: improved performance affects many other coordination mechansisms!

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 13 / 38

Page 18: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Gradient implementations

Different contexts

• computational models• synchronous vs. asynchronous• static vs. dynamic environment (e.g., node mobility)• resource constraints

• input/sensor availability (hop-count, relative distance, GPS, time)

Different goals

• reactivity (healing speed)• precision (value vs. shape precision)

• stability• wrt small and big perturbations

• communication cost

How are higher-level patterns/algorithms affected (especially during transients)?

• Key point: improved performance affects many other coordination mechansisms!

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 13 / 38

Page 19: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Gradient implementations

Different contexts

• computational models• synchronous vs. asynchronous• static vs. dynamic environment (e.g., node mobility)• resource constraints

• input/sensor availability (hop-count, relative distance, GPS, time)

Different goals

• reactivity (healing speed)• precision (value vs. shape precision)

• stability• wrt small and big perturbations

• communication cost

How are higher-level patterns/algorithms affected (especially during transients)?

• Key point: improved performance affects many other coordination mechansisms!

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 13 / 38

Page 20: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Classic gradient

Classic gradient

• Iteratively applies a triangle inequality constraint in each device δ

• Starting with∞ everywhere

G(δ) =

{0 if source(δ)min{G(δ′) + w(δ′, δ) : δ′ linked with δ} otherwise

Protelis (external DSL) [PVB15]def classic(source, metric) {

rep(infinity){ (dist) =>mux(source==0){minhood(nbr(dist) + metric()) }

}}

ScaFi (Scala-internal DSL) [CV16]def classic(source: Boolean, metric: => Double = nbrRange): Double =

rep(Double.PositiveInfinity){ dist =>mux(source){ 0.0 }{ minHood(nbr{dist} + metric) }

}

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 14 / 38

Page 21: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Classic gradient

Classic gradient

• Iteratively applies a triangle inequality constraint in each device δ

• Starting with∞ everywhere

G(δ) =

{0 if source(δ)min{G(δ′) + w(δ′, δ) : δ′ linked with δ} otherwise

Protelis (external DSL) [PVB15]def classic(source, metric) {rep(infinity){ (dist) =>

mux(source==0){minhood(nbr(dist) + metric()) }}

}

ScaFi (Scala-internal DSL) [CV16]def classic(source: Boolean, metric: => Double = nbrRange): Double =rep(Double.PositiveInfinity){ dist =>

mux(source){ 0.0 }{ minHood(nbr{dist} + metric) }}

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 14 / 38

Page 22: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Classic Gradient: issues I

Rising value problem – Fast falling, slow rising (e.g., when a source is disconnected)

• In response to changes, slow adaptation to values that need to rise

• Rising speed of Classic is bounded by the distance between the pair of closestdevices [BBVT08]

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 15 / 38

Page 23: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Classic Gradient: issues II

Speed bias

• Continuous movement⇒ underestimation of gradient values

• Error increasing with movement speed

Instability (lack of smoothness)

• Flickering of values

• Variations can change the connection tree• Can be detrimental to the performance of higher-level coordination

mechanisms

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 16 / 38

Page 24: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Improved algorithms

Constraint and Restoring Force (CRF) gradient [BBVT08]

• Idea: fixed rising speed if “no constraints”, only reducing otherwise

• Requires: distance estimations, time sensors

� faster healing speed � reduced stability of values

FLEX gradient [Bea09]

• Idea: inequality relaxation (for smoothness), metric distortion (for healing speed)

• Requires: distance estimations

� improved stability � faster healing speed � reduced precision

Bounded Information Speed (BIS) gradient [ADV17]

• Idea: enforcing a minimum information speed v

• Use time distance T as a lower bound vT − R for space distance G

• Requires: distance estimations, time sensors

• Theorem: BIS with v equal to the avg SP info speed is optimal among SP algorithms ���

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 17 / 38

Page 25: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Improved algorithms

Constraint and Restoring Force (CRF) gradient [BBVT08]

• Idea: fixed rising speed if “no constraints”, only reducing otherwise

• Requires: distance estimations, time sensors

� faster healing speed � reduced stability of values

FLEX gradient [Bea09]

• Idea: inequality relaxation (for smoothness), metric distortion (for healing speed)

• Requires: distance estimations

� improved stability � faster healing speed � reduced precision

Bounded Information Speed (BIS) gradient [ADV17]

• Idea: enforcing a minimum information speed v

• Use time distance T as a lower bound vT − R for space distance G

• Requires: distance estimations, time sensors

• Theorem: BIS with v equal to the avg SP info speed is optimal among SP algorithms ���

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 17 / 38

Page 26: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Improved algorithms

Constraint and Restoring Force (CRF) gradient [BBVT08]

• Idea: fixed rising speed if “no constraints”, only reducing otherwise

• Requires: distance estimations, time sensors

� faster healing speed � reduced stability of values

FLEX gradient [Bea09]

• Idea: inequality relaxation (for smoothness), metric distortion (for healing speed)

• Requires: distance estimations

� improved stability � faster healing speed � reduced precision

Bounded Information Speed (BIS) gradient [ADV17]

• Idea: enforcing a minimum information speed v

• Use time distance T as a lower bound vT − R for space distance G

• Requires: distance estimations, time sensors

• Theorem: BIS with v equal to the avg SP info speed is optimal among SP algorithms ���

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 17 / 38

Page 27: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Rising problem: comparison of algorithms

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 18 / 38

Page 28: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 19 / 38

Page 29: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 20 / 38

Page 30: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Information speed: how fast information flows?

information speed = space travelled over time elapsed

Single-Path (SP) Information Speed

• Information flows through a spanning tree• Value in device depends on a single selected neighbour device

• Typical when information from multiple devices cannot be easily aggregated

• About R/2T if radius R and time period T

Multi-Path (MP) Information Speed

• Information flows through every link in a network

• Value in device needs to be summarised from values in every neighbour device

• “Light speed” which cannot be exceeded

• Depends on network density and shape of time period distribution

⇒ to improve over BIS we have to use some form of multi-path communication

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 21 / 38

Page 31: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Information speed: how fast information flows?

information speed = space travelled over time elapsed

Single-Path (SP) Information Speed

• Information flows through a spanning tree• Value in device depends on a single selected neighbour device

• Typical when information from multiple devices cannot be easily aggregated

• About R/2T if radius R and time period T

Multi-Path (MP) Information Speed

• Information flows through every link in a network

• Value in device needs to be summarised from values in every neighbour device

• “Light speed” which cannot be exceeded

• Depends on network density and shape of time period distribution

⇒ to improve over BIS we have to use some form of multi-path communication

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 21 / 38

Page 32: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Information speed: how fast information flows?

information speed = space travelled over time elapsed

Single-Path (SP) Information Speed

• Information flows through a spanning tree• Value in device depends on a single selected neighbour device

• Typical when information from multiple devices cannot be easily aggregated

• About R/2T if radius R and time period T

Multi-Path (MP) Information Speed

• Information flows through every link in a network

• Value in device needs to be summarised from values in every neighbour device

• “Light speed” which cannot be exceeded

• Depends on network density and shape of time period distribution

⇒ to improve over BIS we have to use some form of multi-path communication

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 21 / 38

Page 33: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Information speed: how fast information flows?

information speed = space travelled over time elapsed

Single-Path (SP) Information Speed

• Information flows through a spanning tree• Value in device depends on a single selected neighbour device

• Typical when information from multiple devices cannot be easily aggregated

• About R/2T if radius R and time period T

Multi-Path (MP) Information Speed

• Information flows through every link in a network

• Value in device needs to be summarised from values in every neighbour device

• “Light speed” which cannot be exceeded

• Depends on network density and shape of time period distribution

⇒ to improve over BIS we have to use some form of multi-path communication

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 21 / 38

Page 34: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

SVD gradient

Stale Value Detection (SVD) gradient

• Starts like Classic gradient

• When obsolete information is detected, fast “reconfiguration” occurs• Basically, new information is preferred over old information

• Theorem: SVD attains optimal reactivity among algorithms with a multi-pathinformation flow ��� modulo a fixed delay � that depends on networkparameters

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 22 / 38

Page 35: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

SVD gradient » implementation

def SVD(source: Boolean, metric: => Double, lagMetric: => Double): Double = {val defaultDist = if(source) 0.0 else Double.PositiveInfinityval loc = (defaultDist, defaultDist, mid(), false)rep[(Double,Double,Int,Boolean)](loc) {case old @ (spaceDistEst, timeDistEst, sourceId, isObsolete) => {val allOthersObsolete = !excludingSelf.anyHood { !nbr{isObsolete} }val (newSpaceDistEst, newSourceId) = minHood {mux(nbr{isObsolete} && !allOthersObsolete) { (defaultDist, mid()) } {(nbr{spaceDistEst} + metric, nbr{sourceId})

} }

val newTimeDistEst = minHood {mux(nbr{sourceId} != newSourceId){ defaultDist } {nbr { timeDistEst } + lagMetric

} }

val loop = newSourceId == mid() && newSpaceDistEst < defaultDistval newObsolete =detect(timestamp() - newTimeDistEst) || loop || excludingSelf.anyHood {

nbr{isObsolete} && nbr{sourceId} == newSourceId &&nbr{timeDistEst}+lagMetric < newTimeDistEst + 0.0001

}

List((newSpaceDistEst, newTimeDistEst, newSourceId, newObsolete), loc).min}

}._1 // Selects estimated distance}

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 23 / 38

Page 36: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

SVD gradient » implementation

def detect(time: Double): Boolean = {// how much time is elapsed since the first time the current info// (originated from the source in time ’time’) reached the current deviceval repCount = rep(0.0) { old =>if(Math.abs(time - delay(time)) < 0.0001) {old + deltaTime().toMillis

} else {0.0

}}

repCount > rep[(Double, Double, Double)](2, 8, 16) { case (avg, sqa, bound) =>// Estimate of the avg peak value for repCount, obtained by exponentialfiltering// with a factor 0.1 the peak values of repCountval newAvg = 0.9 * avg + 0.1 * delay(repCount)// Estimate of the average square of repCount peak valuesval newSqa = 0.9 * sqa + 0.1 * Math.pow(delay(repCount), 2)// Standard deviationval stdev = Math.sqrt(newSqa - Math.pow(newAvg, 2))// New boundval newBound = newAvg + 7*stdev(newAvg, newSqa, newBound)

}._3 // is obsolete?}

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 23 / 38

Page 37: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

SVD gradient vs. BIS

SVD vs. BIS » approach

• Approach: BIS uses incremental-repair; SVD uses invalidate-and-rebuild

• Use of time-related information• BIS minimizes over space, just carrying along the lag (in single-path fashion)• SVD also minimizes over time (but in a multi-path fashion)

SVD vs. BIS » performance

• SVD has some fixed delay �

• SVD is more resource-demanding than BIS �

• Doesn’t mean we can’t do anything about that (see ULT)

• SVD is not smooth �

• Doesn’t mean we can’t do anything about that (see ULT)

• SVD usually heals faster than BIS �

• See Evaluation

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 24 / 38

Page 38: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

SVD gradient vs. BIS

SVD vs. BIS » approach

• Approach: BIS uses incremental-repair; SVD uses invalidate-and-rebuild

• Use of time-related information• BIS minimizes over space, just carrying along the lag (in single-path fashion)• SVD also minimizes over time (but in a multi-path fashion)

SVD vs. BIS » performance

• SVD has some fixed delay �

• SVD is more resource-demanding than BIS �

• Doesn’t mean we can’t do anything about that (see ULT)

• SVD is not smooth �

• Doesn’t mean we can’t do anything about that (see ULT)

• SVD usually heals faster than BIS �

• See Evaluation

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 24 / 38

Page 39: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: SVD vs. BIS » setup

Simulation technology

• Supercomputer Occam [ABL+16], Alchemist simulator [PMV13], ProtelisDSL [PVB15]

Environment

• Number of devices: 1000

• Average update rate: 1s

• Devices disposed randomly in a 〈K 〉m × 20m corridor

• Two fixed sources at both ends of the corridor.

• At time t = 200, left source is abruptly disconnected.

Input/output

• Parameter: Space/time variability: 0(none), 0.5(medium), 1.0(high)

• Parameter: Length of the corridor: [250, 1500]m

• Parameter: Communication radius: [5, 15]m

• Output: Precision: as absolute error wrt Euclidean distance

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 25 / 38

Page 40: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: SVD vs. BIS » results

⇒ an increase in variability gives advantage to SVD⇒ the length of the corridor does not influence the relative performance⇒ when the communication radius is low, MP ≈ SP⇒ BIS goes better

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 26 / 38

Page 41: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 27 / 38

Page 42: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

ULT gradient: idea

metric

gradient 1

damper 1

. . .gradient 2

damper 2

max

filter

def ULT(src, metric, radius, speed, factor){let svd = SVD(src, metric)let bis = BIS(src, metric, radius, speed)inertialFilter(max(svd, bis), factor)

}

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 28 / 38

Page 43: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

ULT gradient: idea

metric

gradient 1

damper 1

. . .gradient 2

damper 2

max

filter

def ULT(src, metric, radius, speed, factor){let svd = SVD(src, metric)let bis = BIS(src, metric, radius, speed)inertialFilter(max(svd, bis), factor)

}

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 28 / 38

Page 44: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

ULT gradient: by composition of state-of-art techniques

Metric correction – in order to prevent the speed bias

• Adjust the metric by taking into account the speed of the device itself and itsneighbours

Output filtering – in order to improve smoothness

• Exponential filters for nearly-static environments

• Intertial filter for more dynamic environments• Uses a “change speed” estimate to set the filtering

Combining fast-healing gradients – to quickly react on input discontinuities

• BIS always outperforms Classic, FLEX, CRF

• SVD usually better than BIS (not always)

» ULT = max(BIS,SVD)

FLEX-style damping: to decrease communication cost (and improve smoothness)

• Can be applied onto any gradient computation

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 29 / 38

Page 45: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: overall performance » scenario

Environment

• Number of devices: 1000

• Communication radius: 10m

• Average update rate: 1s

• Devices disposed randomly in a 500m × 20m corridor (network 50 hops wide)

• Two fixed sources at both ends of the corridor.

• At time t = 200, left source is abruptly disconnected.

Input

• Parameter: Space/time variability: 0(none), 0.5(medium), 1.0(high)

Output

• Precision: as absolute error wrt Euclidean distance

• Smoothness (stability): as the absolute acceleration of values

• Communication cost: number of values exchanged with neighbours• Assuming that steady values do not need to be broadcast

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 30 / 38

Page 46: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: overall performance » results

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 31 / 38

Page 47: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: overall performance » results

Results

• As variability increases, SVD outperforms BIS

• Metric correction eliminates the systematic error due to speed bias

• SVD has the worst peak in stability• Mitigated in ULT by the filter (achieving best stability in hi-var scenarios)

• FLEX damping improves stability further and reduce communication cost• at the expense of a predictable systematic error• might still be convenient e.g. for computing while descending the gradient

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 32 / 38

Page 48: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: on node counting through multi-spanning-tree collection

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 33 / 38

Page 49: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Evaluation: on node counting through multi-spanning-tree collection

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 33 / 38

Page 50: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Outline

1 General problem: effective SASO engineering » patternsGradients: a key SASO pattern

2 Concrete framework: Aggregate Computing

3 State-of-art: state-of-art gradients and their dynamical performance

4 ContributionsNew MP-optimal gradient algorithm: SVD

The “best” gradient algorithm to date: ULT

5 Conclusion

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 34 / 38

Page 51: Compositional Blocks for Optimal Self-Healing Gradients

Intro: SASO patterns Aggregate Computing State-of-art gradients: CRF, FLEX, BIS Contributions: SVD, ULT Conclusion

Conclusion and future work

Paper contributions

• Make the point of state-of-art of gradient computations

• New gradient algorithm (SVD) with optimal MP reactivity

• New algorithm (ULT) with best performance trade-offs to date through• composition of fastest self-healing gradients (SVD, BIS)• fine-tuning techniques (metric correction, filtering, damping)

• Analysis of gradient algorithms wrt• precision• stability• communication cost

Future works

• Estimation of the actual SP and MP speed in different networks

• Specific implementation techniques to increase the speed of MP solutions

• Empirical evaluation in large and realistic simulation scenarios

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 35 / 38

Page 52: Compositional Blocks for Optimal Self-Healing Gradients

Appendix

References I

[ABL+16] Marco Aldinucci, Stefano Bagnasco, Stefano Lusso, Paolo Pasteris, SaraVallero, and Sergio Rabellino.The Open Computing Cluster for Advanced data Manipulation (occam).In The 22nd International Conference on Computing in High Energy andNuclear Physics (CHEP), San Francisco, USA, 2016.

[ADV17] Giorgio Audrito, Ferruccio Damiani, and Mirko Viroli.Optimally-self-healing distributed gradient structures through boundedinformation speed.In International Conference on Coordination Languages and Models,pages 59–77. Springer, Cham, 2017.

[BBVT08] Jacob Beal, Jonathan Bachrach, Dan Vickery, and Mark Tobenkin.Fast self-healing gradients.In Proceedings of the 2008 ACM symposium on Applied computing,pages 1969–1975. ACM, 2008.

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 36 / 38

Page 53: Compositional Blocks for Optimal Self-Healing Gradients

Appendix

References II

[Bea09] Jacob Beal.Flexible self-healing gradients.In Proceedings of the 2009 ACM symposium on Applied Computing,pages 1197–1201. ACM, 2009.

[BPV15] Jacob Beal, Danilo Pianini, and Mirko Viroli.Aggregate programming for the internet of things.IEEE Computer, 2015.

[CV16] Roberto Casadei and Mirko Viroli.Towards aggregate programming in Scala.In First Workshop on Programming Models and Languages for DistributedComputing, PMLDC ’16, pages 5:1–5:7, New York, NY, USA, 2016. ACM.

[FMSM+13] Jose Luis Fernandez-Marquez, Giovanna Di Marzo Serugendo, SaraMontagna, Mirko Viroli, and Josep Lluís Arcos.Description and composition of bio-inspired design patterns: a completeoverview.Natural Computing, 12(1):43–67, 2013.

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 37 / 38

Page 54: Compositional Blocks for Optimal Self-Healing Gradients

Appendix

References III

[MPV12] Sara Montagna, Danilo Pianini, and Mirko Viroli.Gradient-based self-organisation patterns of anticipative adaptation.In Self-Adaptive and Self-Organizing Systems (SASO), 2012 IEEE SixthInternational Conference on, pages 169–174. IEEE, 2012.

[PMV13] Danilo Pianini, Sara Montagna, and Mirko Viroli.Chemical-oriented simulation of computational systems with Alchemist.Journal of Simulation, 2013.

[PVB15] Danilo Pianini, Mirko Viroli, and Jacob Beal.Protelis: Practical aggregate programming.In Proceedings of ACM SAC 2015, pages 1846–1853, Salamanca, Spain,2015. ACM.

R. Casadei (Università di Bologna) Optimal Self-Healing Gradients SASO 2017 38 / 38