Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current...

64
Software Engineering for Self-Adaptive Systems

Transcript of Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current...

Page 1: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Software Engineering for Self-Adaptive Systems

Page 2: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Self-Adaptation

• The complexity of current software-based systems has led the software engineering community to look for inspiration in diverse related fields (e.g., robotics, artificial intelligence) as well as other areas (e.g., biology) to find new ways of designing and managing systems and services.

• Self-adaptation

– Has become one of the most promising directions.

– The capability of the system to adjust its behaviour in response to its perception of the environment.

11/04/23 2Carlos J. P. Lucena © LES/PUC-Rio

Page 3: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

The Development of Self-adaptive Systems

• The development of self-adaptive systems can be viewed from two perspectives:

• top-down when considering an individual system

– assess their own behaviour and change it when the assessment indicates a need to adapt due to evolving functional or non-functional requirements

• bottom-up when considering cooperative systems

– The global behaviour of the system emerges from these local interactions.

11/04/23 3Carlos J. P. Lucena © LES/PUC-Rio

Page 4: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 4Carlos J. P. Lucena © LES/PUC-Rio

The Study of Self-Adaptive Systems

• The topic of self-adaptive systems has been studied within the diferent research areas of software engineering, including, requirements engineering, software architectures, middleware, component-based development, and programming languages (most of these initiatives have been isolated).

• Other research communities that have also investigated this topic from their own perspective are even more diverse: fault-tolerant computing, biologically inspired computing, multi-agent systems, (distributed artificial intelligence) and robotics, among others.

Page 5: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 5Carlos J. P. Lucena © LES/PUC-Rio

Roadmap

• Requirements– state of the art

– research challenges

• Engineering– state of the art

– research challenges

Page 6: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 6Carlos J. P. Lucena © LES/PUC-Rio

Requirements – State of the Art 1

• Requirements engineering is concerned with what a system ought to do and within which constraints it must do it.

• Requirements engineering for self-adaptive systems, therefore, must address what adaptations are possible and what constrains how those adaptations are carried out.

Page 7: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 7Carlos J. P. Lucena © LES/PUC-Rio

Requirements – State of the Art 2

• In particular, questions to be addressed include:

• What aspects of the environment are relevant for adaptation?

• Which requirements are allowed to vary or evolve at runtime and which must always be maintained?

• One of the main challenges that self-adaptation poses is that when designing a self-adaptive system, we cannot assume that all adaptations are known in advance

Page 8: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 8Carlos J. P. Lucena © LES/PUC-Rio

Requirements – State of the Art 3

• Requirements engineering for self-adaptive systems must deal with uncertainty because the expectations on the environment frequently vary over time.

• For example, if a system is to respond to cyber-attacks, one cannot possibly know all attacks in advance since malicious actors develop new attack types all the time.

Page 9: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 9Carlos J. P. Lucena © LES/PUC-Rio

Requirements – State of the Art 4

• As a result, requirements for self-adaptive systems may involve degrees of uncertainty or may necessarily be specified as “incomplete".

• The requirements specification therefore should cope with:

– the incomplete information about the environment and the resulting incomplete information about the respective behaviour that the system should expose

– the evolution of the requirements at runtime

Page 10: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 10Carlos J. P. Lucena © LES/PUC-Rio

Requirements – Challenges 1

A New Requirements Language

• Traditionally, requirements documents make statements such as “the system shall do this".

• For self-adaptive systems, the prescriptive notion of “shall" needs to be relaxed and could, for example, be replaced with “the system may do this or it may do that" or “if the system cannot do this, then it should eventually do that."

• This idea leads to a new requirements vocabulary for self-adaptive systems that gives stakeholders the flexibility to account for uncertainty in their requirements documents.

Page 11: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 11Carlos J. P. Lucena © LES/PUC-Rio

Requirements – Challenges 3

Mapping to Architecture

• Given a new requirements language that explicitly handles uncertainty, it will be necessary to provide systematic methods for refining models in this language down to specific architectures that support runtime adaptation.

• One can imagine, therefore, a semi-automated process for mapping to architecture where heuristics and/or patterns are used to suggest architectural units corresponding to certain vocabulary terms in the requirements.

Page 12: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 12Carlos J. P. Lucena © LES/PUC-Rio

Requirements – Challenges 4

Managing Uncertainty

• In general, once we start introducing uncertainty into our software engineering processes, we must have a way of managing this uncertainty and the inevitable complexity associated with handling so many unknowns.

• Certain requirements will not change (i.e., invariants), whereas others will permit a degree of flexibility.– For example, a system cannot start out as a transport robot and self-

adapt into a robot chef!

• Allowing uncertainty levels when developing self-adaptive systems requires a trade of between flexibility and assurance such that the critical high-level goals of the application are always met.

Page 13: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 13Carlos J. P. Lucena © LES/PUC-Rio

Requirements – Challenges 6

Online Goal Refinement

• As in the case of design decisions that are eventually realized at runtime, new and more flexible requirement specifications would imply that the system should perform the RE processes at runtime, e.g. goal-refinement

Traceability from Requirements to Implementation

• New operators of a new RE specification language should be easily traceable down to architecture, design, and beyond. Furthermore, if the RE process is performed at runtime we need to assure that the final implementation or behaviour of the system matches the requirements.

Page 14: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 14Carlos J. P. Lucena © LES/PUC-Rio

Roadmap

• Requirements– state of the art

– research challenges

• Engineering– state of the art

– research challenges

Page 15: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 15Carlos J. P. Lucena © LES/PUC-Rio

Engineering: State of the Art & Feedback Loops

Preliminary consideration

• Any attempt to automate self-adaptive systems necessarily has to consider feed-back loops. We focus on the feed-back loop - a concept that is elevated to a first-class entity in control engineering - when engineering self-adaptive software systems.

Commonalities of self-adaptive systems

• What self-adaptive systems have in common is that design decisions are moved towards runtime and that the system reasons about its state and environment. The reasoning typically involves feedback processes with four key activities: collect, analyze, decide, and act

Page 16: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 16Carlos J. P. Lucena © LES/PUC-Rio

Figure 1: Activities of the control loop.

Page 17: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 17Carlos J. P. Lucena © LES/PUC-Rio

Example

• For example, keeping web services up and running for a long time requires:

– collecting of information that reflects the current state of the system,

– analysis of that information to diagnose performance problems or to detect failures, deciding how to resolve the problem (e.g., via dynamic load-balancing or healing),

– and acting to effect the made decision.

Page 18: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 18Carlos J. P. Lucena © LES/PUC-Rio

Engineering: Generic Control Loop 1

• When engineering a self-adaptive system, questions about these properties become important.

• The feedback cycle starts with the collection of relevant data from environmental sensors and other sources that reflect the current state of the system.

• Some of the engineering questions that need be answered are: How reliable is the sensor data?

Page 19: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 19Carlos J. P. Lucena © LES/PUC-Rio

Engineering: Generic Control Loop 2

• Next, the system analyzes the collected data.

• There are many approaches to structuring and reasoning about the raw data (e.g., using applicable models, theories, and rules).

• Some of the applicable questions here are: How is the current state of the system inferred? How much past state may be needed in the future? What data need to be archived for validation and verification?

Page 20: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 20Carlos J. P. Lucena © LES/PUC-Rio

Engineering: Generic Control Loop 3

• Next, a decision must be made about how to adapt the system in order to reach a desirable state.

• Approaches such as risk analysis can help to make a decision among various alternatives.

• Here, the important questions are: How is the future state of the system inferred? How is a decision reached (e.g., with off-line simulation or utility/goal functions)?

Page 21: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 21Carlos J. P. Lucena © LES/PUC-Rio

Engineering: Generic Control Loop 4

• Finally, to implement the decision, the system must act via available actuators and effectors.

• Important questions here are: When should and can the adaptation be safely performed? How do adjustments of different feedback loops interfere with each other? Do centralized or decentralized control help achieve the global goal?

• The above questions - and many others – regarding the control loop should be explicitly identified, recorded, and resolved during the development of the self-adaptive system.

Page 22: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

11/04/23 22Carlos J. P. Lucena © LES/PUC-Rio

Autonomic Computing

• Autonomic computing seeks to improve computing systems with a similar aim of decreasing human involvement.

• The term “autonomic” comes from biology.

– In the human body, the autonomic nervous system takes care of unconscious reflexes, that is, bodily functions that do not require our attention

• The term autonomic computing was first used by IBM in 2001 to describe computing systems that are said to be self-managing.

Page 23: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Autonomic Computing

• Autonomic computing aims at providing systems with self-management capabilities

– self-configuration (automatic configuration according to a specified policy)

– self-optimization (continuous performance monitoring)

– self-healing (detecting defects and failures, and taking corrective actions)

– self-protection (taking preventive measures and defending against malicious attacks)

Page 24: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Baldoíno Fonseca Neta

JAAF-*

11/04/23 @LES/PUC-Rio

24

Page 25: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF

• JAAF-S é um framework que basea-se na experiência adquirida durante o desenvolvimento do seu antecessor (JAAF 1.0) a fim de fornecer suporte ao desenvolvimento de agentes auto-adaptativos orientados a serviços.

• A principal diferença entre o JAAF-S e o JAAF 1.0 esta na adição de um conjunto de mecanismos para:

– Monitoramento;

– Descoberta;

– Seleção;

– Disponibilização de serviços em tempo de execução.

11/04/23 @LES/PUC-Rio

25

Page 26: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF 1.0

• Fornece mecanismos reutilizáveis para o desenvolvimento de agentes auto-adaptativos como uma extensão do JADE;

• Arquitetura baseada em Control-loop

– Collect

– Analyze

– Decision

– Effector

11/04/23 @LES/PUC-Rio

26

Page 27: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF 1.0: Hot-spots e Frozen-spots

11/04/23 @LES/PUC-Rio

27

• Agente (classe AdaptationAgent)

• Planos de Auto-Adaptação (classe AdaptationControlLoop)

• Atividades (classe Behaviour)

• Mecanismos de Raciocínio (interface IReasoningStrategy)

Page 28: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF 1.0: Diagrama de Classes

11/04/23 @LES/PUC-Rio

28

Page 29: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S

11/04/23 @LES/PUC-Rio

29

• É uma evolução do framework JAAF 1.0;

• Fornece mecanismos para o desenvolvimento de agentes capazes de realizar as seguintes tarefas relacionadas a Web Service (WS):

– Monitoramento;

– Detecção de falhas provenientes da sua execução;

– Descoberta de novos serviços WS capazes de solucionar tais falhas;

– Seleção do melhor dentre os vários descobertos;

– Notificações e configurações necessárias para disponibilização do WS selecionado.

Page 30: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Control-loop

11/04/23 @LES/PUC-Rio

30

• Collect

– Utiliza tecnologias para monitoramento de eventos e WS. Estrutura tais informações de forma que elas possam ser entendidas pelas atividades seguintes;

• Analyze

– Collect e utiliza um conjunto de mecanismos de raciocínio para detecção de problemas e descoberta de novos WS.

• Decision

– Seleciona serviço que melhor solucione os problemas que levaram à necessidade da auto-adaptação;

• Effector

– Realiza as notificações e configurações necessárias para disponibilização do serviço selecionado pela atividade Decision.

Page 31: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Diagrama de Classes

11/04/23 @LES/PUC-Rio

31

Page 32: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Diagrama de Classes

11/04/23 @LES/PUC-Rio

32

Page 33: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Analyze

11/04/23 @LES/PUC-Rio

33

Page 34: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Analyze

11/04/23 @LES/PUC-Rio

34

• Raciocínio Baseado em Regras (RBR)– Considere que a atividade Collect esteja monitorando um

determinado serviço e as seguintes informações são coletadas:

• (i) Número de falhas ocorridas durante a sua execução (representada pela variável serviceFailure);

• (ii) tempo de resposta (representada pela variável responseTime);

• (iii) autenticações realizadas com sucesso (representada pela variável authenticationErro).

Page 35: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Analyze

11/04/23 @LES/PUC-Rio

35

• Raciocínio Baseado em Regras (RBR)

R1: If serviceFailure > 0 Then Problem = “serviceFailure”

R2: If Problem!=“serviceFailure” AND responseTime > 10

Then Problem = “highResponseTime”

R3: If Problem!=“serviceFailure” AND authenticationErro == true Then Problem = “highResponseTime”

Page 36: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Analyze

11/04/23 @LES/PUC-Rio

36

• Raciocínio Baseado em Casos (RBC)– Similaridade entre Objetos

• O objetivo deste mecanismo é encontrar as experiências passadas mais similares com o problema atual. Para tanto, ele estende a API jColibri2, a fim de fazer uso dos algoritmo de similaridade local e global.

• Tais algoritmos são aplicados entre os dados coletados na atividade Collect, juntamente, com os problemas detectados a partir da aplicação do RBR, e o conjunto de casos (ou experiências passadas) recuperados a partir do banco de dados.

– Similaridade entre OWL-S• O objetivo do mecanismos em questão é verificar o nível de

similaridade entre as soluções enviadas pelo mecanismo anteriormente descrito e um conjunto de Profiles descrevendo serviços atualmente on-line.

Page 37: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Analyze

11/04/23 @LES/PUC-Rio

37

• Similaridade entre Objetos

Page 38: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Analyze

11/04/23 @LES/PUC-Rio

38

• Similaridade entre Profiles

Page 39: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Decision

11/04/23 @LES/PUC-Rio

39

Page 40: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Decision

11/04/23 @LES/PUC-Rio

40

• Função de Utilidade

– Avalia e seleciona cada serviço levando em consideração diferentes dimensões de qualidade como tempo de resposta, custo, performance, segurança, escalabilidade, etc.

– Exemplo:

• Serviço Pacote Viagem Nordeste Paraíso

– Possui tempo de resposta (t) médio, segurança (s) excelente e escalabilidade (e) médio, com utilidade ut(médio) = 0.5, us(excelente) = 1 e ue(médio) = 0.5, respectivamente.

– Considerando que o tempo de resposta tem peso wt =0.2, segurança ws = 0.4 e escalabilidade we = 0.4 a importância do serviço é calculada da seguinte forma:

– 0.2*0.5 + 0.4*1 + 0.4*0.5 = 0.7;

• Reputação

– Basea-se na reputação dos serviços para realizar a seleção.

Page 41: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Effector

11/04/23 @LES/PUC-Rio

41

Page 42: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Frozen-spots

11/04/23 @LES/PUC-Rio

42

• Um control-loop de auto-adaptação representado pela classe ControlLoop.

• Quatro atividades: Collect, Analyze, Decision e Effector.

• Um mecanismo para monitoramento de WS e outro para interceptação de eventos.

• Dois mecanismos de similaridade: – (i) Verifica similaridade entre objetos

– (ii) Verifica similaridade entre ontologias OWL-S.

• Dois mecanismos de seleção : – (i) Função de Utilidade

– (ii) Reputação;

• Três mecanismos relacionados a atividade Effector: – (i) realiza notificação de mudanças;

– (ii) realiza as configurações necessárias para disponibilização de novos serviços

– (iii) toma as ações necessárias para execução do serviço.

Page 43: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

JAAF-S: Hot-spots

11/04/23 @LES/PUC-Rio

43

• Planos de auto-adaptação (classe abstrata AdaptationConrolLoop)

• Atividades (classe abstrata Behaviour)

• Monitoramento (classe abstrata Monitor)

• Raciocínios (interface IReasoningStrategy)

• Técnicas para seleção de serviços (classe abstrata SelectionStrategy)

• Mecanismos para efetivação da solução (interface Iactuator)

Page 44: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Automated Support for Self-Adaptation in Multi-Agent Systems

Page 45: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Challenges on Support Self-Adaptation

• Adaptation policies prescribe a set of rules that guide the behavior of system components

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Policy P1 { Condition {

! Component.isLoadHigh() } Decision {

Component.helloWorld() }

Policy P1 { Condition {

! Component.isLoadHigh() } Decision {

Component.helloWorld() }

Policy P2 { Condition {

Component.isLoadHigh() } Decision {

Component.sendEmail("[email protected]", “Problem !!", "...")

}

Policy P2 { Condition {

Component.isLoadHigh() } Decision {

Component.sendEmail("[email protected]", “Problem !!", "...")

}

Page 46: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Challenges on Support Self-Adaptation

• Tight-coupling between application code and adaptation logic

1. Extensive effort to develop the adaptation action

1. Require significant development effort to explicitly model the numerous potential error states and recovery paths from an error state to a correct state

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Policy P2 { Condition {

Component.isLoadHigh() } Decision {

Component.sendEmail("[email protected]",”Problem !!", "...") }

Policy P2 { Condition {

Component.isLoadHigh() } Decision {

Component.sendEmail("[email protected]",”Problem !!", "...") }

Page 47: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Our Approach

• Feature model is the knowledge base that serves all steps of the control loop, instead of fixed adaptation polices

• Feature model defines all possible configurations of the underline system.

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

IDW NN PI

Interpolation

SplineVegetation Slope Rain

Factors

GeoRisc

CC = {f} | f ∈ FM ∧ f = 1 ∧ CC ⊆ FMCC = {f} | f ∈ FM ∧ f = 1 ∧ CC ⊆ FM

Page 48: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Approach Overview

• When a reconfiguration need emerge, we consider it as an

event e over a feature f ∈ FM, in a certain set of

conditions C , the multi-agent system derive an adaptation

action α.

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

e(f) ∧ C ⇒ α | α {∈ αh,αo,αc,αp }

α({Cps},{Cpd})

e(f) ∧ C ⇒ α | α {∈ αh,αo,αc,αp }

α({Cps},{Cpd})

Page 49: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Approach Overview

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

IDW NN PI

Interpolation

SplineVegetation Slope Rain

Factors

GeoRisc

Event

Adaptation Polices

Feature Model Reconfiguration

IDW NN PI

Interpolation

SplineVegetation Slope Rain

Factors

GeoRisc

Feature Model Adaptation Inference

Adaptation selection

Structural Constraint Validation

Derive aAdaptation Action

SystemReconfiguration

Interpolation Agent

Interpolation Agent

Runtime system

Architectural Models

Page 50: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Feature Model Operations

• RC takes an inconsistent feature model configuration ψi

and returns a set of valid feature model configuration

ψv.

• FL takes a feature model configuration ψ and a set of characteristic C as input and returns a set of valid

feature model configuration ψv that satisfies at the

same time all feature model constraints and the set of characteristics.

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

RC(ψi)={ψv}RC(ψi)={ψv}

FL(ψ,C) = {ψv}FL(ψ,C) = {ψv}

Page 51: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Feature Model Reconfiguration

• OT takes a set of objective functions O and a set of valid

feature model configuration ψc as input and returns a valid

feature model configurations ψo that better satisfies all

object functions.

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

OT({ψc},O) = ψoOT({ψc},O) = ψo

Page 52: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Deriving Adaptation Action

• The problem to find an adaptation action that reaches the requested adaptation is equivalent to find a valid reconfiguration of the feature model and compare it with the current configuration.

• Let DR denote a derivation operation

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

DR(ψv,Ma,Mo,Mc,CK) = {Cp} | Cp ⊆ MoDR(ψv,Ma,Mo,Mc,CK) = {Cp} | Cp ⊆ Mo

Page 53: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Deriving Adaptation Action

Healing

Optimization

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

αh(DR(RC(CC),Ma,Mo,Mc) – DR(CC,Ma,Mo,Mc),DR(CC,Ma,Mo,Mc) – DR(RC(CC),Ma,Mo,Mc))

αh(DR(RC(CC),Ma,Mo,Mc) – DR(CC,Ma,Mo,Mc),DR(CC,Ma,Mo,Mc) – DR(RC(CC),Ma,Mo,Mc))

αo(DR(OT({ψc},O),Ma,Mo,Mc) – DR(CC,Ma,Mo,Mc),DR(CC,Ma,Mo,Mc) – DR(OT({ψc},O),Ma,Mo,Mc))

αo(DR(OT({ψc},O),Ma,Mo,Mc) – DR(CC,Ma,Mo,Mc),DR(CC,Ma,Mo,Mc) – DR(OT({ψc},O),Ma,Mo,Mc))

Page 54: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Mapping Feature Model to CSP

• Based on Constraint Programming - Constraint Satisfaction Problem (CSP)

– Set of variables

– Set of constraints over those variables

• CSP for Feature Model

– Set of variables F representing the features in the feature

model

– Each configuration is a set of values for these variables

• fi = 1 (Selected) or fi = 0 (Deselected)

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Page 55: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Mapping Feature Model to CSP

• Configuration rules

– Set of constraints C associated with each variable f

• Optional Relation

– f1 f

• Or-relation

– f f1 v f2 v … fn

• Alternative Relation

– f fi | i [1..n] (f1 (¬f2^…^¬fn^f))^(f2 (¬f1^…^¬fn^f))^…^(fn (¬f1^…^¬fn-1^f))

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Page 56: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Mapping Models to CSP

• CSP for Domain-specific Architecture Models

– Set of variables A representing the element in the

architecture model

– Set of variables D representing the element in the

domain-specific architecture model

– Each configuration is a set of values for these variables

• di = 1 (Selected) or di = 0 (Deselected)

• ai = 1 (Selected) or ai = 0 (Deselected)

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Page 57: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Mapping Architectural Models to CSP

• Configuration Rules

– Set of constraints Cf for each variable d which have a feature expression associated

• Boolean Feature expression di

– Set of constraints Ca for each variable d which have architecture element associated

• di ai

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Page 58: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Working Example - GeoRisc

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Vegetation

Slope Rain

Factors

IDW NN PI

Interpolation

Spline

Preserved Forest

Degraded Forest

Plantation

Vegetation

Floodplain(...)

scale Scale Scale Scale

SM Generation Process

Variabilidades

Page 59: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Configuration Knowledge

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Page 60: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Working Example I - Self-healing

• Georisc Input Factors to be analyzed

– Different data sources

• File

• Data Base

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Slope

Factors

File DataBase

Rain

File DataBase

Vegetation

File DataBase

c:\\GeoRisco\\dados\\rain.shp jdbc:mysql://localhost/olis

... ... ... ...

Page 61: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Working Example I- Self-healing

@MBehaviour(ID="Rain",agentName="GeoRiscAgent")

public class Rain extends CyclicBehaviour {

private GeoRiscAgent geoRiscAgent;

@MResource

private String dataSource =

...

}

@MBehaviour(ID="Rain",agentName="GeoRiscAgent")

public class Rain extends CyclicBehaviour {

private GeoRiscAgent geoRiscAgent;

@MResource

private String dataSource =

...

}

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

MonitorMonitor AnalyzerAnalyzer

Data Source Failure

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Factors

Rain

File DataBasexFactors

Rain

File DataBase

Feature ModelReconfiguration

“file://c:\\GeoRisco\\dados\\rain.shp“;

Derive adaptation actions

Derive adaptation actions

“db://jdbc:mysql://localhost/olis“;

Failure(Rain)

Page 62: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Dynamic Binding Approach

Camila Nunes, Elder Cirilo e Ingrid Nunes © LES/PUC-Rio

Runtime Environment

OSGi

JADE

JVM

Management Server

FeatureModel

Multi-levelModels

KnowledgeKnowledge

ConfigurationModel

Page 63: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

References

• Software Engineering for Self-Adaptive Systems: A Research Road Map

– Betty H.C. Cheng, et. al.

• A survey of Autonomic Computing—Degrees, Models, and Applications

– MARKUS C. HUEBSCHER and JULIE A. McCANN

11/04/23 63Carlos J. P. Lucena © LES/PUC-Rio

Page 64: Software Engineering for Self-Adaptive Systems. Self-Adaptation The complexity of current software-based systems has led the software engineering community.

Software Engineering for Self-Adaptive Systems