1 Introduction

Matching problems are among the most well-studied problems in combinatorial optimization. The original motivations of the problem were minimizing transportation costs and optimally assigning personnel to job positions, although many more applications of matching problems can be formulated as optimization problems defined on networks. Matching theory has been even used in the solution of linear systems. In Schenk et al. [33] proposed an alternative technique to the traditional pivoting strategies to factorize matrices based on symmetric weighted matchings. Recently, matching theory has been used for modeling and analyzing wireless resource allocation in a wireless network [24], where a matching was essentially an allocation between resources and users. Many real world applications are usually modelled throughout the use of networks. However, very often the exact location of the nodes is unknown or simply, we have to choose a location for the node within a given region. Thus, the assumption of modelling the nodes by points with a priori known location should be revised. In this sense, we propose to consider a region where the location of a node can lie, that is usually referred in the literature as neighborhood, see Arkin and Hassin [3], Dorrigiv et al. [14], Gentilini et al. [20] among others. In this paper, we deal with matching problems on graphs where nodes are points of their corresponding neighborhoods. For simplicity, we will say that the nodes of the graph are represented by neighborhoods.

A matching of a graph is a subgraph in which each node has a degree of at most one. A maximum matching is a matching of maximum cardinality, that is, a matching with the greatest possible number of edges. If each edge has an associated weight, the maximum weight matching is a matching which maximizes the sum of the weights. Alternatively, edges may have costs, and the minimum cost matching consists of finding a matching with the lowest possible cost, satisfying some specific characteristic. In particular, the minimum cost maximal matching consists of finding a maximal matching (no other edge can be added to it while keeping the property of being a matching) which minimizes the sum of the costs of all the edges in the matching. There are excellent surveys on Matching Theory by Gerards [21], Lovasz and Plummer [25], and Pulleyblank [32].

Generalizations of the matching problem consider more general degree constraints. These generalizations lead to so called b-matchings or f-factors [19, 21, 25]. The b-matching problems considered in this paper are those matching problems where each node is met by at most b edges and the same edge can be used at most once. Important applications of b-matching problems include the T-join problem, the Chinese postman problem, the 2-factor relaxation for the symmetric traveling salesman problem and capacitated vehicle routing [29]. The b-matching model is used to solve numerous problems in different areas, e.g. Tennenholtz [36] in the context of combinatorial auctions and Dong et al. [13] for energy allocation in sea surface monitoring problems. The problem of finding a b-matching of maximum cardinality has been widely studied [2, 18, 19]. The minimum-cost perfect bipartite b-matching problem has been studied in Cohen et al. [10]. Although the minimum cost maximal matching has been addressed by Bodur et al. [9], Taşkin and Ekim [35], Tural [37], to the best of our knowledge, the minimum cost maximal b-matching problem with \(b>1\) has not been studied.

The computational complexity of Matching problems, has been extensively studied in the literature. Edmond [17] proved that the maximum cardinality matching problem is solvable in polynomial-time and proposed a strongly polynomial algorithm for the maximum (minimum) weighted matching problem. The minimum cost maximal 1-matching problem is NP-hard in general graphs [9]. Vaidya [38] showed that Euclidean matching problems, in which the nodes are given as points in the plane and the weight of an edge between the two points is the distance between the two points in the plane, can be solved in \(\mathcal {O}(n^{5/2}(\log n)^4)\) time, for n the number of nodes of the graph. When the points lie on the boundary of a convex polygon, a minimum weight perfect matching with Euclidean distances can be found in \(\mathcal {O}(n \log n)\) time [28]. They also proved that this complexity is \(\mathcal {O}(n{\log }^2 n)\) when the points lie on a simple non-convex polygon. Cunningham and Marsh [11] found the first polynomial time algorithm for finding an optimal b-matching of maximum cost and Anstee [2] presented a strongly polynomial algorithm for solving this problem. The maximum cardinality b-matching of maximum cost can be solved in \(\mathcal {O}(nm{\log }^2 n)\) time [19], for m the number of edges of the graph.

As far as we know, matching problems on a graph with neighborhoods have not been investigated yet. Recently, some extensions of combinatorial optimization problems have been considered on a graph using convex neighborhoods to represent its nodes. In particular, the Traveling Salesman Problem with Neighborhoods (TSPN) consists of searching the minimum-length tour visiting just once each one of the neighborhoods. This problem was introduced by Arkin and Hassin [3] and studied when the neighborhoods are polygonal regions, discs or disjoint convex full dimension objects [12, 16, 20, 22]. As a generalization of the classical TSP problem, the Euclidean TSPN problem is also NP-hard. The Minimum Spanning Tree Problem with Neighborhoods (MSTPN) aims to identify a representative point from each neighborhood so that the MSTP of the set of representative points has the minimum total length among all possible spanning trees. The Minimum Spanning Tree Problem where neighborhoods are a set of disjoint disks, rectangles or second order cone representable, was analyzed in Blanco et al. [8], Dorrigiv et al. [14], Puerto and Valverde [31], Yang et al. [39]. The general case of this problem in the plane is NP-hard.

This paper concentrates on the Minimum Cost b-Matching Problems (MCbMP’s) with neighborhoods instead of nodes, where the costs represent distances between points in each neighborhood. Depending on the criteria of matching neighborhoods, different variants of the MCbMP’s are considered. In particular, we will study the minimum cost versions of: (i) the perfect b-matching problem (each neighborhoods is met by exactly b edges), (ii) the maximum cardinality b-matching problem (find a b-matching with the greatest possible number of edges), (iii) the maximal b-matching problem (no other edge can be added to it while keeping the property of being a b-matching) and (iv) the ab-matching problem (in addition to the conditions of a b-matching, at least a-edges are incident in each neighborhood).

Applications of this kind of problems can be found in wireless network, where the goal is to serve the voice and/or data traffic demand of a particular geographic region (not always convex in structure). The traffic from and/or to a user device of a region is driven through a cell tower [30]. When the number of requests overhead the maximum capacity of the tower, the traffic is routed to the cell tower’s antenna in another region, usually the closest one to reduce costs and guarantee the signal quality. Hence, when designing the wireless network, one may pose the location of a cell tower in each region (neighborhood) taking into account to which other tower will be connected in case of overhead the maximum capacity. The goal is matching neighborhoods and locating a cell tower in each of them to minimize the total sum of all the distances between the matched neighborhoods’ towers. In order to prevent that more than one tower overhead the maximum capacity, a number b could be set such that each neighborhood is matched to, at most, other b-neighborhoods instead of to only one. Depending on the criteria to find the b-matching with neighborhoods, the aforementioned problems arise. For instance, considering the maximum cardinality 2–4-matching criterion, the goal would be to find a matching taking into account that: (1) each tower can be covered, in the case of overhead its capacity, by at least two towers and at most four towers, (2) the higher number of towers to cover a possible overhead of another tower, the better for the quality of the connection among the towers.

To the best of our knowledge, this paper is the first attempt to deal with neighborhoods in matching problems and there is no previous results on the complexity of this kind of problems. We study different cases depending on b, the matching criterion and the type of neighborhoods. Table 1 summarizes the complexity results for some of the b-matching problems studied in this paper. This table allows us to compare the complexity in the case of nodes and neighborhoods. It is worth mentioning that matching problems that are strongly polynomial with nodes are still polynomially solvable with Second Order Cone (SOC) representable neighborhoods. However, they become NP-hard when non-convex polygons are considered as neighborhoods.

In spite of the hardness of some problems, we will provide mathematical programming tools for solving the aforementioned problems. In particular, we provide SOC based formulations for these problems with non-convex neighborhoods given as the union of SOC representable sets. The main reason for this is that they can be solved by interior point methods and, in general, are more efficient that Semidefinite Programming (SDP) problems. In addition, state-of-the-art solvers incorporate mixed integer non-linear implementations of SOC constraints. For further details on the SOC constraints, see the books of Ben-Tal and Nemirovski [5], Luemberger and Ye [27].

The rest of the paper is organized as follows. First, we describe the MCbMP’s with all the variants studied here. Their complexity is analyzed in Sect. 3. In Sect. 4, different non-linear integer programming formulations are developed for the different variants of the b-matching problems. In Sect. 5, these formulations are rewritten as SOC programs in the case of non-convex neighborhoods given as the union of SOC representable sets. Before assessing their performance on randomly generated graphs in the computational results section, a procedure to generate initial solutions is described in Sect. 6. The paper ends with a section of conclusions and some possible future lines of research.

2 Minimum cost b-matching problems with neighborhoods

Let \(G=(V, E)\) be an undirected graph where the nodes are represented by neighborhoods \({{\mathcal {N}}}_i\), with \(i\in N:=\{1,\ldots ,n\}\), E be the set of edges between the neighborhoods of V, and \(\delta (i)\) be the set of edges incident to \({{\mathcal {N}}}_i\). In this paper, for the sake of presentation, we will restrict to three types of neighborhoods: non-convex polygons, balls of \(\ell _p\)-norms and convex polyhedra. Depending on the case the neighborhoods are encoded by the list of their consecutive vertices in case of non-convex polygons, the center, radius in case of a \(\ell _p\) ball and by the set of inequalities describing the polyhedron. A b-matching \({{\mathcal {M}}}\subseteq E\) is a subset of edges such that each neighborhood in V is met by at most b edges in \({{\mathcal {M}}}\) and the same edge can be used at most once. In the b-matching problem, b is the so-called node constraint or degree requirement and it could be considered different for each neighborhood. Indeed, the maximum number of edges that can met \({{\mathcal {N}}}_i\) will be the minimum of \(|\delta (i)|\) and b, and this can be different for each neighborhood. For the sake of simplicity and without loss of generality, we will assume the same value b for all the neighborhoods.

In the MCbMP’s with neighborhoods the goal is twofold: (i) finding a b-matching in the underlying graph, and (ii) determining a point in each neighborhood to be the connection point among the edges defining the b-matching. We assume that the same point \(z_i\in {{\mathcal {N}}}_i\) is used to calculate the distances with all the matched neighborhoods with \({{\mathcal {N}}}_i\). Note that this point could be anywhere in the neighborhood, even in its interior. Therefore, the sum of the lengths (costs) of the edges defined by these points being part of the b-matching is minimized. Indeed, to minimize the sum of all distances between matched neighborhoods, we have to simultaneously obtain the b-matching and points \(z_i\in {{\mathcal {N}}}_i\), determining the distances between the neighborhoods. Note that the main difference with the MCbMP’s with nodes is that in the version with neighborhoods, the distances are not part of the input, but part of the decision.

Table 1 Complexity results for minimum cost matching problems

We introduce the following optimization problems:

  1. (i)

    the minimum cost perfect b-matching problem (P_MCbMP) consists of finding the perfect b-matching of minimum cost, i.e., each neighborhoods is met by exactly b egdes.

  2. (ii)

    the minimum cost maximum cardinality b-matching problem (M\(_{card}\_\)MCbMP) consists of finding a b-matching with the maximum cardinality of minimum cost, i.e., with the greatest possible number of matched neighborhoods.

  3. (iii)

    the minimum cost maximal b-matching problem (Max_MCbMP) consists of finding a maximal b-matching of minimum cost, i.e., no other edge can be added to it while keeping the property of being a b-matching.

  4. (iv)

    the minimum cost maximum cardinality/maximal ab-matching problem, denoted by M\(_{card}\_\)MCabMP and Max_MCabMP respectively, with \(a\in {\mathbb {Z}}\), \(0\le a <b\), consists of finding a maximum cardinality/maximal b-matching of minimum cost where it is imposed that each neighborhood is matched to at least a neighborhoods. Observe that in a M\(_{card}\_\)MCbMP or Max_MCbMP, a neighborhood could be not matched to any neighborhood. This situation is avoided in the ab-matching problem with \(a>0\). When \(a=0\), the classical minimum cost maximum cardinality/maximal b-matching problem is obtained.

The following example illustrates the MCbMP’s.

Fig. 1
figure 1

The minimum cost maximal 2-matching problem with euclidean distances

Example 2.1

Consider a graph \(G=(V,E)\) in \(\mathbb {R}^2\), with a set of nodes given by their coordinates \(V=\{(40,105), (63,111), (103,75), (66,35), (36,44), (58,70)\}\), and the set of edges \(E=\{(1,2),(1,3),(1,6),(2,3),(3,6),(4,5),(4,6),(5,6)\}\). An optimal solution for the minimum cost maximal 2-matching problem using the Euclidean norm is given by the solid line in Fig. 1a, and the total cost is 182.32.

Now, we consider \(V=\{{{\mathcal {N}}}_1,\ldots ,{{\mathcal {N}}}_6\}\) a set of neighborhoods with \(v_i\in {{\mathcal {N}}}_i\), for \(i=1,\ldots ,6\) and the same set of edges. For the sake of simplicity, the neighborhoods are defined as Euclidean disks and rectangles. The centers and radii of the disks are given by \(\{\{(63,111),1.5\},\{(36,44),5\},\{(58,70),4\}\}\), and the lower left corner/upper right corner of the rectangles are \(\{\{(40,90),(46,115)\},\{(99,72),(107,78)\},\{(66,32),(70,38)\}\}\). For solving the minimum cost maximal 2-matching problem using the Euclidean norm, we have to simultaneously obtain the maximal 2-matching and six points \(z_i\in {{\mathcal {N}}}_i\), which determine the distances between the neighborhoods. The same point \(z_i\in {{\mathcal {N}}}_i\) is used to calculate the distances with all the matched neighborhoods with \({{\mathcal {N}}}_i\).

The optimal matching with neighborhoods is given by the solid line in Fig. 1b, and the total cost is 140.83. For instance, \({{\mathcal {N}}}_1\) is matched to \({{\mathcal {N}}}_3\) and \({{\mathcal {N}}}_6\) and the point of the neighborhood \({{\mathcal {N}}}_1\) used to calculate the distances to \({{\mathcal {N}}}_3\) and \({{\mathcal {N}}}_6\) is the same point for both of them, \(z_1\). Note that the distance between \({{\mathcal {N}}}_1\) and \({{\mathcal {N}}}_6\) using \(z_1\) and \(z_6\) is not the closest distance between neighborhoods \({{\mathcal {N}}}_1\) and \({{\mathcal {N}}}_6\).

Comparing the optimal solutions of the maximal 2-matching problem with/without neighborhoods, we observe that \({{\mathcal {N}}}_2\) is not matched to any neighborhood in the optimal solution of the maximal 2-matching problem with neighborhoods (Fig. 1b). However, in the optimal solution without neighborhoods (Fig. 1a), \(v_2\) is matched to \(v_1\) and \(v_3\). This shows the influence in the optimal solution of the points chosen in each neighborhood to determine the distances.

To illustrate the different b-matching problems introduced above, we consider the following example.

Fig. 2
figure 2

2-matching problems of minimum cost

Example 2.2

Consider the same graph of Example 2.1.

An optimal solution of the perfect 2-matching problem is given by the six solid lines in Fig. 2a and the total cost associated with this matching is 206.66. This is also the optimal solution of the maximum cardinality 2-matching problem. Note that this solution is maximal, and contains two edges more than the solution of the minimum cost maximal 2-matching problem given in Fig. 1b with total cost 140.83.

The optimal solution of the minimum cost maximal 2-matching given in Fig. 1b allows a neighborhood not to be matched to any other (see neighborhood \({{\mathcal {N}}}_2\)). If we impose that all the neighborhoods must be matched to at least another one (1–2-matching problem), the optimal solution of the maximal 1–2-matching of minimum cost is given in Fig. 2b. The total cost associated with this matching is then 149.37. Note that now, neighborhood \({{\mathcal {N}}}_6\) is matched to \({{\mathcal {N}}}_1\) and \({{\mathcal {N}}}_5\) whereas in the optimal solution of the minimum cost maximal 0–2-matching \({{\mathcal {N}}}_6\) was matched to \({{\mathcal {N}}}_1\) and \({{\mathcal {N}}}_3\).

Observe that whenever the minimum cost perfect b-matching problem is feasible, the minimum cost maximum cardinality b-matching problem has the same solution (see Fig. 2a). However, the former can be unfeasible and the latter is always feasible, see Fig. 3.

Fig. 3
figure 3

The minimum cost maximum cardinality 2-matching problem

3 Comparing the MCbMP’s and analyzing the complexity

After describing in Sect. 2 the different b-matching problems of minimum cost studied in this paper, we show the relationship between the optimal total cost of all of them. Let \(f^P_b\), \(f^{MC}_b\), \(f^{M}_b\) be the optimal objective value of the P_MCbMP, M\(_{card}\_\)MCbMP and Max_MCbMP, respectively, and \(f^{MC}_{ab}\), \(f^{M}_{ab}\) the corresponding version of the ab-matching.

Proposition 3.1

The following relationships are satisfied:

  1. (i)

    \(f^{M}_b\le f^{MC}_b\) and \(f^{MC}_b= f^{P}_b\), if P_MCbMP is feasible.

  2. (ii)

    \(f^{M}_{b}\le f^{M}_{ab}\).

  3. (iii)

    \(f^{MC}_b\le f^{MC}_{ab}\).

Proof

This result follows from the fact that the solutions of the perfect b-matching are feasible solutions of b-matching of maximum cardinality problems. Moreover, the feasible solutions of the latter are also feasible solutions of the maximal b-matching problem. On the other hand, the feasible solutions of the ab-matching are feasible solutions of the corresponding minimum cost b-matching problem. \(\square\)

Figure 4 shows the relationship among feasible solutions sets of the MCbMP’s depending on the values of a and b.

Fig. 4
figure 4

Relationship among feasible solutions sets of the MCbMP’s

In the following, we analyze the complexity of the different variants of the MCbMP’s depending on b and the structure of the neighborhoods.

Proposition 3.2

The P_MCbMP and \(M_{card}\_\)MCbMP are NP-hard with non-convex polygons.

Proof

We consider a graph \(G=(V, E)\) where \(V=\{{{\mathcal {N}}}_i: i=1,\ldots ,k\}\), with \({{\mathcal {N}}}_1\) a point, \({{\mathcal {N}}}_i\) (\(i\ne 1\)) given by non-convex polygons, and \(E=\{(1,2),(2,3),(3,4),\ldots ,(k-1,k)(k,1)\}\) (Fig. 5). The minimum cost perfect/maximum cardinality 2-matching problem is equivalent to the Touring Polygons problem [15] which consists of finding a shortest tour (shortest cycle) that starts at \({{\mathcal {N}}}_1\), visits the polygons in the given order, and ends again at \({{\mathcal {N}}}_1\). Since the polygons are non-convex, the Touring Polygons problem is NP-hard for any metric \(\ell _p\), \(p\ge 1\) [1, 15]. Therefore, the P_MCbMP and M\(_{card}\_\)MCbMP are NP-hard and the result holds. \(\square\)

Fig. 5
figure 5

Minimum cost perfect/maximum cardinality 2-matching problem with non-convex neighborhoods

From Proposition 3.2, we have the following result.

Corollary 3.1

The \(M_{card}\_MCabMP\) is NP-hard with non-convex polygons.

Observe that (Max_MCbMP) and (Max_MCabMP) are NP-hard because the minimum cost maximal 1-matching problem where the nodes are points is NP-hard.

However, when \(b=1\) the complexity of some versions of the minimum cost 1-matching problems become polynomial in some cases.

Proposition 3.3

The P_MC1MP and \(M_{card}\_MC1MP\) with SOC-representable neighborhoods are solvable in polynomial time.

Proof

When \(b=1\), each neighborhood is met by at most one edge and the distances between neighborhoods are independent of one another. Therefore, we can previously determine the distances between neighborhoods (solving minimum distances problems between neighborhoods) and then solving a classical matching problem in a graph with nodes using these computed distances as the costs or distances of the edges between the nodes.

Provided that the distances between neighborhoods can be computed in polynomial time, since these distances can be reduced to solve a SOC programming problem and the version of the minimum cost perfect and maximum cardinality matching problems are solvable in polynomial time, the result follows. \(\square\)

Proposition 3.4

The Max_MC1MP on trees with SOC-representable neighborhoods is solvable in polynomial time.

Proof

The case of Max_MC1MP is solvable in polynomial time on trees [37]. Following similar arguments to the ones given in Proposition 3.3, the result holds. \(\square\)

Note that the complexity given in the previous two results are polynomial in the sense of the complexity of interior point algorithm for solving SOC representable problems. Moreover, the results given in Propositions 3.3 and 3.4 could be extended to the case of any neighborhood, not only SOC-representable, provided that the distances between neighborhoods could be computed in polynomial time.

4 Formulations for MCbMP’s

In this section we present mixed integer non-linear programming formulations for the different MCbMP’s defined in Sect. 2. All formulations use the following sets of decision variables:

$$\begin{aligned}&x_{ij}=\left\{ \begin{array}{lll} 1, &{} \text{ if } (i,j) \text{ belongs } \text{ to } \text{ the } \text{ matching, } &{} \\ 0,&{}\text{ otherwise, }&{}\end{array} \right.&\forall (i,j)\in E, (i< j).\\&z_{i}: \text{ continuous } \text{ variables } \text{ to } \text{ represent } \text{ the } \text{ point } \text{ selected } \text{ in } \text{ each } \text{ neighborhood, }&\forall i\in N. \end{aligned}$$

Moreover, we denote \(||\cdot ||_q\) the standard \(\ell _q\)-norm with \(q\in [1,\infty )\). In this section, constraints related to the structure of the neighborhoods are not explicitly formulated, and we will refer to them just by \(z_i\in {{\mathcal {N}}}_i\). In Sect. 5, we will formulate them properly.

4.1 The minimum cost perfect b-matching problem

This section deals with the P_MCbMP, where each neighborhood \({{\mathcal {N}}}_i\) is met by exactly b edges. This problem can be formulated as follows:

$$\begin{aligned} (\text {F}_{P})&\min&\sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}}||z_i-z_j||_qx_{ij} \end{aligned}$$
(1)
$$\begin{aligned}s.t.&\sum _{{\mathop {i<j}\limits ^{j:(i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}= b,\quad \forall i\in N, \\&x_{ij} \in \{0,1\}, \quad \forall i,j(i<j)\in N,\nonumber \\&z_i\in {{\mathcal {N}}}_i,\quad \forall i\in N. \nonumber \end{aligned}$$
(2)

The objective function (1) accounts for the sum of the length of the matching edges which is determined by the distance between the chosen points in each neighborhood. Constraints (2) define the perfect b-matching constraints, i.e., each neighborhood meets exactly b edges.

4.2 The minimum cost b-matching problem with maximum cardinality

The M\(_{card}\_\)MCbMP can be formulated as a maximum weight b-matching problem as follows:

$$\begin{aligned}&(\text {F}_{card}) \max \sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}}(M-||z_i-z_j||_q)x_{ij} \nonumber \\&\quad \quad \quad s.t.\quad \sum _{{\mathop {i<j}\limits ^{j:(i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}\le b,\quad \forall i\in N,\\&\quad \quad \quad x_{ij} \in \{0,1\}, \quad \forall i,j(i<j)\in N, \nonumber \\&\quad \quad \quad z_i\in {{\mathcal {N}}}_i,\quad \forall i\in N, \nonumber \end{aligned}$$
(3)

where \(M:=\max _{{\mathop {z_i\in {{\mathcal {N}}}_i, z_j\in {{\mathcal {N}}}_j}\limits ^{i,j\in N}}}\{||z_i-z_j||_q\}+1\).

This problem has been transformed in a maximum problem using a big-M parameter, in such a way that if an edge is not used, the penalization is huge. Therefore, the choice of the maximum number of edges is guaranteed. Family of constraints (3) is the classical family of b-matching constraints when the number of edges is being maximized.

4.3 The minimum cost maximal b-matching problem

In this section we propose two different formulations for the Max_MCbMP. First, we give the following definition. A neighborhood \({{\mathcal {N}}}_i \in V\) is said saturated if no other edge can met \({{\mathcal {N}}}_i\). For each \({{\mathcal {N}}}_i\in V\), the maximum number of edges that can met \({{\mathcal {N}}}_i\) is defined as \(S_i=\min \{b,|\delta (i)|\}\). Thus, a neighborhood \({{\mathcal {N}}}_i\) is said saturated if \(\sum _{{\mathop { i<j}\limits ^{j: (i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}=S_i\).

The first formulation of the minimum cost maximal b-matching problem consider binary y-variables to keep under control when neighborhood i can be matched with neighborhood j (because they are not saturated), i.e.,

$$\begin{aligned} y_{ij}=\left\{ \begin{array}{lll} 1, &{} \text{ if } (i,j) \text{ could } \text{ be } \text{ in } \text{ the } \text{ matching, } &{} \\ 0,&{}\text{ otherwise, }&{}\end{array} \right.&\forall (i,j)\in E. \end{aligned}$$

Hence, this problem can be formulated as follows:

$$\begin{aligned} (\text {F1}_{max})&\min\quad \sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}}||z_i-z_j||_qx_{ij} \nonumber \\ s.t.&\sum _{{\mathop { i<j}\limits ^{j: (i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}\le S_i,\quad \forall i\in N, \end{aligned}$$
(4)
$$\begin{aligned}&S_iy_{ij}\ge S_i-\left(\sum _{{\mathop {k\ne j; i<k}\limits ^{k:(i,k)\in E}}}\!\!\!\!x_{ik}+\sum _{{\mathop {k\ne j; k<i}\limits ^{k:(i,k)\in E}}}\!\!\!\!x_{ki}\right),\quad \forall i\in N, j:(i,j)\in E, \end{aligned}$$
(5)
$$\begin{aligned}&x_{ij}\ge y_{ij}+y_{ji}-1,\quad \forall (i,j)\in E, i<j, \end{aligned}$$
(6)
$$\begin{aligned}&y_{ij} \in \{0,1\}, \quad \forall (i,j)\in E, \nonumber \\&x_{ij} \in \{0,1\}, \quad \forall (i,j)\in E,i<j, \end{aligned}$$
(7)
$$\begin{aligned}&z_i\in {{\mathcal {N}}}_i,\quad \forall i\in N. \end{aligned}$$
(8)

Constraints (4) ensures that the generated solution is a b-matching. Constraints (5) ensure that \(y_{ij}=1\) if neighborhood \({{\mathcal {N}}}_i\) is not saturated without using edge (ij) (\(\sum _{{\mathop {k\ne j; i<k}\limits ^{k:(i,k)\in E}}}\!\!\!\!x_{ik}+\sum _{{\mathop {k\ne j; k<i}\limits ^{k:(i,k)\in E}}}\!\!\!\!x_{ki}<S_i\)). Constraints (6) ensure that \(x_{ij}=1\) if \(y_{ij}=1\) and \(y_{ji}=1\). That is, if neighborhoods \({{\mathcal {N}}}_i\) and \({{\mathcal {N}}}_j\) are not saturated, then \({{\mathcal {N}}}_i\) and \({{\mathcal {N}}}_j\) are matched.

An alternative formulation can be considered using the following binary variables [35]:

$$\begin{aligned} y_{i}=\left\{ \begin{array}{lll} 1, &{} {\text{ if } {{\mathcal {N}}}_i \text{ is } \text{ saturated } \text{ in } \text{ the } \text{ matching, }} \\ 0,&{}\text{ otherwise. }&{}\end{array} \right.&\forall i\in N. \end{aligned}$$

The alternative formulation for the minimum cost maximal b-matching problem using the variables defined above is given by

$$\begin{array}{*{20}l} {({\text{F2}}_{{max}} )\min } \hfill & {\sum\limits_{{\begin{array}{*{20}c} {(i,j) \in E} \\ {i < j} \\ \end{array} }} {|z_{i} - z_{j} ||_{q} x_{{ij}} } } \hfill \\ {s.t.} \hfill & \begin{gathered} (4),(7),(8) \hfill \\ x_{{ij}} \ge 1 - y_{i} - y_{j} ,\quad \forall (i,j) \in E,i < j, \hfill \\ \end{gathered} \hfill \\ \end{array}$$
(9)
$$\begin{aligned}&S_i y_i\le \sum _{{\mathop { i<j}\limits ^{j: (i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji},\quad \forall i\in N, \\&y_i\in \{0,1\},\quad \forall i\in N.\nonumber \end{aligned}$$
(10)

Constraints (9) enforce the condition that if \(x_{ij}=0\), neighborhood i or j has to be saturated, i.e., \(y_i=1\) or \(y_j=1\). Constraints (10) ensure that if neighborhood i is not saturated, (\(\sum _{{\mathop { i<j}\limits ^{j: (i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}<S_i\)) then \(y_i=0\).

The following constraints are valid inequalities for (F2\(_{max}\)),

$$\begin{aligned} y_i\ge \sum _{{\mathop {i<j}\limits ^{j: (i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}-S_i+1,\quad \forall i\in N. \end{aligned}$$
(11)

That is, if neighborhood \({{\mathcal {N}}}_i\) is saturated (\(\sum _{{\mathop { i<j}\limits ^{j: (i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}=S_i)\), then \(y_i=1\).

Further constraints can be added to reinforce the formulation in cases where \(|\delta (i)|=1\):

$$\begin{aligned} y_j\ge 1-x_{ij}\quad \forall (i,j)\in E, |\delta (i)|=1. \end{aligned}$$

To the best of our knowledge, the Max_MCbMP with \(b>1\), for the standard case (by considering a set of nodes), has not been studied. Therefore, formulations (F1\(_{max}\)) and (F2\(_{max}\)) after removing (8) are also valid for solving the standard minimum cost maximal b-matching problem if we consider singletons instead of neighborhoods.

4.4 The minimum cost ab-matching problems

This section is devoted to the minimum cost b-matching problems where additional constraints are imposed to the matching in order to guarantee each neighborhood \({{\mathcal {N}}}_i\) is matched to at least a neighborhoods, with \(1\le a\le b\). These models are called minimum cost ab-matching problems.

Formulations for the Max_MCabMP and M\(_{card}\)_MCabMP are obtained by adding the following constraints to the corresponding formulations given in the previous subsections:

$$\begin{aligned} \sum _{{\mathop {i<j}\limits ^{j:(i,j)\in E}}}x_{ij}+\sum _{{\mathop {j<i}\limits ^{j:(i,j)\in E}}}x_{ji}\ge a, \forall i\in N, \end{aligned}$$

and are denoted by (F\(^{ab}_{max}\)) and (F\(^{ab}_{card}\)), respectively.

5 SOC formulations for the MCbMP’s with neighborhoods

Observe that all the formulations of the different versions of the MCbMP’s given in the previous section can be written as follows:

$$\begin{aligned}&\min \sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}} ||z_i-z_j||_q x_{ij}-\sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}} M x_{ij}\\&\quad \quad \quad s.t. [MC]\nonumber \\&\quad \quad \quad x_{ij} \in \{0,1\}, \quad \forall (i,j)\in E,i<j, \nonumber \\&\quad \quad \quad z_i\in {{\mathcal {N}}}_i,\quad \forall i\in N,\nonumber \end{aligned}$$
(12)

where [MC] is the set of Matching Constraints given in each formulation depending on the problem (perfect b-matching, maximum cardinality b-matching, maximal b-matching and ab-matching) and \(M:=\max _{{\mathop {z_i\in {{\mathcal {N}}}_i, z_j\in {{\mathcal {N}}}_j}\limits ^{i,j\in N}}}\{||z_i-z_j||_q\}+1\), for the case of the maximum cardinality version, and 0 otherwise.

One of the main difficulty of the problem above lies in the term \(||z_i-z_j||_q x_{ij}\) of the objective function (12). Let us define a new set of variables \(d_{ij}\ge 0\) as \(d_{ij}=||z_i-z_j||_q x_{ij}\), \(\forall (i,j)\in E\), \(i<j\). Then, the formulations for the MCbMP’s presented in the previous section can be reformulated as follows:

$$\begin{aligned} (\text {F}_{general})\min&\sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}} d_{ij}-\sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}} M x_{ij}\nonumber \\s.t.&[MC]\nonumber \\&||z_i-z_j||_q\le d_{ij}+M_{ij}(1-x_{ij}), \quad \forall (i,j)\in E, i<j, \end{aligned}$$
(13)
$$\begin{aligned}&d_{ij}\ge 0, \quad \forall (i,j)\in E,\nonumber \\&x_{ij} \in \{0,1\}, \quad \forall (i,j)\in E,i<j,\nonumber \\&z_i\in {{\mathcal {N}}}_i,\quad \forall i\in N, \end{aligned}$$
(14)

where \(M_{ij}:=\max _{z_i\in {{\mathcal {N}}}_i, z_j\in {{\mathcal {N}}}_j}\{||z_i-z_j||_q\}\). Although the reformulation has a linear objective function, constraints (13) are not linear since they are considering a \(\ell _q\)-norm. However, this type of constraints have a representation as Second Order Cone (SOC) inequalities, see Blanco et al. [7]. Most of the state-of-the-art solvers are capable to efficiently solve optimization problems involving SOC constraints by means of quadratic constraints with positive definite matrices.

So far, we have focused our attention in the modelling aspects of the objective function and constraints to model the corresponding matching criterion under study. And, we have obtained a linear objective function and a set of constraints with a SOC representation. However, the characterization of the neighborhoods have not been addressed yet. Particularly, we will concentrate on neighborhoods given by the union of SOC-representable sets [26], more precisely, polyhedra and \(\ell _q\) balls. Different transformations of (\(\text {F}_{general}\)) (one for each matching criterion) will be carried out to accommodate it to the use of second order cone optimization. The main reason for this is that it can be solved by interior point methods and, in general, they are more efficient that Semidefinite Programming (SDP) problems. For further details on the SOC constraints, see books Ben-Tal and Nemirovski [5], Luemberger and Ye [27].

5.1 SOC formulations for the MCbMP’s with some non-convex neighborhoods

In this subsection, we consider the case where the neighborhoods belong to a family of non-convex sets given by a finite union of polyhedrons and \(\ell _q\)-norm balls as Fig. 6. We will use results from disjunctive programming [4, 34] to formulate the MCbMP’s with these neighborhoods.

Fig. 6
figure 6

Different neighborhoods

Let us consider a set of neighborhoods \({{\mathcal {N}}}_i\), with \(i\in N\), defined as \({{\mathcal {N}}}_i=\left( \bigcup _{j\in P^i}{{\mathcal {P}}}^i_j\right) \cup \left( \bigcup _{k\in D^i}{{\mathcal {D}}}^i_k\right)\) where \({{\mathcal {P}}}^i_j\) is a full-dimensional polyhedron given by \({{\mathcal {P}}}^i_j:=\{x\in \mathbb {R}^m:A^i_jx\le b^i_j \}\), whose recession cone is the null vector, with \(A^i_j\) a real matrix and \(b^i_j\in \mathbb {R}\) for any \(j\in P^i:=\{1,\ldots ,p^i\}\), and \({{\mathcal {D}}}^i_k:=\{x\in \mathbb {R}^m: ||x-c^i_k||_q\le r^i_k\}\) where \(||\cdot ||_q\) denotes the standard \(\ell _q\)-norm with \(q\in [1,\infty )\), \(q\in \mathbb {Q}\), and \(c^i_k\in \mathbb {R}^m\) and \(r^i_k\in \mathbb {R}\) for any \(k\in D^i:=\{1,\ldots ,d^i\}\). Observe that neighborhoods \({{\mathcal {N}}}_i\) are not convex in general.

Let \(z_i\) be a point in the neighborhood \({{\mathcal {N}}}_i\). Then \(z_i\) belongs to a polyhedron \({{\mathcal {P}}}^i_j\), for some \(j\in P^i\), or a \(\ell _q\)-norm ball \({{\mathcal {D}}}^i_k\), for some \(k\in D^i\). We will use the following variables to distinguish points in the polyhedron or \(\ell _q\)-norm ball.

  • Continuous variables \(u^i_{j}\in \mathbb {R}^m\) to represent a point in the polyhedron \({{\mathcal {P}}}^i_j\).

  • Continuous variables \(w^i_{k} \in \mathbb {R}^m\) to represent a point in the \(\ell _q\)-norm ball \({{\mathcal {D}}}^i_k\).

  • Binary variables \(t^i_j\) equal to 1 if \(z_i\) is in the polyhedron \({{\mathcal {P}}}^i_j\) and 0 otherwise.

  • Binary variables \(s^i_k\) equal to 1 if \(z_i\) is in the \(\ell _q\)-norm ball \({{\mathcal {D}}}^i_k\) and 0 otherwise.

The following proposition give a characterization of a point belonging to a neighborhood.

Proposition 5.1

\(z_i\in {{\mathcal {N}}}_i\) if and only if

$$\begin{aligned} z_i=\sum _{j\in P^i}u^i_j+\sum _{k\in D^i}(w^i_k-c^i_k(1-s^i_k)),&\end{aligned}$$
(15)
$$\begin{aligned} A^i_ju^i_j\le b^i_j t^i_j,\quad j\in P^i, \end{aligned}$$
(16)
$$\begin{aligned} ||w^i_k-c^i_k||_q\le r^i_ks^i_k,\quad k\in D^i, \end{aligned}$$
(17)
$$\begin{aligned} \sum _{j\in P^i}t^i_j+\sum _{k\in D^k}s^i_k=1,&\end{aligned}$$
(18)
$$\begin{aligned} t^i_j,s^i_k\in \{0,1\},\quad j\in P^i, \,k\in D^i. \end{aligned}$$
(19)

Proof

(\(\Rightarrow\)) Let \(z_i\in {{\mathcal {N}}}_i\). Then, \(z_i\) belongs to a polyhedron \({{\mathcal {P}}}^i_{j_0}\), for some \(j_0\in P^i\), or a \(\ell _q\)-norm ball \({{\mathcal {D}}}^i_{k_0}\), for some \(k_0\in D^i\) (if \(z_i\) belongs to the intersection of both, we only consider one of the two cases).

  • if \(z_i\in {{\mathcal {P}}}^i_{j_0}\), we consider \(t^i_{j_0}=1\), \(t^i_j=0\) and \(u^i_j=\mathbf{0}\in \mathbb {R}^m\), \(\forall j(\ne j_0)\in P^i\), \(u^i_{j_0}=z_i\), \(s^i_k=0\) and \(w^i_k=c^i_k\), \(\forall k\in D^i\). Hence, (15)–(19) are satisfied.

  • if \(z_i\in {{\mathcal {D}}}^i_{k_0}\), we consider \(s^i_{k_0}=1\), \(s^i_k=0\) and \(w^i_k=c^i_k\) \(\forall k(\ne k_0)\in D^i\), \(w^i_{k_0}=z_i\), \(t^i_j=0\) and \(u^i_j=\mathbf{0}\in \mathbb {R}^m\), \(\forall j\in P^i\). Hence, (15)–(19) are satisfied.

(\(\Leftarrow\)) Let \(z_i\) a point satisfying (15)–(19). From (18) and (19), there exists either \(j_0\in P^i\) such that \(t^i_{j_0}=1\) and \(t^i_j=0\) \(\forall j(\ne j_0)\in P^i\) and \(s^i_k=0\) \(\forall k\in D^i\), or there exists \(k_0\in D^i\) such that \(s^i_{k_0}=1\) and \(s^i_k=0\), \(\forall k(\ne k_0)\in D^i\) and \(t^i_j=0\), \(\forall j\in P^i\).

In the first case, on the one hand, since \(t^i_{j_0}=1\) and \(t^i_j=0\) \(\forall j(\ne j_0)\in P^i\) then, by (16), \(u^i_{j_0}\in {{\mathcal {P}}}^i_{j_0}\) and \(A^i_ju^i_j\le 0\), \(\forall j(\ne j_0)\in P^i\). Since any vector satisfying \(A^i_ju^i_j\le 0\), \(\forall j(\ne j_0)\in P^i\) would be a vector of recession cone of \({{\mathcal {P}}}^i_{j}\) and, by hypothesis, this is the null vector, then \(u^i_j=\mathbf{0}\in \mathbb {R}^m\), \(\forall j(\ne j_0)\in P^i\) . Moreover, on the other hand, if \(s^i_k=0\) \(\forall k\in D^i\), by (17), we have that \(||w^i_k-c^i_k||_q=0\), \(\forall k\in D^i\), that is, \(w^i_k=c^i_k\). Therefore, from (15), we obtain that \(z_i=u^i_{j_0}\in {{\mathcal {P}}}^i_{j_0}\). That is, \(z_i\) belongs to the polyhedron \({{\mathcal {P}}}^i_{j_0}\).

Analogously in the second case, if we have that there exists \(k_0\in D^i\) such that \(s^i_{k_0}=1\) and \(s^i_k=0\), \(\forall k(\ne k_0)\in D^i\) and \(t^i_j=0\), \(\forall j\in P^i\), then we would obtain that \(z_i=w^i_{k_0}\in {{\mathcal {D}}}^i_{k_0}\), that is, \(z_i\) belongs to the \(\ell _q\)-norm ball \({{\mathcal {D}}}^i_{k_0}\). \(\square\)

Therefore, (14) can be replaced by (15)–(19). Hence, since constraints (17) are SOC-representable, (\(\text {F}_{general}\)) is a mixed integer SOC-formulation when the neighborhoods are defined by a finite union of polyhedrons and \(\ell _q\)-norm balls, and the distances are also measured with a \(\ell _q\)-norm. We could even consider neighborhoods with different \(\ell _q\)-norms or distances between neighborhoods using simultaneously different \(\ell _q\)-norms, with \(q\in [1,\infty )\).

6 Procedure for generating an initial solution

In this section we describe a procedure to generate an initial solution for solving the MCbMP’s with neighborhoods.

This procedure starts by considering a fixed point in each neighborhood, \(v_i\in {{\mathcal {N}}}_i\). Now, \(V=\{v_1,\ldots ,v_n\}\). The distances \(\delta _{ij}=||v_i-v_j||_q\) between these points are calculated. Afterwards, we solve the standard version (without neighborhoods) of the MCbMP’s by considering these points:

$$\begin{aligned}&(\text {F}_{point})\min \sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}} \delta _{ij}-\sum _{{\mathop {i<j}\limits ^{(i,j)\in E}}} M x_{ij}\\&\quad \quad \quad s.t.\quad [MC]\\&\quad \quad \quad x_{ij} \in \{0,1\}, \quad \forall (i,j)\in E,i<j, \end{aligned}$$

where \(M:=\max _{{v_i,v_j\in V}}\{||v_i-v_j||_q\}+1\). Notice that in the case of the Max_MCbMP, this model include binary y-variables.

Let \(\bar{x}_v\) (and \(\bar{y}_v\) for (F2\(_{max}\))) the optimal solution of the above problem. This is a partial feasible solution of the general formulation with neighborhoods (F\(_{general}\)). We provide these values of the x-variables (y-variables) as feasible starting solution for the (F\(_{general}\)) model.

The goodness of the initial solution generated by the procedure will depend on the points chosen in each neighborhood. Figure 1 showed that the optimal matching of the problems with/without neighborhoods is not the same and depends on the choice of the points. This procedure is tested in the next section.

7 Computational study

A computational experiment was carried out to assess the usefulness of the given formulations for solving the proposed MCbMP’s with neighborhoods. Tests are performed on instances with n neighborhoods defined in \(\mathbb {R}^m\) (with \(m=2\) or 3). We consider two kind of neighborhoods: convex sets (\(\ell _2\)-norm unit balls and polyhedra) and non-convex sets defined as the union of three of these convex sets. We have considered the number of neighborhoods \(n\in [10,26]\), \(b\in [1,5]\) and the Euclidean norm to measure the distances. Graphs with different settings have been considered. The expected edge density of the graph (measured as \(\frac{2|E|}{n\cdot (n-1)}\), see Taşkin and Ekim [35]) takes values 0.4, 0.6, 0.8 and 1 (complete graph).

All the formulations were coded in Python 3.8, and solved using Gurobi 9.1.2. [23] in a Windows 10 Server with an Intel Xeon W-2245 processor at 3.9 GHz and 256 MB of RAM and setting by default all cuts and presolve strategies of the solver. A limit of one hour of CPU time was set in all the experiments.

The procedure described in Sect. 6 for getting an initial feasible solution is tested. The results obtained by using the solution procedure are indicated with Proc.

Fig. 7
figure 7

Percentage of instances solved within given time for all the formulations in a complete graph

7.1 Computational results with non-convex neighborhoods

First, different tests are performed on non-convex neighborhoods. These neighborhoods were generated by considering the union of three convex sets of the following:

  • In the case of the plane: \(\ell _2\)-norm disks with different radii randomly generated, and rectangles with sides parallel to the axis and lengths randomly generated.

  • In the 3D-space, \(\ell _2\)-norm balls with different radii randomly generated and polyhedra whose faces are rectangles randomly generated.

The neighborhoods were generated taking into account different factors such as size, overlapping, and spatial distribution among them. First, n random points in \([0, 100]^m\) are generated. Each point will belong to one of the neighborhoods and will be in at least one of the three sets of this neighborhood. The minimum distance among the randomly generated points is calculated (\(\ell\)), and a fixed percentage f (factor) of \(\ell\) is calculated. The diameters of \(\ell _2\)-norm balls and the sides of the rectangles will have a randomly generated length in \((0,f\cdot \ell )\).

Similar procedures to generate instances have been used in the literature of the combinatorial optimization problems with neighborhoods (see Blanco et al. [8], Gentilini et al. [20] among others).

A preliminary study with \(n=\{12,14,16,18,20\}\) and \(b=\{1,2,3,4,5\}\) for a complete graph in the plane was carried out. Five different instances were generated for each combination of n and b-values. Figure 7 displays the percentage of instances solved (within a given time) for the different formulations proposed here with the procedure (solid line) and without procedure (dashed line). As can be seen, this percentage increases when the solution procedure is considered for all the MCbMP’s studied. In the case of the P_MCbMP (blue line) this percentage increases up to \(20\%\). The hardest problem to be solved is M\(_{card}\)_MCbMP (brown and yellow lines) where less than \(10\%\) of instances were solved to optimality after 1 hour. We think it is due to the big-M parameter defined in the objective function. Moreover, the behaviour of (F2\(_{max}\)) and (F2\(^{ab}_{max}\)) are quite similar with both formulations.

In this figure does not appear formulation (F1\(_{max}\)) because provides worse computational results than (F2\(_{max}\)) for solving Max_MCbMP (see Fig. 8, which displays, in logarithmic scale, the average of the times for different values of n and b of both formulations).

Fig. 8
figure 8

Average time (logarithmic scale) for (F1\(_{max}\)) and (F2\(_{max}\))

As consequence of this first experiment, we decided focus our computational study on formulations solving the largest percentage of instances within the time limit. Since the behaviour of (F2\(_{max}\)) and (F2\(^{ab}_{max}\)) are quite similar, we concentrate on (F\(_P\)) and (F2\(_{max}\)) providing an initial solution. The CPU time to obtain an initial solution using the procedure in Sect. 6 is around 0.1–0.2 seconds on most instances.

Table 2 Average results for (F\(_P\)) in complete graphs

Table 2 summarizes the results for (F\(_P\)). We concentrated on complete graphs (density equal to one) due to the number of unfeasible problems obtained when graphs of other densities were used. The first two columns are the values of n and b, respectively. The column CPU reports the average computing time (in seconds) to attain optimality. Notice that, here, a CPU time equal to 1H has been attributed for the instances that could not be solved within this limit, therefore times are underestimated. Column \(\#\) gives the number of solved instances. Whenever the time limit of 1 hour is reached without certifying optimality, a gap between the lower and upper objective bound is calculated. Thus, if zu is the upper bound (the best solution found) and zl is the lower bound, then gap is defined as \(100\, |zu-zl|/|zu|\). When \(zu=0\) and \(zl\ne 0\), the gap is defined to be infinity. Column \(G_{BS}\) reports the average percentage gap of those instances where the gap is not infinity (a superscript indicates the number of these instances).

The first observation that comes after running the experiment is that the computational times increase with the size of n and b. Moreover, the number of unsolved instances increases with b.

Table 3 shows the results for (F2\(_{max}\)) with graphs of different densities. In all the experiments the valid inequalities (11) have been included (their inclusion provided better computational results in a preliminary study). As it can be seen, the computational times increase with the density of the graph. Solving instances in complete graphs is harder than solving instances in graphs with lower densities. This can be better appreciated in Figs. 9 and 10, which display the averages of the CPU times for different values of n and b, respectively, depending on the density of the graph. In addition, an extension of the experiment was carried out to evaluate up to what size of instances we could solve with (F2\(_{max}\)). Table 4 shows that even for lower densities, with \(n \ge 22\), and \(b \ge 3\), the instances are hard to solve. Moreover, they show the behaviour of (F2\(^{ab}_{max}\)) with \(a=1\) (we proved different values of a obtaining similar results).

Table 3 Average results for (F2\(_{max}\))
Table 4 Average results for (F2\(_{max}\)) with higher n
Fig. 9
figure 9

Average time by number of neighborhoods

Fig. 10
figure 10

Average time by size of b

Another computational study was still carried out to test three-dimensional instances with (F\(_P\)) and (F2\(_{max}\)) in complete graphs (see Table 5). We observe that three-dimensional instances are harder to solve than two-dimensional ones, given the same number of neighborhoods, n. See \(n=18\) and \(b=3\). the case of (F\(_P\)), the average time for solving 2D-instances was 845 seconds, whereas three of the 3D-instances could not be solved in one hour for the same size. For (F2\(_{max}\)), the average time of 2D-instances tested was 2067 seconds, whereas none of the five 3D-instances could be solved in one hour.

Table 5 Average results for (F\(_P\)) and (F2\(_{max}\)) in complete graphs with 3D-instances

We have noticed by testing different instances that overlapping does not influence the overall CPU time. Nevertheless, the size of the neighborhoods may influence the difference in CPU time. In order to illustrate the effect of the size of the neighborhoods, Fig. 11 shows the averaged time (logarithmic scale) for (F2\(_{max}\)) with \(n=12\) with different scale factors (0.5, 0.7 and 0.9). This confirms that instances with larger neighborhoods are harder to solve than instances with smaller ones.

Fig. 11
figure 11

Time average (logarithmic scale) for (F2\(_{max}\)) neighborhoods (n = 12) with different scale factors

7.2 Computational results with convex neighborhoods

A second study was carried out to compare the performance of (F\(_P\)) and (F2\(_{max}\)) with convex neighborhoods. We concentrate on the plane and consider two kind of instances: all the neighborhoods are \(\ell _2\)-norm disks or all are squares (see Blanco et al. [8], Blanco [6] for similar instances). First, n random points in \([0, 100]^m\) are generated. In the first set of instances, these points will be the centers for disks. In the second set of instances, they will be the centers of the squares. With the same randomly generated points, the two set of instances are obtained. The radius of the disks is 4 units, and the side length of the squares is 6 units. Five different set of points were generated for each combination of \(n=\{12,14,16,18,20,22,24,26\}\) and \(b=\{1,3,5\}\).

The average results with both set of instances are given in Table 6. The results show that solving instances with \(\ell _2\)-norm disks is much harder than with squares. See \(n=20\) and \(b=5\). (F\(_P\)) and (F2\(_{max}\)) did not solve to optimality any of the instances with disks in 1 hour. However, when the instances are squares, the time is 10.2 for (F\(_P\)) and 64.7 for (F2\(_{max}\)). This is due the fact that when neighborhoods are squares, the constraints are all linear.

Table 6 Average results for (F\(_P\)) and (F2\(_{max}\)) in complete graphs with disks vs. squares neighborhoods

8 Concluding remarks

This work can be considered as another step forward to address combinatorial optimization problems on graphs with neighborhoods instead of nodes. Different versions of the b-matching problem with minimum cost have been studied: the perfect matching problem, the maximum cardinality matching problem, the maximal matching problem and the ab-matching problem. The property of the standard matching problems (without neighborhoods) of being solvable in polynomial-time, is not guaranteed with neighborhoods. We have proved that, in general, all the versions of the b-matching with non-convex neighborhoods studied here are NP-hard, even for non-convex polygons.

Different non-linear integer programming formulations for the minimum cost b-matching problems with all the versions presented in this paper have been developed and then reformulated as mixed integer SOC formulations. We have performed a series of computational experiments in order to compare the performance of the given formulations, as well as to explore the limitations of each one of them. For this, we have generated several batteries of instances with different settings. The extensive computational experience shows the usefulness of the formulations to solve the proposed problems. We have developed an initial solution procedure that allows to reduce the computational times and solve to optimality some initially unsolved instances.

The findings of this paper can be the basis of further research on some other combinatorial optimization problems with neighborhoods. It would be interesting to explore alternative algorithms for solving the MCbMP’s, as Benders decomposition methods or good matheuristics to be able to solve larger instances.