Graph Exploration by Energy-Sharing Mobile Agents
J. Czyzowicz, S. Dobrev, R. Killick, E. Kranakis, D. Krizanc, L. Narayanan, J. Opatrny, D. Pankratov, S. Shende
GGraph Exploration by Energy-Sharing Mobile Agents (cid:63)
J. Czyzowicz , S. Dobrev , R. Killick , E. Kranakis , D. Krizanc , L. Narayanan , J. Opatrny ,D. Pankratov , and S. Shende D´epartement d’Informatique, Universit´e du Qu´ebec en Outaouais, Canada Slovak Academy of Sciences, Bratislava, Slovakia School of Computer Science, Carleton University, Ottawa, Canada Dept.of Mathematics & Computer Science, Wesleyan University, Middletown CT, USA Department of Computer Science and Software Engineering, Concordia University, Canada Department of Computer Science, Rutgers University, USA
Abstract
We consider the problem of collective exploration of a known n -node edge-weightedgraph by k mobile agents that have limited energy but are capable of energy transfers. The agentsare initially placed at an arbitrary subset of nodes in the graph, and each agent has an initial,possibly different, amount of energy. The goal of the exploration problem is for every edge in thegraph to be traversed by at least one agent. The amount of energy used by an agent to traveldistance x is proportional to x . In our model, the agents can share energy when co-located: whentwo agents meet, one can transfer part of its energy to the other.For an n -node path, we give an O ( n + k ) time algorithm that either finds an exploration strategy,or reports that one does not exist. For an n -node tree with (cid:96) leaves, we give an O ( n + (cid:96)k ) algorithmthat finds an exploration strategy if one exists. Finally, for the general graph case, we show thatthe problem of deciding if exploration is possible by energy-sharing agents is NP-hard, even for3-regular graphs. In addition, we show that it is always possible to find an exploration strategyif the total energy of the agents is at least twice the total weight of the edges; moreover, this isasymptotically optimal. Key words and phrases.
Energy, Exploration, Graph, Mobile Agent, Path, Sharing, Tree.
The emergence of swarm robotics has inspired a number of investigations into the capabilities ofa collection of autonomous mobile robots (or agents), each with limited capabilities. Such agentscooperate and work collaboratively to achieve complex tasks such as pattern formation, objectclustering and assembly, search, and exploration. Collaboration on such tasks is achieved by, forexample, decomposing the task at hand into smaller tasks which can be performed by individualagents. The benefits of the collaborative paradigm are manifold: smaller task completion time,fault tolerance, and the lower build cost and energy-efficiency of a collection of smaller agents ascompared to larger more complex agents. Somewhat surprisingly, for example, a recent paper [15]shows that two agents can search for a target at an unknown location on the line with lower totalenergy costs than a single agent.In this paper, we study the problem of collective exploration of a known edge-weighted graphby n mobile agents initially placed at arbitrary nodes of the graph. Many variants of the graphexploration problem have been studied previously; see Section 1.2 for a description of some of therelated work. For our work, the goal of exploration is that every edge of the graph must be traversed (cid:63) This is the full version of the paper appearing in the proceedings of SIROCCO 2021. a r X i v : . [ c s . D M ] F e b y at least one agent. The weight of an edge is called its length . Every agent is equipped with a battery/energy container that has an initial amount of energy; the initial energies of different agentscan be different. We assume that moving length x depletes the battery of an agent by exactly x .Clearly then, for exploration to be possible, the sum of the initial energies of all agents has tobe at least E , the sum of all edge weights. However total energy E may not be sufficient; the initialplacement of the agents plays a role in deciding if exploration is possible with the given energies.To see this, consider exploration by 2 agents of a path with 4 nodes, where each of the 3 edges haslength 1. If the agents are initially placed at the two endpoints of the path, then total energy 3suffices to explore the path. However if the two agents are initially placed at the middle two nodesof the path, it is not difficult to see that total energy 4 is necessary to complete the exploration.In addition to initial placement of agents, and the total amount of energy, the initial energydistribution also affects the existence of an exploration strategy. To see this, suppose the 2 agents areplaced at the middle nodes of the 4-node path. Consider first an energy distribution in which bothagents have initial energy 2. Then one exploration strategy would be for both agents to explore halfof the center edge, and turn around to travel to the endpoint. Next consider an energy distributionin which agent 1 has energy 3 + (cid:15) for some 0 < (cid:15) ≤ − (cid:15) . It is easyto see that exploration is impossible, even though the total energy of both agents is the same as inthe first distribution.Recently, several researchers have proposed a new mechanism to aid collaboration: the capabilityto share energy . In other words, when two agents meet, one can transfer a portion of its energy tothe other. It is interesting to investigate what tasks might be made possible with this new capability,given the same initial amounts of energies. In [6,12,13,14,25], researchers have studied the problemsof data delivery, broadcast, and convergecast by energy-sharing mobile agents.In the example described above, where agent 1 has energy 3 + (cid:15) for some 0 < (cid:15) ≤ − (cid:15) , if energy transfer is allowed, agent 1 (with the higher energy) can firstgo to the endpoint closer to its initial position, then turn around, reach agent 2, and transfer itsremaining energy (cid:15) to agent 2. This enables agent 2 to reach the other endpoint, thereby completingthe exploration.This simple example shows that energy-sharing capabilities make graph exploration possible insituations where it would have been impossible otherwise. Note that an algorithm for explorationwith energy sharing requires not only an assignment of trajectories to agents that collectivelyexplore the entire graph, but also an achievable schedule of energy transfers. In this paper, we areinterested in exploration strategies for edge-weighted graphs by energy-sharing mobile agents. Wegive a precise definition of our model and the collaborative exploration problem below. We are given a weighted graph G = ( V, E ) where V is a set of n vertices (or nodes), E a set of m edges, and each edge a i ∈ E is assigned a real number w i , denoting its length . We have k mobileagents (or robots) r , r , . . . , r k placed at some of the vertices of the graph. We allow more thanone agent to be located in the same place. Each mobile agent (or agent for short) r i can move withspeed 1, and initially possesses a specific amount of energy equal to e i for its moves. An agent canmove in any direction along the edges of the graph G , it can stop if needed, and it can reverse itsdirection of moving either at a vertex, or after traversing a part of an edge. The energy consumedby a moving agent is linearly proportional to the distance x traveled; to simplify notation it isassumed to be equal to x . An agent can move only if its energy is greater than zero.2n important feature of our model is the possibility of energy sharing between agents: whentwo agents, say r i and r j , i (cid:54) = j , meet at some time at some location in the graph, agent r i cantransfer a portion of its energy to r j . More specifically, if e (cid:48) i and e (cid:48) j are the energy levels of r i and r j at the time they meet then r i can transfer to r j energy 0 < e ≤ e (cid:48) i and thus their energies willbecome e (cid:48) i − e and e (cid:48) j + e , respectively.In our model, each agent is assigned a trajectory to follow. We define a trajectory of an agentto be a sequence of edges or parts of edges that starts at the agent’s initial position and forms acontinuous walk in the graph. In addition, a trajectory specifies a schedule of energy transfers, i.e.,all points on this walk (could be points different from vertices) where the agent is to receive/transferenergy from/to other agents, and for each such point the amounts of energy involved. We call a setof trajectories valid if the schedules of energy transfers among trajectories match, and energy levelsare sufficient for the movement of agents. More specifically, for every transfer point on a trajectoryof agent r i where energy is to be received/transferred, there is exactly one agent r j , j (cid:54) = i , whosetrajectory contains the same transfer point transferring/receiving that amount of energy to/from r i , and the transfers can scheduled on a time line. Furthermore, the energy of an agent, initiallyand after any energy transfer, must be always sufficient to continue to move along its assignedtrajectory. We are interested in solving the following general problem of collaborative exploration: Graph Exploration Problem : Given a weighted graph G = ( V, E ) and k mobile agents r ,r , . . . , r k together with their respective initial energies e , e , . . . , e k and positions s , s , . . . , s k inthe graph, find a valid set of trajectories that explore (or cover) all edges of the graph. The problems of exploration and searching have been investigated for over fifty years. The stud-ied environments were usually graphs (e.g.[1,17,22,26]) and geometric two-dimensional terrains(e.g.[2,4,16]). The goal of such research was most often the minimization of the time of thesearch/exploration that was proportional to the distance travelled by the searcher. The task ofsearching consists of finding the target placed at an unknown position of the environment. Theenvironment itself was sometimes known in advance (cf. [4,8,14,22]) but most research assumedonly its partial knowledge, e.g. the type of graph, the upper bound on its size or its node degree,etc. Remarkably, there exist hundreds of papers for search in an environment as simple as a line(cf. [3]). The task of exploration consisted of constructing a traversal of the entire environment,e.g. in order to construct its map (see [21,26]). It is worth noting that performing a complete graphtraversal does not result in acquiring the knowledge of the map (see [10]).Most of the early research on search and exploration has been done for the case of a singlesearcher. When a team of collaborating searchers (also called agents or robots) is available, themain challenge is usually to partition the task among the team members and synchronize theirefforts using available means of communication, cf. [5,9,18,20]. Unfortunately, for the centralizedsetting, already in the case of two robots in the tree environment known in advance, minimizingits exploration time is NP-hard, e.g., see [20].The case of robots that can share energy has been recently studied for the tasks of data commu-nication, [6,12,13,14,25]. In this research the robots are distributed in different places of the network,each robot initially possessing some amount of energy, possibly distinct for different robots. Theenergy is used proportionally to the distance travelled by the robot. The simplest communicationtask is data delivery (see [6,7,11,12]), where the data packet originally placed in some initial position3n the environment has to be carried by the collaborating robots into the target place. Remarkably,when the robots cannot share energy, data delivery is an NP-hard problem even for the line network,(see [11]). When the robots are allowed to exchange a portion of energy while they meet in thetree of n nodes, [12] gives the O ( n )-time solution for the data delivery. For energy sharing robots,the authors of [13] study the broadcast problem , where a single packet of data has to be carried toall nodes of the tree network, while [12] investigates also the convergecast problem , where the datafrom all tree nodes need to be accumulated in the memory of the same robot. In both cases efficientcommunication algorithms are proposed. A byproduct of [14] is an optimal exploration algorithmin the special case when all robots are initially positioned at the same node of the tree. When theenergy sharing robots have small limited memory, able to carry only one or two data packets at atime, the simplest case of the data delivery problem is shown to be NP-hard in [6]. Further, in [19]bounds are proved in an energy model where robots can communicate when they are in the samenode and the goal of robot team is to jointly explore an unknown tree. We start in Section 2 with exploration of a path. Given an initial placement and energy distributionfor k energy-sharing agents on an n -node path, we give an O ( n + k ) algorithm to generate a set ofvalid trajectories whenever the exploration of the path is possible. We also show that a path canalways be explored if the total energy of energy-sharing agents is times the total weight of edgesin the path. In contrast, we show that there are energy configurations for which any total amountof energy is insufficient for path exploration without energy sharing.In Section 3 we study exploration of trees. We first observe that without energy sharing theexploration of trees is NP-complete. Then, for an n -node tree, we give an O ( n + (cid:96)k ) algorithmthat finds an exploration strategy if one exists, where (cid:96) is the number of leaves in the tree.In Section 4, we consider exploration of general graphs. We show that the problem is NP-hardeven for 3-regular graphs. In addition, we show that it is always possible to find an explorationstrategy if the total energy of the agents is at least twice the total weight of the edges; moreover,this is asymptotically optimal, even for trees.Therefore our results show that allowing energy to be shared between agents makes explorationpossible in many situations when it would not be possible without sharing energy. Furthermore,the total energy needed for exploration is at most twice (at most 3/2) the total weight of the edgesin the graph (path respectively), while there is no upper bound on the total energy needed forexploration if agents cannot share energy, even when the graph to be explored is a path. In this section we consider the case when the graph is a simple path on n nodes; without lossof generality, we assume that the path is embedded in the horizontal line segment [0 , O ( n + k ) time. The path exploration problem can therefore be restated as follows: Problem 1 (Segment Exploration).
Given mobile agents r , r , . . . , r k with energies e , e , . . . , e k ,located initially in positions 0 ≤ s ≤ s ≤ · · · ≤ s k ≤ , t i of agent r i explores a closed sub-segment a i of [0 ,
1] containing s i . Let b (cid:96)i , b ri bethe left, right end point of this sub-segment. We want to find a valid set of trajectories, i.e., a setthat explores the line segment [0 , a , a , . . . , a k explore (or cover) [0 ,
1] and they don’t overlap, i.e., b (cid:96) = 0, b rn = 1,and b ri = b (cid:96)i +1 for 1 ≤ i ≤ k − t i starts at s i , goes straight to one of the endpoints of a i . When both endpoints aredifferent from s i , it turns around and goes straight the other endpoint of a i . Thus, in this casethe trajectory covers doubly a sub-segment between s i and the endpoint where it turns around,and the trajectory has a doubly covered part and a singly covered part .3. A transfer of energy between two agents r i and r i +1 may occur only at their meeting point b ri .Thus at b ri exactly one of the following occurs:(a) There is no energy transfer.(b) There is energy transfer from r i to r i +1 . In that case t i +1 does not end at that point, it endsat b ri +1 , and either b (cid:96)i +1 = s i +1 or b (cid:96)i +1 is a point where the trajectory t i +1 turns around tothe right.(c) There is energy transfer from r i +1 to r i . In that case t i does not end at that point, it endsat b (cid:96)i and either b ri = s i or b ri is a point where the trajectory t i turns around to the left.The next lemma, stated without proof, specifies two additional restrictions that can be imposedon the nature of valid trajectories that will be applied by our algorithm. Lemma 1.
Assume that the segment [0 , can be explored by a set of valid trajectories T = { t , t , . . . , t k } of the agents. Then there is a canonical set of valid trajectories T (cid:48) = { t (cid:48) , t (cid:48) , . . . , t (cid:48) k } that explore the segment such that(i) If agent r i receives energy from a right (left) neighbour then it receives it at its initial position s i , and its trajectory may only go in straight line segment from s i to the left (right).(ii) For each trajectory, its singly covered part is at least as long as its doubly covered part. We now describe a recursive, linear time algorithm for Problem 1 to find canonical trajectories asdescribed in Lemma 1 above. The trajectories are assigned to agents from left to right, determiningwhether more energy needs to be transferred to complete the coverage on the left, or some surplusenergy is to be transfused to agents on the right. If i is the index of the leftmost agent not used in theexploration of initial sub-segment [0 , (cid:96) i ] and if tr i is the energy deficit (negative) or surplus (positive)left after exploring this sub-segment using only agents 1 through ( i − Path ( i, (cid:96) i , tr i ) decides whether a solution to the exploration problem for the remaining sub-segment[ (cid:96) i ,
1] is possible via canonical trajectories. It does so by greedily deploying agent i to use the leastamount of energy to cover at least the segment [ (cid:96) i , s i ]: if this does not lead to energy deficit, thenthe trajectory of agent r i is allowed to cover as much of the segment [ s i , s i +1 ] as it can, whichdetermines the position (cid:96) i +1 . Then, a recursive call to Path is made with arguments i + 1, (cid:96) i +1 and the resulting energy deficit or surplus tr i +1 . For an easier understanding of the algorithm, thedescription below is annotated in detail and Figure 1 provides an example for each case encounteredin the algorithm.We use the following lemma to simplify the proof of the main theorem of this section.5 rocedure Path ( i, (cid:96) i , tr i ) if tr i ≤ then if e i < s i − (cid:96) i + tr i then (cid:46) Case 1.1 (deficit increases) r i waits to receive energy | tr i +1 | from r i +1 . Trajectory t i is from s i to (cid:96) i .Transfer | tr i | of energy to r i − (cid:96) i +1 ← s i tr i +1 ← e i + tr i − ( s i − (cid:96) i ) else if e i ≥ s i − (cid:96) i + tr i then (cid:46) Case 1.2 (deficit eliminated) Using the values of (cid:96) i , s i and e i − | tr i | , select a canonical trajectory t i origi-nating in s i , located between (cid:96) i and s i +1 as in Cases 1.2.1 to . Transfer | tr i | of energy to r i − tr i +1 ← e i + tr i − length ( t i ) (cid:96) i +1 ← right endpoint ( t i ) else (cid:46) Case 2 : (Energy surplus)
A surplus of energy at (cid:96) i implies that (cid:96) i = s i . The trajectory t i of r i is “from s i to the right, but at most to s i − ”. (cid:96) i +1 ← s i + min { s i +1 − s i , s i + e i + tr i } tr i +1 ← tr i + e i − (min { s i +1 − s i , s i + e i + tr i } − s i )) if ( i < k ) then return Path ( i + 1 , (cid:96) i +1 , tr i +1 ) else if ( (cid:96) k +1 <
1) or ( tr k +1 < then (cid:46) Insufficient energy return with solvable ← false else return with solvable ← true 6 i s i +1 s i s i s i s i s i s i e i = 11 s i
333 33333 5 422 2 s i +1 s i +1 s i +1 s i +1 s i +1 s i +15 5 tr i +1 = 0 tr i = − tr i +1 = 0 tr i +1 = 3 tr i +1 = 2 tr i = − tr i = − tr i = 1 l i tr i +1 = − l i l i l i tr i = − l i +1 l i l i l i l i l i +1 l i +1 l i +1 l i +1 e i = 11 s i e i = 6 e i = 6 e i = 2 l i +1 s i s i +1 1 Case 1.2.1Case 1.2.2Case 1.2.3Case 2Case 1.1
Fig. 1.
Assignment of a trajectory to agent r i by Procedure Path . The trajectory established in each case is in redon the right part of the figure. Cases 1.1 to 1.2.3 deal with an energy deficit prior to an assignment of a trajectory to r i , and Case 2 deals with a surplus of energy. In Cases 1.2.1 to 1.2.3 the deficit is eliminated. Lemma 2.
Let t , t , . . . , t i − be the trajectories and (cid:96) i , tr i be the values established by Procedure Path after i − recursive calls, ≤ i ≤ k + 1 . These trajectories explore the segment [0 , (cid:96) i ] usingin total energy ( (cid:80) i − j =1 e j ) − tr i and this is the minimum energy required by the agents to explorethe segment [0 , (cid:96) i ] . Furthermore, if tr i < (deficit) then (cid:96) i = s i − , if tr i > (surplus) then (cid:96) i = s i ,and if tr i = 0 then s i − ≤ (cid:96) i ≤ s i .Proof. The proof is done by induction on i and omitted for the lack of space. (cid:117)(cid:116) Theorem 1.
Assume we are given mobile agents r , r , . . . , r k with energies e , e , . . . , e k , locatedinitially in positions s ≤ s ≤ · · · ≤ s k of a line segment [0 , respectively. Let r k +1 be an additional“dummy agent” at position 1 with zero energy. Then the procedure call Path (1 , , on this instanceruns in O ( k ) time and terminates with solvable being true if and only if there are trajectories ofagents that explore the line segment [0 , .Proof. It is clear from the description of the algorithm that it is linear in k . When the algorithmterminates with solvable being true, it is straightforward to see that a schedule can be determinedfor the agents, that creates a valid trajectory for each agent. To wit, in Round 1 all agents thatreceive no energy follow their trajectory and do the energy transfers as calculated. Notice thatenergy is received by agents when in their initial positions.In Round i all agents that receive energy in Round i − solvable being true, the ex-ploration of segment [0 ,
1] is possible, and our algorithm returns valid trajectories for the agentsto achieve this coverage. Thus we only need to show that the exploration of the segment [0 ,
1] isnot possible when the algorithm terminates with solvable being false. In fact, solvable is set tofalse in the algorithm only if either tr k +1 < (cid:96) k +1 <
1. By Lemma 2, if tr k +1 < l k +1 = s k ≤ (cid:80) kj =1 e j ) in energy. If7 r k +1 = 0 and (cid:96) k +1 < , (cid:96) k +1 ] is the maximum segment that can be explored by the agentsusing ( (cid:80) kj =1 e j ) energy. In both cases, the exploration of the entire segment [0 ,
1] is impossible withthe given initial positions and energies. (cid:117)(cid:116)
Consider the case when we apply our algorithm to an input instance with the sum of energies (cid:80) k e i ≥ . Since in each trajectory the part covered doubly is less or equal the part coveredsingly, the energy deficit/surplus tr k +1 obtained after assigning a trajectory to agent r k is at most (cid:80) k e i − , and it cannot be negative. Also (cid:96) k +1 cannot be less than 1 since there would be an unusedsurplus of energy of at least (cid:80) k e i − (cid:96) k +1 >
0. Thus with (cid:80) k e i ≥ the algorithm terminates withvalid exploration trajectories for the segment.On the other hand when the input instance consists of a single agent r located at point 0 . r to cover the segment [0 ,
1] is equal to . Corollary 1.
The segment [0 , can always be explored by k agents with canonical trajectories ifthe sum of their initial energies is at least , but exploration may be impossible in some instancesif the sum is less than .Remark 1. If agents cannot share energy , regardless of k , exploration is impossible in an inputinstance where all k agents are co-located at 0, each with energy equal to 1 − (cid:15) , which gives totalenergy greater than k −
1. Thus, without energy-sharing, there is no upper bound on the totalenergy of agents that guarantees exploration of a path. We have also constructed a linear algorithmfor the exploration of a path by agents that cannot share energy, however we cannot include it inthis paper due to the limit on the number of pages.
In this section we consider a restricted case of the graph exploration problem, specifically whenthe graph is a tree. First we observe that, without energy exchange , there is a straightforwardreduction from the partition problem showing that the exploration is NP-hard even on a stargraphs: Given an instance of the partition problem S = { a , a , . . . , a n } , let T = (cid:80) ni =1 a i /
2. Weconstruct a star graph, with n + 2 edges incident on the central node. Of these, n edges have weight a / , a / , . . . , a n / T . Assume two agentsare at the central node of the star graph with energy 3 T / S if and only if the there is an exploration strategy (without energy sharing) for the two agents onthe star graph. However, for energy-sharing agents located on a tree we derive below a polynomialexploration algorithm (see also [20]).Let T be an edge-weighted tree with k agents distributed across the n nodes of T with possiblyseveral agents per node each of them with some non-negative energy. To simplify the design of ouralgorithm, we first preprocess the tree to transform it to a rooted binary tree where all the agentsare located only at the leaves of the tree. We obtain such a tree from the initial tree T in four stages:(a) by taking all the agents at every non-leaf vertex v and shifting them to a new leaf node l v that isadded to the tree and connected to v via a zero-weight edge, (b) by repeatedly splitting vertices ofdegree more than 3 into trees of maximum degree 3 using zero-weight edges, (c) by collapsing anypath with internal vertices of degree 2 into an edge whose weight equals the cumulative weight ofthe path, and (d) by converting the resulting 3-regular unrooted tree into a rooted one by splittingone of its edges and making its midpoint be the root of the tree. Without loss of generality, we will8enote this new, rooted tree as T . We note these preprocessing steps have complexity O ( n + k ).Our problem can be stated as follows: Problem 2 (Tree Exploration).
Let T be a rooted, edge-weighted binary tree obtained by prepro-cessing an unrooted edge-weighted tree with k agents at its nodes, so that all the agents are nowlocated at leaves in T and have their given initial energies. For every node v , let a v be the initialnumber of agents inside subtree T v and let e v be the sum of their initial energies. Let w e ≥ e . If possible, find a set of valid trajectories for the agents that explore everyedge of T using only the given initial energies.Now, consider any feasible exploration for the tree witnessed by a set of trajectories for theagents. The successful exploration of a subtree T v may either have necessitated additional energybrought into the subtree from outside, or there may be a surplus of energy that could have goneout of the subtree to explore other parts of the tree. Also, exploration may have needed a transferof agents into the subtree (over and above its a v agents) or may have been accomplished with someagents made available to leave the subtree and contribute to the exploration of the rest of the tree.We formalize this idea as follows. Let B [ v, i ] denote the maximum possible total surplus energy that can leave the subtree T v after it is fully explored so that i agents can leave the subtree withthis total energy. Note that i counts only the balance of agents that depart from the tree, notindividual arrivals and departures. Thus, we allow for i being negative (i.e., i agents enter the thetree on balance), or B [ v, i ] being negative (i.e., − B [ v, i ] amount of energy is needed to be broughtin from outside T v to explore it fully). We remark that:(i) when i ≤ B [ v, i ] ≥
0, it means that an agent carrying excess energy must leave T v butnevertheless, the overall balance of agents entering/leaving T v is non-positive.(ii) the B [ v, i ] values do not take into consideration the energy expenditure that would be requiredto explore the edge from v to its parent node in the tree.(iii) for node v , the value of i can only be in the interval [ − k + a v , a v ], because, on balance, at most a v agents can leave T v and at most k − a v can enter it.In order to simplify the calculation of B [], we extend the definition of B [] to edges as well: Let e = ( u, v ) where u is the parent of v . As described above, B [ v, ∗ ] denotes the surplus energy leavingsubtree T v . B [ e, i ] will denote the surplus energy available at u along edge e with a balance of i agents that could transit through u from the direction of v . We observe that agents do spend energytraversing e itself and can also stop in the middle of e , and hence the values B [ e, ∗ ] and B [ v, ∗ ] aredifferent. Since node u has exactly two child edges below it, we can compute the B [ u, ∗ ] values bysuitably combining the B [] values of these edges.It remains to show how to calculate B [ v, ∗ ] and B [ e, ∗ ] for each v and e . In principle, we canconsider all the possibilities of what the agents can do, but in reality it is enough to consider only thebest possible activity with the desired balance of agents. The calculation is performed by callingprocedures HandleVertex and
HandleEdge (described below in pseudocode) respectively foreach vertex and for each edge of T . The computation proceeds in a bottom-up manner startingfrom leaves, with the boolean arrays done [ v ] and done [ e ] being used to ensure this flow. In order tosimplify the presentation in HandleEdge , we assume that the assignment B [ e, i ] ← y is shorthandfor B [ e, i ] ← max( B [ e, i ] , y ) (with the initial values B [ e, ∗ ] being initialized to −∞ ).Our main result in this section is the following:9 heorem 2. After transforming an unrooted tree with a specified distribution of initial agent lo-cations and energies, procedure
HandleVertex , when applied to the root of the resulting rootedbinary tree, correctly solves the tree exploration problem for the original tree in O ( n + (cid:96)k ) time. Itdoes so by correctly computing the optimal B [ v, i ] values for every vertex v and all relevant i valuesfor that vertex, in conjunction with procedure HandleEdge that correctly computes the optimal B [ e, i ] for every edge e and all relevant i values for that edge. Procedure
HandleVertex ( v ) if v is a leaf then for i = − k + a v to a v do B [ v, i ] ← e v else (cid:46) v has two child edges e (cid:48) and e (cid:48)(cid:48) wait until done[ e (cid:48) ] and done[ e (cid:48)(cid:48) ] for i = − k + a v to a v do B [ v, i ] ← max i (cid:48) + i (cid:48)(cid:48) = i ( B [ e (cid:48) , i (cid:48) ] + B [ e (cid:48)(cid:48) , i (cid:48)(cid:48) ]) done[ v ] ← true if v is the root then if there is B [ v, i ] ≥ i ≥ then return solvable else return not solvable The proof of Theorem 2 hinges on an inductive argument that shows that the B [] values arecorrectly computed in a bottom-up manner starting at the leaves and working our way up the tree.The base case for the induction is for the leaf nodes, and follows directly from the construction(line 3 of HandleVertex : all the energy in a leaf node is surplus and can be utilized to explorethe rest of the tree).Our induction hypothesis is established by proving two concomitant lemmas, the proofs of whichare in the appendix:
Lemma 3.
Let e = ( u, v ) be an edge in T with u being the parent of v . If the values B [ v, ∗ ] havebeen correctly computed, then procedure HandleEdge correctly computes B [ e, ∗ ] , where ∗ standsfor all relevant values of i . Lemma 4.
Let v be an internal vertex with two child edges e (cid:48) and e (cid:48)(cid:48) . If B [ e (cid:48) , ∗ ] and B [ e (cid:48)(cid:48) , ∗ ] havebeen correctly computed, then procedure HandleVertex correctly computes B [ v, ∗ ] where ∗ standsfor all relevant values of i . It is easy to see after the O ( n + k ) time preprocessing step to convert the original tree into a fullbinary tree, each leaf of the tree and subsequently, each edge of the tree can be processed in O ( k )time. To obtain the B [] values for any internal node, we need to combine the k -vectors associatedwith the child edges (in step 7 of HandleVertex ). Observe that there are two classes of internalnodes in the converted tree. The first class correspond to O ( k ) nodes that contained a subset ofagents in the original tree. Each such node, generated in stage (a) of the conversion phase, has achild that is a leaf in the converted tree (containing the same subset of agents). The second classcontains the internal nodes generated in stage (b) of the conversion phase, as well as the nodes10 rocedure HandleEdge ( e ) Require: e = ( u, v ) where v is a child of u wait until done[ v ] for i = − k + a v to a v do if B [ v, i ] ≤ then if i < then B [ e, i ] ← B [ v, i ] − | i | w e (cid:46) Case 1a else B [ e, i ] ← B [ v, i ] − ( i + 2) w e (cid:46) Cases 2a, 3a and 4a else if i ≤ then (cid:46) B [ v, i ] > if B [ v, i ] > (2 + | i | ) w e then B [ e, i ] ← B [ v, i ] − (2 + | i | ) w e (cid:46) Cases 1c and 2c else if i < then B [ e, i ] ← i ( w e − B [ v, i ] / (2 + | i | )) (cid:46) Case 1b else (cid:46) i = 0 B [ e, − ← ( B [ v, − w e ) / (cid:46) Case 2b B [ e, ← B [ v, − w e (cid:46) Case 2b’ else (cid:46) i > B [ v, i ] > if B [ v, i ] ≥ iw e then B [ e, i ] ← B [ v, i ] − iw e (cid:46) Cases 3c and 4c else (cid:46) i > B [ v, i ] < iw e B [ e, i ] ← − ( i + 2)( w e − B [ v, i ] /i ) (cid:46) Cases 3b” and 4b if i = 1 then B [ e, − ← B [ v, − w e (cid:46) Case 3b B [ e, ← B [ v, − w e ) (cid:46) Case 3b’ done[ e ] ← true that were of degree at least 3 in the original tree, and the root obtained in stage (d). Observe thatthere are at most (cid:96) nodes in the second class. Let v be an internal node of the first class and let v (cid:48) be its child that was added in preprocessing that has taken the v ’s agents. By construction, allthe B [ v (cid:48) , ∗ ] values are equal to e v (cid:48) , and since the weight of e (cid:48) is 0, B [ e (cid:48) , ∗ ] = e v (cid:48) as well. Hence, forsuch a node v we have B [ v, a e (cid:48) + a e (cid:48)(cid:48) − i ] = e v (cid:48) + max ij =0 B [ e (cid:48)(cid:48) , a e (cid:48)(cid:48) − i ] which can be for i = 0 to k computed in time O ( k ). Consequently, the overall complexity of HandleVertex called for all O ( k ) internal nodes of class one is O ( k ). On the other hand, for each of O ( (cid:96) ) internal nodes fromclass two, the max function from step 7 of HandleVertex may be computed in O ( k ) time, whichleads to O ( (cid:96)k ) overall complexity of all the calls of the HandleVertex procedure for nodes ofthe second class. Applying Lemma 4 to the root of the tree, it is clear that the algorithm correctlydecides whether or not the binary tree can be explored fully, and the computation takes O ( (cid:96)k )time after the preprocessing step.We further remark that if exploration is indeed feasible then in the same time complexity,standard post-processing, top-down techniques can be used to recover the trajectories (and theschedules) for the agents from the computed B [] values by combining the schedules locally computedat each vertex and edge. The choice of the root vertex is arbitrary (after preprocessing) and doesnot influence the decision outcome – however, it does influence the computed schedule and the11mount of energy left in the root, and there may be multiple feasible solutions (one for each i ≥ B [] values). This completes the proof of Theorem 2. Unfortunately, while the exploration problem for segments and trees admits very efficient solutions,for general graphs, exploration becomes intractable (unless P=NP). Indeed, we show that the graphexploration problem is NP-hard even in the case of 3-regular graphs by using a reduction from theHamiltonian cycle problem. We also give an approximation algorithm.
Let G be a 3-regular graph on n nodes. We construct a graph M by replacing each edge e = ( u, v )of G by a meta-edge gadget m ( u, v ) from Figure 2 case a), where a and b are chosen so that a > nb where n is the number of vertices of G . In addition, each meta-vertex (i.e., an image m ( v ) of avertex v of G ) starts with one agent and 3 a + 5 b energy.Note that the overall energy is (3 a + 5 b ) n , while the overall weight of the edges (3 n/ n ( a + b ). Hence, a length at most 2 bn can be crossed twice. As a > bn ,this means no a -edge is crossed twice and at most 2 n of b -edges are crossed twice. a ab ba ab b a ab ba ab b a)c) b)d) cwm ( u ) m ( v ) wm ( u ) m ( v ) wm ( u ) m ( v ) wm ( u ) m ( v ) Fig. 2. a) the meta-edge gadget, b) covering gadget using one agent c) efficient covering of the gadget using twoagents d) covering gadget using two agents so that at least one agent exits the gadget
Lemma 5.
If only one agent x enters (w.l.o.g. from m ( u ) ) a meta-edge e = m ( u, v ) , a total of a + 4 b energy is spent ensuring e is fully explored. In such case x ends up in m ( v ) .Proof. Consult Figure 2, case b). Let us call the edges of weigh b starting at w whiskers . As the agenthas to cover both ( m ( u ) , w ) and ( w, m ( v )), since there is not sufficient energy to cover either ofthese edges twice, the agent must cover the whiskers before arriving at m ( v ). Hence, both whiskersmust be traversed twice, for the total energy expenditure of at least 2 a + 4 b , which the agent musthave had at the moment it left m ( u ). (cid:117)(cid:116) Lemma 6.
Assume two agents x and y enter a meta-edge e = m ( u, v ) from m ( u ) and m ( v ) ,respectively, and ensure e is fully explored. If no agent leaves e then the total energy spent in e is atleast a + 2 b . If one or both agents leave e then all the leaving agents leave to the same meta-vertex,and the total energy spent in e is more than a + 4 b . roof. If each of x and y have at least energy a , they can both arrive at the middle vertex w . Iftheir total energy is at least 2 a + 2 b , they can share energy at w so that each can complete onewhisker (see Figure 2, case c)). In order for at least one of the agents to leave e (w.l.o.g. assumevia m ( v )), without having a full double-crossing of the edge ( w, m ( v )), the two agents must meetinside ( w, m ( v )), with one or both of them going to m ( v ). No agent can return to w , otherwise thewhole ( w, m ( v )) would have been double covered, for which there is no enough energy in the wholesystem. This means both whiskers must have been covered by the agent originating in m ( u ) at afull double-cost of 4 b , for a total of more than 2 a + 4 b (the part between the meeting point and m ( v ) must be traversed twice, raising the cost sharply above 2 a + 4 b ). (cid:117)(cid:116) Note that the second case of Lemma 6 is worse than Lemma 5 in terms of total energy expen-diture, due to the extra cost of c (or 2 c ). Still, it might be justified if the blue agent does not haveenough energy for case b), or if the red agent does not have enough energy for case c).Lets call a meta-edge light if it is covered by the first part of Lemma 6 (Figure 2, case c)),otherwise it is heavy . Observe that each light meta-edge consumes 2 agents, while each heavymeta-edge consumes an excess of 2 b energy compared to the weight of its edges. This yields: Lemma 7.
If there is an exploration strategy for the input graph, the number of heavy edges isexactly n .Proof. As the total energy in the system exceeds the total weight of the edges by 2 bn and eachheavy meta-edge consumes 2 b more energy than the weight of its edges, there can be at most n heavy meta-edges. On the other hand, as there are only n agents available in total and each lightmeta-edge consumes two agents, there can be at most n/ n/
2, the number of heavy edges must be exactly n . (cid:117)(cid:116) By Lemma 5 and the second part of Lemma 6, a heavy meta-edge is traversed in one direction– lets call the halves outgoing and incoming .Consider the directed graph H = ( V, E (cid:48) ) formed by the heavy meta-edges, i.e., e = ( u, v ) ∈ E (cid:48) iff e is a heavy meta-edge from m ( u ) to m ( v ). Lemma 8.
Each vertex of H has at least one incoming edge.Proof. As both light and outgoing edges consume agents, if v had no incoming edge, it would need3 agents. Since each vertex starts with 1 agent, it is not possible for v to have 3 agents without anagent coming via an incoming edge. (cid:117)(cid:116) Because the number of heavy edges is exactly n , the heavy edges form a vertex-disjoint (vertex)cycle cover of H , i.e., each meta-vertex has one incoming, one outgoing and one light edge.The problem is that the disjoint cycle cover is solvable in polynomial time. Hence, we need tomodify the input so that there is a solution to the exploration problem if and only if the heavyedges form a single cycle of length n .This is done by modifying the input into I as follows: – the three edges incident to the initial vertex have weights adjusted to a + (cid:15)n for some small (cid:15) < b/ n , – the energy at the initial vertex is 3 a + 5 b + (2 n ) (cid:15) – the energy at all other meta-vertices is 3 a + 5 b + (cid:15) emma 9. If the graph G is Hamiltonian then there is an exploration solution to the modifiedinput I .Proof. Select the direction of the Hamiltonian cycle, its edges will be the heavy meta-edges. The explorer agent starting in the initial vertex takes all the energy available there and follows theHamiltonian cycle. It collects 2 a + 4 b + (cid:15) energy in each of the meta-vertices it crosses, whilespending 2 a + 4 b on each heavy meta-edge. The agents located at other meta-vertices wake-upwhen the explorer arrives, take a + b energy and explore half of the incident light meta-edge.Note that when the explorer reaches i -th meta-vertex (not counting the initiator), it has a + b + (cid:15)n + i −
1) energy remaining, except when it returns to the initiator, when it has only a + b + (cid:15)n energy as the last meta-edge it crossed has an extra (cid:15)n cost. This is just sufficient to cover half ofthe incident light meta-edge, which is the last part not yet covered. (cid:117)(cid:116) Theorem 3.
The exploration problem is NP-hard for 3-regular graphs.Proof.
Suppose there is an exploration solution for I . We claim that then the graph G is Hamil-tonian. Note that since the sum of all (cid:15) is less than b , Lemma 7 and Lemma 8 still hold. Hence,the only way meta-edges incident to the starting vertex can be covered is if the agent returning tothe starting vertex carries a + b + (cid:15)n energy. As the agent can gain only (cid:15) energy in each vertex itcrosses (the remainder is used-up on crossing the heavy meta-edge and covering half of the incidentlight meta-edge), it needs to visit all n meta-vertices in order to collect sufficient energy, i.e., it hasperformed Hamiltonian cycle. The theorem then follows since the Hamiltonian cycle problem for3-regular graphs is known to be NP-complete. (cid:117)(cid:116) Even though the graph exploration problem is NP-hard, it is still possible to obtain an efficientapproximation algorithm for exploring arbitrary graphs that has an energy-competitive ratio atmost 2. Specifically, the algorithm uses at most twice as much energy as the cumulative sum of theedge weights of the graph. First we state without proof a well-known result for agents on a cyclefor which the reader is referred to [24][Paragraph 3, Problem 21].
Lemma 10.
For any cycle and any initial positions of the agents there is an algorithm whichexplores the cycle if and only if the given sum of the energies of the agents is not less than thelength of the cycle.
Lemma 10 has some important consequences. Recall that a graph G is Eulerian if it is connectedand all its vertices have even degrees. Theorem 4.
For any Eulerian graph and any initial positions of the agents there is an algorithmwhich explores the graph provided that the sum of the energies of the agents at the start is notless than the sum of the edges of the given graph. Moreover, the algorithm has optimal energyconsumption.Proof.
Assume we have agents in such a graph so that the sum of the energies of the agents is atleast equal to the sum of the length of the edges of the graph. Since the graph is Eulerian we canconstruct a cycle which traverses all the edges of the graph exactly once. By Lemma 10 there is analgorithm which assigns trajectories to the given sequence of agents and covers the entire graph.This proves Theorem 4. (cid:117)(cid:116) heorem 5. Any graph can be explored by energy-sharing agents if the sum of their initial energiesis at least twice the sum of edge weights. Moreover, this constant cannot be improved even fortrees.Proof. The original graph, say G = ( V, E ), is not necessarily Eulerian. However, by doubling theedges of the graph we generate an Eulerian graph G (cid:48) = ( V, E (cid:48) ). The sum of the weights of the edgesof G (cid:48) is equal to twice the sum of the weights of the edges of G . Theorem 4 now proves that thegraph G can be explored if the sum of their initial energies is at least twice the sum of edge weightsin the graph.Consider a star graph with 2 k leaves, all edges are of weight 1, for a total weight of 2 k . Assumethat we have k agents in the leaves of the star, and one agent in the center of the star. Agentsin the leaves have energy 0, and the agent in the center 4 k −
1. To explore the graph the centeragent can traverse 2 k − k − (cid:117)(cid:116) Remark 2.
An improvement of the competitive ratio 2 of Theorem 5 is possible in specific casesby using a Chinese Postman Tour [23] (also known as Route Inspection Problem). Namely, inpolynomial time we can compute the minimum sum of edges that have to be duplicated so as tomake the graph Eulerian, and this additional sum of energies is sufficient for the exploration.Assume we have a fixed configuration C of k agents r , r , . . . , r k in a given graph G . We saythat energy assignment E = e , e , . . . , e k to agents in configuration C is minimal if exploration ispossible with energies in E , but impossible when the energy level of any one agent is decreased. Let | E | = (cid:80) ki =1 e i . We now investigate how large the ratio | E | / | E | can be for two minimal assignments E and E of a given configuration C , Claim.
For any configuration of agent C and any two minimal energy assignments E and E theratio | E | / | E | ≤
2, and this is asymptotically optimal.
Proof.
See the appendix. (cid:117)(cid:116)
We studied graph exploration by a group of mobile agents which can share energy resources whenthey are co-located. We focused on the problem of deciding whether or not it is possible to findtrajectories for a group of agents initially placed in arbitrary positions with initial energies so as toexplore the given weighted graph. The problem was shown to be NP-hard for 3-regular graphs whilefor general graphs it is possible to obtain an efficient approximation algorithm that has an energy-competitive ratio at most 2 (and this is shown to be asymptotically optimal). We also gave efficientalgorithms for the decision problem for paths, trees, and Eulerian graphs. The problem consideredis versatile and our study holds promising directions for additional research and interesting openproblems remain by considering exploration with 1) optimal total energy consumption, 2) agentswith limited battery capacity, 3) energy optimal placement of mobile agents, 4) time vs energyconsumption tradeoffs for mobile agents with given speeds, 5) additional topologies, as well as 6)combinations of these. 15 eferences
1. S. Albers and M. R. Henzinger. Exploring unknown environments.
SIAM J. Computing , 29(4):1164–1188, 2000.2. S. Albers, K. Kursawe, and S. Schuierer. Exploring unknown environments with obstacles.
Algorithmica ,32(1):123–143, 2002.3. S. Alpern and S. Gal.
The theory of search games and rendezvous . Springer, 2003.4. R. Baeza Yates, J. Culberson, and G. Rawlins. Searching in the plane.
Information and Computation , 106(2):234–252, 1993.5. R. Baeza-Yates and R. Schott. Parallel searching in the plane.
Comp. Geom. , 5(3):143–154, 1995.6. E. Bampas, S. Das, D. Dereniowski, and C. Karousatou. Collaborative delivery by energy-sharing low-powermobile robots. In
Proc. of ALGOSENSORS , pages 1–12, 2017.7. A. B¨artschi.
Efficient Delivery with Mobile Agents . PhD thesis, ETH Zurich, 2017.8. A. Beck. On the linear search problem.
Israel Journal of Mathematics , 2(4):221–228, 1964.9. W. Burgard, M. Moors, C. Stachniss, and F. E. Schneider. Coordinated multi-robot exploration.
IEEE Trans-actions on Robotics , 21(3):376–386, 2005.10. J. Chalopin, S. Das, and A. Kosowski. Constructing a map of an anonymous graph: Applications of universalsequences. In
Proc. of OPODIS , pages 119–134. Springer, 2010.11. J. Chalopin, R. Jacob, M. Mihal´ak, and P. Widmayer. Data delivery by energy-constrained mobile agents on aline. In
Proc. of ICALP , pages 423–434. Springer, 2014.12. J. Czyzowicz, K. Diks, J. Moussi, and W. Rytter. Communication problems for mobile agents exchanging energy.In
Proc. of SIROCCO , pages 275–288, 2016.13. J. Czyzowicz, K. Diks, J. Moussi, and W. Rytter. Broadcast with energy-exchanging mobile agents distributedon a tree. In
Proc. of SIROCCO , pages 209–225, 2018.14. J. Czyzowicz, K. Diks, J. Moussi, and W. Rytter. Energy-optimal broadcast and exploration in a tree usingmobile agents.
Theoretical Computer Science , 795:362–374, 2019.15. J. Czyzowicz, K. Georgiou, R. Killick, E. Kranakis, D. Krizanc, M. Lafond, L. Narayanan, J. Opatrny, and S.M.Shende. Energy consumption of group search on a line. In
Proc. of ICALP , pages 137:1–137:15, 2019.16. X. Deng, T. Kameda, and C. Papadimitriou. How to learn an unknown environment. In
Proc. of FOCS , pages298–303. IEEE Computer Society, 1991.17. X. Deng and C. H. Papadimitriou. Exploring an unknown graph.
J. of Graph Theory , 32(3):265–297, 1999.18. D. Dereniowski, Y. Disser, A. Kosowski, D. Pajak, and P. Uzna´nski. Fast collaborative graph exploration.
Information and Computation , 243:37–49, 2015.19. Miroslaw Dynia, Jakub (cid:32)Lopusza´nski, and Christian Schindelhauer. Why robots need maps. In
InternationalColloquium on Structural Information and Communication Complexity , pages 41–50. Springer, 2007.20. P. Fraigniaud, L. Gasieniec, D. R. Kowalski, and A. Pelc. Collective tree exploration.
Networks: An InternationalJournal , 48(3):166–177, 2006.21. J. M. Kleinberg. On-line search in a simple polygon. In
Proc. of SODA , pages 8–15, 1994.22. E. Koutsoupias, C. Papadimitriou, and M. Yannakakis. Searching a fixed graph. In
Proc. of ICALP , pages280–289. Springer, 1996.23. M.-K. Kwan. Graphic programming using odd or even points.
Acta Mathematica Sinica (MR 0162630. Translatedin Chinese Mathematics 1: 273–277, 1962) , 10:263–266, 1960.24. L. Lov´asz.
Combinatorial Problems and Exercises . Elsevier, 1979.25. J. Moussi.
Data communication problems using mobile agents exchanging energy . PhD thesis, Universit´e duQu´ebec en Outaouais, 2018.26. P. Panaite and A. Pelc. Exploring unknown undirected graphs.
J. of Algorithms , 33(2):281–295, 1999. Appendix
Proof. of Lemma 1
First we show that the trajectories can be modified to satisfy part (i). Let t i be a trajectory ofagent r i which receives some energy from its neighbour at an endpoint different from s i . Assumefirst that in trajectory t i agent r i moves to the right of s i and it arrives at b ri with x being itsremaining energy, it receives there additional energy x from r i +1 , and the remaining energy of r i +1 at b ri after the transfer is x . Let y = b ri − s i . There are two cases to consider.Case 1: x ≥ y . Clearly, the energy available to r i at b ri is sufficient to move back to s i . Considerthe situation after r i moves back to s i from b ri . At that point the energy of r i is x + x − y . Considermodified trajectories t (cid:48) i and t (cid:48) i +1 for r i and r i +1 as follows: Agent r i remains at s i , and agent r i +1 moves to s i , and the energy transfer is done at s i by transferring to r i the energy x − y . Noticethat r i +1 has sufficient energy to reach r i and go back to b ri since x ≥ y , in case the trajectory t i +1 of r i +1 was turning back at left. Then the energy of r i at point s i after the energy transferwould be x + y + x − y = x + x − y , and r i +1 after returning to b ri is left with energy x + x − y − ( x − y ) = x , i.e., both agents are exactly with the same energy as in t i , t i +1 atthe same points and they can follow the rest of their previous trajectories.Case 2: x < y . Let c = b ri − ( x / r i reaches c from b ri . Atthat point the energy of r i is x + x /
2. Consider modified trajectories t (cid:48) i and t (cid:48) i +1 for r i and r i +1 as follows: Agent r i moves from x i to c , where it turns to the left. Agent r i +1 moves to c . If thetrajectory of r i +1 ended at b ri then now it ends at c , else it turns right to go back to b ri . There isno energy transfer done at c . In the modified trajectory the energy of r at the turning point c is x + x /
2, and r i +1 even if it needs to return to b ri is left with energy x + x − x /
2) = x , i.e.,both agents are exactly with the same energy level or better as in t i , t i +1 at the same points, andthey can follow the rest of their previous trajectories and possible energy transfers as before.Clearly a symmetric modification can be done if r i first moves to the left of s i . Therefore, byrepeated application of the above transformation, we can ensure that the trajectories covering thesegment [0 ,
1] satisfy ( i ) of the lemma while using at most the given energies.We then process every trajectory not satisfying ( ii ) of the lemma as follows. Let t i be a trajectorythat does not satisfy ( ii ) of the theorem. Assume that trajectory t i of agent r i first goes from point s i to point b ri > s i on the right of s i , then to point b (cid:96)i < s i on the left of s i , and | s i b ri | > | s i b (cid:96)i | .Since t i satisfies ( i ), agent r i receives no energy at b ri . Then, clearly, replacing t i by t (cid:48) i which firstgoes left to b (cid:96)i and then to b ri we have a trajectory that is shorter, since the doubly covered part isshorter than the singly covered part. If r i delivers some energy to r i − or r i +1 , it can deliver thesame amounts when following t (cid:48) i . This change does not influence any other trajectory. Clearly asymmetric modification can be done if r i first goes to the left of s i . (cid:117)(cid:116) Proof. of Lemma 2
We give a proof by induction on i . Trivially, the inductive hypothesis is true for i = 0, before anytrajectory is assigned, since (cid:96) = 0 , tr = 0.Assume now that the statement is true for some i , where 0 ≤ i ≤ k −
1. We will show that thestatement is true for i + 1. We consider the following exhaustive cases: Case 1 : tr i >
0, there is a surplus of energy in the initial part. Then the trajectories assignedso far explore the interval up to s i . Clearly, the unused energy tr i should be transferred to r i . ByLemma 1 the transfer of energy is done at s i , agent r i will have energy e i + tr i , and we may assignto r i a straight line trajectory t i from s i to the right until either r i runs out of energy, or it reaches17 i +1 , i.e., to point s i + y = l l +1 where y = min { s i +1 − s i , s i + e i + tr i } , and this is the trajectoryassigned by our algorithm. Clearly, a straight line trajectory of r i is energy optimal, and followingthis trajectory r i ends with unused energy tr i +1 = e i + r i − y ≥
0. Thus trajectories t , t , . . . , t i − , t i explore the segment [0 , l i +1 ] using in total energy ( (cid:80) ij =1 e j ) − tr i +1 and this energy cannot be madesmaller, Furthermore, if tr i +1 > l i +1 = s i +1 , and if tr i +1 = 0 then s i ≤ l i +1 ≤ s i +1 , and theinductive hypothesis is true for i + 1. Case 2 : tr i <
0, there is a deficit in the initial part. Then the trajectories assigned so far cover theinterval up to (cid:96) i = s i − . By Lemma 1 the transfer of energy is done by r i at s i − . The trajectoryof r i depends on its energy level:If e i < tr i + ( s i − s i − ) then r i does not have enough energy to cover the sub-segment from s i to s i − and to give r i − the needed energy and thus it needs to receive energy from r i +1 . By Lemma1 the trajectory t i of r i should only go from s i to the left until s i − , and deliver the requiredenergy to r i − , with the deficit at s i being tr i − ( s i − s i − ). A straight line trajectory of r i is energyoptimal and it is the trajectory assigned by our algorithm. Thus, with addition of t i trajectories t , t , . . . , t i − , t i cover the segment [0 , s i ] using in total energy ( (cid:80) ij =1 e j ) − tr i +1 and this energycannot be made smaller. Furthermore, l i +1 = s i , and the inductive hypothesis is true for i + 1.If e i ≥ tr i + ( s i − s i − ) then r i has enough energy to cover the sub-segment from s i to s i − , to give r i − energy tr i , and it has e i − ( tr i + ( s i − s i − )) energy left over. This energy must be used tocover a part of the segment to the right of s i , but not past s i +1 . Since r i moves left and right of s i , a part of its trajectory is covered twice. By Lemma 1, the part of the segment covered doublyshould not exceeded the length the segment covered singly. Let e (cid:48) i = e i − | tr i | , i.e., it is the energyavailable for covering a segment around s i .Assume s i − (cid:96) i ≤ e (cid:48) ≤ s i − (cid:96) i ) and let y = min { e (cid:48) i − ( s i − (cid:96) i )2 , s i +1 − s i } . Consider a trajectory of r i that goes right to (cid:96) i +1 = s i + y from s i , then turns left and goes to s i − where it gives energy tr i to r i − . In the traversal it spends energy 2 y + ( s i − (cid:96) i ). If s i + y = s i +1 , then agent r i givesits excess energy e i − | tr i | − ( s i − (cid:96) i ) − y to r i +1 when at s i +1 . Since y ≤ ( e (cid:48) − ( s i − (cid:96) i )) / ≤ (3( s i − (cid:96) i ) − ( s i − (cid:96) i ) / s i − (cid:96) i ), the length of the doubly covered part, is at most equal to s i − (cid:96) i ,and thus the doubly covered part should be on the right. This trajectory of r i covers the segmentup to s i + y and with the available energy, it cannot cover more. This is the trajectory and energytransfers assigned by our algorithm.If e (cid:48) > s i − (cid:96) i ) and ( s i − (cid:96) i ) ≥ ( s i +1 − s i ) then, clearly, it is optimal to do double coverage on theright. Since the available energy is sufficient for it, trajectory of r i should go from s i all the way to s i +1 , there r i turns left and goes to (cid:96) i to deliver energy tr i to r i − . When at s i +1 it should give itssurplus energy tr i +1 = e (cid:48) i − s i +1 − s i ) − ( s i − (cid:96) i ) ≤ e (cid:48) i to r i +1 . This is the trajectory and energytransfers assigned by our algorithm.If e (cid:48) > s i − (cid:96) i ) and ( s i − (cid:96) i ) < ( s i +1 − s i ) then r i has sufficient energy to cover the sub-segmentfrom (cid:96) i to s i +1 . Since ( s i − (cid:96) i ) < ( s i +1 − s i ), it is optimal to do a double coverage on the left. Thetrajectory of r i thus should go left from s i to (cid:96) i = s i − where it gives energy tr i to r i − , then turnsright and goes to s i +1 to deliver its remaining energy tr i +1 e (cid:48) i − s i − (cid:96) i ) − ( s i +1 − s i ) to s i +1 . Thisis the trajectory and energy transfers assigned by our algorithm.Thus in all these cases trajectories t , t , . . . , t i − , t i cover the segment [0 , l i +1 ] using in total energy( (cid:80) ij =1 e j ) − tr i +1 and this energy cannot be made smaller, Furthermore, if tr i +1 > l i +1 = s i +1 ,and if tr i +1 = 0 then s i ≤ l i +1 ≤ s i +1 , and the inductive hypothesis is true for i + 1. Case 3 : tr i = 0, there is no deficit. This is similar to Case 2 and its sub-cases and thus omitted.This completes the proof by induction. (cid:117)(cid:116) roof. of Lemma 3 Before elaborating on the proof via a case analysis of possibilities, we first examine which scenariosfor agents crossing the edge e are energy efficient and need to be analyzed in detail, and whichones are wasteful and hence can be ignored. As mentioned earlier, agents can collaborate to explore ew e uv A B C D E F G
Fig. 3.
Optimizing scenarios with agents terminating inside edge e . The green arrows are the wasteful extra agents. the edge, and this could mean that it is sometimes useful for an agent to expend all its remainingenergy to explore the edge partially starting from one endpoint of the edge, while leaving otheragents to explore the rest of the edge. In particular, we are interested in justifying the cases whenan agent really needs to terminate inside the edge.Consider the cases in Figure 3 where each blue/green arrow represents an agent exploring apart of the edge e = ( u, v ) from v , while each red arrow represents an agent coming from u toexplore the rest of the edge. We claim that cases A, B and C from Figure 3 are the only scenariosthat make sense from the point of energy efficiency. Indeed, case D can be seen as the same as caseB, with the agents switching their roles in their meeting point. Hence, if an agent crosses the wholeedge, having an agent traveling in the same direction that terminates inside e (the green arrow incase E) serves no purpose at all: it only increases the net energy expenditure and hence the casecan be ignored. Similarly, it is wasteful to have two or more agents going in the same directionand terminating inside of e , as the same effect (namely, covering that part of e , bringing energyto agents coming from the opposite side) can be achieved by a single agent as in case F. Finally,once an edge e has been fully crossed (and hence explored), there is no point in turning back andterminating inside e as that serves no purpose (case G). As this applies for both directions in e ,the result is that in each direction at most one agent terminates inside e and if it does so, there areno agents crossing e in this direction. Hence, cases A, B and C are indeed all the scenarios withagents terminating inside e that need to be considered .We are now in a position to describe all the possibilities that are relevant to calculating B [ e, ∗ ]for any edge e = ( u, v ), namely those in Figure 4. Blue arrows represent surplus energy availablefrom subtree T v (i.e., with B [ v, ∗ ] ≥
0) while red arrows represent an energy deficit that has to beprovided from u . The possibilities shown in the figure belong to four groups characterized by thevalue of i in B [ v, i ]: group 1 where i < i = − i = 0,group 3 where i = 1 and group 4 for i > i = 2 is shown). Within each group, thereare three basic cases based on B [ v, i ] ≤ B [ v, i ] > i agents to traverse the edge (case c); and B [ v, i ] > i = 0 and i = 1, which is the reason for having separate groups forthem. 19 w e uv iw e ≤ B [ v, i ]0 < B [ v, i ] < iw e B [ v, i ] ≤ B [ v, i ] ≤ | i | + 2) e w ≤ B [ v, i ]0 < B [ v, i ] < ( | i | + 2) w e B [ v, ≤ < B [ v, < w e w e ≤ B [ v, ew e uv < B [ v, < w e B [ v, ≤ w e ≤ B [ v, Fig. 4.
Handling an edge e = ( u, v ), based on B [ v, i ]. The four groups are characterized by the value of i in B [ v, i ]:group 1 where i < i = − i = 0, group 3 where i = 1 and group 4 for i > i = 2 is shown). Indeed, the assignment of B [ e, ∗ ] values in HandleEdge closely tracks the sub-cases in Figure 4.Consider first the scenarios where no agent terminates inside the edge e . This means B [ e, i ] = B [ v, i ] − x where x is the cost incurred on the edge e . Let us do the case analysis to derive x : – if i < B [ v, i ] ≤
0, both i agents and B [ v, i ] energy must reach v from u at a cost of x = | i | w e for those | i | agents to cross e (see case 1a from Figure 4 and line 5 of HandleEdge ) – if i < < B [ v, i ]: i agents must cross from u to v . While the minimal cost of this crossingis achieved by | i | agents crossing from u to v at a cost of | i | w e , they would need to take energyfrom u , effectively wasting all of B [ v, i ]. Hence, the best strategy is to make the optimal use ofthe energy available in v , even if that means spending more in exploring e : • If B [ v, i ] > = (2 + | i | ) w e , there is enough energy in v to allow an agent to bring this excessto u , pay | i | w e for the transit of | i | agents from u to v , and 2 w e for its own costs (as it alsoreturns to v to maintain the balance of | i | agents). Hence, x = (2 + | i | ) w e (see cases 1c and2c from Figure 4 and line 10 of HandleEdge ). • If 0 < B [ v, i ] < (2 + | i | ) w e , there is not enough energy in v to do all of this, and extra energyfrom u is needed. As the total energy spent on e is | i | w e + 2 y where y is the distance traveledby the agent from v , it is minimized when y is minimized. In turn, y is minimized when B [ v, i ] = (2 + | i | y ) so that when it meets the agents from u it has just enough energy tobring them (and itself) to v (otherwise some of the energy in v would have been wasted). Insuch case, the extra energy brought from u is equal to | i | ( w e − y ) (see case 1b from Figure 4and line 12 of HandleEdge ). – if i ≥ B [ v, i ] ≤
0, an agent has to come from u to v to bring the energy so that i agentscan cross from v to u , with the overall cost of x = (2 + i ) w e (see cases 2a, 3a and 4a fromFigure 4 and line 7 of HandleEdge ). – if i > ≤ B [ v, i ]: i agents must cross from v to its parent. • If ≥ iw e , they have enough energy to do so without help from the parent, incurring cost x = iw e (see cases 3c and 4c from Figure 4 and line 18 of HandleEdge ). • If 0 < B [ v, i ] < iw e , extra energy from u is needed to help bring the i agents all the wayto u . Let y is the distance traveled from u by the agent bringing this extra energy. The20ptimal cost of iw e + 2 y is achieved by minimizing y , however y ≥ ( w e = B [ v, i ] /i ) in orderto reach all the agents that need energy. (see cases 3b” and 4b from Figure 4 and line 20 of HandleEdge ). – if i = 0, as the e must be explored, the cost x on it cannot be iw e = 0 but it must be 2 w e (stillassuming no agent terminates inside e ). The cases B [ v, i ] < B [ v, i ] > w e have alreadybeen dealt with, which leaves case 2b’ from Figure 4 and line 15 of HandleEdge .We are left with analyzing the cases when an agent (or two) terminates inside e . As shownbefore, the only such scenarios that are possibly optimal are cases A, B and C from Figure 3.These correspond to cases 3b, 3b’ and 2b from Figure 4 and lines 22, 23 and 14 of HandleEdge ,respectively. It is straightforward to verify that the values computed in those lines indeed correspondto the energy supplied from u . Remember that ← assigns only if the new value is better (higher)than the previous one. Hence, B [ e, −
1] at the end gets the best value from case 1b of B [ v, − B [ v,
0] and case 3b of B [ v,
1] (provided the values of B [ v, ∗ ] with those cases exist) while B [ e,
0] gets the better of case 2b’ of B [ v,
0] and case 3b’ of B [ v, (cid:117)(cid:116) Proof. of Lemma 4
As no energy and agents are lost at v , the optimal energy for the balance of i agents at v isobtained by considering all possibilities how to combine agents from the subtrees to obtain i agentsand taking the best option (line 7 of HandleVertex ).It remains to be shown that the schedule with balance B [ v, i ] is indeed feasible (it might not bebecause a lack of agents or energy at the right time and place). Let i (cid:48) and i (cid:48)(cid:48) be the agent balancesthat result in the best B [ v, i ]. W.l.o.g. assume i (cid:48) ≥ i (cid:48)(cid:48) . If i (cid:48) > B [ v, i (cid:48) ] >
0, this means that T e (cid:48) can be explored without any contribution from v or its parent (by induction hypothesis), bringingthe excess agents and energy to v , which has now exactly the right amount of agents and energy(with possible contribution from its parent) to complete the exploration of T e (cid:48)(cid:48) . This works even if i (cid:48) or B [ e (cid:48) , i (cid:48) ] are not positive, as long as the contribution from the parent allows to explore T e (cid:48) or T e (cid:48)(cid:48) .However, there is one case where this does not work: If i and B [ v, i ] are positive, i (cid:48) and B [ e (cid:48)(cid:48) , i (cid:48)(cid:48) ]are positive but B [ e (cid:48) , i (cid:48) ] and i (cid:48)(cid:48) are negative. In such case there is no help coming from the parentof v , and neither subtree can be explored first on its own in a naive manner. However, the fact that B [ e (cid:48)(cid:48) , i (cid:48)(cid:48) ] is positive means that there is an agent in T e (cid:48)(cid:48) with excess energy. That agent first comesout to v and brings energy to explore the T e (cid:48) and then returns (together with the agents it bringsfrom T e (cid:48) ) to explore T e (cid:48)(cid:48) . This does not cost extra energy beyond what is already accounted for in B [ e (cid:48)(cid:48) , i (cid:48)(cid:48) ] – this is captured in case 1c from Figure 4 and line 10 of of HandleEdge . (cid:117)(cid:116) Claim.
For any configuration of agent C and any two minimal energy assignments E and E theratio | E | / | E | ≤
2, and this is asymptotically optimal.
Proof.
We know from Theorem 4 that | E | / | E | ≤
2. Consider a star graph with 2 k leaves, all edgesof weight 1. Assume that we have configuration C consisting of k agents in the leaves of the star,and one agent in the center of the star, and the following two energy assignments for C : E : agents in the leaves have energy 0, and the agent in the center 4 k − k −
1, i.e., asin the proof of Theorem 5. E : agents in the leaves have energy 2, and the agent in the center 0 for a total 2 k . E was shown to be minimal in the proof of Theorem 5, and E is obviously minimal. Clearly, | E | / | E | = (4 k − / k which converges to 2 for large k . (cid:117)(cid:116)(cid:117)(cid:116)