17
Distributed Online Algorithms for the Agent Migration Problem in WSNs Nikos Tziritas & Spyros Lalis & Samee Ullah Khan & Thanasis Loukopoulos & Cheng-Zhong Xu & Petros Lampsas # Springer Science+Business Media New York 2013 Abstract The mobile agent paradigm has been adopted by several systems in the area of wireless sensor networks as it enables a flexible distribution and placement of application components on nodes, at runtime. Most agent placement and migration algorithms proposed in the literature, assume that the communication rates between agents remain stable for a suffi- ciently long time to amortize the migration costs. Then, the problem is that frequent changes in the application-level com- munication may lead to several non-beneficial agent migra- tions, which may actually increase the total network cost, instead of decreasing it. To tackle this problem, we propose two distributed algorithms that take migration decisions in an online fashion, trying to deal with fluctuations in agent com- munication. The first algorithm is more of theoretical value, as it assumes infinite storage to keep information about the mes- sage exchange history of agents, while the second algorithm is a refined version that works with finite storage and limited information. We describe these algorithms in detail, and pro- vide proofs for their competitive ratio vs. an optimal oracle. In addition, we evaluate the performance of the proposed algo- rithms for different parameter settings through a series of simulated experiments, also comparing their results with those achieved by an optimal static placement that is computed with full (a posteriori) knowledge of the execution scenarios. Our theoretical and experimental results are a strong indication for the robustness and effectiveness of the proposed algorithms. Keywords Distributed algorithms . Online algorithms . Optimizing network cost . Wireless sensor and actuator networks . Agent placement . Agent migration . Agent-based programming 1 Introduction In the last few years, the agent-code mobility problem (or agent migration problem) has received considerable attention from the research community [11, 12, 19, 31, 34]. This prob- lem is especially important for wireless systems, where every possible communication saving is welcome in order to reduce the stress on the network but also to prolong the lifetime of nodes running on batteries. Previous work has primarily stud- ied agent migration to minimize the total network cost, but (i) without considering frequent changes in the applications message traffic, and (ii) without taking into account the actual cost for performing a migration. Therefore, they may lead to bad performance if the communication between agents varies significantly during the lifetime of the application. The reason N. Tziritas (*) : S. U. Khan : C.<Z. Xu Chinese Academy of Sciences, Beijing, China e-mail: [email protected] S. Lalis University of Thessaly & IRETETH/CERTH, Thessaly, Greece e-mail: [email protected] S. U. Khan North Dakota State University, Fargo, ND, USA e-mail: [email protected] T. Loukopoulos : P. Lampsas Technological Educational Institute of Lamia, Lamia, Greece T. Loukopoulos e-mail: [email protected] P. Lampsas e-mail: [email protected] C.<Z. Xu Wayne State University, Detroit, MI, USA e-mail: [email protected] Mobile Netw Appl DOI 10.1007/s11036-013-0452-0

Distributed Online Algorithms for the Agent Migration Problem in WSNs

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Distributed Online Algorithms for the Agent Migration Problem in WSNs

Distributed Online Algorithms for the Agent MigrationProblem in WSNs

Nikos Tziritas & Spyros Lalis & Samee Ullah Khan &

Thanasis Loukopoulos & Cheng-Zhong Xu & Petros Lampsas

# Springer Science+Business Media New York 2013

Abstract The mobile agent paradigm has been adopted byseveral systems in the area of wireless sensor networks as itenables a flexible distribution and placement of applicationcomponents on nodes, at runtime. Most agent placement andmigration algorithms proposed in the literature, assume that thecommunication rates between agents remain stable for a suffi-ciently long time to amortize the migration costs. Then, theproblem is that frequent changes in the application-level com-munication may lead to several non-beneficial agent migra-tions, which may actually increase the total network cost,instead of decreasing it. To tackle this problem, we proposetwo distributed algorithms that take migration decisions in anonline fashion, trying to deal with fluctuations in agent com-munication. The first algorithm is more of theoretical value, as

it assumes infinite storage to keep information about the mes-sage exchange history of agents, while the second algorithm isa refined version that works with finite storage and limitedinformation. We describe these algorithms in detail, and pro-vide proofs for their competitive ratio vs. an optimal oracle. Inaddition, we evaluate the performance of the proposed algo-rithms for different parameter settings through a series ofsimulated experiments, also comparing their results with thoseachieved by an optimal static placement that is computed withfull (a posteriori) knowledge of the execution scenarios. Ourtheoretical and experimental results are a strong indication forthe robustness and effectiveness of the proposed algorithms.

Keywords Distributed algorithms . Online algorithms .

Optimizing network cost . Wireless sensor and actuatornetworks . Agent placement . Agent migration .

Agent-based programming

1 Introduction

In the last few years, the agent-code mobility problem (oragent migration problem) has received considerable attentionfrom the research community [11, 12, 19, 31, 34]. This prob-lem is especially important for wireless systems, where everypossible communication saving is welcome in order to reducethe stress on the network but also to prolong the lifetime ofnodes running on batteries. Previous work has primarily stud-ied agent migration to minimize the total network cost, but (i)without considering frequent changes in the application’smessage traffic, and (ii) without taking into account the actualcost for performing a migration. Therefore, they may lead tobad performance if the communication between agents variessignificantly during the lifetime of the application. The reason

N. Tziritas (*) : S. U. Khan :C.<Z. XuChinese Academy of Sciences, Beijing, Chinae-mail: [email protected]

S. LalisUniversity of Thessaly & IRETETH/CERTH, Thessaly, Greecee-mail: [email protected]

S. U. KhanNorth Dakota State University, Fargo, ND, USAe-mail: [email protected]

T. Loukopoulos : P. LampsasTechnological Educational Institute of Lamia, Lamia, Greece

T. Loukopoulose-mail: [email protected]

P. Lampsase-mail: [email protected]

C.<Z. XuWayne State University, Detroit, MI, USAe-mail: [email protected]

Mobile Netw ApplDOI 10.1007/s11036-013-0452-0

Page 2: Distributed Online Algorithms for the Agent Migration Problem in WSNs

is in such scenarios the cost of agent migrations may not beamortized, and may in fact result in an overall increase of thenetwork cost, rather than decreasing it.

We give a concrete example inspired from the applicationprototypes that were developed in the POBICOS project[31]. Imagine that an application uses a “presence detector”agent P to infer user presence based on the reports receivedfrom two “activity sensor” agents, S1 and S2, which reside onnodes n1 and n2 representing motion sensors in two differentrooms of an apartment. Let these nodes communicate direct-ly over wireless. Also, without loss of generality, assume thatP resides on one of those nodes, e.g., on n1. The networktopology and agent placement are illustrated in Fig. 1a.

Let agents S1 and S2 report to P at a rate of 4 messages perminute when motion is sensed, and stop reporting when thereis no motion. Also, let each report message be 5 bytes, and letthe size of P be 150 bytes (in POBICOS, simple agents canbe quite small). Now, assume that the user casually movesbetween the two rooms, leading to corresponding reportingrates of S1 and S2, as depicted in Fig. 2b (note that S1 and S2report in a mutually exclusive fashion, since n1 and n2 are indifferent rooms and there is just one user). On the one hand,it is trivial to see that a static placement of P on n1 (where P isplaced initially, as shown in Fig. 1a) is suboptimal, sincemost reports come from S2 on n2, and thus have to travel overthe wireless network. On the other hand, if P migrates as-suming that the agent message traffic does not change fre-quently then it will move on the node of the sensor agent thatgenerates most reports at any point in time. For example,according to Fig. 1b, P would migrate from n1 to n2 at time 3,as soon as S2 starts reporting (while S1 remains silent). Thisis indeed desirable as it reduces the network cost (150 bytesto transfer P over the network, while saving 200 bytes inmessages that are delivered locally once P is on n2). How-ever, this can also lead to undesirable oscillations. To con-tinue the example, with the same rationale, P would migratefrom n2 to n1 at time 17 only to migrate back from n1 to n2 attime 22, which is clearly undesirable; this saves 120 bytes inmessages, but incurs a cost of 300 bytes in order to transfer Ptwice of the network, yielding a total cost of 180 bytes (vs. 60bytes if P had remained on n2). Clearly, one would like to

have a better algorithm that can avoid such oscillations whilestill allowing P to migrate in order to reduce the overallnetwork cost.

With this motivation, we have studied the online version ofthe agent migration problem. The main challenge lies in thefact that the online algorithm must take a decision withoutbeing able to “look into the future” of the (dynamicallyvarying) application’s message traffic patterns. The migrationdecisions have to be taken based exclusively on informationabout the system’s history. In fact, for all practical purposes,this information may be just partially available. Also note thatsuch an algorithm can take two types of wrong decisions: (i) todecide to perform a migration that turns out to be non-beneficial, i.e., perform badmigrations, as would an algorithmthat assumes static message traffic, but also (ii) to decide not toperform a migration that would have been desirable, i.e.,missing beneficial migrations.

In this paper, we propose two online algorithms for theagent migration problem. The most salient features of theproposed algorithms are as follows. When deciding about amigration, the cost of performing the migration as well asprevious message exchanges are both taken into account toavoid bad migrations. Moreover, the migration decision isbased only on local information about previous message ex-changes with other nodes; thus the wireless network is notoverburdened with extra control messages, and migration de-cisions can be taken in a distributed manner. Finally, we limitthe amount of data that needs to be kept at each node using asliding window approach, and consider data entries in anincremental fashion, which gives more weight to the mostrecent data traffic and accelerates the decision making process.

Commonly, the performance of online algorithms isassessed using competitive analysis, where the performanceof the online algorithm under consideration is comparedagainst some adversary. The ratio obtained (competitive ratio)from this analysis is used as an indication of algorithm’sperformance. In this paper, we compare the proposed algo-rithms versus an optimal “oracular” algorithm that knows allthe message exchanges that will take place in the system, for aworst-case scenario created by an adversary. The theoreticalanalysis of the algorithms gives a worst case performance

(a) (b)

n1

P

S1 S2

n2 0

5

10

15

20

1 6 11 16 21 26 31 36 41

rep

ort

ing

rat

e [b

ytes

/min

]

time [min]

S1

S2

Fig. 1 A simple presencedetection scenario: a threeapplication agents and theirinitial placement on a 2-nodenetwork; b reporting rates ofagents S1 and S2 reflecting userpresence in the two differentrooms

Mobile Netw Appl

Page 3: Distributed Online Algorithms for the Agent Migration Problem in WSNs

bound. Furthermore, to gain insight on the actual performanceof the proposed algorithms, we experimentally evaluate theproposed algorithms via simulation for a number of systemconfigurations, and compare their performance to that of astatic offline optimal algorithm.

In summary, the contribution of our work is as follows: (i)the agent migration problem is tackled in an online anddistributed fashion; (ii) two novel online algorithms are intro-duced and discussed in detail; (iii) the performance of thealgorithms is formally studied via competitive analysis; and(iv) an experimental evaluation is presented, comparing theperformance of the proposed algorithms vs. that achieved by astatic offline (optimal) agent placement.

The rest of the paper is organized as follows. Section 2describes the application and system model. Section 3 pre-sents the proposed online algorithms. Section 4 gives a de-tailed analysis on the competitive ratios of these algorithms.Section 5 discusses the performance achieved by these algo-rithms vs. a static offline placement, in simulated experiments.Section 6 discusses the related work. Finally, Section 7 con-cludes our work.

2 Application sodel, system model and problemformulation

This section introduces the application model in more detail.We also describe the network model and the assumptionsmade regarding the implementation of agent migration. Final-ly, we give the problem formulation for the online agentmigration problem.

2.1 Application model

The model we adopt in terms of how applications areimplemented on top of a sensor and actuator network (SAN)is inspired from that of the POBICOS system [31], which inturn evolved from the programming model of ROVERS [11].An application is designed as a collection of cooperatingagents, with each agent being dedicated to a specific, perhaps

very simple, task. In the spirit of hierarchical control systems[24], agents are organized in a tree. Leaf agents interact withthe physical environment by acquiring information oreffecting change through the sensors and actuators providedby the nodes of the SAN. Given that these agents requirespecial resources to perform their task, they are referred to as“non-generic”. The rest of the agents in the application treeimplement higher-level aggregation, processing and controltasks, using only general-purpose computing resources (CPUand memory). Since these agents do not require special re-sources, they are referred to as “generic”. Agents communi-cate via message passing. Being consistent with the hierarchi-cal approach, an agent can exchange messages only with itsimmediate parent and children in the tree.

As an example, Fig. 2 shows the structure of an applicationfor turning off lights in an apartment when there is no useractivity (of course, in general, applications can be more com-plex). The root agent (R) employs a user presence detectoragent (P), which in turn relies on multiple user activity sensoragents (S1..Sx). The root also employs multiple light controlagents (L1..Ly) to switch off lights when P reports user ab-sence, and a notification agent (N) to inform the user aboutthis action.

The application works as follows. Each activity sensoragent S periodically reports to P when it senses user-relatedactivity. P infers that a person is around as long as it receivessome reports from at least one S. If no report is received fromany S for a sufficiently long time, P infers that the apartment isempty, and notifies R. When R receives a report from P, itsends a command to N in order to notify the user about theaction to be taken (note that human presence detection may beinaccurate), and then sends a command to all L agents toswitch off all lights in the apartment.

At runtime, the agents of the application are created on oneor more nodes (using corresponding middleware primitives,not discussed here). In POBICOS, we assume that nodes areembedded into “smart” objects that can be found in the homeor office. In order for non-generic agents (A, L and N in theabove example) to perform their task, they have to be placedon nodes that provide the respective sensors and actuators. In

… …

Agents Functionality

switch-off lights, when user is absent

infer user presence/absence

send a report when user activity is detected

switch-off lights when a command is received

notify user when a command is received

P

R

N

R

P

S

L

NS1 Sx L1 Ly

Fig. 2 Agent tree of an application that switches off lights in anapartment when there is no one around. Generic agents have a whitecolor, non-generic agents are black. At runtime, instances of the S and Lagent are created on every node that can act as user activity sensors

(e.g., motion sensor nodes) and can control lights (e.g., a smart lamp),respectively. A single instance of the N agent is created on a node thathas the capability to notify the user (e.g., a TV)

Mobile Netw Appl

Page 4: Distributed Online Algorithms for the Agent Migration Problem in WSNs

contrast, generic agents (P and R in the example) can beplaced on any node since they do not require special resourcesto perform their task. Note that the agent placement of Fig. 1acorresponds to a concrete instantiation of the human presencedetection subtree of the above application, for the case whereonly two nodes can host an instance of S.

Last but not least, generic agents can migrate from onenode to another to offload their current hosts or to get closerto the agents with which they communicate more intensely.For instance, P could move on the node or towards thenodes of the S agents that report more frequently than allothers (as discussed in the previous section). Note that in thegeneral case a generic agent has to migrate to the “center ofgravity” of its communication traffic with its parent andchildren; depending on the network topology and currentagent placement, this may be a node that does not host anyof those agents. We consider migration only for genericagents as their operation is, by design, location- and node-independent. Also, we view agent migration as a service thatis provided by the middleware transparently for the appli-cation programmer (like in POBICOS). Thus the proposedalgorithms are to be implemented by the middleware, notthe application programmer.

2.2 System model

Let the application have A agents ak, k=1..A. Also, let thenetwork comprise N nodes ni, i=1..N. We assume that thenetwork routing topology is a tree, i.e., for every pair ofnodes there is a single path that connects them. Let hij denotethe hop-distance between ni and nj; obviously, hij=hji. Also,hii=0. We assume that the network topology remains stablethroughout the application’s lifetime.

As discussed earlier, each agent is placed on a node,and can exchange messages with its parent and childrenin the tree, which may reside on the local or on remotenodes. Let ljk

st be the number of bytes exchanged be-tween ak placed on ni and other agents that reside on nj,during the time interval [s, t). Then, Pik

st denotes thenetwork communication cost due to the message ex-change between ak on ni and all remote agents (placedon any other node), as defined by Eq. 1. Note that thistakes into account the number of hops required for amessage to travel from the source to the destination.

Pstik ¼

XNj¼1

lstjk � hji ð1Þ

Let Mijk denote the migration of ak from ni to nj. As anestimate for the potential savings that can be achieved bysuch a migration, one can use the difference between thenetwork cost with ak on ni and the network cost with ak on nj,for a given time interval [s, t). We call this the potential

benefit of Mijk (based on the data exchanges during thisinterval), denoted by Bijk

st, as defined in Eq. 2.

Bstijk ¼ Pst

ik−Pstjk ð2Þ

Henceforth the time interval [s, t) will typically refer tothe recent past. In other words the recent agent commu-nication history will be used as a forecast for the messageexchanges that will occur in the future (of course, such aforecast can be wrong). Consequently, t will represent thecurrent point in time, and s will represent some point intime in the past.

Regarding the cost and duration of agent migrations, wemake some simplifying assumptions. Without any loss ofgenerality, we assume that the network cost for migratingagent ak over 1-hop is practically independent of the sourceand destination nodes and the point in time when the migra-tion occurs. We refer to this cost as MCk. In addition, weassume that a migration occurs instantaneously, within a sin-gle time unit. This is justified based on measurementsperformed with the POBICOSmiddleware on top of a ZigBeewireless network, where it was shown that migrations are fastfor typical agent sizes of a few hundred bytes [32]. Also, whilethe wireless bandwidth can vary in time and hierarchicalnetwork topologies may introduce bandwidth asymmetriesfor some nodes, in practice, the agents we consider here arevery lightweight in size compared to such differences.

Based on these assumptions, the cost of Mijk for any twonodes ni and nj is then practically equal to the cost of a 1-hopmigration of ak multiplied by the number of times needed toperform such a migration, i.e., the number of hops between niand nj. Let MCijk

s denote the cost of Mijk if this actuallyoccurred at time s, else 0, as defined in Eq. 3.

MCsijk ¼

hij �MCk ; Mijk occured at s0; Mijk did not occur at s

�ð3Þ

Recall that we assume that migrations occur within asingle time unit. Therefore, if Mijk starts at time s, it will becompleted by s+1.

2.3 Problem formulation

Let the lifetime of the application be the time interval [1, T).For the purpose of formulating the problem, we assume thatT is known, but can be arbitrarily large; of course, in practice,the application lifetime is unknown, as it is the user whodecides how long to run a specific application in his home oroffice. Also, let f(s,k) be a continuous “placement function”that returns the host of agent ak at any point in time s withinthat interval.

Then, total communication cost due to agent-level mes-sage exchanges equals CommCost(f), as defined inM1. Thedivision by two is because the summations take into

Mobile Netw Appl

Page 5: Distributed Online Algorithms for the Agent Migration Problem in WSNs

account the communication cost for each pair of agentstwice (if ak is on ni and am is on nj, the message exchangesthat take place between them during [s, t) are included inljk

st as well as in lmist).

CommCost fð Þ ¼XT−1s¼1

XNi¼1

XAk¼1

ls;sþ1ik � hi; f s;kð Þ

� �.2 ðM1Þ

Also, the total cost of all the migrations that are performedfor each agent during the application’s lifetime equalsMigrCost(f), as defined in M2.

MigrCost fð Þ ¼XTs¼1

XAk¼1

XNj¼1

MCsf s;kð Þ; j;k ðM2Þ

Finally, the total cost incurred to the network by theapplication, taking into account all agent-level communica-tion and all the agent migrations that have been performed(by the middleware), equals TotalCost(f), as defined by M3.

TotalCost fð Þ ¼ CommCost fð Þ þMigrCost fð Þ ðM3ÞThen, based on the above, the agent migration problem

can be defined as follows: find a placement function f so thatM3 is minimized.

3 Algorithms

In this section, we present two agent migration algorithmsdesigned to reduce the total network cost of the application.Both algorithms are distributed, relying only on informationthat is locally available on each node of the network. Also,these algorithms work in an online fashion, in that they aresensitive to changes in the communication rates between theagents of the application. The basic idea is the same for bothalgorithms: they move an agent towards the center of gravityof its communication with other agents. Importantly, thealgorithms are designed to take into account the networkcost of implementing a migration vs. the reduction of net-work cost (benefit) that is expected to be achieved by thatmigration.

3.1 Online algorithm based on discrete-time events (ADE)

The first algorithm, called ADE, records for each genericagent the volume of the data exchanged with other agents atdiscrete time units. ADE uses this information to computethe potential benefit of a migration, and pick the migrationthat is expected to achieve the most significant reduction ofthe network cost (in the future).

The traffic information for generic agent ak is kept in abuffer, sorted in chronological order. We refer to this buffer asthe “window” for ak,wk. The window starts from the beginning

of the application’s execution, and grows in time as ak commu-nicates with other agents. Note that the window size is un-bounded. The window is structured as a sequence of entries.Each entry captures the data volume of message exchanges thattook place during a time interval of fixed length L. The value ofL determines the “time granularity” at which migrations areevaluated. For instance, if L equals 1, all possible migrationswill be checked for every single time unit. Let wk

i and T(wki)

denote the ith entry of wk and the time interval this entrycorresponds to, respectively. An entry wk

i contains a list of oneormore tuples (nj: v) with v being the volume of data exchangedbetween ak and the agents hosted by nj during T(wk

i). Note thatit is trivial for the local node to know the hosts of remote agents:this information is typically included in the network-levelpackets; it can also be included in application-level messages.Entries are sorted in increasing time order and their intervals arenon-overlapping and contiguous, i.e., if T(wk

i)=[s1,s2) andT(wk

i+1)=[s3,s4) then s2=s3.Consider the example shown in Fig. 3, for an agent tree

comprising four agents placed on three nodes. In this case,agent ak on n2 communicates with its children a1, a2, and a3placed on n1, n2 and n3, respectively. As discussed above,node n2 maintains a window wk for the data exchanges of ak,shown in Table 1 (entries are listed from top to bottom indecreasing chronological order). The window consists of fourentries, covering the traffic data for the time interval [1, 5); Lequals 1 time unit. The most recent entry wk

4 includes twotuples, one for the data exchanged between ak and a1 on n1 fora total of 5 data units, and one for the data exchanged with a3on n3 for a total of 1 data unit. All other entries include onetuple. For instance, the second most recent entry wk

3 includesonly a tuple for the data exchanged between ak and a3 on n3for a total of 5 units; obviously, there was no communicationbetween ak and a1 during the time interval [3,4).

Each node maintains a separate window for each locallyhosted generic agent, and uses this information to decidewhether an agent (or, in general, a group of agents) shouldmigrate to another node. This is done in an iterative manner,starting from the most recent entry and iteratively consolidat-ing it with the ones that precede it in the window. All possiblemigrations for the respective agent (or group of agents) areevaluated in each step. The process terminates when the last

n1

1 2

n2 n3

3

k

Fig. 3 Placement of the genericagent ak and its non-genericchildren a1, a2, a3 on nodes n1,n2, and n3 (the nodes are linkedin a chain topology)

Mobile Netw Appl

Page 6: Distributed Online Algorithms for the Agent Migration Problem in WSNs

(oldest) window entry has been considered, or the benefit of amigration exceeds a threshold (also referred to as the migra-tion threshold MT). The second condition is defined as prop-erty P1 below:

Bstijk ≥MT ðP1Þ

More specifically, P1 states that the agent in question (or,in general, the group of agents in question) should be con-sidered for migration at time t only if there exists a contigu-ous time interval [s, t) such that the respective migrationbenefit is greater than or equal to a so-called migrationthreshold MT. Note that MT is a parameter of the algorithm;we will elaborate on this in the next section, where we derivethe competitive bound for the algorithms.

To continue the previous example, Table 2 lists the itera-tions performed for agent ak based on the entries of itswindow wk (see Table 1). Each iteration is listed in a separaterow, with the key variables of the algorithm and their valuesgiven in separate columns. The best migration (but notnecessarily beneficial) option for each iteration is markedby shading the respective cell; note that there can be at mostone beneficial migration at each point in time, because thenetwork topology is a tree.

For instance, the first iteration considers just the most recententry wk

4. The respective benefit of migrating ak on eachpossible destination (n1 and n3) is calculated for the timeinterval [4,5). As per Eqs. 2 and 1, B2,1k

4,5 = P2k4,5 − P1k

4,5 =(l1k

4,5 × h1,2 + l3k4,5 × h3,2) − (l2k

4,5 × h2,1 + l3k4,5 × h3,1), which

equals 4. So, if M2,1k were performed right before time 4, thiswould have had reduced the total network cost for the interval[4,5) by 4 units. As can be seen,M2,1k is the bestmigration optionfor this iteration. In the second iteration, the two most recent

entries, wk4 and wk

3, are consolidated to provide aggregatedtraffic statistics for the interval [3,5). In this case, the bestmigration option is M2,3k for a benefit of 1. And so on.

As mentioned earlier, the algorithm terminates as soon asP1 is satisfied or when there are no more entries to consoli-date, in which case no migration is chosen. For instance, in theabove example, if MT were equal to 8 then the algorithmwould terminate after the third iteration and would decidefor M2,1k. But if MT were equal to 10, the algorithm wouldgo through all four iterations, and would not decide for anymigration, suggesting that ak should remain on n2. The pro-cess is repeated when a new entry is added to the window.

Note that it is useless for wk to contain entries that do nothave any data tuple, i.e., for intervals were ak did not send orreceive any message. Such entries do not contribute to thealgorithm. In practice, empty entries could be eliminated (theresulting gaps between the intervals of subsequent entries aretrivial to handle). An alternative solution would be to mergesuch entries with the ones that precede them in the window.

3.2 Online algorithm based on sliding windowdiscrete-time events (ADE-SW)

While ADE is sufficient from a theoretical perspective, it isinapplicable in practice. This is because the application maylive for a long time (or forever), which in turn means that thewindows for its generic agents would grow to enormous sizes(or indefinitely). Moreover, embedded wireless nodes mayhave tight storage constraints, which may already be stressedby the code of the application (e.g., in POBICOS, code imagesare dynamically installed on nodes over the network, and arestored in the same memory used by the application to store itsdata). It is thus desirable to have an algorithm that can beimplemented also on resource-constrained nodes.

To this end, we propose a modified version of ADE thatplaces an upper bound on the memory used to store thetraffic data for a generic agent. More specifically, the pro-posed algorithm employs for each generic agent ak a slidingwindow wk of maximum size S in terms of the number ofentries it can accommodate. One can imagine this as a framesuperimposed on top of the window kept by ADE, whichmoves forward to include the most recently added entry

Table 1 Window wk for agent ak on node n2 after 4 time units (L=1)

Entry Time interval Data traffic tuples

wk4 [4, 5) (n1: 5), (n3: 1)

wk3 [3, 4) (n3: 5)

wk2 [2, 3) (n1: 10)

wk1 [1, 2) (n2: 15)

Table 2 Iterative evaluation ofthe migration benefit for ak,based on wk as per Table 1

Iteration Lastconsolidatedentry

Timeinterval

Load for each node Benefit ofM2,1k

Benefit ofM2,3k

n1 n2 n3

1st wk4 [4, 5) l1k

4,5=5 l2k4,5=0 l3k

4,5=1 B2,1k4,5=4 B2,3k

4,5=−4

2nd wk3 [3, 5) l1k

3,5=5 l2k3,5=0 l3k

3,5=6 B2,1k3,5=−1 B2,3k

3,5=1

3rd wk2 [2, 5) l1k

2,5=15 l2k2,5=0 l3k

2,5=6 B2,1k2,5=9 B2,3k

2,5=−9

4th wk1 [1, 5) l1k

1,5=15 l2k1,5=15 l3k

1,5=6 B2,1k1,5=−6 B2,3k

1,5=−24

Mobile Netw Appl

Page 7: Distributed Online Algorithms for the Agent Migration Problem in WSNs

while leaving out the oldest entry. This algorithm is calledADE sliding window (or ADE-SW). Moreover, ADE-SWcan consolidate several entries in a single iteration, in orderto take decisions based on traffic data over longer timeperiods. The number of additional entries to consolidate ineach iteration is referred to as “consolidation step” (Cstep).Otherwise, ADE-SW works in the same way ADE does,considering all possible migrations in each iteration, andterminating as soon as a beneficial migration is found asper P1, or when there are no more entries to consolidate.

As an example, consider the agent placement illustrated inFig. 4a, and the respective traffic data and sliding window wk

for ak as shown in Fig. 4b. The traffic history includes tenentries for the time intervals t1…t10, sorted from left to rightin ascending time order. To keep things simple, each entryincludes a single tuple. S is 6, so wk includes the 6 mostrecent entries t5…t10, as shown in Fig. 4b. Note that wk ismaintained by n1, which is the host of ak.

Assume that ADE-SW works in a 1-hop mode, consider-ing as candidates only its immediate neighbors. Also, let themigration threshold MT be 4, and the consolidation stepCstep be equal to 2. In the first iteration, illustrated inFig. 4b(1), the first 2 entries, for the intervals t10 and t9, will beconsidered in order to identify the best migration option for ak.In this case, the only candidate node is n2, and the benefit forthe respective migration M1,2k is 2. Given that P1 is notsatisfied, a second iteration will be performed, shown inFig 4b(2), taking into account the next 2 entries in addition tothe ones that were considered so far. This time, the benefit formigration M1,2k equals 4, and P1 is satisfied. Consequently,the algorithm decides to migrate ak from n1 on n2. Note that itis straightforward for a node to know the routing path of eachmessage received, in particular the node that was the last hopof this path, as this information can be easily included innetwork-level messages (if the routing path is too long, onlythe last few hops can be included).

When an agent migrates, the entries that triggered itsmigration are also transferred to the new host (as part ofthe agent’s state). The reason for doing this is to acceleratethe decision making process for subsequent migrations, rath-er than having to wait in order to collect new traffic data.Going back to the example of Fig. 4, assume that the recent

communication pattern, whereby ak and a4 exchange 1 unitin each time interval, continues for some time. Then, if akwould migrate on n2 while completely resetting its window,4 time units would be required to decide for the next migra-tion of ak on n3, and when ak moves on n3 it would takeanother 4 time units for ak to migrate it on n4. In other words,the total delay for ak to reach its final destination would be 12time units, during which time the communication between akand a4 would occur over the network. By including entriest7…t10 in the window maintained by the new host(s), thenext migration(s) of akwill be decided immediately, yieldinga total end-to-end migration delay of just 4 time units.

Note, however, that it is not useful to transfer the entirewindow contents to the new host. This is because the subset ofentries that triggered the migration in the first place will mostlikely suffice to trigger the next migration(s), in which case therest of the entries will not be considered anyway. In the aboveexample, ak can migrate all the way to n4 based on entries t7…t10 (even if it carried along the entries t5 and t6; these would notbe used). In fact, passing the entire window to the agent’s newhost may lead to undesirable oscillations. For instance, ima-gine that when akmoves on n2 it carries all entries t5…t10 withit, and that, for some reason, the algorithm is not run imme-diately. Then, if there is even a short communication betweenak and a1, resulting in a new entry with the tuple (n1:1) to beadded in wk for t11 (the window would then include entriest6…t11), the algorithm would decide (after three iterations,based on the consolidated traffic data of the entire window)to migrate ak from n2 back to n1. However, if the frequentcommunication between ak and a4 holds (i.e., the next entriesadded to the window are the same as t7…t10) then ak wouldeventually migrate to n2 again. By pruning the window toinclude just the entries that triggered a migration, the algo-rithm basically decides to forget older traffic history, whichcould, due to even spurious communication, pull the agentbackwards, to the “wrong” direction.

4 Competitive ratios

In this section, we discuss the competitive ratios between theoptimal algorithm (OPT) and ADE assuming tree-like

n1

1 2

n2 n3

3 4

n4

k t1 t2 t3 t4 t5 t6 t7 t8 t9 t10

a1:3 a1:3 a2:1 a2:1 a1:9 a1:9 a4:1 a4:1 a4:1 a4:1

t1 t2 t3 t4 t5 t6 t7 t8 t9 t10

a1:3 a1:3 a2:1 a2:1 a1:9 a1:9 a4:1 a4:1 a4:1 a4:1

wk

(1)

(2)

Fig. 4 a Placement of a genericagent ak and its non-genericchildren a1, a2, a3, a4 on nodesn1, n2, n3, and n4 (the nodes arelinked in a chain topology). bIndicative traffic statistics for akon n1, the window wk (S=6) andthe first two iterations (1) and (2)of ADE-SW for Cstep=2

Mobile Netw Appl

Page 8: Distributed Online Algorithms for the Agent Migration Problem in WSNs

routing topologies. We must note that we omit the proof ofthe competitive ratio of ADE-SW (to be 1

�3 ) due to the lack

of space. First of all, we give an outline of the proof that thecompetitive ratio between OPT and ADE is 1

�3 : (a) The first

part of the proof (Lemma 1) gives a competitive ratio thatholds true if and only if ADE performs only one 1-hop agentmigration, provided that: (i) MT is equal to 1 and (ii) OPTdoes not perform any migration. (b) In the sequel (Lemma2), we prove that the competitive ratio of Lemma 1 does notchange when ADE performs more than one 1-hop agentmigrations, provided that back-and-forth migrations are notpermitted. (c)We show (Lemma 3) that the competitive ratioof Lemma 2 increases when allowing back-and-forth migra-tions. (d) Lemma 4 results in the fact that the competitiveratio that is given by Lemma 2, cannot decrease irrespectiveof whether ADE and OPT perform migrations or not. (e)Weprove in Lemma 5 that the competitive ratio does not changewhen varying the number of migration hops. (f) Lastly, weprovide Theorem 1 reporting that the competitive ratio be-comes 1

�3 , provided that an agent is migrated if and only if

the migration benefit equals two times the migration cost.The default agent for our proof is agent ak that is initially

hosted by ni. Throughout our proofs, we assume that eachagent communicates with nodes instead of agents. This is avalid assumption because the total data exchanged betweenan agent and a node concern the messages exchanged be-tween that agent and the agent(s) hosted by the node inquestion.

Lemma 1 The competitive ratio between OPT and ADE is1/(1 + MCijk

y) provided that: (a) ADE performs only oneagent migration, while OPT does not perform any migration,(b) the source node is 1-hop away from the destination node,and (c) MT is equal to 1.

Proof Let ADE perform the migration Mijk, with its costbeing equal to MCijk

y, provided that hij = 1. The above isaccording to our restriction that the source and destinationnodes are 1-hop far away. We assume that the life of ouragent is captured by the time interval [s, c], which can bebroken down into three time intervals: (a) [s, y−] representsthe life of the agent from birth until the time instant that thefirst migration takes place, (b) (y−, y+) represents the life ofthe agent during the migration, and (c) [y+,c] represents thelife of ak just after the migration and until it is destroyed.Because an agent is suspended during the migration, it can-not exchange data with other agents until it is resumed.Therefore, we can say that the only network load incurredduring (y−, y+) is that of migrating ak from ni to nj, which is

equal to MCijky. The above implies that Py−yþ

ik ¼ 0 . There-fore, when ADE is called, the total network load becomes

Psy−

ik þ Pyþcjk þMCy

ijk . Specifically,Psy−

ik represents the network

load incurred within theWSNwhen ak is hosted by ni during the

time interval [s, y−]. Pyþcjk represents the WSN load when ak is

hosted by ni during the time interval [y+,c]. MCijky repre-

sents the load incurred within the WSN for migrating akfrom ni to nj. On the other hand, when OPT is called, nomigration takes place, with the total network load being

captured by Pscik ¼ Psy−

ik þ Pyþcjk . Therefore, the network cost

ratio between OPT and ADE becomes:

Psy−

ik þ Pyþcik

Psy−

ik þMCyijk þ Pyþc

jk

ð4Þ

The competitive ratio between OPT and ADE is capturedwhen Eq. 4 tends to become zero. We can observe that the

smaller the values of Psy−

ik , Pyþcik , and the greater the value of

Pyþcjk , the smaller the ratio captured by Eq. 4. In the following

paragraphs, we examine one by one the appropriate values ofthe variables of Eq. 4.

We claim that Psy−

ik ¼ 1 , with our rationale being describedbelow. For ADE to perform Mijk at the time interval (y−, y+),property P1 must hold true. The above entails that there mustbe a time interval [p,y−] ⊆ [s,y−], where p can be any point in

time in the past but not older than s, such that Bpy−

ijk ≥MT ¼ 1 .

Recall that MT equates to 1 due to our initial precondition.According to Eq. 2, the above can be expressed by

Ppy−

ik −Ppy−

jk ≥1 , which combined with the fact that [p,y−] ⊆[s,y−] results in Psy−

ik ≥Ppy−

ik ≥1 . Recall that Psy−

ik must be as

small as possible, which results in Psy−

ik ¼ 1 .In the sequel, we need to determine the appropriate values

of Pyþcik and Pyþc

jk that force the ratio captured in Eq. 4 to be as

small as possible. We illustrate our argument through Fig. 5,in which there are four WSN nodes and one generic agent ak.Specifically, ns and nf are d and d’ hops away from ni and nj,respectively, while ni is one hop away from nj. Note that dand d’ are integers ranging between 1 and the diameter of ourWSN. (To be precise, d’ should be some distance infinitesi-mal smaller than the diameter of the underlying WSN.) Itshould be stressed that Fig. 5 only captures the time interval[y+, c]. Therefore, according to that time interval, we have

that Pyþcik ¼ ly

þjk c� hij þ ly

þcsk � his þ ly

þcfk � hif ¼ 1� jþ

s� d þ f � ds0 þ 1ð Þ and Pyþcjk ¼ ly

þcik �hji þ ly

þcfk � hjfþ

lyþcsk � hjs that is equal to 1 × i + f × d ′ + s × (d + 1). Let usexamine what is the impact on Eq. 4 when changing the

values of the load variables involved in both Pyþcik and Pyþc

jk .

We have the following four cases. (a) lyþcjk must be equal to

zero, otherwise the ratio described in Eq. 4 would increase.

Specifically, Pyþcik would increase by ly

þcjk � hij ¼ j� 1 ,

Mobile Netw Appl

Page 9: Distributed Online Algorithms for the Agent Migration Problem in WSNs

while Pyþcjk would remain the same. The latter is attributed to

the fact that Pyþcjk does not depend on ly

þcjk (see the equations

reported for Fig. 3 for further information). (b) lyþcfk must

equate to zero, otherwise the ratio described in Eq. 4 would

increase. Specifically, Pyþcik would increase by ly

þcfk �

hif ¼ f � d0 þ 1ð Þ and Pyþcjk would increase by ly

þcfk �

hjf ¼ f � d0 . (c) lyþcik must equate to zero. Otherwise, Byþc

jik

would be greater than zero. Particularly, the above entailsthat a second migration would take place, which contradictsour assumption that only one migration can take place. (d)

lyþcsk must equate to zero. Otherwise, Byþc

jik would be greater

than zero. The above entails that a second migration wouldtake place, which will contradict our basic assumption. It isstraightforward that Fig. 5 can be extended to hold morenodes, such as nf and ns having load variables equal to zero.(Same reasoning as detailed for cases (b) and (d) would

apply.) Therefore we conclude that both Pyþcik and Pyþc

jk must

be zero for Eq. 4 to be as small as possible. Finally, by

substituting the values (we identified) of Psy−

ik ;Pyþcik and

Pyþcjk into Eq. 4, we get the competitive ratio between ADE

and OPT as:

1

1þMCyijk

�����hij ¼ 1 ð5Þ

Lemma 2 The competitive ratio between OPT and ADE re-mains 1/(1 + MCijk

y) when ADE is allowed to perform morethan 1-hop agent migrations, provided that: (a) no back-and-forth migrations are permitted, (b) OPT does not performany migration, and (c) the preconditions of Lemma 1 holdtrue.

Proof We start out with the assumption that ADE makes onlytwo migrations. Let ADE perform the migrations Mijk andMjhk during the time intervals (y−, y+) and (z−, z+), respectively.We assume that the life of our agent is captured by the timeinterval [s, c]. Therefore, the life of ak can be broken downinto three time intervals: (a) [s, y−] represents the life of theagent from the birth until the time instant that the first

migration takes place. (b) [y+, z−] represents the life of ak justafter the first migration until the time instant that the secondmigration takes place. (c) [z+, c] represents the life of ak justafter the second migration until it is destroyed. As previously,we assume that during (y−, y+) and (z−, z+) there is no com-munication between agents. Consequently, the ratio of net-work cost between OPT and ADE becomes:

Psy−

ik þ Pyþz−ik þ Pzþc

ik

Psy−

ik þMCyijk þ Pyþz−

jk þMCzjhk þ Pzþc

hk

ð6Þ

In regards to the second migration of ak from nj to nh, wedifferentiate between the case that nh ≠ ni and the case that nh ≡ni. However, the case nh ≡ ni cannot occur due to our precon-dition that back-and-forth migrations are not permitted. There-fore, nh should be a node like nf in Fig. 5, with the constraintthat nh is one hop away from nj. The above is justified becausein this lemma we consider only 1-hop migrations. To becompatible with Fig. 5, from now onwards, we will use the

notation of nf instead of nh. Note that we need to keep Psy−

ik ,

Pyþz−ik , and Pzþc

ik as small as possible, while Pyþz−jk and

Pzþchk ≡Pzþc

fk to be as large as possible.

Let us examine one by one the variables that make up

Eq. 6. (a) Psy−

ik must equate to 1 (see the respective casereported in Lemma 1). (b) Following the same reasoning as

that of Lemma 1 (see the cases for Pyþcik and Pyþc

jk ), we

conclude that Pzþcik and Pzþc

fk must both be equal to zero. (c)

We observe that the bigger the difference Pyþz−jk −Pyþz−

ik , the

smaller will be the resultant of the Eq. 6. Under the assump-tion that Fig. 5 is associated with the time interval [y+, z−]

instead of [y+, c], we have that: (i) Pyþcik equals

lyþcjk � hij þ ly

þcsk � his þ ly

þcfk � hif and (ii) Pyþc

jk equals

lyþcik � hji þ ly

þcfk � hjf þ ly

þcsk � hjs . From the above, we con-

clude that Pyþz−jk −Pyþz−

ik equals lyþz−ik þ ly

þz−sk −ly

þz−jk −ly

þz−fk .

Therefore, if Pyþz−jk −Pyþz−

ik > 0 , then the following must hold:

lyþz−ik þ ly

þz−sk > ly

þz−jk þ ly

þz−fk ð7Þ

It should also be stressed that there cannot be a time

interval [p,z−] ⊆ [y+,z−] such that lpz−

ik þ lpz−

sk > lpz−

jk þ lpz−

fk .

Otherwise, it would be beneficial to perform Mjik instead ofMjfk, which contradicts our basic assumption. Therefore, we

conclude that lpz−

ik þ lpz−

sk ≤ lpz−

jk þ lpz−

fk must always be true.

Because the above holds true for every [p,z−] ⊆ [y+,z−], wecan say that the following must also hold true:

lyþz−ik þ ly

þz−sk ≤ ly

þz−jk þ ly

þz−fk . However, the above entails that

nfd hops 1 hop d’ hops

ak

si j

f

The amount of data ( ) exchangedbetween ak and ns for the timeinterval [y+, c]

y cskl

njns ni

+

Fig. 5 The network costs for the time interval [y+, c] when ak is hostedby ni and nj, respectively

Mobile Netw Appl

Page 10: Distributed Online Algorithms for the Agent Migration Problem in WSNs

Eq. 7 cannot hold true, which translates into

Pyþz−jk −Pyþz−

ik ≤0⇔Pyþz−jk ≤Pyþz−

ik . Recall that Pyþz−ik must be kept

to be as small as possible for Eq. 6 to be as small as possible.

However, from the above we also deduce the fact that Pyþz−jk

must also be kept as small as possible. Note that the ideal

case occurs when both Pyþz−ik and Pyþz−

jk are equal to zero.

That is to say that lyþz−ik , ly

þz−sk , ly

þz−jk , and ly

þz−fk all equate to

zero. However, for ADE to perform Mjfk it is required that

lyþz−fk ≥1 . Otherwise, there cannot be any migration benefit

greater than zero. Therefore, we conclude that lyþz−fk ¼ 1 .

Putting it all together, we conclude that Pyþz−ik ¼ 2 and

Pyþz−ik ¼ 1 .Consequently, the competitive ratio becomes 2/(2 +

MCijky + MCjhk

z), which according to Eq. 3 is equal to 2/(2+ 2MCijk

y). Following the same rationale with N migrationsof ak, we conclude that N/(N + N × MCijk

y) = 1/(1 + MCijky).

Lemma 3 The competitive ratio between OPT and ADEbecomes 1/(1 + MP + 2MCijk

y) provided that: (a) back-and-forth migrations are permitted and (b) the preconditions ofLemma 2 hold true.

Proof Recall that in the previous lemma, we precluded the casewhen nh ≡ ni as we did not allow back-and-forth migrations.Therefore, we pick up from that point to show that the compet-itive ratio changes when nh ≡ ni instead of nh ≠ ni. Specifically,in that case, ak returns to ni andwe can say that a back-and-forthmigration takes place. Notice that this case also appeared inLemma 2, where it was deemed irrelevant whether nh ≡ ni or

otherwise. In terms of the second case we have that Pzþchk ≡Pzþc

ik

(instead of Pzþchk ≡Pzþc

fk ). The above entails that Pzþcik appears in

both the numerator and the denominator of Eq. 6. As a conse-

quence, we conclude that Pzþcik must be equal to 0 for Eq. 6 to

be as small as possible. As far as the third case is concerned, weobserve that in Fig. 5 (under the assumption of [y+, z−] instead

of [y+, c], if lyþz−jk increases, then Pyþz−

ik increases; however,

Pyþz−jk remains unchanged. Therefore, ly

þz−jk should be kept as

small as possible. Following the same reasoning we conclude

that lyþz−fk also must be kept as small as possible, while ly

þz−ik and

lyþz−sk are to be kept as large as possible. Therefore, ly

þz−jk and

lyþz−fk must equate to zero. However, we need to investigate

further to identify the most appropriate values of lyþz−ik and ly

þz−sk

that makes Eq. 6 as small as possible.

We claim that lyþz−ik cannot be greater than the maximum

payload of a packet (hereafter referred to asMP). The above

is justified by the fact that when lyþz−jk and ly

þz−fk are equal to

zero, then ADE will perform Mjik whenever nj receives orsends from or to ni a packet (data) related with ak. Therefore,

according to the fact that lyþz−ik should be as large as possible

and not greater than MP, we conclude that lyþz−ik ¼ MP .

Now, we prove that lyþz−sk must equate to zero. Initially, we

make the assumption that lyþz−sk ¼ 0 , then by substituting

lyþz−jk ¼ 0 , ly

þz−sk ¼ 0 , ly

þz−fk ¼ 0 , ly

þz−ik ¼ MP in the equations

appearing in cases (i) and (ii) in terms of the previous lemma,

we deduce that Pyþz−ik ¼ 0 and Pyþz−

jk ¼ MP . Therefore, Eq. 6

transforms into 1/(1 + MP + MCijky + MCjik

z), whichaccording to Eq. 3 is equal to the following:

1

1þMP þ 2MCyijk

� ������hij ¼ 1 ð8Þ

Now, we assume that lyþz−sk ¼ X , which means that Pyþz−

ik

will increase by d × X, where d is the distance between ns and

ni. For the variable Pyþz−jk the valuation will increase by (d +

1) × X, where d + 1 is the distance between ns and nj.Therefore, the numerator of Eq. 8 will increase by d × X,while the denominator will increase by (d + 1) × X. It shouldbe stressed that when the numerator of any fraction, say A/Bincreases by W, while the denominator by Q, then for therespective fraction to decrease, it is required thatW/Q < A/B.The above entails that for the fraction (1 + d × X)/(1 +MP +2MCijk

y + (d + 1) × X) to be smaller than the fraction of Eq. 8,it is required that d × X/(d + 1) × X = d/(d + 1) < 1/(1 +MP +2MCijk

y). Because d, MP, and MCijky are integers that are

always greater than zero, the above cannot hold true. There-

fore, we conclude that lyþz−sk ¼ 0 .

From the above, we can deduce that the smallest ratio canonly be achieved when nh ≡ ni. Therefore, Eq. 8 gives thecompetitive ratio. It should also be noted that when N suchback-and-forth migrations take place, the competitive ratiodoes not change. The above is justified by the fact that it isequivalent to stating that the numerator and denominator ofEq. 8 is multiplied by N (see the respective case in theprevious lemma).

Lemma 4 There cannot be a smaller ratio than 1/(1 + MP +2MCijk

y) irrespective of whether OPT and ADE performmigrations provided that the preconditions of Lemma 1 hold.

Proof When both ADE and OPT do not perform any mi-grations, then the ratio between them is equal to 1. Therefore,we focus on the cases where the loads are such that eitherADE or OPT chooses to perform migrations. Specifically,there are three cases: (a) ADE performs migrations, whileOPT does not, (b) OPT performs migrations, while ADEdoes not, and (c) both ADE and OPT perform migrations.

Mobile Netw Appl

Page 11: Distributed Online Algorithms for the Agent Migration Problem in WSNs

Case (a) has already been covered by the above mentionedlemmas. In regards to case (b), consider that OPT performs amigration Mijk, which means that there must be a time inter-val [s, z−] such that Bsz−

ijk ≥MCzijk . (If the above does not hold,

then OPT would not be able take the optimal decision—acontradiction.) However, if Bsz−

ijk ≥MCzijk , then it is a contra-

diction on its own as ADE would decide to perform Mijk.Regarding case (c), we must modify Eqs. 4 and 6 to capturethe fact that OPT is allowed to migrate ak to nd.

Initially, we examine the case where ADE performs ex-actly one migration and OPTone or more migrations. There-fore, we modify Eq. 5 to:

Psx−ik þMCx

idk þ Pxþcjk

Psy−

ik þMCyijk þ Pyþc

jk

ð9Þ

We should note that OPT cannot perform more than onemigration as ADE must also do the same. There are twocases for the destination nodes nd and nj: (a) nd ≠ nj and (b)nd ≡ nj. Case (a) cannot hold as ADE will eventually migrateak to nd by performing two migrations in total. For the secondcase, OPT will migrate ak to nd ≡ nj before ADE does thesame as OPT always takes the optimal decision. The above

means that s; x−½ �⊂ s; y−½ �⇒Psy−

ik ¼ Psx−ik þ Pxy−

ik and

xþ; c½ �⊃ yþ; c½ �⇒Pxþcjk ¼ Pxþy

jk þ Pyþcjk . Substituting the afore-

mentioned into Eq. 9, we get:

Psx−ik þMCx

idk þ Pxþyjk þ Pyþc

jk

Psx−ik þ Pxy−

ik þMCyijk þ Pyþc

jk

ð10Þ

The lowest ratio of Eq. 10 is achieved when: (a) Psx−ik ,

Pyþcjk , and Pxy−

ik all are kept as small as possible, and (b)

Pxy−

ik becomes as large as possible. Following the samereasoning as detailed previously for various lemmas,we can conclude that the variables involved in (a) mustequal to zero and the variables involved in (b) must equate toMP. However, we also can observe that the resulting ratio (seeEq. 11) is greater than Eq. 8. Therefore, the competitive ratiomust still be represented by Eq. 8.

MCxidk

MP þMCyijk

¼ MCyijk

MP þMCyijk

�����hij ¼ 1 ð11Þ

Secondly, we examine the system when ADE performsexactly two migrations. (This implies that OPT can onlyperform at most two migrations.) Case (a) If OPT performstwo migrations, then by modifying Eq. 6 and following thesame rationale as previously undertaken, we arrive at the sameratio as that of Eq. 11. (b) If OPT performs one migration, thenby modifying Eq. 6 and following the same rationale aspreviously undertaken, we arrive at the same ratio as that of

Eq. 12. (We must note that for case (a) and case (b), thedestination nodes must be the same with those of ADE’smigrations.) Now, we also can observe that the ratio ofEq. 12 is greater than the ratio of Eq. 8.

1þMCyijk

1þMP þ 2MCyijk

�����hi j ¼ 1 ð12Þ

Following the same reasoning for an abstract number ofmigrations for both ADE and OPT, we conclude that thelesser the number of migrations of OPT, the lesser is the ratiobetween OPT and ADE. However, the smaller ratio is beingcaptured when OPT does not perform migrations. Conse-quently, there cannot be a ratio between OPT and ADEsmaller than that captured by Eq. 8 irrespective of whetherOPT and ADE perform migrations or otherwise.

Lemma 5 The competitive ratio between OPTand ADE doesnot depend on the number of migration hops.

Proof If a k-hop back-and-forth migration takes place of anagent ak from ns to nd, then the competitive ratio given byEq. 8 can be rewritten as:

1� hsd

1� hsd þMP � hsd þ 2hsd �MCyij

� ������hij ¼ 1 ð13Þ

We can observe that the factor hsd appears in both thenumerator and the denominator of Eq. 13. Therefore, hsd iscancelled out, resulting in the same ratio as that of Eq. 8.

Theorem 1 The competitive ratio between OPT and ADE is1�3 under the requirement that an agent is migrated only

when Bpz−

ijk ≥MT ¼ 2MCzijk .

Proof According to the previous lemmas, Eq. 8 defines thecompetitive ratio. Therefore, what it remains is to examine howthis equation changes when MT varies. By incorporating themigration threshold MT into Eq. 8 the ratio becomes:MT/(MT + MT − 1 + MP + 2MCijk

y). The factor MT-1 + MP

being justified by the fact that when Psy−

ik ¼ MT−1 , ADEcannot migrate ak to nj until a message (of maximum size MP)

is exchanged between ak and nj. Therefore, Psy−

ik cannot begreater than MT-1 + MP. It should also be stressed that thenumerator cannot be greater than 2MCijk

y. Specifically, the nu-merator is equal to 2MCijk

y in the extreme case when ak hostedby ni exchanges exactly 2MCijk

y data units with nj and after thatak stops communicating with nj and communicates only with ni.

Therefore, the optimal decision is either to perform aback-and-forth migration or not to perform any migrationat all. In both cases, the numerator will be equal to 2MCijk

y.

Mobile Netw Appl

Page 12: Distributed Online Algorithms for the Agent Migration Problem in WSNs

As we can see, the ratio described in Eq. 8 increases untilMTis equal to 2MCijk

y, where it is almost 1�3 . Specifically, the

numerator becomes 2MCijky, while the denominator becomes

MP − 1 + 6MCijky. Particularly, the denominator is almost

equal to 6MCijky, given that 6MCijk

y ≫ MP − 1. As a conse-quence, by havingMT to be equal to 2MCijk

y, we achieve thebest competitive ratio that we can have – 1

�3 . Lastly, we

prove that the above mentioned competitive ratio doesnot change when the WSN has more than one agentwith concurrent migrations. This is justified by the factthat all the aforementioned proofs are modeled in such away that each agent communicates only with nodes. Theabove modeling gives us the leeway to assume thatagents do not communicate directly with each other,but only indirectly through their hosting nodes. Com-bining the above with the fact that the competitive ratiofor each agent does not depend on its size and is fixedat 1

�3 , we conclude that the total ratio will be also be

1�3 , independently of the number of agents within the

WSN with concurrent migrations.

5 Experiments

The applications developed in the POBICOS projectwere proof-of-concept prototypes, which were testedprimarily in lab-like setups, using simple network topol-ogies with just a few nodes. To evaluate the perfor-mance of ADE and ADE-SW for bigger networks andmore complex application structures, we performed aseries of simulated experiments, using the NS2 [26].Both the network topologies and the application struc-tures were generated randomly, to avoid bias for someparticular pattern. The same approach was adopted re-garding the message exchange patterns between agents,as we did not have any data from real-world deploy-ments (of that scale or complexity). This section pre-sents the experimental setup, and discusses the resultsof the most indicative experiments.

5.1 Network and application structure

Network structure The network structure was producedusing 50 nodes placed randomly in a plane of 120 × 120distance units. Two nodes were assumed to be in range ofeach other if the Euclidean distance is less than 30 units. Thecorresponding tree-based routing topology was obtained byconstructing a spanning tree. Five different topologies weregenerated.

Application structure The application tree is generated ran-domly, based on an initial (given) number of generic agents.The agents are divided into disjoint groups of 5, and for eachgroup 2–5 agents are randomly picked as children of a newnon-generic agent. In subsequent iterations, orphan (non-generic and generic) agents are (again) randomly split ingroups of 5, and the process of parent creation is repeated,until a single agent becomes the root of the application.Three different application classes were considered with(50, 22), (25, 12) and (10, 5) non-generic and generic agents,respectively, referred to as app-50, app-25 and app-10. Theagents were assigned random sizes, uniformly distributedfrom 100 to 1000 units. For each class, five different in-stances were produced, yielding a total of 15 different appli-cation trees. The application tree also imposes an indirectlimitation to the agent’s placement, namely non-generic sib-lings have to be placed on a different node (operationally, itdoes not make any sense to have two instances of the samenon-generic agent on the same node).

Application traffic A non-generic (the generic agents agentcan change between two reporting modes MH andML. Whenin the MH mode, an agent sends ten times more messagescompared to the ML mode. We consider four different typesof application traffic fluctuations in terms of how often anagent changes between the MH and ML modes. Specifically,we introduce traffic types T(UH), T(H), T(L) and T(UL) (for“ultra high”, “high”, “low” and “ultra low” fluctuation)where an agent remains in the same reporting mode for aninterval that is randomly determined from a uniform distri-bution of [1,10), [1, 100), [50, 500), and [100, 1000), re-spectively. Also, we say that an application belongs to familyF1, F2 and F3, when at most 1, 2 and 3 agents that have thesame parent can be in the MH mode simultaneously. Unlessotherwise stated, the presented results are for applications ofthe F1 family, which offers the most opportunities for bene-ficial migrations.

Metrics Each experiment discussed in the following wasconducted for all 15 application trees, each being deployedon all 5 network topologies (starting from a random initialplacement). Thus, each experiment includes 75 runs in total.The reported results are the averages over these runs. The

T(H) T(L) T(UL)

To

tal n

etw

ork

load

Traffic pattern

ADE-SW-(0.1,1)ADE-SW-(0.1,10)ADE-SW-(0.1,50)

Fig. 6 Network load ADE-SW-(0.1, x)

Mobile Netw Appl

Page 13: Distributed Online Algorithms for the Agent Migration Problem in WSNs

main metric we use for our comparison is the total aggregat-ed network load over the entire lifetime of the application,for the agent placements (and migrations that are performedto implement those placements) decided by the algorithms.As a yardstick, we use a static optimal placement, which iscomputed by the algorithm presented in [18]. We must notethat the aforementioned algorithm (a posteriori) knows allthe message exchanges that occur between the applica-tion’s agents during the execution. This placement is thenimplemented at the beginning of the execution, by performingthe necessary migrations, and is kept unchanged until the endof the execution.

In the sequel, we start by discussing the performance ofADE-SW for different values of its two key parameters: themigration threshold MT and the consolidation step Cstep. Weuse the notation ADE-SW-(x-y) to refer to the algorithm whenrun withMT = x and Cstep = y. The results for T(H), T(L) and(TUL) are reported separately from those for T(UH) becausethe algorithm behaves differently in the latter case. Note thateven though the proofs for the competitive ratios presented inSection 4 are given for the case where MT equals twice theagent migration cost, it is nevertheless important to see theeffect of this parameter in practice, i.e., how varying MTaffects, if at all, the performance of ADE-SW in differentscenarios. Then, we pick the best variant of ADE-SW andcompare it with ADE and the optimal static placement.

5.2 Performance of ADE-SW for T(H), T(L) and T(UL)

Figure 6 plots the total network load that results for differentvalues of Cstep withMT = 0.1 of the agent size, and all typesof traffic, except T(UH) which is discussed separately in thenext subsection. As can be seen, the performance of ADE-SWdeteriorates as Cstep increases. The reason is that a largervalue of Cstep practically means that migration decisions willbe taken based on more aged information, which in turnmakes the algorithm less reactive to changes inmessage trafficpatterns. Another observation is that the performance gapgrows as the changes in agent communication become lessfrequent: the difference between the best and worst variant ismaximized for T(UL). This is because the actual benefit of amigration (and the opportunity cost for not performing it assoon as possible) is more likely to be larger for more stableagent traffic. In contrast, these differences are much smallerfor T(H), where migrations are unlikely to be beneficial any-way; in fact, in this case it could be equally if not morebeneficial for an agent not to migrate at all, instead of migrat-ing back-and-forth due to load changes (see next subsection,where this aspect is discussed in more detail).

These experiments were repeated, this time varying MTwhile keepingCstep = 1 (which was the setting that performedbetter in the previous set of experiments). Figure 7 shows the

results. Clearly, the performance of ADE-SW drops as themigration threshold increases, the best variant beingMT = 0.1.This is due to the fact that the algorithm becomes moreconservative for larger values of MT, taking migration de-cisions with increased latency, only after sufficient traffic datahas been collected. However, as long as the migration is notdecided, this traffic also incurs more cost for the network.Again, the difference is more pronounced for T(UL), whereagent communication is mostly stable, and diminishes forT(H) where the agent communication rates change frequently.Overall, we conclude that the best variant is ADE-SW-(0.1, 1).

5.3 Considering T(UH)

Figure 8 shows the behavior of ADE-SWwithMT = 0.1 whilevarying Cstep, for T(UH). It is interesting to observe that theresults achieved show an opposite trend compared to casesdiscussed previously (see Fig. 6). This is because the veryfrequent changes in the application traffic make it far moreunlikely for the cost of migrations to be amortized. Thus, ascan be seen, the best performance is achieved for larger valuesofCstep, which, as discussed, make the algorithm less reactiveto traffic changes. This can be verified by looking at thenumber of migrations performed per agent, shown in Fig. 9,which drop as the value of Cstep increases.

To explore the effects of the migration threshold, weconducted experiments where we kept Cstep = 500 (the bestvariant in the previous experiments) and varied MT. Theresults are shown in Fig. 10. Note that, somewhat surpris-ingly, the performance of ADE-SW drops as MT increases.Since a large MT will reduce the number of migrations, and

T(H) T(L) T(UL)

To

tal n

etw

ork

load

Traffic pattern

ADE-SW-(0.1,1)ADE-SW-(1,1)ADE-SW-(10,1)ADE-SW-(20,1)ADE-SW-(50,1)

Fig. 7 Network load ADE-SW-(x, 1)

To

tal n

etw

ork

load ADE-SW

Fig. 8 Network load ADE-SW-(0.1, x), T(UH)

Mobile Netw Appl

Page 14: Distributed Online Algorithms for the Agent Migration Problem in WSNs

given that migrations are unlikely to be beneficial whentraffic changes frequently, one would expect to see an oppo-site trend. The explanation for this is as follows. Given thelarge value of Cstep which already makes the algorithm lessresponsive to traffic fluctuations, having a largeMTon top ofit can eliminate migrations that would have been beneficial,despite the frequent changes in the application traffic.

Trying to shed somemore light into the relationship betweenCstep and MT for T(UH), we performed additional experi-ments, varying MT as before but this time with Cstep = 1.The results are shown in Fig. 11. One can see that (i) theperformance trend when MT ≤ 10 is opposite to the onereported previously (for Cstep = 500), and (ii) the trend whenMT ≥ 20 is in accordance to the one reported previously.Actually, both observations confirm the explanation givenabove. If Cstep is small, a larger MT has a positive effect as itcan suppress migrations that are quite likely to turn out to benon-beneficial, whereas if MT becomes too big then the algo-rithm will also eliminate migrations that would have beenbeneficial. Indeed, Fig. 12 illustrates the sharp drop in thenumber of migrations performed whenMT ≥ 10. It seems that,for Cstep = 1, MT = 10 strikes a tradeoff between eliminatingmost non-beneficial migrations while at the same time allowingfor some beneficial migrations to occur as well. Note that thebest overall results are achieved by ADE-SW-(0.1, 500).

5.4 Comparison between offline and online algorithms

In the next set of experiments we pick the best variant ofADE-SW for each type of traffic, and compare it with ADE

and the optimal static placement algorithm. The results areshown in Fig. 13. A first observation is that the performanceof ADE and ADE-SW are identical. This indicates that evenif nodes had the capacity to store the entire traffic history oflocally hosted generic agents, this would have no noticeableeffect on the migration decisions taken by the proposedalgorithms (for the value range of MT investigated in ourexperiments). Another important remark is that the optimalstatic placement algorithm outperforms the online algo-rithms only for T(UH), when the application traffic changesvery fast. This is not surprising as in this particular case theoptimal static placement represents a rather good policy, whileit is hard for an online algorithm to decide whether an agentmigration will turn out to be useful or not, based on historicaldata (which is does not reveal what will happen next). Never-theless, the online algorithms handle the situation quite well asthey decide to perform very few migrations, as it shown inFig. 14, in fact, almost as few as the ones that need to beperformed to reach the optimal static placement.

The extra network cost incurred by the online algorithmsfor T(UH) is acceptable given the savings achieved for allother types of traffic, T(H), T(L) and T(UL). In fact, for thelast two cases, these savings are significant, reducing thenetwork cost more than 70 % compared to the optimal staticplacement. This shows that these algorithms are indeed agood choice when traffic changes are infrequent, making itpossible to adapt the placement of agents to the current ratesof agent communications. The very dynamic nature of thesealgorithms in response to traffic changes can also be inferredfrom the increased number of agent migrations for T(H),T(L) and T(UL), shown in Fig. 14. However, it is also

0

10

20

30

40

50

Mig

rati

on

s p

er a

gen

t

ADE-SW

Fig. 9 Migr. per agent ADE-SW-(0.1, x), T(UH)

To

tal n

etw

ork

load

ADE-SW

Fig. 10 Network load ADE-SW-(x, 500), T(UH)

To

tal n

etw

ork

load ADE-SW

Fig. 11 Network load ADE-SW-(x, 1), T(UH)

0

10

20

30

40

50

Mig

rati

on

s p

er a

gen

t

ADE-SW

Fig. 12 Migr. per agent ADE-SW-(x, 1), T(UH)

Mobile Netw Appl

Page 15: Distributed Online Algorithms for the Agent Migration Problem in WSNs

important to note the difference in the efficiency of themigrations performed for T(H) vs T(L) and T(UL): althoughthe number of migrations performed for T(L) and T(UL) isonly about 15 % higher compared to T(H), the load reductionachieved is nearly 3-fold.

Finally, we also conducted experiments where we vary theapplication family, while we keep fixed the traffic type atT(L). From Fig. 15 one can observe that the performance ofboth online algorithms degrades as the application family goesfrom F1 to F2 and then to F3. Recall that the index of anapplication family is equal to the maximum number of siblingagents that can simultaneously be in the MH mode (highreporting rate). Consequently, given that it is quite likely forsiblings to be placed on different parts of the tree network, andgiven that non-generic agents cannot be moved from theiroriginal (randomly picked) hosts, the probability of a migra-tion being beneficial is greatly reduced. Nevertheless, the loadreduction vs. the optimal static placement remains significant,close to 40 % even for F3.

We have conducted similar experiments with capacity con-straints on the nodes. In this case, a beneficial migration maybe impossible to perform simply because there is no space onthe respective destination node. Despite this limitation, theproposed algorithms achieve notable reductions in the net-work cost: even if it may be impossible to place an agentoptimally, on the node that would minimize the amount ofagent communication that is performed over the network, theagent may still be migrated to a nearby node, and thus reducethe network load noticeably). The results are not shown due tothe lack of space.

6 Related work

One from the most renowned problems in the context ofonline decision problems is that of deciding which of k pagesto keep in a memory to minimize the number of faults (i.e.,paging problem). Sleator and Tarjan [29] discussed that LRUand FIFO are k-competitive. Ref. [10] proposed for the sameproblem a randomized algorithm, called RMARK. The au-thors in [6] showed how a primal-dual method can be appliedfor the weighted caching problem.

Online load balancing has received a lot of researchinterest in the context of online strategies. Ref. [1] and [3]studied the problem of minimizing the load on machines forthe case where the tasks have limited duration. Caragianniset. al. [7] introduced the online problem of how much thequality of load balancing is affected by selfishness andgreediness. Ref. [8] studied the problem of load balancingunder the Lp norm. The proposed algorithms compute in anonline fashion a fractional solution to the problem and usethe fractional values to perform random choices.

In the last few years, a significant part of research commu-nity has turned its attention towards online decision problemsin the context of WSNs. Even though the online routingproblems have received a lot of interest [13, 15, 22, 25, 35],there are also works that focus on other issues related toWSNs. For example, in [4, 20] the authors analyze the theo-retical complexity for the problem of gathering data in WSNsin a distributed fashion, and devise online algorithms as plau-sible solutions. The authors of [9] devised an online algorithmfor the time interval top-k query optimization to maximize thenetwork lifetime. Another work reported in [16] presents anonline algorithm to minimize the total transmission energy ina broadcast network by dynamically adjusting each node’stransmission power and rate on a per-packet basis. Ref. [23]deals with the online problem of mining frequent sensor valuesets from a large WSN. Last, in [2] the authors solve theproblem of service placement in virtual networks under theobjective to minimize the total delay experienced by theclients using the services. They prove that their algorithm isO(μlogn)-competitive, with μ being the ratio between maxi-mal and minimal link capacity in the underlying network, and

-20

0

20

40

60

80

100

T(UH) T(H) T(L) T(UL)

load

red

uct

ion

(%

)ag

ain

st o

pti

mal

Traffic pattern

ADE-SW

ADE

Fig. 13 Load reduction for all traffic types

0

20

40

60

80

100

120

T(UH) T(H) T(L) T(UL)

mig

rati

on

s p

er a

gen

t

Traffic pattern

ADE ADE-SW Opt

Fig. 14 Migr. per agent for all traffic types

0

20

40

60

80

F1 F2 F3

load

red

uct

ion

(%

) ag

ain

st o

pti

mal

Application families

ADE-SW

ADE

Fig. 15 Load reduction for all application families

Mobile Netw Appl

Page 16: Distributed Online Algorithms for the Agent Migration Problem in WSNs

n being the number of servers. However our problem differswith the above in the following issues: (a) the work in [2] is onthe context of services that communicate with clients, whileour context is on WSNs, (b) even though we can say that thegeneric agents play the role of services and the non-genericones play the role of clients, in the above work, there is nocommunication between services (in our work, we considercommunicational dependencies between generic agents), and(c) the objective tackled in [2] is the total delay, while ours isthe total communication overhead.

Algorithmic wise, the agent migration problem (AMP)belongs to the general family of placement problems, wherebygiven a set of possible hosting entities and a set of objects, theproblem is to place the objects at the entities so that perfor-mance is optimized. The most recent related papers we foundin the literature are detailed below. Ref. [30, 35] proposedalgorithms to minimize the total communication cost for theproblem of virtual machine placement on clouds. The authorsof [34] proposed a fully distributed algorithm that minimizesthe total communication cost of agent placement in WSNs.Ref. [33] introduced the problem of agent evictions to tacklethe same problem when the nodes in the system have limitedstorage capacity.

Unfortunately, none of the above referenced papers arerelated to the problem of deciding in an online fashion wheth-er the cost of an agent migration can be amortized in the futureor not – the main focus of our work. However, the referencework provided us with some useful insights into devising thecompetitiveness of our algorithms. Themost relevant works toours are the papers dealing with the problem of online loadbalancing on machines. Specifically, our work can be consid-ered in the context of agent-based embedded middleware,specifically, POBICOS [31]. Many systems, such as, Rover[10], Mate [19], Agilla [12], one.world [14], Olympus [28],SensorWare [5], MagnetOS [21], Pleiades [17], and DFuse[27], provide environments supporting mobile code and mi-grations. However, the above frameworks do not support codemigration in an online fashion. This is a main drawback,because there are environments where the network topologychanges dynamically, rendering these systems completelyunsuitable to those environments. Therefore, our proposedalgorithms could be adopted from such systems to addressthe problem of online code migration.

7 Conclusions

In this work, we tackled the problem of deciding at whatpoint in time an agent should be migrated on which node inorder to reduce the network cost of the message exchangesthat take place at the application level. The proposed algo-rithms have a proven competitive ratio of 1

�3 vs. an optimal

“oracular” algorithm, for the worst case scenario. Also, theexperimental evaluation shows that unless the application’smessage traffic changes very frequently, the algorithms per-form well compared to an optimal static placement. In fact,for infrequent traffic changes, the improvement achieved bythese algorithms is very significant, more than 70%. Overall,these theoretical and experimental results are a strong indi-cation of the quality of the proposed algorithms. In thefuture, we plan to extend these algorithms by incorporatingmachine learning techniques in order to detect periodic pat-terns in the application traffic fluctuations, and use thisknowledge to schedule migrations in a more proactive way.

References

1. Aspenes J, Azar Y, Fiat A, Plotkin S, Waarts O (1993) On-line machine scheduling with application to load balancingand virtual circuit routing. ACM Symposium on Theory ofComputing

2. Arora D, Bienkowski M, Feldman A, Schaffrath G, Schmid S(2011) Online strategies for intra and inter provider service migra-tion in virtual networks, Proc. IPTcomm

3. Azar Y et al. (1993) On-line load balancing of temporary tasks,Workshop on algorithms and data structures

4. Bonifaci V, Korteweg P, Marchetti-Spaccamela A, Stougie L (2008)The distributed wireless gathering problem. Proc. ICAMWN

5. Boulis A, Han C-C, Shea R, Srivastava MB (2007) Sensorware:programming sensor networks beyond code update and querying.Pervasive Mob Comput J

6. Buchbinder N, Naor J (2009) The design of competitive onlinealgorithms via a primal: dual approach. Found Trends TheoriticalComput Sci

7. Caragiannis I, Flammini M, Kaklamanis C, Kanellopoulos P,Loscardelli L (2006) Tight Bounds for Selfish and Greedy LoadBalancing. Proc. ICALP

8. Caragiannis I (2009) Better bounds for online load balancing onunrelated machines. Proc. SODA

9. Chen B, Liang W, Xu Yu J (2010) Online time interval top-kqueries in wireless sensor networks. Proc. ICMDM

10. Chrobak M, Koutsoupias E, Noga J (2003) More on randomizedon-line algorithms for caching. Theoritcal Comput Sci

11. Domaszewicz J, Roj M, Pruszkowski A, Golanski M, Kacperski K(2006) ROVERS: pervasive computing platform for heterogeneoussensor-actuator networks. Proc. WowMoM

12. Fok CL, Roman GC, Lu C (2005) Rapid development and flexibledeployment of adaptive wireless sensor network applications. Proc.ICDCS

13. Fontanelli D, Palopoli L, Passerone R (2009) On the global con-vergence of a class of distributed algorithms for maximizing thecoverage of a WSN. Proc. CDC/CCC

14. Grimm R, Davis J, Lemar E, Macbeth A, Swanson S, Anderson T,Bershad B, Borriello G, Gribble S, Wetherall D (2004) Systemsupport for pervasive applications. ACM Trans Comput Syst

15. Harks T, Heinz S, Pfetsch ME (2009) Competitive onlinemulticommodity routing. Theory Comput Syst

16. Kompella RR, Shoeren AC (2003) Practical lazy scheduling insensor networks. Proc. SenSys

17. Kothari N, Gummadi R, Millstein T, Govindan R (2007) Reliableand efficient programming abstractions for wireless sensor net-works. Proc. ACM SIGPLAN PLDI

Mobile Netw Appl

Page 17: Distributed Online Algorithms for the Agent Migration Problem in WSNs

18. Lee C-H, Shin KG (1997) Optimal task assignment in homo-geneous networks. IEEE Trans on Parallel Distrib Syst 8:119–129

19. Levis P, Culler D (2002) Mate: a tiny virtual machine for sensornetworks. Proc. ASPLOS

20. Liang W (2007) Online data gathering for maximizing networklifetime in sensor networks. IEEE Trans Mob Comput

21. Liu H, Roeder T, Walsh K, Barr R, Sirer EG (2005), Design andimplementation of a single system image operating system for adhoc networks. Proc. MOBISYS

22. Li Q, Aslam J, Rus D (2001) Online power-aware routing inwireless ad-hoc networks. Proc. MobiCom

23. Loo KK, Tong I, Kao B (2005) Online algorithms for mining inter-stream associations from large sensor neworks. Lect Notes inComput Sci

24. Mesarovic MD (1970) Multilevel systems and concepts in processcontrol. Proc IEEE 58(1):111–125

25. Minhas MR, Gopalakrishnan S, Leung VCM (2009) An onlinemultipath routing algorithm for maximizing lifetime in wirelesssensor networks. ITNG

26. Network Simulator2 (ns2), http://www.isi.edu/nsnam/ns/27. Ramachandran U et al. (2006) Dynamic data fusion for future

sensor networks. ACM Trans Sens Netw

28. Ranganathan A, et al. (2005) Olympus: a high-level programmingmodel for pervasive computing environments, PERCOM

29. Sleator DD, Tarjan RE (1985) Amortized efficiency of list updateand paging rules. ACM Commun

30. Sonnek J, Greensky J, Reutiman R (2010) Starling: minimizingcommunication overhead in virtualized computing platforms usingdecentralized affinity-aware migration, Proc. ICPP

31. STREP/FP7-ICT: Platform for Opportunistic Behaviour in Incom-pletely Specified, Heterogeneous Object Communities (POBICOS),http://www.ict-pobicos.eu/index.htm

32. Tziritas N, Georgakoudis G, Lalis S, Paczesny T, Domaszewicz J,Lampsas P, Loukopoulos T (2012) Middleware mechanisms foragent mobility in wireless sensor and actuator networks, Proc. 3rdInternational Conference on Sensor Systems and Software (S-CUBE)

33. Tziritas N, Lampsas P, Lalis S, Loukopoulos T, Khan SU, Xu C-Z(20012) Introducing agent evictions to improve application place-ment in wireless embedded systems. Proc. ICPP

34. Tziritas N, Loukopoulos T, Lalis S, Lampsas P (2011) GRAL: agrouping algorithm to optimize application placement in wirelessembedded systems. Proc. IPDPS

35. Tziritas N, Khan SU, Xu C-Z, Hong J (2012) An optimal fullydistributed algorithm to minimize the resource consumption ofcloud applications, Proc. ICPADS

Mobile Netw Appl