Agent based Architecture for Modeling and Analysis of Self Adaptive Systems using Formal Methods

Self-adaptive systems (SAS) can modify their behavior during execution; this modification is done because of change in internal or external environment. The need for selfadaptive software systems has increased tremendously in last decade due to ever changing user requirements, improvement in technology and need for building software that reacts to user preferences. To build this type of software we need well establish models that have the flexibility to adjust to the new requirements and make sure that the adaptation is efficient and reliable. Feedback loop has proven to be very effective in modeling and developing SAS, these loops help the system to sense, analyze, plan, test and execute the adaptive behavior at runtime. Formal methods are well defined, rigorous and reliable mathematical techniques that can be effectively used to reason and specify behavior of SAS at design and run-time. Agents can play an important role in modeling SAS because they can work independently, with other agents and with environment as well. Using agents to perform individual steps in feedback loop and formalizing these agents using Petri nets will not only increase the reliability, but also, the adaptation can be performed efficiently for taking decisions at run time with increased confidence. In this paper, we propose a multi-agent framework to model self-adaptive systems using agent based modeling. This framework will help the researchers in implementation of SAS, which is more dependable, reliable, autonomic and flexible because of use of multi-agent based formal approach. Keywords—Formal methods; self-adaptive systems; agent based modeling; feedback loop; Petri nets


INTRODUCTION
As the complexity has increased, hence, existing approaches do not suffice the requirements of modeling, managing and developing software systems.This has motivated the research community to explore new dimensions in software engineering and integrate other fields like biology, psychology; nature inspired computing, robotics, artificial intelligence and more.The change in the way the software is used needs that it has the capability of self-adaptation [1] which is one of the hot areas of research since last decade.SAS [2] are capable of modifying their behavior due to change in environment at run time.Modeling of these types of systems is either very difficult or not possible by the use of conventional software engineering approaches.One of the major difference in requirement engineering is that the "shall" statements become "may" statements when developing a SAS that has the capability to adapt in accordance with the external environment [1].Uncertainty is one of the most certain thing in modeling and development of SAS.[2].This aspect motivates the practitioners and researchers to use multiple existing approaches or develop new approaches [3] to handle uncertainties of the system [4].
There has been a lot of research in SAS including software engineering, requirements engineering, software architectures, middleware, component-based development and programming languages [5].In addition to these some research has been done in other areas of Computer Science which includes faulttolerant computing, biologically inspired computing, multiagent systems, distributed artificial intelligence and robotics [6].
Formal methods are very effective and concrete mathematical techniques and methods in specifying, modeling, verifying and developing systems.Formal methods have been majorly applied in modeling of SAS [7].Application of formal methods for verification, model checking and theorem proving is less for SAS [8].To utilize the formal methods according to its strengths, there is a need to apply them in validation and verification [9] of SAS, this will consequently produce systems that are more reliable and tested [6] at an early stage of development [10].
Use of agents in modeling system [11] that have capacity and capability to adapt to a new behavior at runtime has been very effective and efficient [12].Agents [13] help the systems to perform all the tasks autonomously and efficiently, this increases the overall productivity of the system.We use agents to perform the tasks autonomously with well-defined and concrete rules which have been developed, analyzed and tested by use of formal methods.More specifically Petri nets will be used to model all these agents.
In this paper we propose an initial architecture of the system that will use the strengths and rigor of formal methods, autonomous working of agents and the effectiveness of feedback loop to model a self-adaptive system [14].This model will further be extended for distributed systems where most of the components will be reused with some additional components like distributed feedback loop manager, distributed agent manager and distributed application manager will be added.Fig. 1 depicts the scope of the work and the gives an idea of the proposed integration.This is an initial attempt to propose an architecture which integrates agents, formal methods and feedback loop.This paper is introduced in www.ijacsa.thesai.orgSection I, literature review is given in Section II, Section III introduces SAS, Section IV gives an overview of feedback loop, Section V elaborates formal methods, followed by the proposed architecture in Section VI, and finally we conclude the paper and give pointers to future work.

II. RELATED WORK
Life patterns have changed, consequently having a huge impact on working environment [15] and the way software is used in ever changing environment [4].Improvement in technology, change in working environment, improvement in technology, increase in storage capacity, need of high processing, and availability of variety of data is causing fundamental change in software development, testing and performance [8].This gives rise to systems that can adapt to the working environment; these systems are categorized as SAS.Development of SAS has increased the flexibility of software systems, however, this has also led increased the complexity of systems resulting in a lot of challenges [16] for software engineering community [4].Methods as well as processes of engineering software systems have also evolved for development of SAS [17].One of the major problems in the current approaches is that focus on quality of the output is much less [18] , this may be due to the variety of problems, uncertainty and changing environment [15] that had to be handled by SAS.Many model based approaches [19] have been proposed in literature which address the problem of requirement engineering in SAS .A context aware methodology is proposed in literature, this approach performs the adaption at run time considering the context, not only this but a complete mechanism of verification [20] and validation is also proposed, the focus of this work is done on the basis of image processing algorithms [21].Goal based [22] and requirement driven architecture [1] for systems are proposed in literature which can adapt themselves to a better configuration by monitoring and analyzing the current actors in the system [23].
Non-functional requirements play vital role in selfadaptive approach which takes information that is not easily identifiable and overwhelmingly against the static nature of information [24].Although, functional requirements are also important, but non-functional requirements have more infringement in software development and software quality assurance, using self-adaptive approach [20].One of the major problems in the current approaches is that focus on quality of the output is much less, this may be due to the variety of problems, uncertainty and changing environment [15] that had to be handled by SAS.Many model based approaches [25] have been proposed in literature which address the problem of requirement engineering in SAS.A context aware methodology which performs the adaption at run time considering the context, not only this but a complete mechanism of verification [20] and validation is also proposed.A lot of work has been done in identifying the key areas of research, challenges faced, architecture problems, design techniques available, implementation issues in engineering [26] of SAS [10].Many papers discuss the importance of adaption and propose architecture based adaptation [25], goal based adaptation [26], feature oriented adaptation [4], parameter based adaptation, requirement driven adaptation [1] and much more.Software agents have been used to model [27] and implement the adaptation process.
It has been observed that formal methods has mostly been used in modeling of SAS [7] and not in model checking and theorem proving which are major strengths of formal methods, hence, the need to apply formal methods for these is positively required to make the overall process of designing the SAS more reliable [6].A combination of formal and semi-formal methods is also used in modeling of SAS [8] and the results have been very encouraging [6].There have been a few studies where formal methods are used successfully in model checking [9] and domain specific languages [14] and design patterns [3] are proposed for development of SAS.

III. SELF-ADAPTIVE SYSTEMS
SAS can alter their behavior during operation [4].These systems fall under the category of context aware systems [28].Adjusting as per needs of the user at run-time is one of the major strength of these systems [29].The adaptations that these systems perform during executions are not included in the requirements for which these systems are developed [24].This variability makes the development of these systems challenging as the development team has to plan for the uncertainties that may arise at run time [30], [15].Hence, major part of the requirement engineering has to completed at run time [31].Not only the requirement engineering, but testing is also done at run time, all this is done by use of feedback loops [32].To enhance the efficiency and reliability of these systems, all these steps are performed autonomously by agents [33].
Almost all major systems that exist today have the capability of adaptation; however, in some systems the adaptations are planned at design time and in other it is done at run time.In case, the adaptations are implemented at design time, the systems are categorized as simple adaptive systems and when the adaptation is done at rum time, the systems are classified as self-adaptive [34].

IV. FORMAL METHODS
Formal methods are mathematical tools and techniques that are used in analysis and modeling of different hardware and software systems [35].Additionally they help us in www.ijacsa.thesai.orgvalidation and verification of systems at an early stage of development [9].These methods are reliable and help us in analyzing, modeling, reasoning and testing the systems.As these methods are based on concrete mathematical principles, hence the reliability of systems that are developed using formal methods is increased many folds [36].Strength of these methods is that they can be used in combination with existing software development methods.Most of these methods have specification languages that are based on first and second order predicate calculus, temporal logic, algebraic theory and graph theory.Sets, sequences, relations, functions, mappings and state machines are the foundation of formal modeling techniques.Due to the use of precise mathematical symbols the effective ness of these methods is much more than conventional methods.
Formal methods are supported by a variety of case tools which help in model development, model checking and simulating the overall scenario.We have successfully modeled a small self-adaptive system by use of Petri Net which is a formal method and is based on graph theory.The tools help in development of concrete model efficiently and reliably.Hence, formal methods are very effective in modeling of complex system like self-adaptive systems.These methods have already been successfully applied in development of many complex industrial systems and many safety critical systems.

V. FEEDBACK LOOP (MAPE-K LOOP)
Feedback loop comprises of four major steps which are monitor, analyze, plan and execute, this loop is also referred as MAPE-K Loop [6].Each phase is further divided in to further sub-phases and multiple strategies are used for design and implementation of each phase.Formal methods have the capability to model all phases with success and reliability.In the monitor phase the input is received from the external environment, and after performing the initial transformation of inputs it is checked against the existing requirements.In case a match is found, no adaptations are performed and the requirement is executed.However, if the set of input are new then analysis of inputs is performed which is followed by the planning and testing phase.It is to be noted that the possible adaptations, testing and execution is done at run time.The execution is executed by the system effectors.In a situation where the proposed adaptation is not successful, the loop starts again and this process continues iteratively [37] till a final adaptation is executed [14].A simplified version of MAPE-K feedback loop is shown in Fig. 2.

VI. PROPOSED ARCHITECTURE
We have proposed an architecture which not only focuses on performing the adaptation at run time but it also keeps a track of the results of adaptation when it is executed.As given in Fig. 3, the overall system is divided in to four major parts namely managed system, managing system, data collector and requirement pyramid.The top most part covers the input and output channels of the system and is classified as managed system in our architecture.Generally, input is given by sensors and is received by monitor agent.Monitor agent performs the transformation and converts the inputs in to a form that can be further analyzed.Another step that is performed by the monitor phase is to check the set of inputs against the existing knowledge.In case, the input from the environment matches any existing requirement, no adaptation is performed and the system acts according to the existing requirement.If the inputs do not match any of the existing requirements, then it is passed to the next phase, which analyzes the input according to the system goals, existing requirements, system objectives and overall preferences of the user.All this is available in the knowledge repository.Once the analysis is completed, all the data is forwarded to the next agent which is the plan, test and decide agent.Here the requirements are mapped to the nearest match, fuzzy rules are applied and possible adaptations are proposed.After formulating a few possible adaptations, these are tested on the criterion given in knowledge base, additionally; the capability of system effectors is also checked.For instance, an adaptation to take an aerial route to destination will fail the test for a car.Once the planning and testing is completed, one proposed adaptation is finalized and sent to the next agent which transforms the proposed execution in to the form that can be understood by the output channels.The process does www.ijacsa.thesai.orgnot end here, the data collector agent continuously monitors the managed system during its execution and results of execution are recorded.We may have two possible scenarios here, either the proposed adaptation has been successful or it has ended up in failure.In both cases the data is recorded and knowledge base is updated with a flag of success or failure, the successful adaptation is also recorded in the variable requirement part.In case of failure, the process is repeated iteratively till a final goal is achieved.This is kept for future enhancement in system and to make sure that all capabilities of system are available in the requirement set of the system.
An important contribution of this work that the system is designed in way that performs the adaptation at run-time, monitors the quality of output produced by the proposed adaptation and regular update of the knowledge and requirement base.All these modules will be analyzed, modeled and verified using formal methods.

VII. CONCLUSION AND FUTURE WORK
This research has two major contributions, firstly we have proposed an integration of formal methods, agent based modeling and SAS for successfully analyzing, testing and implementing the systems that have the capability to adapt at run time.Secondly, an overall architecture of the complete system is given, which includes four major components.It is to be noted that we have successfully modeled the first phase using Petri Nets, the results have been very encouraging and the complete system will be analyzed, modeled, simulated, verified and tested by using formal methods.The given architecture gives a concrete base for the researchers and practitioners to implement systems that have the capability to adapt during execution.This is the first step toward development of a multi-agent autonomous formal model for self-adaptive system.We have successfully applied Petri nets to model feedback loop [12] and the work will be extend for a complete model for SAS using formal methods.This architecture will be further be extended for distributed systems where the variability of inputs in more and there are multiple feedback loops at each node.Further, each agent will be implemented and the task will be further sub divided in to multiple agents where each agent will be designed to perform an atomic task.