Keywords

1 Introduction

The Bin Packing Problem with Conflicts (BPPC), first introduced in a scheduling context in [14], is defined as follows: given a graph G = (V, E), a nonnegative integer weight w i for each vertex i ∈ V , and a nonnegative integer B, find a partition of V  into k subsets V 1, …, V k, such that the sum of the weights of the vertices assigned to same subset is less than or equal to B, two vertices connected by an edge do not belong to the same subset, and k is minimum.

The minimum value of k will be denoted k BPPC. The graph G = (V, E) is called conflict graph and two vertices connected by an edge are said to be in conflict.

BPPC generalizes two well known combinatorial optimization problems, the Bin Packing Problem and the Vertex Coloring Problem. In fact, BPPC reduces to Bin Packing when the edge set E of the graph G is empty, and it reduces to Vertex Coloring when B ≥∑iV w i or when G is complete. Observe that Vertex Coloring is solvable in linear time on threshold graphs, nevertheless BPPC with a threshold conflict graph is NP-hard because Bin Packing is [10].

In this paper we show that a popular random graph generator [11], widely used in the context of the Bin Packing Problem with Conflicts, generates threshold graphs. Threshold graphs are very special interval graphs, contradicting the authors [11] who claim that “No assumptions are made on the adjacency structure of the graph”, and strengthening [28] where the authors recognise the graphs as being arbitrary interval graphs [28].

In Sect. 2 we recall the definition of threshold graphs and discuss some of their peculiar properties, in Sect. 3 we present the generator defined in [11] showing that it produces threshold graphs, in Sect. 4 we analyse the effects of using this generator on instances of Bin Packing Problem with Conflicts. Concluding remarks are discussed in Sect. 5.

2 Threshold Graphs

A graph G = (V, E) is a threshold graph if there exist a real number d (the threshold) and a weight p x for every vertex x ∈ V  such that (i, j) is an edge iff (p i + p j)∕2 ≤ d (see [12]). W.l.o.g. from now on we assume that p x ∈ [0, 1] ∀x (as a consequence it makes sense to choose d ∈ [0, 1]).

According to this definition it follows that a vertex i is connected to all the vertices j such that p j ≤ 2d − p i. Let N(x) denote the set of vertices adjacent to x and let deg(x) = |N(x)|. Then N(h) ⊇ N(k) and deg(h) ≥deg(k) if and only if p h ≤ p k.

A threshold graph has many peculiar properties as it is at the same time an interval graph, a co-interval graph, a cograph, a split graph, and a permutation graph. In addition, its complement, where (i, j) is an edge iff (p i + p j)∕2 > d, is a threshold graph too.

W.l.o.g. from now on we assume that the vertices of a threshold graph G are numbered in such a way that i < j if and only if deg(i) ≥deg(j). Then the n × n symmetric adjacency matrix M = [m i,j] of G always appears as in Fig. 1, where an entry 0 is coloured in white and an entry 1 is highlighted in grey, and m i,i = 0 for i = 1, …, n.

Fig. 1
figure 1

Examples of adjacency matrices of threshold graphs with n = 60 nodes and threshold (a) d = 0.2, (b) d = 0.5, and (c) d = 0.7

By what above, we observe what follows.

  1. 1.

    For each row i, let \(last\_col(i) = \max \{j : m_{i,j} = 1, j=1,\dots,n\}\) if m i,1 = 1, and last_col(i) = 0 if m i,1 = 0 (see Fig. 1b); hence last_col(i) ≥ last_col(i + 1).

  2. 2.

    Let \(t = \min \{j : m_{j,j+1} = 0, j=1,\dots,n\}\). Then the set of vertices {1, …, t} induces a maximum clique of size ω(G) = t (see Fig. 1a). In fact, by definition, m t−1,t = 1, thus last_col(t − 1) ≥ t and, by Point 1, m i,j = 1 for i = 1, …, t and j = 1, …, t, ij.

  3. 3.

    The set of vertices {t, …, n} induces a maximum independent set of size n − t + 1. In fact, by definition, m t,t+1 = 0 and m t,t−1 = 1 (as m t−1,t = 1) thus last_col(t) = t − 1 and m i,j = 0 for i = t, …, n and j = t, …, n (see Point 1.).

  4. 4.

    Let g = last_col(n) (see Fig. 1c). If g ≥ 1, vertex i, for i = 1, …, g, is connected to any other vertex.

  5. 5.

    Recalling that a threshold graph G is a particular interval graph, it is always possible to derive a family of (open) intervals whose intersection graph is G, namely: to each vertex j = t, …, n, associate the interval I j = (l j, r j) = (j − t, j − t + 1); to each vertex j = 1, …, t − 1, associate the interval \(I_j=(l_j,r_j)=(0,r_{last\_col(j)})=(0,last\_col(j)-t+1)\) (we remark that r j ≥ 1 as last_col(j) ≥ t}). See an example in Fig. 2.

    Fig. 2
    figure 2

    (a) The adjacency matrix of threshold graph with n = 20 nodes and (b) the corresponding opened interval model

  6. 6.

    The edge density δ = 2|E|∕(n(n − 1)) of G is not equal to the threshold d, generally speaking.

For n → and p 1, …, p n uniformly distributed in [0, 1], one has:

  1. 7.

    ω(G) = t = nd.

  2. 8.

    The edge density δ = 2|E|∕(n(n − 1)) of G depends on d. Precisely

    $$\displaystyle \begin{aligned}\delta = f(d) = \left \{ \begin{array}{ll} \frac{2(nd)^2 - nd}{n(n-1)} & \mbox{for } d \le 0.5 \\ \; \\ \frac{n(n-1) - 2n^2(1-d)^2 - n(1-d)}{n(n-1)} & \mbox{for } d \ge 0.5 \end{array} \right. \end{aligned}$$

    In fact, for d ≤ 0.5 the 2|E| 1’s are in the area A ∪ B ∪ C (see Fig. 3a). In a similar way one can compute the number of 1’s in the matrix when d ≥ 0.5.

    Fig. 3
    figure 3

    The expected adjacency matrix when n → and with threshold (a) d ≤ 0.5 and (b) d ≥ 0.5

  3. 9.

    g = 0 when d ≤ 0.5, and g = n(2d − 1) when d ≥ 0.5 (see Fig. 3b).

According to Points 2 and 3 above, when d ≥ 0.5, in any optimal solution of BPPC one has V i = {i} for i = 1, …, g. The remaining sets V i for i ≥ g + 1 can be determined by solving a smaller instance Q defined on the last n − g vertices (observe that the problem becomes simpler and simpler as d increases). The conflict graph of Q is a threshold graph with expected edge density 0.5, thus it contains a maximum clique of expected size (n − g)∕2. According to Point 7, when n = 120 and d = 0.9, a lower bound for k BPPC is nd = 108 (indeed this value appears in Table 2, column LBO, Size 120, d = 90 in [9]).

3 On the Random Graph Generator Proposed in [11]

In [11] the following random graph generator is described: “A value p i was first assigned to each vertex i ∈ Vaccording to a continuous uniform distribution on [0, 1]. Each edge (i, j) of G was created whenever (p i + p j)∕2 ≤ d, where d is the expected density of G.”.

This generator clearly produces a threshold graph whose expected edge density is not d as claimed but it is the one discussed in Points 6 and 8 of Sect. 2.

To get a threshold graph with expected edge density δ one has to set

$$\displaystyle \begin{aligned}d = \left \{ \begin{array}{ll} \frac{1 + \sqrt{1 + 8 n (n - 1) \delta}}{4n} &\quad \mbox{for } \delta \le 0.5 \\ \; \\ 1 + \frac{1 - \sqrt{1 + 8 n (n - 1) (1 -\delta)}}{4n} &\quad \mbox{for } \delta \ge 0.5 \end{array} \right. \end{aligned}$$

Already for n ≥ 100 these values can be approximated to \(d = \sqrt {\delta / 2}\) and \(d = 1 - \sqrt {(1 - \delta ) / 2}\), respectively.

The generator in [11] has been improperly used to generate arbitrary graphs [3,4,5,6,7,8,9, 13, 15,16,17,18,19,20,21,22,23,24,25,26,27,28, 30, 31]. In particular, the authors in [26] made publicly available “benchmark” instances generated in this way (see http://or.dei.unibo.it/library/bin-packing-problem-conflicts) and used by many authors [4,5,6,7,8,9, 13, 15,16,17, 19,20,21, 25, 27, 28, 30, 31].

Most of the authors using the generator in [11] claim that they group the graphs of their test bed by edge densities, but actually they group the graphs by threshold values. Our analysis of the instances introduced in [26] shows that the relation between the threshold d and the corresponding edge density δ is the following.

d

0.00

0.10

0.20

0.30

0.40

0.50

0.60

0.70

0.80

0.90

δ

0.00

0.02

0.08

0.18

0.32

0.50

0.68

0.82

0.92

0.98

We remark that the values of δ coincide with those which can be computed by the formula of Point 8 in Sect. 2.

4 Computational Results on Different Graph Classes

Since threshold graphs are a subclass of interval graphs, which are in their turn a subclass of arbitrary graphs, we expect that BPPC on threshold graphs is the easiest to solve. To prove our claim we conducted some computational experiments.

By X(n, δ) we denote a set of ten instances with n vertices, bound B = 150, and conflict graph X with expected edge density δ ∈{0.02, 0.08, 0.18, 0.32, 0.50, 0.68, 0.82, 0.92, 0.98} (the same densities of the instances used in [26]). In particular, we choose n ∈{250, 1000} and X ∈{T, I, A}, where X = T (I, A, respectively) when the conflict graph is a threshold (interval, arbitrary, respectively) graph.

The T(250, δ) and T(1000, δ) instances are exactly those in the classes 2 and 4 described in [26], respectively. Precisely, given n, the weight of the i-th vertex of the k-th instance of T(n, δ) is the same for all δ.

As for the I(n, δ), the weight of the i-th vertex of the k-th instance coincides with the weight of the i-th vertex of the k-th instance of T(n, δ), and the arbitrary interval conflict graphs have been generated according to the interval graph generator in [2].Footnote 1

Table 1 Computational results on instances with threshold (T), interval (I)1, and arbitrary (A) conflict graphs

As for the A(n, δ), the weight of the i-th vertex of the k-th instance coincides with the weight of the i-th vertex of the k-th instance of T(n, δ), and the arbitrary conflict graphs have been generated as in [28]: “We began with the empty graph. We iteratively selected an item pair (i, j) at random (with uniform distribution); then edge (i, j) was added to the graph if it was not already defined. The procedure was interrupted as soon as the desired graph density was reached.”.

We solved to optimality the T(n, δ), I(n, δ), and A(n, δ) instances for all n and δ by means of the Vector Packing Solver 3.1.2 (VPS for short) defined in [4], available at http://vpsolver.dcc.fc.up.pt/. This method is based on an arc-flow formulation with side constraints and builds very strong integer programming models that can be given in input to any state-of-the-art mixed integer programming solver. Actually, the arc-flow formulation is derived from a suitable graph which is preliminarily generated and whose size increases rapidly with B. We remark that the algorithm is applied to many classical combinatorial problems: in particular, it is one of the best behaving exact approaches for the instances introduced in [26], which are all solved to optimality within 50 min and with an average runtime of 2 min. For our analysis we solved the integer programming model with Cplex 12.6 on an Intel Core i7-3632QM 2.20 GHz with 16 GB RAM under a Linux operating system, setting a time limit of 600 s for each instance. The instances used in this section and many others can be downloaded at [1].

The computational results are summarized in Table 1, where rows are indexed by δ, and columns by the type of the conflict graph. In the “Opt” columns we report the number of instances, out of ten, solved to optimality within the time limit, and in the “Time” columns the time in seconds required to solve one instance, averaged over the solved instances, only.

The results in the table show that threshold instances T are easier w.r.t. instances with interval conflict graphs, and these latter are easier than those with arbitrary conflict graphs, confirming our claim.

We remark that, as far as we know, no tests on instances of BPPC with arbitrary interval conflict graphs were performed in the literature. The authors in [28] observe that the conflict graphs of the benchmark instances in [26] are interval graphs and not arbitrary graphs (actually they are not arbitrary interval ones). Nevertheless, to our knowledge, the authors in [28] are the only ones who test their algorithm on instances with arbitrary conflict graphs.

5 Concluding Remarks

In this paper we show that graphs of the BPPC instances considered in [3,4,5,6,7,8,9, 13, 15,16,17,18,19,20,21,22,23,24,25,26,27,28, 30, 31] and generated according to [11] are threshold graphs (and not arbitrary ones), and their edge density is not the declared one.

We also show that BPPC instances with threshold conflict graphs are computationally easier to solve than instances with interval or arbitrary conflict graphs (the instances used and many others are available at [1]). This behaviour confirms the behaviour of the computational complexity of many classical combinatorial problems on the three graph classes considered.

We believe that the reduced difficulty of these instances is mainly due to the structure of the conflict graph and not to “the presence of capacity constraints on the cardinality of the color classes” as suggested in [8]. This could be ascertained by solving BPPC instances with arbitrary interval conflict graphs and with arbitrary conflict graphs.

We also remark that the authors in [11] claim to use “the procedure described in” [29], but this is not true. In fact, the procedure in [29] generates “edge (i, j) with probability” (p i + p j)∕2: by doing so it generalizes the uniform random graph generator and outputs arbitrary graphs.