SlideShare a Scribd company logo
1 of 39
Download to read offline
Nicolás Cardozo - Ivana Dusparic
@ncardoz - @ivanadusparic
n.cardozo@uniandes.edu.co - ivana.dusparic@scss.tcd.ie
Language abstractions and Techniques for
Developing Collective Adaptive Systems
Using Context-oriented Programming
2020
August 21
st
, 2020 (online)
Collective adaptive systems
2
Adaptive
Interactive
Autonomous adaptation to changes in the
surrounding execution environment to satisfy
performance and quality attributes of the system
Manage interaction between system entities to
ensure the emergence of desired behavior
… How do you engineer such systems?
1. How to introduce behavior adaptations?
2. How to make adaptive behavior modular?
3. How to plug adaptations whenever they are required?
4. How to execute adaptations appropriately to the environment?
5. How to manage interaction between adaptations?
4
Building a CAS
City transport systems characterize by the interaction
between its different individual systems (bus routes)
consisting of:
• Buses
• Stations
• Traveling passengers
• Traffic conditions
Roads Stations Buses
5
Building a CAS
We want to build a transport management system that adapts to
the situations that arise from the system execution
Alerts raised upon identified problems in the system functioning
RoadBlocked FullStation FullBus
5
Building a CAS
We want to build a transport management system that adapts to
the situations that arise from the system execution
Alerts raised upon identified problems in the system functioning
Dynamically change
the system behavior
for a more
appropriate one
foo() { … }
bar() { … }
Context-oriented programming
RoadBlocked FullStation FullBus
6
TranCity
Stations Buses
Enable passengers to enter
to wait for a bus in their
desired route.
Move between stations in a
specified route. At stations
passengers get off, letting new
passengers on the bus
Station = Trait({
id: id,
name: name,
open: true,
capacity: 120,
load: 0.0,
passengers: []
addPassenger: function(p) {
this.passengers.push(p);
this.setLoad();
},
})
Bus = Trait({
id: id,
route: “R4”,
capacity: 56,
load: 0,
currentNode: “S1”,
passengers: []
moveBus: function() {
//add and remove passengers
//move to the next station
},
})
Regular JS
objects
6
TranCity
Stations Buses
execution
loop
Enable passengers to enter
to wait for a bus in their
desired route.
Move between stations in a
specified route. At stations
passengers get off, letting new
passengers on the bus
Station = Trait({
id: id,
name: name,
open: true,
capacity: 120,
load: 0.0,
passengers: []
addPassenger: function(p) {
this.passengers.push(p);
this.setLoad();
},
})
Bus = Trait({
id: id,
route: “R4”,
capacity: 56,
load: 0,
currentNode: “S1”,
passengers: []
moveBus: function() {
//add and remove passengers
//move to the next station
},
})
Regular JS
objects
7
Alerts and expected behavior
Full Station
Full Bus
Close the station
Divert passengers to near stations in
their route
Don’t allow passengers on the bus
Send additional bus to route of the full
bus
!
Road blocked
Split the route at the blockage point,
serve each road segment independently
(as a new route). Divert passengers
across the blocked point
!
!
1. Introduce adaptive behavior?
2. Make adaptive behavior modular?
9
Object to adapt
Full Station
Full Bus
!
Road blocked!
!
[Gonzalez et al. Context-traits MODULARITY’13]
9
Object to adapt
FullBus = cop.Context({
name = “Full bus”
})Full Station
Full Bus
!
Road blocked!
!
[Gonzalez et al. Context-traits MODULARITY’13]
9
Object to adapt
FullBus = cop.Context({
name = “Full bus”
})Full Station
Full Bus
!
Road blocked!
!
FullBusBehavior = Trait({
nextBusStation: function() {
filter(passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
[Gonzalez et al. Context-traits MODULARITY’13]
9
Object to adapt
FullBus = cop.Context({
name = “Full bus”
})Full Station
Full Bus
!
Road blocked!
!
FullBusBehavior = Trait({
nextBusStation: function() {
filter(passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
FullBus.adapt(bus, FullBusBehavior)
[Gonzalez et al. Context-traits MODULARITY’13]
9
Object to adapt
FullBus = cop.Context({
name = “Full bus”
})Full Station
Full Bus
!
Road blocked!
!
FullBusBehavior = Trait({
nextBusStation: function() {
filter(passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
FullBus.adapt(bus, FullBusBehavior)
Regular JS
objects
[Gonzalez et al. Context-traits MODULARITY’13]
10
Object to adapt
FullBus = cop.Context({
name = “Full bus”
})
FullBusBehavior = Trait({
nextBusStation: function() {
filter(this.passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
FullBus.adapt(bus, FullBusBehavior)
Independent objects
introduced “on-the-fly”
Minimum connection between
application and adaptation
3. Plug adaptations whenever
they are required?
12
Realization concerns
FullBus.adapt( * , FullBusBehavior );
bus
<<object instance>>
Adaptations applicable
to a single object
Bus
<<class>>
Adaptations applicable
to all objects specified
by a given class
check()
<<function>>
Adaptations applicable
to a given function
Fine grained adaptation enable global or localized modification of entities’
behavior
13
Realization concerns
FullBus.adapt(Bus, FullBusBehavior)
RoadBlocked.adapt(Bus, BrokenBusBehavior)
BrokenBusBehavior = Trait({
nextBusStation: function() {
callTowCar();
proceed();
}
})
Adaptations
are
composable by
definition
13
Realization concerns
FullBus.adapt(Bus, FullBusBehavior)
RoadBlocked.adapt(Bus, BrokenBusBehavior)
BrokenBusBehavior = Trait({
nextBusStation: function() {
callTowCar();
proceed();
}
})
Reuse behavior
of other
available
adaptation
Adaptations
are
composable by
definition
14
Realization concerns
BrokenBusBehavior = Trait({
nextBusStation: function() {
callTowCar();
proceed();
}
})
FullBusBehavior = Trait({
nextBusStation: function() {
filter(this.passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
14
Realization concerns
BrokenBusBehavior = Trait({
nextBusStation: function() {
callTowCar();
proceed();
}
})
FullBusBehavior = Trait({
nextBusStation: function() {
filter(this.passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
FullBus.activate(); RoadBlocked.activate()
behave like FullBus, then like
RoadBlocked
14
Realization concerns
BrokenBusBehavior = Trait({
nextBusStation: function() {
callTowCar();
proceed();
}
})
FullBusBehavior = Trait({
nextBusStation: function() {
filter(this.passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
FullBus.activate(); RoadBlocked.activate()
RoadBlocked.activate(); FullBus.activate()
behave like FullBus, then like
RoadBlocked
behave like RoadBlocked,
then like FullBus
14
Realization concerns
BrokenBusBehavior = Trait({
nextBusStation: function() {
callTowCar();
proceed();
}
})
FullBusBehavior = Trait({
nextBusStation: function() {
filter(this.passengers, p =>
p.destination() != this.currentNode);
this.route.depot.sendBus(
this.currentNode);
}
})
cop.manager.addObjectPolicy(Bus, [BrokenBusBehavior, FullBusBehavior])
FullBus.activate(); RoadBlocked.activate()
RoadBlocked.activate(); FullBus.activate()
behave like FullBus, then like
RoadBlocked
behave like RoadBlocked,
then like FullBus
always use
BrokenBusBehavior
before
FullBusBehavior
4. Appropriateness of adaptations?
16
Temporal concerns
function checkCapacity(bus) {
if(bus.load >= 0.7)
FullBus.activate();
else
FullBus.deactivate();
}
Context
discovery
world
sensors/monitors
enacting
adaptations
execution
loop
Bus = Trait({
moveBus: function() {
nextBusStation();
},
nextBusStation() { … }
})
16
Temporal concerns
function checkCapacity(bus) {
if(bus.load >= 0.7)
FullBus.activate();
else
FullBus.deactivate();
}
Context
discovery
world
sensors/monitors
enacting
adaptations
execution
loop
Bus = Trait({
moveBus: function() {
nextBusStation();
},
nextBusStation() { … }
})
FullBusBehavior = Trait({
nextBusStation: function() {
…
}
})
16
Temporal concerns
function checkCapacity(bus) {
if(bus.load >= 0.7)
FullBus.activate();
else
FullBus.deactivate();
}
Context
discovery
world
sensors/monitors
enacting
adaptations
execution
loop
Bus = Trait({
moveBus: function() {
nextBusStation();
},
nextBusStation() { … }
})
5. Managing interaction between
adaptations?
18
Interaction concerns
EDPr(ED)
Pr(¬ED)
req(ED) act(ED)
deac(ED)
req(¬ED)
FBPr(FB) Pr(¬FB)
req(FB)
act(FB)
deac(FB)
req(¬FB)
[Fandiño de la Hoz et al. Distributed Context Petri Nets. COP’19]
FullBus
Empty Depot
Node	2
Node	1
Context dependency relations define interaction between (unknown)
adaptations across nodes
18
Interaction concerns
EDPr(ED)
Pr(¬ED)
req(ED) act(ED)
deac(ED)
req(¬ED)
FBPr(FB) Pr(¬FB)
req(FB)
act(FB)
deac(FB)
req(¬FB)
[Fandiño de la Hoz et al. Distributed Context Petri Nets. COP’19]
FullBus
Empty Depot
Node	2
Node	1
Context dependency relations define interaction between (unknown)
adaptations across nodes
context dependency relations
encoded as Petri net
interaction
19
Interaction concerns
[Cardozo and Dusparic. Learning Run-time Composition of Interacting Adaptations. SEAMS’20]
FullStationBehavior = Trait({
closeStation: function() {
sendBus();
}
})
FullBusBehavior = Trait({
nextBusStation: function() {
sendBus();
}
})
DepotEmptyBehavior = Trait({
recallBus: function() {
…
}
})
Based on interaction, learn when adaptations should be composed or
execute individually to best suit the requirements from the environment
? ?
?
Learn
relationships
using RL
20
Interaction concerns
[Cardozo and Dusparic. Learning Run-time Composition of Interacting Adaptations. SEAMS’20]
FullStationBehavior = Trait({
closeStation: function() {
sendBus();
}
})
FullBusBehavior = Trait({
nextBusStation: function() {
sendBus();
}
})
DepotEmptyBehavior = Trait({
recallBus: function() {
…
}
})
Based on interaction, learn when adaptations should be composed or
execute individually to best suit the requirements from the environment
compatible compose conflicting individually
conflicting individually
21
Conclusion
Context-oriented programming (COP) is effective in
realizing Collective Adaptive Systems (CAS)
1. How to introduce behavior adaptations?
2. How to make adaptive behavior modular?
3. How to plug adaptations whenever they are required?
4. How to execute adaptations appropriately to the environment?
5. How to manage interaction between adaptations?
21
Conclusion
Context-oriented programming (COP) is effective in
realizing Collective Adaptive Systems (CAS)
1. How to introduce behavior adaptations?
2. How to make adaptive behavior modular?
3. How to plug adaptations whenever they are required?
4. How to execute adaptations appropriately to the environment?
5. How to manage interaction between adaptations?
‣ COP posits first-class modular entities to represent contexts and behavioral
adaptations
21
Conclusion
Context-oriented programming (COP) is effective in
realizing Collective Adaptive Systems (CAS)
1. How to introduce behavior adaptations?
2. How to make adaptive behavior modular?
3. How to plug adaptations whenever they are required?
4. How to execute adaptations appropriately to the environment?
5. How to manage interaction between adaptations?
‣ COP posits first-class modular entities to represent contexts and behavioral
adaptations
‣ Adaptations are introduced dynamically through software composition
21
Conclusion
Context-oriented programming (COP) is effective in
realizing Collective Adaptive Systems (CAS)
1. How to introduce behavior adaptations?
2. How to make adaptive behavior modular?
3. How to plug adaptations whenever they are required?
4. How to execute adaptations appropriately to the environment?
5. How to manage interaction between adaptations?
‣ COP posits first-class modular entities to represent contexts and behavioral
adaptations
‣ Adaptations are introduced dynamically through software composition
‣ Adaptations take place reactively and promptly to changes in the environment
21
Conclusion
Context-oriented programming (COP) is effective in
realizing Collective Adaptive Systems (CAS)
1. How to introduce behavior adaptations?
2. How to make adaptive behavior modular?
3. How to plug adaptations whenever they are required?
4. How to execute adaptations appropriately to the environment?
5. How to manage interaction between adaptations?
‣ COP posits first-class modular entities to represent contexts and behavioral
adaptations
‣ Adaptations are introduced dynamically through software composition
‣ Adaptations take place reactively and promptly to changes in the environment
‣ Adaptations are managed through defined dependency relations realized
dynamically, or learned from interactions
Nicolás Cardozo - Ivana Dusparic
@ncardoz - @ivanadusparic
n.cardozo@uniandes.edu.co - ivana.dusparic@scss.tcd.ie
Thanks for watching!
Language abstractions and Techniques for
Developing Collective Adaptive Systems Using
Context-oriented Programming
2020
August 21
st
, 2020 (online)

More Related Content

Similar to Language Abstractions and Techniques for Developing Collective Adaptive Systems Using Context-oriented Programming

Iaetsd modified artificial potential fields algorithm for mobile robot path ...
Iaetsd modified  artificial potential fields algorithm for mobile robot path ...Iaetsd modified  artificial potential fields algorithm for mobile robot path ...
Iaetsd modified artificial potential fields algorithm for mobile robot path ...
Iaetsd Iaetsd
 
DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM
DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM
DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM
NITISH K
 
Complete the following- The int planTrip(int numPassengers- String tri.pdf
Complete the following- The int planTrip(int numPassengers- String tri.pdfComplete the following- The int planTrip(int numPassengers- String tri.pdf
Complete the following- The int planTrip(int numPassengers- String tri.pdf
2adretail
 
1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf
1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf
1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf
alimacal
 

Similar to Language Abstractions and Techniques for Developing Collective Adaptive Systems Using Context-oriented Programming (20)

Advanced functional programing in Swift
Advanced functional programing in SwiftAdvanced functional programing in Swift
Advanced functional programing in Swift
 
Iaetsd modified artificial potential fields algorithm for mobile robot path ...
Iaetsd modified  artificial potential fields algorithm for mobile robot path ...Iaetsd modified  artificial potential fields algorithm for mobile robot path ...
Iaetsd modified artificial potential fields algorithm for mobile robot path ...
 
my final paper
my final papermy final paper
my final paper
 
Learning run-time composition of interacting adaptations
Learning run-time composition of interacting adaptationsLearning run-time composition of interacting adaptations
Learning run-time composition of interacting adaptations
 
Presentation
PresentationPresentation
Presentation
 
DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM
DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM
DESIGN AND IMPLEMENTATION OF PATH PLANNING ALGORITHM
 
Traffic assignment
Traffic assignmentTraffic assignment
Traffic assignment
 
Complete the following- The int planTrip(int numPassengers- String tri.pdf
Complete the following- The int planTrip(int numPassengers- String tri.pdfComplete the following- The int planTrip(int numPassengers- String tri.pdf
Complete the following- The int planTrip(int numPassengers- String tri.pdf
 
Adaptive Feature Fusion Networks for Origin-Destination Passenger Flow Predic...
Adaptive Feature Fusion Networks for Origin-Destination Passenger Flow Predic...Adaptive Feature Fusion Networks for Origin-Destination Passenger Flow Predic...
Adaptive Feature Fusion Networks for Origin-Destination Passenger Flow Predic...
 
Workshop 25: React Native - Components
Workshop 25: React Native - ComponentsWorkshop 25: React Native - Components
Workshop 25: React Native - Components
 
Commutetown
CommutetownCommutetown
Commutetown
 
Commutetown
CommutetownCommutetown
Commutetown
 
Commutetown
CommutetownCommutetown
Commutetown
 
Making flow Mule
Making flow MuleMaking flow Mule
Making flow Mule
 
Cognitive Urban Transport
Cognitive Urban TransportCognitive Urban Transport
Cognitive Urban Transport
 
Mt croid
Mt croidMt croid
Mt croid
 
Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)
 
1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf
1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf
1. BooleanSourceHW4 classpublic BooleanSourceHW4(double initProbab.pdf
 
Spark - Citi Bike NYC
Spark - Citi Bike NYCSpark - Citi Bike NYC
Spark - Citi Bike NYC
 
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdfCOMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
COMPUTER SCIENCE PROJECT OF RAILWAY RESERVATION SYSTEM PYTHON PROGRAMMING.pdf
 

More from Universidad de los Andes

An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...
Universidad de los Andes
 
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
Universidad de los Andes
 
[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps
Universidad de los Andes
 

More from Universidad de los Andes (17)

An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...An expressive and modular layer activation mechanism for Context-Oriented Pro...
An expressive and modular layer activation mechanism for Context-Oriented Pro...
 
[FTfJP23] Points-to Analysis for Context-oriented Javascript Programs
[FTfJP23] Points-to Analysis for Context-oriented Javascript Programs[FTfJP23] Points-to Analysis for Context-oriented Javascript Programs
[FTfJP23] Points-to Analysis for Context-oriented Javascript Programs
 
[JIST] Programming language implementations for context-oriented self-adaptiv...
[JIST] Programming language implementations for context-oriented self-adaptiv...[JIST] Programming language implementations for context-oriented self-adaptiv...
[JIST] Programming language implementations for context-oriented self-adaptiv...
 
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
[CAIN'23] Prevalence of Code Smells in Reinforcement Learning Projects
 
[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps[CIbSE2023] Cross-language clone detection for Mobile Apps
[CIbSE2023] Cross-language clone detection for Mobile Apps
 
Keeping Up! with LaTeX
Keeping Up! with LaTeXKeeping Up! with LaTeX
Keeping Up! with LaTeX
 
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
[JPDC,JCC@LMN22] Ad hoc systems Management and specification with distributed...
 
[CCC'21] Evaluation of Work Stealing Algorithms
[CCC'21] Evaluation of Work Stealing Algorithms[CCC'21] Evaluation of Work Stealing Algorithms
[CCC'21] Evaluation of Work Stealing Algorithms
 
Generating Adaptations from the System Execution using Reinforcement Learning...
Generating Adaptations from the System Execution using Reinforcement Learning...Generating Adaptations from the System Execution using Reinforcement Learning...
Generating Adaptations from the System Execution using Reinforcement Learning...
 
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary studyDoes Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
Does Neuron Coverage Matter for Deep Reinforcement Learning? A preliminary study
 
Distributed context Petri nets
Distributed context Petri netsDistributed context Petri nets
Distributed context Petri nets
 
CQL: declarative language for context activation
CQL: declarative language for context activationCQL: declarative language for context activation
CQL: declarative language for context activation
 
Generating software adaptations using machine learning
Generating software adaptations using machine learningGenerating software adaptations using machine learning
Generating software adaptations using machine learning
 
[Bachelor_project] Asignación de exámenes finales
[Bachelor_project] Asignación de exámenes finales[Bachelor_project] Asignación de exámenes finales
[Bachelor_project] Asignación de exámenes finales
 
Programming language techniques for adaptive software
Programming language techniques for adaptive softwareProgramming language techniques for adaptive software
Programming language techniques for adaptive software
 
Peace COrP: Learning to solve conflicts between contexts
Peace COrP: Learning to solve conflicts between contextsPeace COrP: Learning to solve conflicts between contexts
Peace COrP: Learning to solve conflicts between contexts
 
Emergent Software Services
Emergent Software ServicesEmergent Software Services
Emergent Software Services
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 

Recently uploaded (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Language Abstractions and Techniques for Developing Collective Adaptive Systems Using Context-oriented Programming

  • 1. Nicolás Cardozo - Ivana Dusparic @ncardoz - @ivanadusparic n.cardozo@uniandes.edu.co - ivana.dusparic@scss.tcd.ie Language abstractions and Techniques for Developing Collective Adaptive Systems Using Context-oriented Programming 2020 August 21 st , 2020 (online)
  • 2. Collective adaptive systems 2 Adaptive Interactive Autonomous adaptation to changes in the surrounding execution environment to satisfy performance and quality attributes of the system Manage interaction between system entities to ensure the emergence of desired behavior
  • 3. … How do you engineer such systems? 1. How to introduce behavior adaptations? 2. How to make adaptive behavior modular? 3. How to plug adaptations whenever they are required? 4. How to execute adaptations appropriately to the environment? 5. How to manage interaction between adaptations?
  • 4. 4 Building a CAS City transport systems characterize by the interaction between its different individual systems (bus routes) consisting of: • Buses • Stations • Traveling passengers • Traffic conditions Roads Stations Buses
  • 5. 5 Building a CAS We want to build a transport management system that adapts to the situations that arise from the system execution Alerts raised upon identified problems in the system functioning RoadBlocked FullStation FullBus
  • 6. 5 Building a CAS We want to build a transport management system that adapts to the situations that arise from the system execution Alerts raised upon identified problems in the system functioning Dynamically change the system behavior for a more appropriate one foo() { … } bar() { … } Context-oriented programming RoadBlocked FullStation FullBus
  • 7. 6 TranCity Stations Buses Enable passengers to enter to wait for a bus in their desired route. Move between stations in a specified route. At stations passengers get off, letting new passengers on the bus Station = Trait({ id: id, name: name, open: true, capacity: 120, load: 0.0, passengers: [] addPassenger: function(p) { this.passengers.push(p); this.setLoad(); }, }) Bus = Trait({ id: id, route: “R4”, capacity: 56, load: 0, currentNode: “S1”, passengers: [] moveBus: function() { //add and remove passengers //move to the next station }, }) Regular JS objects
  • 8. 6 TranCity Stations Buses execution loop Enable passengers to enter to wait for a bus in their desired route. Move between stations in a specified route. At stations passengers get off, letting new passengers on the bus Station = Trait({ id: id, name: name, open: true, capacity: 120, load: 0.0, passengers: [] addPassenger: function(p) { this.passengers.push(p); this.setLoad(); }, }) Bus = Trait({ id: id, route: “R4”, capacity: 56, load: 0, currentNode: “S1”, passengers: [] moveBus: function() { //add and remove passengers //move to the next station }, }) Regular JS objects
  • 9. 7 Alerts and expected behavior Full Station Full Bus Close the station Divert passengers to near stations in their route Don’t allow passengers on the bus Send additional bus to route of the full bus ! Road blocked Split the route at the blockage point, serve each road segment independently (as a new route). Divert passengers across the blocked point ! !
  • 10. 1. Introduce adaptive behavior? 2. Make adaptive behavior modular?
  • 11. 9 Object to adapt Full Station Full Bus ! Road blocked! ! [Gonzalez et al. Context-traits MODULARITY’13]
  • 12. 9 Object to adapt FullBus = cop.Context({ name = “Full bus” })Full Station Full Bus ! Road blocked! ! [Gonzalez et al. Context-traits MODULARITY’13]
  • 13. 9 Object to adapt FullBus = cop.Context({ name = “Full bus” })Full Station Full Bus ! Road blocked! ! FullBusBehavior = Trait({ nextBusStation: function() { filter(passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) [Gonzalez et al. Context-traits MODULARITY’13]
  • 14. 9 Object to adapt FullBus = cop.Context({ name = “Full bus” })Full Station Full Bus ! Road blocked! ! FullBusBehavior = Trait({ nextBusStation: function() { filter(passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) FullBus.adapt(bus, FullBusBehavior) [Gonzalez et al. Context-traits MODULARITY’13]
  • 15. 9 Object to adapt FullBus = cop.Context({ name = “Full bus” })Full Station Full Bus ! Road blocked! ! FullBusBehavior = Trait({ nextBusStation: function() { filter(passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) FullBus.adapt(bus, FullBusBehavior) Regular JS objects [Gonzalez et al. Context-traits MODULARITY’13]
  • 16. 10 Object to adapt FullBus = cop.Context({ name = “Full bus” }) FullBusBehavior = Trait({ nextBusStation: function() { filter(this.passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) FullBus.adapt(bus, FullBusBehavior) Independent objects introduced “on-the-fly” Minimum connection between application and adaptation
  • 17. 3. Plug adaptations whenever they are required?
  • 18. 12 Realization concerns FullBus.adapt( * , FullBusBehavior ); bus <<object instance>> Adaptations applicable to a single object Bus <<class>> Adaptations applicable to all objects specified by a given class check() <<function>> Adaptations applicable to a given function Fine grained adaptation enable global or localized modification of entities’ behavior
  • 19. 13 Realization concerns FullBus.adapt(Bus, FullBusBehavior) RoadBlocked.adapt(Bus, BrokenBusBehavior) BrokenBusBehavior = Trait({ nextBusStation: function() { callTowCar(); proceed(); } }) Adaptations are composable by definition
  • 20. 13 Realization concerns FullBus.adapt(Bus, FullBusBehavior) RoadBlocked.adapt(Bus, BrokenBusBehavior) BrokenBusBehavior = Trait({ nextBusStation: function() { callTowCar(); proceed(); } }) Reuse behavior of other available adaptation Adaptations are composable by definition
  • 21. 14 Realization concerns BrokenBusBehavior = Trait({ nextBusStation: function() { callTowCar(); proceed(); } }) FullBusBehavior = Trait({ nextBusStation: function() { filter(this.passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } })
  • 22. 14 Realization concerns BrokenBusBehavior = Trait({ nextBusStation: function() { callTowCar(); proceed(); } }) FullBusBehavior = Trait({ nextBusStation: function() { filter(this.passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) FullBus.activate(); RoadBlocked.activate() behave like FullBus, then like RoadBlocked
  • 23. 14 Realization concerns BrokenBusBehavior = Trait({ nextBusStation: function() { callTowCar(); proceed(); } }) FullBusBehavior = Trait({ nextBusStation: function() { filter(this.passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) FullBus.activate(); RoadBlocked.activate() RoadBlocked.activate(); FullBus.activate() behave like FullBus, then like RoadBlocked behave like RoadBlocked, then like FullBus
  • 24. 14 Realization concerns BrokenBusBehavior = Trait({ nextBusStation: function() { callTowCar(); proceed(); } }) FullBusBehavior = Trait({ nextBusStation: function() { filter(this.passengers, p => p.destination() != this.currentNode); this.route.depot.sendBus( this.currentNode); } }) cop.manager.addObjectPolicy(Bus, [BrokenBusBehavior, FullBusBehavior]) FullBus.activate(); RoadBlocked.activate() RoadBlocked.activate(); FullBus.activate() behave like FullBus, then like RoadBlocked behave like RoadBlocked, then like FullBus always use BrokenBusBehavior before FullBusBehavior
  • 25. 4. Appropriateness of adaptations?
  • 26. 16 Temporal concerns function checkCapacity(bus) { if(bus.load >= 0.7) FullBus.activate(); else FullBus.deactivate(); } Context discovery world sensors/monitors enacting adaptations execution loop Bus = Trait({ moveBus: function() { nextBusStation(); }, nextBusStation() { … } })
  • 27. 16 Temporal concerns function checkCapacity(bus) { if(bus.load >= 0.7) FullBus.activate(); else FullBus.deactivate(); } Context discovery world sensors/monitors enacting adaptations execution loop Bus = Trait({ moveBus: function() { nextBusStation(); }, nextBusStation() { … } }) FullBusBehavior = Trait({ nextBusStation: function() { … } })
  • 28. 16 Temporal concerns function checkCapacity(bus) { if(bus.load >= 0.7) FullBus.activate(); else FullBus.deactivate(); } Context discovery world sensors/monitors enacting adaptations execution loop Bus = Trait({ moveBus: function() { nextBusStation(); }, nextBusStation() { … } })
  • 29. 5. Managing interaction between adaptations?
  • 30. 18 Interaction concerns EDPr(ED) Pr(¬ED) req(ED) act(ED) deac(ED) req(¬ED) FBPr(FB) Pr(¬FB) req(FB) act(FB) deac(FB) req(¬FB) [Fandiño de la Hoz et al. Distributed Context Petri Nets. COP’19] FullBus Empty Depot Node 2 Node 1 Context dependency relations define interaction between (unknown) adaptations across nodes
  • 31. 18 Interaction concerns EDPr(ED) Pr(¬ED) req(ED) act(ED) deac(ED) req(¬ED) FBPr(FB) Pr(¬FB) req(FB) act(FB) deac(FB) req(¬FB) [Fandiño de la Hoz et al. Distributed Context Petri Nets. COP’19] FullBus Empty Depot Node 2 Node 1 Context dependency relations define interaction between (unknown) adaptations across nodes context dependency relations encoded as Petri net interaction
  • 32. 19 Interaction concerns [Cardozo and Dusparic. Learning Run-time Composition of Interacting Adaptations. SEAMS’20] FullStationBehavior = Trait({ closeStation: function() { sendBus(); } }) FullBusBehavior = Trait({ nextBusStation: function() { sendBus(); } }) DepotEmptyBehavior = Trait({ recallBus: function() { … } }) Based on interaction, learn when adaptations should be composed or execute individually to best suit the requirements from the environment ? ? ? Learn relationships using RL
  • 33. 20 Interaction concerns [Cardozo and Dusparic. Learning Run-time Composition of Interacting Adaptations. SEAMS’20] FullStationBehavior = Trait({ closeStation: function() { sendBus(); } }) FullBusBehavior = Trait({ nextBusStation: function() { sendBus(); } }) DepotEmptyBehavior = Trait({ recallBus: function() { … } }) Based on interaction, learn when adaptations should be composed or execute individually to best suit the requirements from the environment compatible compose conflicting individually conflicting individually
  • 34. 21 Conclusion Context-oriented programming (COP) is effective in realizing Collective Adaptive Systems (CAS) 1. How to introduce behavior adaptations? 2. How to make adaptive behavior modular? 3. How to plug adaptations whenever they are required? 4. How to execute adaptations appropriately to the environment? 5. How to manage interaction between adaptations?
  • 35. 21 Conclusion Context-oriented programming (COP) is effective in realizing Collective Adaptive Systems (CAS) 1. How to introduce behavior adaptations? 2. How to make adaptive behavior modular? 3. How to plug adaptations whenever they are required? 4. How to execute adaptations appropriately to the environment? 5. How to manage interaction between adaptations? ‣ COP posits first-class modular entities to represent contexts and behavioral adaptations
  • 36. 21 Conclusion Context-oriented programming (COP) is effective in realizing Collective Adaptive Systems (CAS) 1. How to introduce behavior adaptations? 2. How to make adaptive behavior modular? 3. How to plug adaptations whenever they are required? 4. How to execute adaptations appropriately to the environment? 5. How to manage interaction between adaptations? ‣ COP posits first-class modular entities to represent contexts and behavioral adaptations ‣ Adaptations are introduced dynamically through software composition
  • 37. 21 Conclusion Context-oriented programming (COP) is effective in realizing Collective Adaptive Systems (CAS) 1. How to introduce behavior adaptations? 2. How to make adaptive behavior modular? 3. How to plug adaptations whenever they are required? 4. How to execute adaptations appropriately to the environment? 5. How to manage interaction between adaptations? ‣ COP posits first-class modular entities to represent contexts and behavioral adaptations ‣ Adaptations are introduced dynamically through software composition ‣ Adaptations take place reactively and promptly to changes in the environment
  • 38. 21 Conclusion Context-oriented programming (COP) is effective in realizing Collective Adaptive Systems (CAS) 1. How to introduce behavior adaptations? 2. How to make adaptive behavior modular? 3. How to plug adaptations whenever they are required? 4. How to execute adaptations appropriately to the environment? 5. How to manage interaction between adaptations? ‣ COP posits first-class modular entities to represent contexts and behavioral adaptations ‣ Adaptations are introduced dynamically through software composition ‣ Adaptations take place reactively and promptly to changes in the environment ‣ Adaptations are managed through defined dependency relations realized dynamically, or learned from interactions
  • 39. Nicolás Cardozo - Ivana Dusparic @ncardoz - @ivanadusparic n.cardozo@uniandes.edu.co - ivana.dusparic@scss.tcd.ie Thanks for watching! Language abstractions and Techniques for Developing Collective Adaptive Systems Using Context-oriented Programming 2020 August 21 st , 2020 (online)