1 Introduction

Oil wells require various maintenance services from time to time. Work-over rigs are specialized mobile units that are designed to carry out these maintenance activities. However rigs are expensive units and hence limited in number. The wells that require maintenance, wait in queue for a rig to visit them and carry-out the needed work-over, all the while remaining idle and resulting in production loss. Hence, there is a need to generate an optimum maintenance schedule that minimizes the production loss. The problem of optimizing schedule for work-over rigs is combinatorial optimization problem with constraints and belongs to the NP-Hard difficulty. As the number of wells to be serviced increases, the size of the problem increases exponentially which can cause the execution times of these searches to go beyond an acceptable time.

The Work-over Rig Scheduling Problem (WRSP) can be seen as a type of the Vehicle Routing Problem (VRP) [3, 10] but with the objective to minimize the waiting time for the wells multiplied by the production loss. There have been several solutions proposed for solving the WRSP using various heuristics which has been summarized in [7]. Aloise et al. [1] employed Variable Neighborhood Search (VNS) heuristic to solve WRSP. Ribeiro et al. [8] compares between three meta heuristics, Iterated local search (ILS), Clustering search (CS) and Adaptive large neighborhood search (ALNS). Clustering search proceeds by assigning the solutions obtained by the search to various clusters based on minimum hamming distance. The authors claim that the best results were obtained with ALNS.

Several recent works [4,5,6, 9] deals with Capacitated Cumulative Vehicle Routing Problem (CCVRP) which shares a close analogy with WRSP. Ngueveua et al. [6] is the first to formulate CCVRP, draw insights into why CCVRP is tougher than CVRP and uses Memetic Algorithm (Genetic Algorithm (GA) supported with local search) to solve it. Lysgaard et al. [5] uses the Branch-and-Cut-and-Price algorithm to solve CCVRP. Sze et al. [9] and Liu et al. [4] proposes hybrids of the Large Neighborhood Search to solve CCVRP and highlights the robustness and efficiency of the approach.

Since ALNS is one of the state of the art algorithms for solving WRSP, our work focuses on improving ALNS for achieving better solutions in a quicker time. The key contribution of this paper is a new Aggregated Rank Removal Heuristic (ARRH) based ALNS to solve the WRSP. We compare the proposed ARRH based ALNS with existing ALNS to show the performance benefits in terms of production loss.

2 Problem Definition

In this section, the work-over rig scheduling problem (WRSP) and its constraints is formulated mathematically. Different wells require different levels of maintenance which can only be serviced by a rig having a equal or higher level work-over capability. To model WRSP, it is assumed that we know before hand the wells that require work-over, their production loss and various travel times between the wells. A good model of the problem and its constraints has been provided by Ribeiro et al. [8], which has been used in our work.

Let W be the set of wells to be scheduled and K be the set of available rigs. Every schedule s is an association of each rig \(k \in K\) to a directed graph, \(G^{k}=(V^{k},A^{k})\), where \(V^{k}\) is the set of nodes and \(A^{k}\) is the set of arcs. Let \(W^{k}\) be the set of wells assigned to rig k then \( V^{k}= W^{k} \cup \{ o_{k},z_{k} \} \), where \(o_k\) is the node representing the starting position of rig k, \(k \in K\), \(z_k\) is the node representing the ending position of rig k, \(k \in K\). Every arc \((i,j) \in A^{k} \) is characterized by a time duration \(c_{ij}=e_{ij}+d_{j}\), where \(e_{ij}\) is the travel time between nodes i and j, \(i,j \in W \cup _{k \in K}\{o_{k}\}\) and \(d_j\) is the duration of the maintenance (work-over time) required by node j, \(j \in W\). In case of missing paths between any two nodes, travel time will be calculated as the minimum spanning time with one or more intermediate nodes.

We assume dummy arcs \((i,z_{k})\), \(i \in W^{k}\) with zero duration. Also \( i \in W^{k} \cup \{ o_{k} \} \; \; \& \; \;j \in W^{k} \;\;\forall (i,j) \in A^{k}\).

To denote the presence or absence of an edge (i, j) in schedule of rig k we use a binary variable \(y_{ij}^{k}\) as given by Eq. 1.

$$\begin{aligned} y_{ij}^{k}={\left\{ \begin{array}{ll} 1 &{} if \; (i,j) \in A^{k},\\ 0 &{} otherwise.\end{array}\right. } \end{aligned}$$
(1)

We now formulate \(x_j(s)\), the time waited by the node j in the queue for the maintenance to begin in schedule s, using Eq. 2.

$$\begin{aligned} for \;\; s \; s.t \; \; j \in A^{k},\;\; x_j(s)= {\left\{ \begin{array}{ll} e_{{o_{k}}j} &{} if \; y_{{o_{k}}j}^{k} = 1 \\ x_{i}(s)+d_i+e_{ij} &{} if \; y_{{o_{k}}j}^{k} = 0\;\; and\;\;y_{ij}^{k} = 1 \end{array}\right. } \end{aligned}$$
(2)

Objective Function: The objective function \(\varPsi \) to be minimized is given by Eq. 3.

$$\begin{aligned} \varPsi (s\;|\;s \vdash G^k, \;k\in K) = \sum _{k \in K}\sum _{j \in W^{k}}(x_j+d_j)p_j \end{aligned}$$
(3)

where, \(p_j\) is the oil production rate of node j, \(j \in W\).

Constraints

  1. 1.

    All wells demanding maintenance must be present in the combined schedule of all rigs. That is \(W=\sum _{k \in K} \cup W^{k}\).

  2. 2.

    Each well is visited exactly once in the combined schedule of all rigs.

    $$\begin{aligned} \sum _{k \in K}\sum _{j:(i,j) \in A^{k}} y_{ij}^k = 1,\;\; i \in W \end{aligned}$$
    (4)
  3. 3.

    The classic network flow constraints are modeled as.

    $$\begin{aligned} \sum _{j:({o_{k}},j)\in A^{k}} y^{k}_{{o_k}j} = \sum _{i:(i,{z_{k}})\in A^{k}} y^{k}_{i{z_k}} = 1 , k \in K \end{aligned}$$
    (5)
    $$\begin{aligned} \sum _{j:(i,j)\in A^{k}} y^{k}_{ij} - \sum _{j:(j,i)\in A^{k}} y^{k}_{ji} = 0,\; \; k \in K , \; i \in W^{k} \end{aligned}$$
    (6)
  4. 4.

    Level Constraint: Level constraint is modeled to make sure that wells are visited by those rigs that are equipped to serve the level of maintenance demanded.

    $$\begin{aligned} q_k \ge l_j \;\; \forall \; j:(j,i) \in A^{k} ,\; k \in K \end{aligned}$$
    (7)

    where, \(l_j\) is the level of maintenance request at node j, \(j \in W\) and \(q_k\) is the maximum level of maintenance request that can be attended by rig k.

3 Algorithms

3.1 Genetic Algorithm Supported Variable Neighborhood Search (VNS+GA)

We provide below a brief description of the implemented GA and VNS Algorithms along with the hybrid GA supported VNS.

Genetic Algorithm. The initial population was created by means of iteration through each rig multiple times appending a random well (not yet assigned), to its schedule till all requests for maintenance were met by the schedule.

Crossover- In this work, to cross between two schedules the following approach was used. Let PA, PB denote the individuals to be crossed.

  1. 1.

    All wells that belong outside crossover point is removed from PA to form \(PA'\).

  2. 2.

    All wells that are in \(PA'\) are eliminated from PB forms PB’.

  3. 3.

    Concatenation of \(PB'\) to \(PA{'}\) retaining the structure gives child C.

Mutation- In this work, mutation implements two variation in the child. A random interchange of wells within the schedule of a rig and a random well being shifted from one rig’s schedule to another. The number of children to be mutated are given by a user defined parameter \(\tau \). Mating Pool- In this work the method of Roulette wheel selection [2] is used. The number of children is given by a user defined parameter \(n_{child}\).

Variable Neighborhood Search (VNS). Our attempt to solve the WRSP using VNS was inspired and extends the work of Aloise et al. [1] which employed VNS heuristic to solve WRSP. The VNS framework adopts a recursive search involving an exhaustive search of local neighborhoods and a random search of global neighborhoods (a neighborhood is a set of possible schedules that are similar to a given schedule in some way).

For a given schedule its neighborhoods are generated using the following operations

  1. 1.

    Swap Wells from Same Work-over rig (SWSW): In the given schedule, swap two wells assigned to same rig.

  2. 2.

    Swap Wells from Different Work-over rigs (SWDW): In the given schedule, two wells assigned to two different rigs respectively are interchanged.

  3. 3.

    Add Drop (AD): In the given schedule, a well assignment to one rig is dropped and it the well is assigned to another rig.

The local neighborhoods considered are SWSW, SWDW and AD. The global neighborhoods are SWSW done twice and thrice, SWDW done twice and thrice and the AD done twice and thrice.

Genetic Algorithm Supported Variable Neighborhood Search. In Genetic Algorithm Supported Variable Neighborhood Search a GA is employed by the VNS heuristic to carry out its local search routine. From the current schedule several solutions in the neighborhood defined by the VNS are created and these solutions become the initial population of GA. The idea here is to remove the in-efficient exhaustive search and replace it by the much faster GA.

3.2 Proposed ARRH Based ALNS

In this section, we first briefly describe the existing ALNS implementation, and then present our proposed ARRH based ALNS.

Adaptive Large Neighbourhood Search (ALNS). Our work is inspired from and extends the work of Ribeiro et al. [8] which highlights the superiority of ALNS. Below we provide a brief description of ALNS, a detailed view is available in Ribeiro et al. [8]. ALNS proceeds by destroying a part of the existing solution and recreating it. In each iteration it removes a certain number wells from the schedule and then inserts it back into better positions. For this purpose, it employs various insertion and removal heuristics. The probability of selection of a removal or insertion heuristics depends on its past performance in the search.

Objective Function- The objective function in ALNS is modified to add an additional term \(\lambda \) for the broken level constraints. Here \(\lambda \) is a user defined parameter.

The Proposed Aggregated Rank Removal Heuristic Based ALNS. Aggregated Rank Removal Heuristic (ARRH) which is proposed to replace the Worst Removal Heuristic (WRH) in ALNS. The general idea here is that although ALNS is selecting wells based on travel times and production losses using separate methods, such methods lack the power to make unbiased identification of opportunities that arise due to a combination of these factors. The ARRH is designed to solve two shortcomings of the WRH as given below.

  1. 1.

    Bias Factor - For optimization, the general idea behind removal heuristics is to remove those wells that has an opportunity to be placed in a better position. However, evaluating the wells solely based on loss has a tendency to give more preference to those wells that have higher production rate. Similarly large wait times can also occur from wells with large work-over time or a well isolated from others, inducing a large travel time. Hence larger production loss doesn’t always imply the presence of an opportunity for the well to be placed in a better position.

  2. 2.

    Masking Factor - The WRH takes into consideration of the contribution to production loss only. A well’s contribution to over all production loss is driven not only by its own maintenance requirement but also because of the previous wells that make the well under consideration to wait for its turn. However these other wells’ contributions are masked in WRH.

Proposed ARRH- The proposed approach, Aggregated Rank Removal Heuristic (ARRH) works on ranked values of (a) production loss, (b) travel times and (c) work-over time. Ranked values corresponding to each metric is created by ordering the wells in the increasing order of the metric. Then a discrete set of ordered values ranging from 0 to 1 of equal spacing is created and assigned to the wells as their ranked value of the metric. Ranking the metric in such fashion will help identify opportunities for a better solution without bias. Henceforth, in this paper, the ranked values of travel times, work-over time, production rate and ratio of production rate to work-over time will be represented by \(\hat{e}_{i,j}\), \(\hat{d}_j\), \(\hat{p}_j\) and \(\hat{r}_j\) respectively. Scoring - Scoring the well based on multiple criteria can help pinpoint the cause of the increased production loss. ARRH removes wells with the highest scores. In this work, three criteria have been used to determine the goodness of a solution.

  • Suffocation - If any rig is overloaded with many wells with high production losses and large work-over times no matter the ordering, the wells assigned to the rig will face large production losses, indicating that some of the wells assigned to the rig needs to be removed and placed in the schedule of another rig. The suffocation coefficient for a rig is calculated by Eq. 8.

    $$\begin{aligned} \varGamma (k) = \sum _{j \in W^{k} } \hat{p}_{j}+\hat{d}_{j} \end{aligned}$$
    (8)
  • Ordering - Ordering criterion measures how the wells are ordered in the schedule of a rig. It follows the same criteria as described in Bassi et al. [11]. The ordering coefficient for a rig is calculated by Eq. 9.

    $$\begin{aligned} \zeta (k) = \frac{4}{n(n+1)}\sum _{j\in W^{k}}i\;\hat{r}_{j} \end{aligned}$$
    (9)

    Where i = 0, . . ., n is the numbering of wells in schedule of rig r.

  • Travel-time - The suffocation and ordering criteria deals with the distribution and arrangement of rigs based on \(\hat{p_j}\) and \(\hat{d_j}\). An optimization based only on these criteria alone may lead to coupling between wells that are far apart and induce large travel times rendering the entire procedure in-feasible. The travel time criterion mitigates this by evaluating the travel times at the edges of each well. The travel time coefficient is given by the Eq. 10.

    $$\begin{aligned} \xi (i)= {\left\{ \begin{array}{ll} 2\hat{e_{i,i+1}} &{} if \; y_{o_{k}i}=1\\ 2\hat{e_{i,i-1}} &{} if \; y_{iz_{k}} = 1 \\ \hat{e_{i,i+1}}+\hat{e_{i,i-1}} &{} Otherwise \\ \end{array}\right. } \end{aligned}$$
    (10)

    Where \(i \in W^{k}\) and \((i,i+1)\), \((i-1,i) \in A^{k}\)

In order to give an equal importance to all criteria, the coefficients by the design of the equations are set to vary between 0 and 2.

The criteria mentioned above reflects on some trends we want to see in the schedule however, they are not mutually exclusive. A schedule that is suitable to one criteria need not suit another. Therefore there is a need to strike a balance between them using stochastic aggregation.

In ARRH wells are removed based on a score given by Eq. 11.

$$\begin{aligned} s(i) = x\varGamma (k| i\in k)+y\xi (i)+z\zeta (k| i\in k) \end{aligned}$$
(11)

where i is the well,

r is the rig to which i belongs in the current solution,

x, y, z are random numbers between 0.8 and 1.

A time complexity comparison between ARRH and WRH shows that they both have similar average time complexities \(O(|W|^2)\), where |W| is the number of wells that needs to be serviced. Note that that time complexity for both the heuristics is not dependent on the number of rigs.

4 Results

4.1 Experimental Setup

The data used to create different instances of the problem were created using random simulations. All algorithms were implemented using python 3, on a Windows 10 Enterprise 64 Bit system with Intel(R)Core(TM) i7-8650U CPU @ 1.90 GHz and available physical memory of 9.82 GB. For readability and ease of comparison all losses reported are scaled down by a factor of 5000.

The parameters were created as:

  • Production loss (\(p_j\))- Production loss of each well is sampled from a uniform distribution ranging from 20 to 60.

  • Work-over times (\(d_j\))- Work-over times were sampled from a uniform distribution ranging from 20 to 80.

  • Travel times (\(e_{i,j}\))- x and y co-ordinates were sampled from a uniform distribution ranging from 0 to 100. Travel times were calculated as the euclidean distance between two points.

Table 1. User defined parameters

4.2 A Brief Comparison of GA, VNS+GA and ALNS

All three algorithms were tried to solve an instance where VNS failed to deliver results in a feasible time. That is, for 50 wells and 10 Rigs, VNS gave a loss of 78.8956 for an epoch taking 9138 s. Hence we had an estimated 130 h for 50 epochs. For 5 runs, ALNS, VNS+GA and GA gave 70.04, 78.23, 110.51 average losses respectively, for a run time of 2000 seconds. The parameters used for the algorithm are given in Table. 1. The Fig. 1(a) compares the production loss with respect to the run time of these three algorithms.

Fig. 1.
figure 1

Loss vs time comparison

Table 2. ALNS Vs ARRH based ALNS

4.3 Comparison of ALNS Vs ARRH Based ALNS

ALNS and ARRH based ALNS were compared for 18 instances and the results are tabulated in Table. 2. All instances were run 5 times repeatedly to decrease the uncertainty in the result. The entries made into the table are:

  • Instance: Specifies the instance, the n/m notation stands for n wells and m rigs.

  • Time: To be fair both algorithms were run for the same time for an instance and is mentioned in the table in seconds.

  • Average Loss: Gives the average loss over 5 times.

  • Best: Gives the best-found solution from the 5 times.

  • Deviation: Here deviation is defined as \(\frac{Average Loss - Best}{Best}\times 100\).

Figure 1 provides a comparison between ALNS and proposed ARRH based ALNS. As seen from the graph, proposed ARRH based ALNS results in improvement in production losses as compared to ALNS for the same run time. Further if there is a benchmark of production losses ARRH based ALNS is able to achieve it faster.

ALNS and ARRH based ALNS were also compared using Manhattan distance to calculate distance between the wells. The results were collected for 5 instances of 20 and 30 wells each and ARRH based ALNS was found to give an average improvement of 2.14 % over ALNS. This insight is similar to results obtained from euclidean distance, hence the approach is robust to various distance metrics.

5 Conclusion

The Workover Rig Scheduling Problem (WRSP) has been addressed to improve the production losses of the well. We presented the implementation of the Genetic Algorithm based Variable Neighborhood Search algorithm for the same problem. This combination had a significant improvement than both GA and VNS implementations. However, GA based VNS was not found to be superior than existing Adaptive Large Neighborhood based (ALNS) approach. In this paper, a new heuristic - Aggregated Rank Removal Heuristic (ARRH) had been proposed to be implemented with the existing Adaptive Large Neighborhood Search (ALNS) algorithm for WRSP. The proposed ARRH is based on the utility of rank-based methods to make unbiased judgments about the schedules. The results indicates that this proposed approach results in the lower production losses than ALNS approach for equal run times. In this work, a removal heuristic was designed and used on the basis of ranking. In future we aim to introduce a rank based insertion heuristic as well.