Cognitively-inspired Agent-based Service Composition for Mobile & Pervasive Computing
CCognitively-inspired Agent-based ServiceComposition for Mobile & Pervasive Computing
Oscar J. Romero − − − Carnegie Mellon University, Pittsburgh OA 15213, USA, [email protected] , Abstract.
Automatic service composition in mobile and pervasive com-puting faces many challenges due to the complex and highly dynamicnature of the environment. Common approaches consider service com-position as a decision problem whose solution is usually addressed fromoptimization perspectives which are not feasible in practice due to the in-tractability of the problem, limited computational resources of smart de-vices, service host’s mobility, and time constraints to tailor compositionplans. Thus, our main contribution is the development of a cognitively-inspired agent-based service composition model focused on bounded ra-tionality rather than optimality, which allows the system to compensatefor limited resources by selectively filtering out continuous streams ofdata. Our approach exhibits features such as distributedness, modular-ity, emergent global functionality, and robustness, which endow it withcapabilities to perform decentralized service composition by orchestrat-ing manifold service providers and conflicting goals from multiple users.The evaluation of our approach shows promising results when comparedagainst state-of-the-art service composition models.
Keywords:
Service composition, Pervasive Middleware, Cognition
In Mobile and Pervasive Computing (MPC), a
Service can be defined as anyhardware or software functionality (resources, data or computation) of a smartdevice that can be requested by other devices for usage [18].
Service composi-tion refers to the technique of creating composite services by the aggregationof atomic, simpler and easily executable services. Despite the existence of MPCmiddleware for automatic service composition [9, 10, 18, 24], there are still somechallenges that need to be tackled, as we illustrate in the next example:
Alice and Bob are planning to have a theme party at their home next weekend(high-level goal), so they need to coordinate some tasks among them. To achievethis goal, they interact with a user application (e.g., a personal assistant [25],a chatbot [28], etc.) connected to a MPC middleware installed on their mo-bile and wearable devices (e.g., smartphones, smartwatches, tablets, etc.), whichact as Service Providers. The high-level goal, which will lead to the creationof a composite service, may be decomposed into 3 sub-goals: buy-food, buy-beer, a r X i v : . [ c s . S E ] M a y nd buy-home-decoration. There is also a set of atomic services that are hostedby service providers: get-location, find-place, calculate-distance, who-is-nearer,share-shopping-list, go-to-place. Now, each sub-goal is accomplished by the com-position of a sequence of services, e.g.: buy-food = { get-location(user) → find-place(supermarket) → calculate-distance(user, supermarket) → who-is-nearer(market, users) → share-shopping-list(users) → go-to-place(user, market) } . Given the previous example we focus on five challenges, so service compo-sition should: (1) consider preferences from multiple users; (2) coordinate theinteraction between services hosted by different service providers; (3) considerresource scarcity in smart devices [21]; (4) perform dynamic adaptation to un-predictable changes occurring in the environment; (5) deal with both short-termand long-term user’s goals. Performing service composition while taking intoaccount a myriad of variable factors as described above (e.g., users, services,service providers, QoS values, context, etc.), makes the problem become in-tractable even for approaches that use dynamic composition. The main issuewith these approaches is that they propose solutions focused on optimality (e.g,graph-, rule-, and workflow-based solutions), which do no consider limitationsimposed by the decision-making process (specially on smart devices), revealingtheir inability to process and compute the expected utility of every alternativeaction when variable factors grow in size (combinatorial explosion). Therefore,we propose a cognitively-inspired approach based on bounded rationality, whichcenters on the fact that perfectly rational decisions are often not feasible inpractice because of the intractability of the problem, the limited computationalresources, and time constraints; instead, our approach seeks satisfactory solu-tions rather than optimal ones. Thus, our main contributions are twofold: (1)We propose
COPERNIC , a cognitively-inspired agent-based service compositionmiddleware, as a first approach to addressing the five challenges described above(i.e., multiple users, decentralized coordination, and inexpensive, dynamic, andlong-short term composition) using a bounded rationality approach; and (2) Wedevelop a prototype of
COPERNIC and evaluate its performance against tostate-of-the-art service composition models. This paper is organized as follows:Section 2 outlines the system architecture. Section 3 details our approach, andSection 4 reports the experimental results. Sections 5 and 6 presents the relatedwork and the conclusions, respectively.
As considered in the literature [3], we distinguish two types of services: abstract and concrete services. Formally, a concrete service cs i is a tuple (cid:104) cs ini , cs outi ,cs preci , cs postci , cs QoSi , cs ctxi (cid:105) that performs a functionality by acting on inputdata ( cs ini ) to produce output data ( cs outi ), with pre-conditions ( cs preci ), post-conditions ( cs postci ), Quality of Service requirements ( cs QoSi ), and contextual in-formation. An abstract service as i is a tuple (cid:104) as prei , as posti , as csi (cid:105) realized by sev-eral concrete services that offer the same functionality ( as csi ∈ { cs ( i, , cs ( i, , ...,cs ( i,n ) } ) with preconditions ( as prei ) and postconditions ( as posti ) such that ∀ cs ( i,j ) ,cs ( i,k ) ∈ as csi / ( as prei = cs pre ( i,j ) ∩ cs pre ( i,k ) ) ∧ ( as posti = cs post ( i,j ) ∩ cs post ( i,k ) ). ser Applica,ons COPERNIC COGNITIVE AGENT COPERNIC MIDDLEWARE
Hardware Sensors and Services
SMART DEVICE
Percep,on Working Memory Declara,ve Memories Selec,ve A Episodic Seman,c as as as as as as as as Cs Cs Cs Cs Cs Cs Cs i.j Cs i.j Cs i.j Cs Cs i.j Cs i.j Cs i.j Cs i.j 1 User requests S e n s o r y i npu t s 1 Percepts P = {p … p n } 2 Cue (P) Retrieved D = {d … d n } 4 Filtering (Service Matching) W = {w … w n } 3 5 6 Service Coali,ons A = {as … as n } C ={cs … cs n } S e r v i c e D i s c o v e r y & E x e c u , o n Fig. 1. COPERNIC ’s overall Architecture (Single Device). The white cone illustrateshow a continuous stream of data is filtered out so only the most relevant elements areretained for the composition while the others are either discarded or put on hold untilthey receive more activation to become participants. Figure 1 depicts the overall architecture of COPERNIC , though it is worthnoting that it does not reflect yet the distributed nature of our model. The COPERNIC Agent is a cognitive module inspired by architectural principlesdefined by the Common Model of Cognition (CMC) [13, 20], a computationalmodel that captures a consensus about the structures and processes that aresimilar to those found in human cognition. Next, we briefly describe COPER-NIC ’s pipeline (Figure 1) and its realization on the CMC model. In Step 1 ,the Perception module makes sense of the agent’s current state by processingboth external (e.g., user requests) and internal (i.e., signals from other modules)sensory inputs, categorizing that information, and recognizing situations wherea set of abstract services may be triggered. In Step 2 , the Perception moduleoutputs a set of symbolic structures (percepts) that are stored in a WorkingMemory (WM) for further processing as abstract service inputs. In Step 3 , theWM cues the declarative memories (i.e., Episodic Memory that retrieves in-formation about historic performance of services, context, etc., and SemanticMemory that retrieves service definitions, user preferences, etc.) and stores localassociations in Step 4 . In Step 5 , the content of the WM is filtered out by theattention mechanism so the agent only focuses on the most relevant informationneeded for matching abstract services. In Step 6 , goals are decomposed and ab-stract services compete and cooperate (creating coalitions) among them in orderto get the focus of attention. In Step 7 , the Procedural Memory executes a set ofheuristics to dynamically bind abstract services to concrete services by validatingthe QoS requirements. In Step 8 , the Action Selection chooses the most appro-priate action to execute a concrete service using discovery protocols adapted tothe heterogeneous nature of the environment (the process is repeated until allub-goals are satisfied). In Step 9 , service’s output is returned to the application.Unlike traditional approaches that create uPFRont composition plans which areprone to inadaptability, in our approach, plans emerge from the interaction ofcascading sequences of cognitive cycles corresponding to perception-actionloops (steps 1-8) where compositional conditions are validated in every cycle.This contribution allows service composition to be reactive, robust, and adap-tive to dynamic changes while composition plans are generated on-the-fly byusing minimal resources as a result of filtering out a continuous stream of data. A. Perception The perception module defines a set of feature detectors in charge of detect-ing and classifying the sensory inputs, i.e., there are different feature detectorsto identify external stimuli (i.e., user requests) and internal stimuli (i.e., user’scontext, physical context – sensor readings, and service QoS). Feature detectorscreate percepts , units of perceived information with a symbolic representation(key-value pairs, e.g., P R is a set of premises such that as pre ∪ cs pre ⊆ P R . B. Short-term Working Memory (WM) WM holds previous percepts not yet decayed away, and local associationsfrom declarative memories that are combined with the percepts to understandthe current state of the composition. Information written in the WM may reap-pear in different cognitive cycles until it fades away. To that purpose, WM de-fines a limited storage capacity (default: 7 units [16]) and a recency-based decayfunction that keeps active a limited number of units, expressed as a base-levelactivation function [2]: B wi = iB wi + (cid:80) nl =1 t − dl , where i is a WM unit ( w i ), l isthe l th setting of w i , t l is the time since l th unit was presented, iB wi is the initialvalue of activation, and d is a decay parameter that reflects differences in WMunits volatility, e.g., dynamic changes on user context happen more often thanchanges on user preferences , so the former should have a higher decay value,whereas the latter should have a lower one, which makes user context obsoletequicker than user preferences. If B wi is above a threshold ( B wi > t w ) then w i willbe used as an input for service matching, i.e., w i ⊆ ( as pre ∪ cs pre ) ⊆ P R . C. Long-term Episodic Memory (EM) EM is a content-address-able associative memory that records temporal se-quences of user and system events. COPERNIC defines 3 types of EM: (1) UserM that stores user past actions (e.g., Bob searched for nearby beer shops af-ter doing the shopping); (2) Service Provide EM that stores historic data ofservice and service provider performance (efficiency, reliability, QoS, reputation,failures, etc.); and (3) Network EM that stores neighboring updates, networkhops, etc. Any unit written to the WM cues a retrieval from EM, returningprior activity associated with the current entry. We used a Sparse DistributedMemory (SDM) [11], a high-dimensional space that mimics a human neural net-work. SDM is lightweight, random (it retrieves service associations in equal timefrom any location), content-addressable (it finds complete contents using contentportions), and associative (it finds contents similar to a cue). D. Long-term Semantic Memory (SM) SM is intended to capture the meaning of concepts and facts about: (1) ser-vice descriptions; (2) the world (e.g., Based on Posner’s theory of attention [15], our SA filters out a continuousstream of content from WM while carrying out three attentional functions: (1)maintaining an alert state (e.g., SA gives priority to salient information like con-text and QoS); (2) focusing agent’s senses on the required information (e.g., todiscover get-location service and bring it into composition, SA needs to focuson changes on GPS readings); and (3) the ability to manage attention towardsgoals and planning (e.g., SA focuses on the high-level goal “plan a party athome” and its corresponding sub-goals). SA uses a Behavior Network (BN) [14],a hybrid system that integrates both a connectionist computational model and asymbolic, structured representation. BN defines a collection of behaviors (nodes)that compete and cooperate among them (through spreading activation dynam-ics) in order to get the focus of attention. In COPERNIC , each behavior mapsto a single abstract service as , and “service discovering/matching” is modeledas an emergent property of activation / inhibition dynamics among all abstractservices. Revisiting the formal definition of an abstract service as i , we have theuple: (cid:104) as prei , as addi , as deli , as αi (cid:105) , where as prei is a list of preconditions that have tobe true before the service becomes active, as addi and as deli represent the expected(positive and negative) postconditions of the service in terms of an “add” anda “delete” lists, and as αi is the level of activation. If a WM unit w i is in as prei then there is an active link from w i to as i . If the goal g (i.e., a user request orany sub-goal stored in WM) is in as addi then there is an active link from g to as i . There is a successor link from service as i to service as j for every WM unitsuch that w i ∈ as addi ∩ as prej . A predecessor link from as j to as i exists for everysuccessor link from as i to as j . There is a conflicter link from as i to as j for everyWM unit such that w i ∈ as delj ∩ as prei . Additionally, the model defines five globalparameters that can be used to tune the global behavior of the network: π is themean level of activation, θ is the threshold for becoming active, φ is the amountof activation energy a WM unit injects into the network, γ is the amount ofenergy a goal injects into the network, and δ is the amount of activation energya protected goal takes away from the network. These global parameters makeit possible to mediate smoothly between service selection criteria, such as trad-ing off goal-orientedness for situation-orientedness, adaptivity for inertia, anddeliberation for reactivity (see Listing 1.1). input: a set of WM units W , a set of goals G , cognitive cycle t output: selected abstract service ASA := set of registered abstract services // A = { as ...as n } M j := nil // ∀ as ∈ A, j ∈ W | M j = (cid:80) ni =1 as prei ∩ j ) X j := nil // ∀ as ∈ A, j ∈ W | X j = (cid:80) ni =1 as addi ∩ j ) U j := nill // ∀ as ∈ A, j ∈ W | U j = (cid:80) ni =1 as deli ∩ j ) for each abstract service as i in A do: AW ( i,t ) := (cid:80) j φ · (1 /M j ) · (1 / as prei )) //compute activation from current WM state ( AW ) AG ( i,t ) := (cid:80) j γ · (1 /X j ) · (1 / as addi )) //compute activation from goals ( AG ). T G ( i,t ) := (cid:80) j δ · (1 /U j ) · (1 / as deli )) //take activation away from achieved goals ( T G ) BW ( i,t ) := (cid:80) j as α ( t − i · (1 /X j ) · (1 / as addi )) //spread activation energy backward ( BW ) F W ( i,t ) := (cid:80) j as α ( t − i · ( φ/γ ) · (1 /X j ) · (1 / as addi )) ) //spread activation energy forward as ( i,t ) .act := EW ( i,t ) + EG ( i,t ) − T G ( i,t ) + BW ( i,t ) ) + F W ( i,t ) //total activation for as i end forreturn AS := max act ( A ) Listing 1.1. Pseudocode for the Spreading Activation Dynamics of COPERNIC ’sAttentional Mechanism (see Section F.) F. Procedural Memory (PM) PM defines a set of heuristics (in the form of productions) to: 1) discover andmatch concrete services based on contextual information and QoS attributes;and 2) adjust the BN parameters in order to make the global behavior be moreadaptive (i.e., deliberative vs. reactive, goal-oriented vs. situation-oriented, etc.)depending on the task requirements. Suppose there are two concrete servicesassociated to ”get-location” abstract service (e.g., Bob’s phone hosts cs p andBob’s smartwatch hosts cs w ), and each concrete service has 2 QoS features: ac-curacy and latency. The accuracy of cs p is better since it uses fused locationalgorithms and its GPS sensor provides more precise readings, but its latencyis higher than cs w , so at a given moment, a heuristic production might preferto match cs w , even if this is not as accurate as cs p , just because it can delivera faster response during time-sensitive compositions. Regarding tuning BN pa-ameters, PM applies the following heuristics [19] to keep the balance between:(1) goal-orientedness vs. situation-orientedness, γ > φ ; (2) deliberation vs. reac-tivity, φ > γ ∧ φ > θ ; (3) bias towards ongoing plan vs. adaptivity, φ > π > γ ;and (4) to preserve sensitivity to goal conflict, δ > γ . The corresponding valuesare dynamically adapted over time and using a reinforcement learning mecha-nism based on the heuristic utility. Utility learning for a heuristic i after its n thusage is: U i ( n ) = U i ( n − 1) + α [ R i ( n ) − U i ( n − (cid:15) , where α is the learningrate (default [2]: 0.2), R i ( n ) is the effective reward value given to heuristic i forits n th usage, (cid:15) is a temperature (level of randomness) that is decreased overtime, i.e., (cid:15) = 1 /e ( n/k ) , k = 0 . 35 (determined empirically [2]). G. Action Selection (AS) AS processes different kind of actions: (1) internal actions such as goal setting(it adds new goals to both the WM and SA modules); and (2) external actionssuch as triggering a device’s effector/actuator, and invoking the discovery mech-anism to look up a concrete service and then execute it. AS uses a schedulermechanism to sort (by priority) and execute actions in the future. H. Cognitive Cycle In mapping to human behavior [13], COPERNIC ’s cognitive cycles operateat roughly 50 ms, although the actions that they trigger can take significantlylonger to execute. A cognitive cycle starts with sensing and usually ends withselection of an internal or external action. The cognitive cycle is conceived as anactive process that allows interactions between the different components of thearchitecture. Deliberation, reasoning, and generation of plans in COPERNIC take place over multiple cascading cognitive cycles in the current situation (i.e.,multiple overlapping cycles iterating at an asynchronous rate, see Listing 1.2). input: set of sensory inputs SI , set of user goals G output: selected concrete service CSP := nil //set of salient percepts ( P = { p ..p n } ) W := nil //set of active units in the WM ( W = { w ..w n } ) D := nil //set of retrieved declarative units ( D = { d ..d n } ) A := set of registered abstract services ( A = { as ..as n } ) C := set of registered concrete services ( C = { cs ..cs n } ) R := nil //set of resulting actionswhile remaining goals G > do: //cognitive cycle iP i := detect, classify and temporarily store SI and GW i := add salient percepts to WM ( W i = W ( i − ∪ P i ) D i := cue and retrieve declarative memories using the content of WM W i := add declarative units to WM ( W i = W i ∪ D i ) W i := decay and filter WM units ( W i = W d , where W d ⊆ W i ) A i := focus attention and do service matching ( A i = W i ∩ A pre ) C i := apply heuristics (PM) and select concrete service candidates ( Ci = A i ∩ QoS ) CS := select a concrete service R i := wrap CS execution as an action and add it to the set of actions a := prioritize actions R i and pick the most relevantif a is of type ‘‘service-execution’’ then execute concrete service’s action a.CS else execute internal actionend while Listing 1.2. Pseudocode for COPERNIC’s Cognitive Cycle (see Figure 1) I. Session Management This module manages shared sessions across multiple user’s Devices (serviceproviders). A running instance of COPERNIC is hosted by each device. Us-ng proximity discovery protocols, devices are grouped by physical nearness into Groups . For instance, on Figure 2, Group “bob-with-me” represents the devicesthat Bob carries with him whereas “bob-home” represents a Group of devices atBob’s home. Groups belonging to the same user are logically grouped into Ses-sions , where each Session guarantees that multiple ubiquitous devices can shareinformation and collaborate in a distributed, inexpensive and robust fashion. MANET 2 GID: bob-home (Bob’s remote devices) MANET 3 GID: alice-with-me (Alice’s local devices) MANET 1 GID: bob-with-me (Bob’s local devices) SID: bob-1234 SID: alice-1234 Smartwatch DID: b3 S Smartphone DID: b1 S , S Tablet DID: b2 S , S Laptop DID: b4 S Smartphone DID: a1 S , S Smartwatch DID: a2 S , S = Local Active CM Server ID: server S , S = Global CM = Local Passive CM Fig. 2. Infrastructure-less MPC Environment. COPERNIC agents are distributedacross different local networks (MANET) and collaborate during composition. DID:Device ID, GID: Group ID, SID: Session ID, S ..S n : Services. J. Service Management Service management (i.e., service discovery, service coordination, and man-agement of the information flow between service components) is performed by a Composition Manager (CM). Service management tasks are distributed on an as-needed basis among multiple Composition Managers (CMs) in both infrastructure-based and infrastructure-less networks. Unlike traditional approaches, wheretransferring the control from one CM to another does not consider fatal failuresthat prevent such transference, our approach is based on a Binary Star patternthat serves for primary-backup node failover. That is, COPERNIC chooses twoCMs per Group, one works in active mode while the other one in passive mode.Both active and passive CMs monitor each other and if the active CM disappearsfrom the network, then the passive one will take over as active CM and senda request for another device to join as a passive CM. Using a ranking functionbased on four levels of device capabilities, as show in Table 1, COPERNIC isable to determine which devices will be the active and passive CMs, that is: R cm = P ri cm × P er cm , where R is the ranking of CM cm , P ri is a level-basedpriority function (i.e., Level-0 = 0... Level-3 = 3), and P er is a CM performancefunction based on composition completeness, composition time, etc.It is worth noting that only Level-3 can perform global cross-session compo-sitions (i.e., involving multiple users and sessions), though Level-2 and Level-1 able 1. Composition Manager Levels Feature Level-0 Level-1 Level-2 Level-3 COPERNIC Version Minimal Lightweight Full FullResources (CPU, memory) Scarse Limited Rich RichCan act as CM? NO YES YES YESCross-session composition? NO NO NO YESExample devices Sensors Wearables Smartphone, Laptop PC, server can still perform local compositions (i.e., within a group) so the whole compo-sition task is distributed among multiple CMs, as shown in Fig. 2. Each LocalCM tailors a partial composition plan that satisfies the needs of its user by usinglocal resources and services; then a Global CM, which can see the whole picture,receives as inputs partial plans from Local CMs and makes “good enough” de-cisions using the available information. By good enough we mean that, ratherthan trying to look for an optimized solution, CMs exploit opportunities thatcontribute to the ongoing goal/plan while adapting to unpredictable changingsituations. Fig. 3 illustrates how CMs make good enough decisions as a result ofthe spreading activation dynamics coordinated by COPERNIC cognitive agents. S e r v i c e ' s A c + v a + o n L e v e l Cogni+ve Cycles get-loca1on find-supermarket calc-dist-supermarket go-to-supermarket find-beer-shop calc-dist-beer-shop go-to-beer-shop threshold 1 2 3 4 5 8 9 10 11 (a) Alice’s Local CM S e r v i c e ' s A c + v a + o n L e v e l Cogni+ve Cycles get-loca1on find-supermarket calc-dist-supermarket go-to-supermarket find-beer-shop calc-dist-beer-shop go-to-beer-shop threshold 1 2 3 4 5 10 11 (b) Bob’s Local CM 7 13 S e r v i c e ' s A c + v a + o n L e v e l Cogni+ve Cycles bob-go-to-supermarket bob-go-to-beer-shop alice-go-to-supermarket alice-go-to-beer-shop 6 7 13 14 (c) Global CM n n Service execuBon Service nominaBon a) Bob's Local CM. b) Alice's Local CM. c) Global CM. Two sub-goals (buy-food and buy-beer) need to be coordinated between Alice and Bob, so the corresponding Local CMs tailor a parBal composiBon plan for each user to determine the closest distance to both a supermarket and a beer shop (service execuBons (SvEx) 1-5 on the chart). SvEx 6, 7, 13 and 14 require cross-session coordinaBon, so the Global CM receives the parBal composiBon plans from Local CMs and makes a decision based on the highest accumulated acBvaBon of each nominated service. Since Alice is closer to a supermarket, \middleware suggests her go there, while suggesBng Bob go to the beer shop (SvEx 6 and 7 respecBvely). At cogniBve cycle 30, Alice starts walking and her locaBon changes, while Bob receives on his phone a discount coupon from a supermarket near him (unpredictable condiBon). It is important to see how aWer cogniBve cycle 30, the services' acBvaBon levels reacBvely adapt to reflect the changes in the current situaBon (SvEx 8-12). This Bme, \middleware behaves opportunisBcally and suggests Bob go to the supermarket and Alice go to a nearby beer shop (SvEx 13 and 14). Re-planning is inexpensive thanks to: (a) it does not start a new plan from scratch but it uses the results stored in WM from previously acBvated services and modify the plan from there; and (b) the cumulaBve effect of both forward and backward spreading acBvaBon helps service execuBon trigger faster Fig. 3. Spreading Activation Dynamics for the example described in Section 1 A. Experimental Setup We implemented the dynamic composition overlay on the NS-3 simulatorusing the experimental settings on table 2. We compared COPERNIC againsttwo state-of-the-art decentralized service composition models: GoCoMo, a goal-driven service model based on a decentralized heuristic backward-chaining plan-ning algorithm [5]; and CoopC, a decentralized cooperative discovery model thatemploys a backward goal-driven service query and forward service constructionmechanism but does not support runtime composite service adaptation [8]. Werun 2 different experiments and measured the composition efficiency using 4 dif-ferent metrics: composition time ( CT in seconds), average memory usage of allservice providers involved in the composition ( MU in Kb), a planning failurerate ( PFR ) calculated as the ratio of the number of failed planning processesto the number of all the issued requests during the simulation cycles, and theexecution failure rate ( EFR ) computed as the ratio of the number of failedexecutions to the number of all the successful plans. able 2. Experimental Settings Setting Value Number users (1 goal/user) 1, 2Service density ( SD-S ): 20, medium ( SD-M ): 40, dense ( SD-D ): 60Composition Length 5 services ( CL-5 ), 10 services ( CL-10 )Node Mobility slow ( M-S ): 0-2m/s, medium ( M-M ): 2-8m/s, fast ( M-F ): 8-13m/sNumber of Services Abstract: 10, Concrete: 40 (4 per abstract service)Communication range 250 mSem. matchmaking delay 0.2 (s) [5]Sample per experiment 100 runsNode movement Random walking Monte Carlo modelPre/post-cond per service Random (1-4) B. Flexibility of Service Composition This scenario evaluates the flexibility of COPERNIC , GoCoMo, and CoopCduring the generation of service composites while varying node mobility, servicedensity, and service complexity (composition length). This scenario uses theconfiguration presented in table 2 and only one user. The experimental resultsare shown in table 3 (blue and red cells are the best and worst measurements foreach category, respectively). Overall, GoCoMo got the lowest failure rates (PFR),followed by COPERNIC and then by CoopC, though COPERNIC ’s compositiontime (CT) and memory usage (MU) were the lowest in comparison to the othertwo approaches. In particular, GoCoMo got a lower failure rate (12 - 38%) than COPERNIC when the mobility was slow. This difference dropped to 7 - 13%in fast-mobility high-density scenarios thanks to COPERNIC is less sensitiveto mobility changes because the information about participant services is storedin the WM and gradually fades away, so when, for instance, a service providerdisappears and reappears later in time, the probability that this service provideris still in the WM is high (due to its activation may have not decayed entirely),so it will be able to promptly participate again in the composition withoutproducing significant planning failures. In comparison with CoopC, COPERNIC got 12 - 25% less failures due to CoopC’s does not support runtime adaptationand poorly handles mobility and density changes. Regarding composition time, COPERNIC tailored composite services up to 42% faster than GoCoMo and upto 71% faster than CoopC; and it used up to 72% less memory than GoCoMo andup to 84% less memory than CoopC. The reason for this significant reduction incomposition time and resource consumption is that COPERNIC is continuouslyfiltering out the stream of incoming information (sensory stimuli), which keepsit into reasonable margins of resources usage, despite of the dynamism of theenvironment. It is worth noting that COPERNIC did not show a significantdifference in memory usage when using a composition length of either 5 or 10services (-4% - 11%) in comparison with GoCoMo (60% - 190%) and CoopC(157% - 201%), which suggests that our approach could be smoothly scaled up. C. Adaptability of Service Composition In this scenario we simulated 2 users with one goal each. Then, in the middleof the composition users switched their goals (switch point). We measured theability (in terms of planning and executing failure rates) of both COPERNIC and GoCoMo to adapt to the new situation and replan a different compositeservice for both users while using different settings for mobility, density, and able 3. Flexibility of Service Composition M-S M-M M-FSD-S SD-M SD-D SD-S SD-M SD-D SD-S SD-M SD-DCOPERNIC CL-5 PFR (%)CT (sec)MU (Kb) CL-10 PFR (%)CT (sec)MU (Kb) GoCoMo CL-5 PFR (%)CT (sec)MU (Kb) CL-10 PFR (%)CT (sec)MU (Kb) CoopC CL-5 PFR (%)CT (sec)MU (Kb) CL-10 PFR (%)CT (sec)MU (Kb) composition length. In this experiment we did not consider CoopC due to itcannot perform runtime service composition adaptation. Also, for the sake ofsimplicity, we only used a composition length of 5 services. Since GoCoMo lacksboth multi-goal and multi-user composition processing, we had to run simulta-neously 2 instances of GoCoMo with one goal each, and then switched the goalsat the specific switch point. The individual measurements of both instances wereadded up, this makes GoCoMo more comparable against COPERNIC . In orderto demonstrate the adaptability of COPERNIC , we used two different config-urations for its attentional mechanism. A configuration is defined as a tuple ofvalues corresponding to the Behavior Network’s parameters described in Section4.E, such that C i = (cid:104) θ i , π i , φ i , γ i , δ i (cid:105) . Configuration C uses the default valuesfor the attentional mechanism: C = (cid:104) , , , , (cid:105) , while configuration C uses values discovered by the utility learning mechanism (described in Section4.F) after 100 test runs: C = (cid:104) , , , , (cid:105) . Results are presented in table 4. Table 4. Adaptability of Service Composition M-S M-M M-FSD-S SD-M SD-D SD-S SD-M SD-D SD-S SD-M SD-DCOPERNIC - C1 PFR (%)EFR (%)CT (sec)MU (Kb) COPERNIC - C2 PFR (%)EFR (%)CT (sec)MU (Kb) GoCoMo PFR (%)EFR (%)CT (sec)MU (Kb) Despite the fact that GoCoMo had lower planning failure rates than COPER-NIC (12% - 42% and 2% - 11% in comparison with C and C respectively), thememory required by it to complete the compositions was considerable higher (upto 5.7 times higher) than both configurations of COPERNIC . One of the mainreasons for this significant divergence in memory usage is that GoCoMo’s ser-vice discovery mechanism uses a cache to store the progress of resolving split-joinontrols for parallel service flows, which results in resource-intensive processescreating multiple potential execution branches. On the contrary, COPERNIC does not keep a record of multiple execution branches and does not store inmemory different workflows for each fork of the plan; it keeps in memory onlyone single plan that is created on-the-fly, that is, when goals or sensory stimuli(internal signals and user requests) change then it adapts to the new situationby spreading more activation to those nodes (e.g., perception, WM, and at-tentional nodes) that should participate in the new plan, which becomes moreattractive than the current plan. Additionally, COPERNIC does not replan atevery time step. The “history” of the spreading activation also plays a role inthe service selection since the activation levels are not reinitialized at every timestep (instead, they are accumulated over time, so when changing the focus toanother goal, services that may participate in the new goal reuse their currentactivation and continue accumulating activation on top of it). Furthermore, itis important to highlight that the cost of recomposing is significantly reducedby COPERNIC thanks to its distributed nature where multiple agents decom-pose the whole problem into smaller planning objectives. Similar to the previousexperiment, one of the drawbacks of our approach is that its failure rate washigher than GoCoMo’s one due to the attention mechanism could dismiss somecrucial information pieces at any point affecting the final decision. Now, com-paring the results of both configurations of COPERNIC , we can observe thatin general C outperforms C . We can infer that if γ (the amount of energy agoal injects into the attentional mechanism) > φ (the amount of energy that theWM units inject into the attentional mechanism) then COPERNIC will be moregoal-oriented and less sensitive to changes in the current state (e.g., changes inmobility). On the contrary, if φ > γ then the system will be more sensitive tochanges in the current state rather than changes in the goals. Also, if δ (theamount of activation energy a protected goal takes away from the system) issignificantly greater than γ then the system will keep a stubborn position, thatis, it will try to always stick with the original plan (protected goal) and will bereluctant to refocus its attention to the new goal. On the contrary, if γ is consid-erable greater than δ then the system will be continuously switching from onegoal to another and never will conclude any plan. Finally, reducing the activationthreshold θ may help the system make faster decisions (reactive behavior), use-ful during time-sensitive composition; by contrast, increasing θ will slow downthe reasoning process (deliberative behavior), useful for long-term compositionplanning. Therefore, the utility learning mechanism has to find a proper ratiobetween these parameters so the performance of the system is improved. Thelearning mechanism found a tradeoff between the parameter and discovered that,in order to make the system sensitive to both current-state changes (e.g., mo-bility, perceived stimuli, etc.) and goal changes, without switching indefinitelybetween goals, and with the ability to undone previously reached (protected)goals in order to refocus on new goals (replanning), then γ should be slightlygreater than δ at a ratio of ≈ φ should be greater than γ at a ratio of ≈ φ > π > γ where φ is greater than π at a ratio of 14:9. When using valueseyond those ratios (as C does), COPERNIC ’s planning and execution failurerates increased considerably in comparison with GoCoMo.As a side note, the way CoopC (and other baseline service composition mod-els) addresses faults in composition is for the system to restart the whole processif any service has failed during the execution, of course, this solution is unableto utilize the partial results. Unlike CoopC, COPERNIC neither creates a long-term plan upfront, nor constructs a search tree. Instead, plans are tailored on-the-fly through activation accumulation, so that it does not have to start fromscratch when one path does not produce a solution, but smoothly moves fromone composition plan to another. As a result, the computation of the composi-tion plan is much less expensive. Creating a long-term plan in advance wouldrequire too much time (especially for a cognitive agent operating in a rapidlychanging MPC environment), instead, plans are emergently created by COPER-NIC as a result of multiple cascading cognitive cycles. The main differencesbetween our approach and both GoCoMo and CoopC are that our approach canmediate smoothly between deliberation and reactivity by determining (throughlearning) a tradeoff between φ, γ , δ , π and θ ; and that it can perform deliberativecomposition by accessing long-term intentions stored in the episodic memory. Itis worth noting that there is a multiple correlation between resource consump-tion, execution failure rate, and planning failure rate, so the more COPERNIC filters out the information required for the composition the lesser resources arerequired during composition, the faster the composite service will be generatedand, therefore, the lower the execution failure rate will be. That is, if a compositeservice can be planned and replanned quickly and without requiring too manyresources (as COPERNIC does), then the discrepancies between planning andexecution will be minimized and, as a consequence, the execution failure ratewill be minimized as well. However, the more the information is filtered out thehigher the planning failure rate will be due to the cognitive agent may dismisscritical information pieces during planning. In the existing literature, there are mainly three different techniques of draftinga composition plan [18]. The first one utilizes the classical planning techniquesused in AI (e.g., HTN, petri-nets, state charts, rule-based, multi-agent systems,etc.). Under this approach [7,23], the composition of atomic services into a com-posite service is viewed as a planning and optimization problem. The secondtechnique uses workflows, in which a composite service is broken down into asequence of interactions between atomic services [4]. The third technique usesdirect mappings between user requests and service descriptions without needingintermmediate representations such as ontologies [22]. In general, first and sec-ond approaches either rely on conditional plans and can therefore handle onlya limited range of non-deterministic action outcomes, or have the queries aboutunknown information explicitly included in the predefined service compositionprocedure. These plans use to be computationally expensive, have to deal withcomposition length and strive to optimize the resources involved. Our servicecomposition model is not as expensive as traditional approaches because plansre constructed emergently on-the-fly as the result of both the spreading acti-vation dynamics defined at multiple overlays of the system, and the cognitivemechanism for filtering out and focusing on the most relevant information. To re-duce composition and execution failures while dealing with complex user require-ments, existing service composition techniques investigate flexible compositionplanning mechanisms such as: open service discovery approaches and dynamicservice planning approaches. A graph-based service aggregation method [1, 26]models services in an aggregation graph based on the parameter dependence ofthe services. It dynamically composes services to support a task in a workflowwhen a direct match between the task and a single service does not exist. Such aworkflow may need to be generated offline by a domain expert or a compositionplanning engine, which is inconvenient when a change is required at runtime.Dynamic service planning approaches such as [12, 17]use classic AI-planning al-gorithms, such as forward-chaining and backward-chaining for dynamic compo-sition planning, and usually employ a bi-direction planning algorithm to finda path with the smallest cost from the dependency graph. However, these ap-proaches require central service repositories to maintain service overlays, andhave no support for dynamic composition replanning for composition failures.AI-planning algorithms like Haley [27], and a fuzzy TOPSIS method [6] havebeen investigated for dynamic composition planning and have features for au-tomatic re-planning to handle failures. However AI-planning algorithms rely oncentral composition engines that have not yet been applied on mobile devices.In addition, they need to re-generate a new plan for failure recovery, which istime-consuming and not suitable for dynamic environments. We described COPERNIC , an agent-based model for service composition inMPC environments. Our main contribution is the implementation of a cognitivemodel that efficiently and dynamically orchestrates distributed services underhighly changing conditions. Our approach focuses on bounded rationality ratherthan optimality, allowing the system to compensate for limited resources by fil-tering out a continuous stream of incoming information. We tested our modelagainst state-of-the-art service composition models while modifying mobility,service density and composition complexity features, and the promising resultsdemonstrated that a cognitively-inspired approach may be suitable for pervasiveenvironments where resources are scarce and the smart devices have computa-tional and hardware constraints. Our future work will mainly focus on tightlyintegrating a context-awareness feature into our model so cognitive agents canmake more accurate decisions during service selection.