## 1 Introduction
Similarly, self-healing may rely on the deliberative relocation of nodes in the network [20]. Deliberative algorithms reason over a model of the environment. Hence, they tend to be computationally expensive and require information about the problem instance, including network configuration, environment layout, traffic, etc. Instead, reactive deployment assumes that local dispersion leads to global dispersion: hence, each node makes its own decisions based on local factors [21; 22; 23; 24; 25]. Reactive deployment is not optimized, so some features, like path redundancy, shortest path to the sink, etc., cannot be guaranteed. However, it is computationally less expensive and, hence, better suited for operation in unknown environments, adaptation to failure and also to dynamic structures where nodes can move. A popular approach to reactive deployment in MWSN is behavior-based deployment. In behavior-based algorithms, a node relies on several nuclear skills (behaviors). Each behavior associates an input instance to an output action. More complex, emergent behaviors are obtained as the combination of several simpler ones. A node stops moving when the combination of all its behaviors return a null vector. All virtual potential and forces approaches are implementations of behavior-based algorithms [23; 24; 25]. Alternatively, deployment could follow rules rather than behaviors (e.g., [26]). Rule-based deployment is better fitted to deploy into a given topology, e.g., bus, backbone or ring networks, and also to impose hard constraints, e.g., fix a number of beacons for RSS-based localization [27]. However, behavior-based deployment adapts better to the environment, and it is more adequate for self-healing, especially for multi-node failure, since no fixed node structure needs to be preserved [28]. This work proposes a new behavior-based algorithm for deployment and self-healing of MWSN. The proposed algorithm is a variation of the social potential fields (SPF) [29], originally proposed for navigation in a robot swarm. Force-based strategies have also been proposed for deployment, e.g., [23], or for autonomous repair, e.g., [30]. In one case, forces tend to move nodes away from each other, whereas in the other, healthy nodes tend to move towards the center of the deployment area (assuming it is known). Our proposal is valid for both deployment and self-repair simultaneously,because forces are locally established between nodes, not with respect to specific locations. Each node is affected at all times by a number of forces depending on nearby nodes. Nodes stop when forces are balanced. However, any change that affects this balance will make the node move again. Nodes work uniquely with local information (one-hop). Rather than coping with the state of the network, nodes only care about their own goals, i.e., keep as far from the neighbors as possible and preserve connectivity, plus avoiding collisions, since sensors are mobile, and there might be also other obstacles in the environment. The authors proposed an initial implementation of this SPF-based algorithm for MWSN in [28]. However, the proposed implementation only focused on network expansion and was not adapted to the routing strategy. We propose a new SPF-based algorithm for deployment and self-repair and its adaptation to different routing strategies in Section 2. The methodology we use to test the algorithm is presented in Section 3, including quality metrics and the test environment. As stated in [3], the cost of mobile sensors is considerably higher than the cost of static ones, and hence, it is generally accepted that deployment of only few of such nodes may be feasible in real environments. Hence, most works with a large number of robot sensors rely on simulations [3,14]. In our work, we have fixed all working parameters of our algorithm using a reduced number of real robots and then tested it with large MWSN in simulation using the Player/Stage environment.