1 Introduction

Wireless sensor networks (WSNs) are disseminated self-organizing embedded systems which be made up of a large number of low cost, low power, and intellectual sensor nodes organized on a certain geographical area [3042]. The sensor nodes are small in size and can perform many vital functions out of which sensing, wireless communication and data processing with other nodes [40, 4347]. Due to the wide range of possible applications of Wireless sensor networks (WSNs) in fields like health monitoring, disaster warning systems, efficient surveillance systems, target tracking, and environment monitoring [5]. In the above mentioned applications, the sensor nodes sense data from a target area and forward the sensed data to a remote base station (BS) usually through multi-hop communication [6]. Either in an ad-hoc or in a pre-planned manner, the sensor nodes are organized in the target area [7]. Ad hoc deployment of the sensor nodes is valuable in a hostile environment where accessibility is less like deep forest, under water and etc. But, this technique requires the deployment of a large number of sensor nodes to ensure full coverage of the target area. The manual deployment or pre-planned is used for easily accessible areas. This type of deployment brings better network management and helps to save sensor’s energy. In addition, it minimizes the overall network cost as coverage in an area with minimum number of sensor nodes is possible in manual deployment [3]. Nevertheless, in both the deployment strategies, maintaining the desired coverage and connectivity of the whole network is enormously significant key. This is a difficult issue because (1) there may be malfunctioning of hardware components (such as a processing unit, transceiver etc.) or they may be damaged by an external event. (2) They have limited and irreplaceable power source and so their energy has chances to get exhausted after certain rounds of operation, (3) the sensor nodes have limited transmission range. In addition, two nodes interconnection may be changed due to the failure of wireless link. For that reason, coverage of the targets and connectivity between the sensor nodes is an important issue even if certain numbers of nodes fail.

In the past few years, many researchers [16, 18, 20, 21, 24] have been developed to solve communication problem like as coverage and connectivity in target based Wireless Sensor Networks (WSNs). The authors in [16] have described placement of relay nodes that has three conflicting objectives: average energy cost, average sensitive area and network reliability. The authors applied meta-heuristic approaches; however, they did not consider complete coverage of sensing area with desired connectivity. In addition, Konstantinidis and Yang [18] discussed about the k-connected deployment and power assignment problem (DPAP) in WSNs. However, they did not consider the coverage issue. Moreover, Yoon and Kim [20] proposed a GA based approach to deploy the sensor nodes for providing the maximum coverage in the network. But, the authors they did not consider connectivity. The authors in [21] have discussed on three different types of coverage problems; simple, k-coverage and Q-coverage. However, the overall complexities of the algorithm become high. Recently, Gupta et al. [24] have proposed a relay node placement algorithm based on Genetic Algorithm (GA). Here, authors have considered only the connectivity between sensor nodes and relay nodes but connectivity between the placed relay nodes is not considered. In distinguish to this, our algorithm deals with l-coverage of the targets and n-connectivity between the sensor nodes with the relay nodes.

According to, in this paper, we develop a GSA based potential position node placement approach for placing sensor nodes in order that all the target points are l-covered and all the sensor nodes are n-connected. An NP entire issue is to find least number of potential or possible locations to set sensor nodes gratifying both coverage and connectivity from a given a group of target points. In this research, we develop a Oppositional Gravitational Search algorithm (GSA) based approach to solve this problem. This approach helps that the sensor nodes are prone to breakdown, the proposed system supplies l-coverage to all targets and n-connectivity to each sensor node. This GSA based system is presented with agent representation, derivation of efficient fitness function along with the usual GSA operators.

1.1 Author’s contributions

Our major contributions are summarized as follows:

  1. a.

    GSO based potential position node placement algorithm that provides l-coverage of a given collection of targets and n-connectivity of the sensor nodes.

  2. b.

    Oppositional process is produced to improve the solution quality of the standard GSA algorithm.

  3. c.

    An efficient agent encoding algorithm for complete potential position node placement solution.

  4. d.

    Derive a multi-objective fitness function that satisfied three objectives like coverage, connectivity and minimum number of sensor nodes.

  5. e.

    Simulation of the proposed approach to demonstrate its performance against some of existing approaches.

The remainder of this paper is organized as follows: Sect. 2 reviews the related works on meta-heuristic based node deployment with desired coverage and/or connectivity. Section provides an overview of the WSN system model. In Sect. 4, the problem definition of the proposed approach is formulated. Section 5 explains detail explanation of GSA based proposed approach. In Sect. 6, we present the experimental results. Finally, Sect. 7 concludes the work and highlights a few future directions.

2 Review of related works

A numerous researchers [7, 1014] have developed meta-heuristic algorithms to solve various problems in Wireless Sensor Networks (WSNS). Among them, few approaches are discussed in this section.

The coverage problem and presented various solution strategies was solved by Younis and Akkaya [15]. In [16], Lanza Gutierrez and Gomez-Pulido explained the placement of relay nodes which has three conflicting intentions: average confidential area and network dependability and average energy cost. The authors here developed meta-heuristic approaches; nevertheless, they did not consider the complete coverage of sensing area with the desired connectivity. A method to prolong network lifetime by splitting the Wireless Sensor Network into disjoint sets was presented by Cardei and Du [17]. This was done by choosing the set which is to be in the active mode and that which is to be in the sleep mode.

According to their work [17], Liu et al. [9] was developed a modified approach. The authors’ strived to maximize the network lifetime by adding some redundant nodes in this work. This was done by considering the coverage and connectivity without any restriction of the sensing and transmission range. The authors also proposed an algorithm for maximizing the disjoint sets of sensor nodes. Again, this was done to maintain coverage and connectivity (MDS-MCC) problem with a proof that it is an NP-complete problem. The k-connected deployment and power assignment problem (DPAP) in Wireless Sensor Networks was enhanced by Konstantinidis and Yang [18]. This difficulty contracts with sensor locations and communication of power stages for improving the lifetime and network coverage. Here they implemented multi-objective evolutionary algorithm depend on disintegration certifying a definite connectivity with the less number of sensor nodes. Even though, the coverage problem was not measured. Berre et al. [19] implemented multi-objective evolutionary algorithms (MOEAs) to found trade-off between coverage and development of network lifetime. While, they did not argue about k-connectivity (k ≥ 1) of sensor nodes in that study. Yoon and Kim [20] projected a Genetic Algorithm based method to arrange the sensor nodes for giving the highest coverage in the network. In this document, the researchers implemented Monte Carlo technique without the concern of connectivity.

Three various kinds of coverage issues such as simple, k-coverage and Q-coverage was explained by Mini et al. [21]. Initially, researchers have projected a coverage formation algorithm which is directed by a cover optimization level to make an optimized cover set. An M-connected optimized algorithm is projected for connectivity issue. In the optimization level, it inserts the residual nodes one by one to the optimized cover set and verify for all probable M-connected subsets at every new insertion. Therefore, the complete difficulties of the algorithm become high. Misra et al. [22] have developed a technique to locate least number of relay nodes (RNs) in predefined positions with the contemplation that RN gratify exact obligation(s) e.g. connectivity or survivability. A relay node situation difficulty is also originated as a mixed integer linear program optimization. Bari et al. [23] projected an ILP calculation is used to reduce the number of given possible location for relay node position in hierarchical networks. Here, the researchers use redundant relay nodes to certify ks and kr survivability which guides to awful consumption of the resources.

In recent times, Gupta et al. [24] have projected a relay node position algorithm depend on GA. The main goal of this algorithm is to locate minimum number relay nodes to the known possible locations so that all the sensor nodes (targets) can be k-linked with relay nodes. Here, researchers have indicated only the connectivity between sensor nodes and relay nodes but connectivity between the located relay nodes is not indicated. Kalaycı et al. [25] have projected a Genetic Algorithm based method to improve the entire network field by offering k-coverage of few significant fields and by maintaining connectivity between the sensor nodes and this is not projected for any objective based Wireless Sensor Network. In difference to this, their algorithm related with k-coverage of the objectives and m-connectivity between the sensor nodes with the relay nodes. In addition, Rebai et al. [7] initiated a genetic algorithm to get the different positions to locate less number of sensor nodes in such a way that the group of sensor nodes give complete coverage to field and entity sensor nodes are linked with the network. Fitness value of a chromosome is the number of sensor nodes needs to give the needed coverage and connectivity. Here, the projected crossover function may create invalid offspring. So, an offspring correction level is initiated. In addition, Suneet Kumar Gupta et al. [29] developed another genetic algorithm approach to solve the coverage and connectivity problem.

The difficulty of either l-coverage or n-connectivity is resolved by the above algorithms which have used meta-heuristic method, but only some of them have considered both l-coverage and n-connectivity. In our proposed algorithm, both coverage and connectivity are entrusted with less number of sensor nodes.

3 Overview of the GSA

Firstly, Gravitational Search Algorithm was proposed by Rashedi et al. [2] in 2009. This algorithm is based on the gravitational law and laws of motion between particles. It was shown in [4] that the approach is capable of handling large-scale nonlinear and non-convex problems. The structure and main principles of GSA are summarized in this below section.

figure c

4 The system model and problem formulation

4.1 The target based WSN model

In WSN model, the targets are distributed in a two-dimensional area. There are some pre-defined possible locations where we can locate sensor nodes to detect the targets. All the targets and the arranged sensor nodes on some possible locations are immobile. The sensor nodes are enclosing the target if it is within detecting variety of the sensor nodes. More than one target can be detected by the sensor node. Likewise LEACH [26], the collection of data function can be classified into rounds. For every round, all the sensor nodes are detecting the targets and send it to Base Station directly through other sensor nodes which are within its communication rage. All nodes shutdown their communication radios to save energy between two near rounds. Recent execution offers state-of-art MAC protocols to give MAC layer communication [27].

4.2 Problem formulation

In this research, we are representing the difficulty as follows. Consider a group of target points and a group of pre-fixed possible locations. We have to choose least number of possible locations to locate sensor nodes so that it will gratify l-coverage of the targets and n-connectivity of the sensor nodes. Suppose, if it is within the communication area of a sensor node then the target is enclosed and the sensor node will be capable to interact with the BS directly through other sensor nodes. For example, the Fig. 1 illustrates a target based network with 10 possible locations, U = {u 1u 2u 3u 4,…, u 10} and seven targets T = {t 1t 2t 3, …, t 7}, in which sensor nodes are placed on six positions out of 10. From the figure, if it is within the interaction area of the sensor node located at the possible location u 2 then the target t 2 is enclosed and the sensor node can capable to interact with the base station through the sensor nodes located at the possible places u 3 and u 4. In the l-coverage of the targets, every target point must be enclosed by at least 1 sensor nodes. Similarly, if l − l sensor node not succeeds then the target will remain enclosed. In the connectivity of the sensor nodes, every sensor is directly linked with other sensor nodes, which means if n − 1 sensor node is not succeed then the sensor node will remain linked. This is noteworthy that the node deployment with N targets and L potential positions is a NP-complete problem [8, 9]. For example, the Fig. 1 illustrates the two- coverage of the targets and one-connectivity of the sensor nodes in network.

Fig. 1
figure 1

An instance of two-covered and one-connected WSN

4.2.1 Notation used

We first describe all the terminologies used in the proposed algorithm.

1. T = {t 1t 2t 3, …, t N } is the collection of targets.

2. U = {u 1u 2u 3, …, u K } is the collection of given potential positions.

3. R sensi represents sensing range of sensor points.

4. R comm represents communication range of sensor points.

5. dist(t i s j ) represents distance betweent i the set of s j .

6. Cover(t i )represents the collection of target points, which are within sensing range of t i . In other words, t i is covered by Cover(t i ),i.e.,

$$Cover(t_{i} ) = \left\{ {s_{j} \left| {dist(t_{i} ,s_{j} )} \right. \le R_{sens} ,\,\forall j,\quad 1 \le j \le Y} \right\}$$
(1)

7. TCover(s i )represents the collection of target points, which are covered by sensor node s i . In other words, s i is covered allTCover(s i )target points, i.e.,

$$TCover(t_{i} ) = \left\{ {t_{j} \left| {dist(t_{i} ,s_{i} )} \right. \le R_{sens} ,\forall j,\quad 1 \le j \le Z} \right\}$$
(2)

8. Comm(s i )represents the collection of target points, which are within communication range of s i . In other words, s i is connected by Comm(s i ), i.e.,

$$Comm(s_{i} ) = \left\{ {t_{j} \left| {dist(s_{i} ,s_{j} )} \right. \le R_{comm} ,\forall j,\quad 1 \le j \le X} \right\}$$
(3)

Therefore, s i can transmit its sensed data to any one of the sensor node from Comm(s i ), where Comm(s i ) ⊆ S.

4.2.2 LP formulation for the potential position node placement problem

The coverage and connectivity problem can be stated as follows. Given a set of X targets and a set of L pre-defined potential positions, we have to select minimum number of potential positions to place sensor nodes so that the network will fulfil l-coverage and n-connectivity (for some given value of l and n). Letα ij , β ij and γ ij be the Boolean variables defined as follows:

$$\alpha_{ij} = \left\{ {\begin{array}{*{20}l} {1,} \hfill & {{\text{if target}}\,\,t_{i} \,{\text{is}}\,{\text{covered by }}s_{j} } \hfill \\ {0,} \hfill & {\text{otherwise}} \hfill \\ \end{array} } \right.$$
(4)
$$\beta_{ij} = \left\{ {\begin{array}{*{20}l} {1,} \hfill & {{\text{if}}\;{\text{a}}\;{\text{sensor}}\;{\text{s}}_{\text{i}} \;{\text{is}}\;{\text{directly}}\;{\text{connected}}\;{\text{to}}\;{\text{another}}\;{\text{sensor}}\;{\text{s}}_{\text{j}} } \hfill \\ {0,} \hfill & {\text{otherwise}} \hfill \\ \end{array} } \right.$$
(5)
$$\gamma_{ij} = \left\{ {\begin{array}{*{20}l} {1,} \hfill & {{\text{if}}\;{\text{a}}\;{\text{potential}}\;{\text{position}}\;{\text{p}}_{\text{i}} \;{\text{is}}\;{\text{selected}}\;{\text{for}}\;{\text{node}}\;{\text{placement,}}\; 1\le i \le {\text{ L}}} \hfill \\ {0,} \hfill & {\text{otherwise}} \hfill \\ \end{array} } \right.$$
(6)

Then, the Linear Programming Problem (LPP) can be formulized as follows:

$${\text{Minimize}}\;Q = \sum\limits_{i = 1}^{L} {\gamma_{i} }$$
(7)

Subject to

$$\sum\limits_{i = 1}^{N} {\alpha_{i} } \ge l,\,\,\,\,\,\forall i,\,\,\,1 \le i \le X$$
(8)
$$\sum\limits_{j = 1}^{N + 1} {\beta_{i} } \ge n,\,\,\,\,\,\forall i,\,\,\,1 \le i \le Y$$
(9)

The constraint (8) explains about each target t i , ∀i, 1 ≤ i ≤ Y, is enclosed by minimum number of sensor nodes. Therefore, it gratifies l-coverage of every target. The constraint (9) explains about each sensor node s i , ∀i, 1 ≤ i ≤ X, is directly linked with minimum n other sensor nodes to gratify n-connectivity of every sensor node.

5 Oppositional GSA based proposed potential position placement approach

Gravitational search algorithm (GSA) is a search technique which usually works as evolutionary continuum. Depend on the law of gravity and mass communication, which is used to find a best solution at a high dimensional search space. Generally, GSA contains five fundamental steps: coding of variables, arbitrary generation of an early population, estimation of the fitness, production of the agent by GSA operators, and closing criteria. Even though, a normal GSA contains some internal issues in several engineering applications. Recently, many differentiations of GSA have been improved to defeat these issues. In the latest research, oppositional learning algorithm based presented by Tizhoosh [1] to develop candidate result by indicating recent population as well as its opponent population at the similar time. Motivated by these studies, this paper has made an attempt to develop an OGSA for potential position node placement over target based wireless sensor networks.

5.1 Solution or agent encoding and initial population

We introduce the solution or agent by the use of string of zeros and ones. The length of every agent is holding likewise the number of possible locations. For an agent or solution, if the value of i th location is 1then a sensor node is situated on the ith possible location and the location value 0 represents there is no sensor situated at ith possible location.

Let us consider a WSN with 11 targets \({\text{T}} = \left\{ {{\text{t}}_{ 1} ,{\text{t}}_{ 2} ,{\text{t}}_{ 3} ,{ \ldots },{\text{t}}_{ 1 1} } \right\}\) and eight possible locations \({\text{P}} = \left\{ {{\text{p}}_{ 1} ,{\text{p}}_{ 2} ,{\text{p}}_{ 3} , \ldots ,{\text{p}}_{ 8} } \right\}\) as demonstrated in Fig. 2(a). If the length of the agent is 8 then it is similar to the number of possible locations. Figure 2(b) illustrates an agent indication, where the position value at location 2 is 1 which involves that a sensor node is located at possible locationp 2. Likewise, sensor nodes are also situated at p 1p 5 and p 6. Though, no sensor node is situated at p 3p 4p 7 and p 8 as gene value at locations 3, 4, 7 and 8 is 0. The starting population is an arbitrarily created a group of agents in which every agent is a mixture of binary numbers.

Fig. 2
figure 2

a Sub graph of a WSN with 11 target points and eight potential positions, b Agent for the sub graph

5.2 Derivation of fitness function

The fitness value of an agent represents its level of quality on the basis of the objectives. In the proposed work, the goal is to select minimum number of potential positions from the given set of potential positions so that all the targets will be l-covered and deployed sensor nodes will be n-connected for some predefined value of l and n.

(i) Selection of minimum number of potential positions: Let us assume that we select N potential points out of L potential positions to place sensor nodes. Therefore, first objective will be as follows:

$$Objection\;function\;1:\;Minimize\;O_{1} = \frac{N}{L}$$
(10)

(ii) l-coverage of the targets: As stated earlier that Cover(t i )is the set of sensor nodes which are within the sensing range of t i . We define coverage cost of a target t i as follows,

$$Cover\text{Cos} t(t_{i} ) = \left\{ {\begin{array}{*{20}c} {l,} & {if\left| {Cover(t_{i} )} \right| \ge l} \\ {l - \left| {Cover(t_{i} )} \right|} & {\text{otherwise}} \\ \end{array} } \right.$$
(11)

Therefore, our second objective will be as follows:

$$Objection\;function\;2:\;Maximize\;O_{2} = \frac{1}{M \times l}\sum\limits_{i = 1}^{M} {Cover\text{Cos} t(t_{i} )}$$
(12)

(iii) n-connectivity of the sensor nodes: Comm(s i )denotes the set of sensor nodes which are within communication range ofs i . Now, we calculate connectivity cost \(Connect\text{Cos} t(s_{i} )\) of a sensor node s i as follows:

$$Connect\text{Cos} t(s_{i} ) = \left\{ {\begin{array}{*{20}c} {n,} & {if\left| {Comm(s_{i} )} \right| \ge n} \\ {n - \left| {Comm(s_{i} )} \right|} & {\text{otherwise}} \\ \end{array} } \right.$$
(13)

Therefore, our third objective will be as follows:

$${\text{Objection}}\;{\text{function}}\; 3 :\;{\text{Maximize}}\;O_{3} = \frac{1}{N \times n}\sum\limits_{i = 1}^{M} {Connect\text{Cos} t(s_{i} )}$$
(14)

The above targets are disagreement with each other is notable. In order to make sure l-coverage to the targets and n-connectivity of the sensor networks, obstruct is our first target to select more possible locations. Our projected method is used to make the fitness function in such a manner which can be built with these inconsistency targets. The multi-objective fitness functions can be created by the use of WSA (weight sum approach) [28]. WSA is a traditional method to resolve the multi-objective optimization issues. In this method, every target can be multiplied with the weight value α i . At last, to add all the multiplied values and then to transfer the multiple targets into a single scalar objective function as follows.

$$fit = Max\left\{ {\alpha_{1} \times (1 - O_{1} ) + \alpha_{2} \times O_{2} + \alpha_{3} \times O_{3} } \right\}$$
(15)
$$fit = Max\left\{ \begin{aligned} \alpha_{1} \times \left( {1 - \frac{N}{L}} \right) + \alpha_{2} \times \frac{1}{M \times l}\sum\limits_{i = 1}^{M} {Cover\text{Cos} t(t_{i} )} \hfill \\ + \alpha_{3} \times \frac{1}{N \times n}\sum\limits_{i = 1}^{M} {Connect\text{Cos} t(s_{i} )} \hfill \\ \end{aligned} \right\}$$
(16)

In this paper, we consider α 1 + α 2 + α 3 = 1 and 0 ≤ α i  ≤ 1, ∀i, 1 ≤ i ≤ 3

5.3 Update the G, best, worst and M of the population

To start the agent or solution updation process, initially we compute some significant parameter like gravitational constant,

$$G(t) = G(G_{0} ,t) = G(t_{0} ) \times \left( {\frac{{t_{0} }}{t}} \right)^{A} \quad A < 1$$
(17)
$$G(t) = G_{0} \times e^{{ - \tau \left( {\frac{iter}{{iter_{\hbox{max} } }}} \right)}}$$
(18)

Gravitational and inertial masses are updated by the following equations:

$$M_{act\,i} = M_{pas\,i} = M_{{\text{int} i}} \quad {\text{for}}\;i = 1, 2,{ \ldots }, n$$
(19)

According to eliminate ambush from a local optimum, initially the algorithm must exploit the investigation. The investigation must fade out and utilization must fade in by the laps of iteration. To develop the process of GSA, to maintain investigation and utilization by the help ofKbest agents this will impress the others. Kbest is a operation of time with the starting value, K 0 and it reduces the time. In such manner, all agents implement the powers at the initial, and as time passes, Kbest is reduced linearly. Finally, there will be just one agent implementing power to the others and it can be expressed as follows.

$$F_{i}^{d} (t) = \sum\limits_{j \in Kbest\,\,j \ne i} {rand_{j} \times F_{ij}^{d} } (t)$$
(20)

In (20), Kbest is the set of first K agents with the best fitness values and the biggest masses.

5.4 Calculation of acceleration

The acceleration (a) of the agent i at time t in dimension d using the law of motion is given as follows:

$$a_{i}^{d} (t) = \frac{{F_{i}^{d} (t)}}{{M_{ii} (t)}}$$
(21)

where M ii is the inertial mass of ith agent.

5.5 Updating agents’ velocity and position

After calculating agent’s accelerator, the velocity and position is updated by following equations:

$$v_{i}^{d} (t + 1) = rand_{i} \times v_{i}^{d} (t + 1) + a_{i}^{d} (t)$$
(22)
$$x_{i}^{d} (t + 1) = x_{i}^{d} (t) + v_{i}^{d} (t + 1)$$
(23)

In Eq. (22), rand i is a uniform variable in [0, 1]. This random number is utilized to give a randomized characteristic to the search.

The updated mass i in time t may be expressed as follows:

$$m_{i} \left( t \right) = \frac{fit(t) - worst(t)}{best(t) - worst(t)}$$
(24)
$$M_{i} (t) = \frac{{m_{i} (t)}}{{\sum\limits_{1}^{N} {m_{i} (t)} }}$$
(25)

Where fit(t) represents the fitness value of the ith agent at time t and best(t)and worst(t) are defined in (26) (27), respectively, for a maximization problem

$$best(t) = \mathop {\hbox{max} }\limits_{{j \in \left\{ {1,{ \ldots }n} \right\}}} fit_{j} (t)$$
(26)
$$worst(t) = \mathop {\hbox{min} }\limits_{{j \in \left\{ {1,{ \ldots }n} \right\}}} fit_{j} (t)$$
(27)

In this step, valid agents are only taken to next iteration, other non-valid agents are applied to produce new agent by the oppositional operation which is described in the following section. Here, valid or non-valid agent are selected using fitness based sorted agents.

5.6 Oppositional operation

In this process, the non-valid or worst agents are selected from above step, after that oppositional operation is performed to improve the solution quality further. In general, it is used to improve candidate solution by considering current population as well as its opposite population at the same time. Based on the opposition process, we compute the opposition population from non-valid or worst populations

$$OM_{u,v} = p_{u} + q_{v} - L_{u,v}$$
(28)

where, u = 1, 2, .., N x , v = 1, 2, .., n and L u,v and OM u,v denote the vth variable of the uth vector of the population and opposite population respectively.

5.7 Computational procedure

The computational process of this algorithm is illustrated in algorithm 2. The computational process of opposition procedure is depicted in algorithm 3.

figure dfigure d

6 Result and discussion

In this section, we evaluate the performance of our proposed approach through simulations. This experimentation is developed in JAVA (version 1.7) in an Intel® Core™ i5-2450 M CPU @ 2.50 GHz, 4.00 GB RAM and Window 8.1 operating platform.

In testing process, let us indicate two various network scenarios called, WSN ≠ 1, WSN ≠ 2 as given in Fig. 3(a, b) correspondingly. Both the scenarios considered as sensing area of 500 × 500 square meter area and the location of the base station was engaged at (500,300), which indicates the side of the area. The WSN#1 is a grid based scenario where every possible point is the grid cross-point and in the WSN#2, the possible points are randomly placed. In the simulation of execution, we utilized below limit values same as in [26] as tabulated in Table 1.

Fig. 3
figure 3

Two different scenarios a WSN ≠ 1: potential positions are placed in a grid, b WSN ≠ 2: potential positions are placed randomly

Table 1 Simulation parameter

6.1 Parameter setting

The optimal chosen variables for the OGSA are population size M x  = 100; G 0 = 100, τ = 20, OP r  = 90 %, iter max = 1000. Finally, F d i (t)is calculated based on (21). It is assumed that only 2 % of the agents apply force to the others at the end of iteration. In addition, 90 % worst solutions are selected for oppositional process.

6.2 Experimental results

Let us indicate the starting population of 100 agents and the opposition rate (OP r ) was indicated as 90 % for to implement the algorithm. We calculated various values of the weight factors α 1α 2 and α 3. From Table 2, the taken values of α 1 = 0.3, α 2 = 0.35 and α 3 = 0.35 for giving a better outcome. So, we have taken the similar value in the resemblance. It should be notable that it is very critical to select these weights as correctly and exactly, even for famous in someone problem domain [28].

Table 2 Different weight values and achieved objectives in percentage (%) for l = 2, n = 2

Figure 4(a, b) clearly illustrates that minimum number of potential position placed from given set of target points and a set of predefined potential positions using OGSA algorithm. From the Fig. 4(a), in the first scenario WSN ≠ 1, the blue points (positions) only are selected as optimal positions (or minimum positions) from given potential positions, where potential positions are placed in a grid. From the Fig. 4(b), the blue points (positions) only are chosen as minimum positions from given potential positions, where potential positions are randomly placed.

Fig. 4
figure 4

Optimized potential positions for two different scenarios using OGSA a WSN ≠ 1, b WSN ≠ 2

Initially, we explain about the simulated outcomes in terms of number of chosen locations for node position by differentiating the number of given possible locations from 100 to 500 for both the network situations WSN#1 and WSN#2 as illustrated in Figs. 5 and 6 correspondingly. Let us indicate 100 target points for different values of l from 1 to 3 and n from 1 to 2 in the simulation. The Figs. 5 and 6 illustrates that the number of possible location increases then the number of chosen location decreases. Due to the normal information, there are more possibilities to effectively locate the sensor nodes to accomplish the needed coverage and connectivity by the help of increased number of possible locations. It is also used to find the higher value of l and n, contrastly more number of possible locations is used to choose a location for sensor nodes.

Fig. 5
figure 5

Comparison in terms of chosen sensor nodes for WSN ≠ 1

Fig. 6
figure 6

Comparison in terms of chosen sensor nodes for WSN ≠ 2

We also implemented l-coverage and n-connectivity algorithm by the help of differentiation initiated by Mini et al. [21], the Genetic Algorithm based node consumption algorithm proposed by Rebai et al. [7]. The algorithms proposed in [7] and [21] contract with both of the coverage and connectivity problems. Furthermore, Rebai et al. [7] have also executed genetic algorithm to resolve the difficulty. Therefore, this is used to estimate the process of the proposed approach with these algorithms.

We execute the algorithm to differentiate the number of chosen possible locations with the sensor node to give l-coverage and n-connectivity for various values of l and n on both the network situations like WSN#1 and WSN#2 correspondingly. Figures 7 and 8 illustrates the differentiation between projected GA-based algorithm with Rebai et al. [7] and Mini et al. [21] by the number of chosen possible locations in WSN#1 and WSN#2 correspondingly. The projected method is used to choose a minimum number of possible locations for node position in comparison gratifying coverage and connectivity with all such algorithms. The better performance is depend on the competent fitness function which creates the proposed method to make sure required coverage and connectivity by using of comparably low number of sensor nodes.

Fig. 7
figure 7

Comparative analysis for different approaches based different l-coverage and n-connectivity in terms of chosen potential positions in WSN ≠ 1

Fig. 8
figure 8

Comparative analysis for different approaches based different l-coverage and n-connectivity in terms of chosen potential positions in WSN ≠ 2

From this experimental analysis, we can observe that our OGSA based approach achieved better performance than existing approaches like Rebai et al. [7] and Mini et al. [21], which proves that our proposed method uses less potential position than existing approaches to place senor nodes. In summary, our simulation results show that our approach performs well and can achieve better solution for target based wireless sensor network connectivity and coverage problem.

7 Conclusion

In this literature, the problem of coverage and connectivity issue in wireless sensor network was studied. A Gravitational Search Algorithm (GSA) inspired algorithm was proposed to solve that issue. The GSA based proposed method used for discovering minimum number of chosen potential positions for placement of sensor nodes in target based WSN fulfilling l-coverage and n-connectivity of the sensor nodes. The need for this method has been shown to be addressed when all the targets need to be supervised with the same proximity by sensor nodes. First, we have presented the linear programming formulation of the said problem. We have next presented GSA based algorithm with proper agent representation, fitness function derivation, velocity and position updation operations. By using of various scenario of Wireless Sensor Network, the method has been replicated by different number of possible locations and number of target points. According to the number of chosen possible location, the solutions are illustrated by our proposed method. In future, the parameters of the WSN will be varied and tested on different scenario.