






Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!







Jos´e Carlos Almeida Jr., Felipe de C. Pereira, Marina V. A. Reis, and Breno Piva ⋆
Universidade Federal de Sergipe, Departamento de Computa¸c˜ao, Av. Marechal Rondon, s/n, Jd. Rosa Elze, 49100-000, S˜ao Crist´ov˜ao, Sergipe, Brasil. {fcpereira,marinavar,brenopiva}@dcomp.ufs.br
Abstract. The Next Release Problem (nrp) is an important problem in Software Engineering. Several papers investigate the nrp, most of them considering heuristics to solve the problem. However, the literature lacks a more theoretical approach to this problem, specially regarding its complexity, approximability and more powerful exact algorithms. In this paper we aim to help filling this gap.
Keywords: Strong NP-Hardness; FPTAS; Integer Programming; Branch-and- Cut; Search Based Software Engineering
Search-Based Software Engineering (sbse) is concerned with solving optimiza- tion problems in Software Engineering (se), or treating se problems as search problems [6]. Through the software development cycle, several problems can be formulated as search problems. From requirements to testing and all the way through releasing, there are problems that can be thought of as search/opti- mization problems. The Next Release Problem (nrp) was first formalized by Bagnall et al. in [1] as a description of a company’s next release plan considering its involvement in the development and maintenance of large, complex systems to a set of clients that have different needs and different values for the company. The input of nrp can be formalized as been composed by a set R of require- ments, a set of clients C, a budget B ∈ Z+^ and a directed graph D = (R ∪ C, A) indicating the association between requirements and between requirements and clients. The set of arcs in D is A ⊆ R × (R ∪ C). There are also two func- tions ω : R → Z+^ and δ : C → Z+^ indicating, respectively, the cost of each requirement and the value of each client. In a valid input of nrp, D is an acyclic and transitive graph, meaning that if there is a path from vertex a to vertex b, there is no path from b to a. Also, if there is a path from a to b, there is also an arc (a, b) ∈ A. Fig. 1 illustrates an nrp instance. ⋆ (^) The authors would like to thank PIBIC/UFS for the support.
r 1
r 4
r 2 r 3
r 5
r 6 r 7
c 1 c 2 c 3
Fig. 1. An nrp instance with 3 clients and 7 requirements. The transitive edges are omitted for clarity reasons.
A solution of nrp is given by a set R′^ ⊆ R to be implemented and a set C′^ ⊆ C of clients that are satisfied by R′. The cost of the solution is given by the sum of the costs of the requirements in R′, i.e.,
r∈R′^ ω(r). Meanwhile, the value of the solution is the sum of the values of the clients in C′, i.e.,
c∈C′^ δ(c). For a solution to be valid it must have cost at most B (the budget), if a requirement r is implemented, all of its prerequisites, i.e., all the requirements s for which (s, r) ∈ A, must also be implemented. At last, a client c can only be considered satisfied if all of its requirements, i.e., all the requirements r for which (r, c) ∈ A, are implemented. The objective of nrp is to find a solution that satisfies the properties above and have a maximum value. This description can be formalized using the follow- ing integer linear program (ip) formulation due to Bagnall et al. [1]:
(nrp) z = max
∑
c∈C
δ(c)yc (1)
subject to
∑
r∈R
ω(r)xr ≤ B (2)
xr′^ ≤ xr ∀ (r, r′) ∈ A (3) yc ≤ xr ∀ (r, c) ∈ A (4) xr , yc ∈ { 0 , 1 }; r ∈ R, c ∈ C (5)
in this model variables xr indicate whether a requirement is implemented or not, meanwhile, yc indicate if a client is satisfied. Inequality (2) guarantees that the cost of the solution is not greater than the budget. The constraints described by (3) and (4) enforce that the proper requirements are implemented. There are different versions of the problem in the literature, for instance, [2] considers a version of the nrp that is equivalent to a knapsack problem. In [14] the authors propose a bi-objective version of the problem where the goal is to maximize the solution value and minimize its cost, however, in their
In [1], Bagnall et al. showed that the nrp is N P-hard. The proof is based on the fact that nrp generalizes the well-known 0-1 knapsack problem and, therefore, there is an obvious reduction from this problem to the nrp. That is, for each item in the knapsack instance we create a pair of client and requirement for that item where the requirement has the same cost as the item and the client has the same value as the item. The budged of the nrp instance is the capacity of the knapsack instance. The 0-1 knapsack problem is a weakly N P-hard problem [10], thus hav- ing pseudo-polynomial algorithms and also fully polynomial time approximation schemes (fptas) [10]. However, no similar results are known for nrp. In this section we show that nrp is strongly N P-hard and for this reason it cannot have a fptas. According to the definition of strong N P-hardness, a problem is strongly N P-hard if there is no pseudo-polynomial time algorithm to solve it unless P = N P, i.e., an algorithm that have a polynomial time complexity if the problem have a unary encoding. Therefore, in order to show that nrp is strongly N P- hard we show that a pseudo-polynomial algorithm for this problem cannot exist unless P = N P. This is done through a reduction from the k-clique problem. In the k-clique problem we are given a simple graph G and a number k and we must decide whether there is a clique of size k in G. Since a clique is a complete subgraph and G is simple, a clique with k vertices must have k(k − 1)/2 edges. The idea of the reduction is to construct an instance I of nrp such that if there is a solution of value k(k − 1)/2 for I, then there is a clique with k vertices in G.
Proposition 1. The nrp is strongly N P-hard.
Proof. Let G = (V, E) be a simple graph and k an integer. Thus, G and k form an instance of the k-Clique problem. Now, let us use G and k to construct an instance I for nrp. For each vertex v in V we create a requirement rv in I with cost 1 and for each edge uv in E we create a client cuv in I with value 1. For each client cuv in I we associate the requirements ru and rv. Finally, we define the budget of I as k. We must observe that an optimal solution for I provides a solution to the existence of a clique with size k in G. There are two cases to consider, the first is when the answer for the k-clique instance is positive, i.e., there is a clique of size k in G and the other is when the maximum clique in G is smaller than k. If there is a clique of size k in G then, there are k(k − 1)/2 edges connecting these k vertices in G. There are also k requirements in I corresponding to the vertices and k(k − 1)/2 clients corresponding to the edges in the clique. Since each client is associated with the two requirements related to the endpoints of its corresponding edge, it is clear that a solution that implements the k requirements related to the k vertices of the clique, which is possible since each requirement has cost 1 and the budget is k, will satisfy the k(k − 1)/2 clients corresponding to the edges of the clique and since every client has value 1, k(k − 1)/2 will also
be the value of the solution. Notice that since the budget is k and each client has a unique pair of requirements, it is impossible to have a better solution. If, on the other hand, there is no clique of size k in G, that means that every subgraph containing k vertices have less than k(k−1)/2 edges. Suppose there is a solution for I with value k(k−1)/2. Since every client has value 1, there are k(k− 1)/2 clients satisfied and since each client has a unique pair of requirements, there are at least k requirements implemented. Considering the budget is k and each requirement costs 1, there must be exactly k requirements implemented. Now, we know by the construction of I that each of the k requirements corresponds to a vertex in G and each of the clients corresponds to an edge connecting a pair of these k vertices, therefore, there must be a subgraph in G with k vertices and k(k − 1)/2 edges, a contradiction. From the two cases described it is possible to conclude that G has a clique of size k if and only if I has a solution of value k(k − 1)/2. That is, the construction of I describes a reduction from k-clique to nrp. It is trivial to notice that the size of I is polynomial in the size of G and k and the construction of I can be done in a time that is also polynomial in the size of G and k. Hence, we have a polynomial time reduction. Now, suppose there is a pseudo-polynomial algorithm for nrp. In the con- struction described above, the only numerical data in I are the values of the clients and costs of requirements, all of them equal to 1, therefore, an encoding of I in unary have a size that is polynomial in the size of a binary encoding so, a pseudo-polynomial algorithm for nrp solves I in polynomial time and by con- sequence, also the k-clique problem. Hence, such algorithm cannot exist unless P = N P. ⊓⊔
Corollary 1. The nrp does not admit an fptas, unless P = N P.
Proof. Let V be the greatest value among all the clients’ values. Let U be the number of clients multiplied by V plus 1, i.e., U = |C|V + 1. It is clear that the value of any solution is strictly bounded by U , in particular, if OP T is the value of the optimal solution, OP T < U. Now, suppose there is an fptas for the nrp, then we could run the fptas with ǫ = (^) U^1 and the obtained solution would be at most (1 + ǫ)OP T = OP T + ǫOP T < OP T + ǫU = OP T + 1. So, our fptas would return an optimal solution. Since the fptas is polynomial in U , it is a pseudo-polynomial time algorithm for nrp. But from Proposition 1 that is impossible unless P = N P. ⊓⊔
Considering that the nrp is N P-hard, the most common approach to find solu- tions for this problem has been through the use of heuristics. This is reasonable since every known exact algorithm for the problem have exponential time com- plexity. Moreover, the problem is of practical importance and, thus, solutions for real instances must be found despite its hardness.
Let E(H) be an extended cover for nrp. Let χ(C′) denote an ordering of a set of clients C′^ according to some criterion. And denote by χ(C′)[0] the index of the first client in this ordering. Now, let F (c, H′) = {i ∈ { 1 , ..., |R|} \ H′|(ri, c) ∈ A} denote the set of requirements whose indexes are not in H′^ that are prereq- uisites of client c. Finally, a client cover over sets H′^ of requirements indexes and C′^ of clients can be defined as follows: CC(H′, C′) = χ(C′)[0] ∪ CC(H′^ ∪ F (χ(C′)[0], H′), C′^ \ {χ(C′)[0]}) if
j∈F (c,H′) ω(rj^ )^ ≥^ ω(ri) for all^ i^ ∈^ E(H) or CC(H′, C′) = CC(H′, C′^ \ {χ(C′)[0]}) otherwise, moreover, CC(H′, ∅) = ∅. With these definitions we can now define the extended client cover inequalities as
i∈E(H) xri^ +^
j∈CC(E(H),C) ycj^ ≤ |H| −^ 1.
Separation Heuristic Procedure. In order to use the extended client cover in- equalities in a b&c algorithm we must first define a way of finding an inequality of this family to incorporate to the model. This can be achieved through a sep- aration routine. The goal of a separation routine is given a point p and a set of valid solutions P (a polyhedron), find an inequality that is valid for P but not satisfied by p. Therefore, if we have a solution of the linear relaxation s of nrp, we could use a separation routine to find an inequality that is valid for the set of valid solutions of nrp but not for s, thus obligating the solution of the linear relaxation of the model with the new inequality to be closer to a valid solution for nrp than the previous solution. Next we describe a routine that heuristically tries to find a separating ex- tended client cover inequality for the current linear relaxation solution. In that description we consider the relative weight ur of requirement r in a solution S for the linear relaxation as been the cost of the requirement (ω(r)) multiplied by the value of the corresponding variable xr , i.e., ur = ω(r)xr.
Separation Routine
In this section we describe the experiments performed to determine the effec- tiveness of the proposed b&c algorithm. To do so we compare a b&b algorithm constructed using the formulation from [1] against the b&c algorithm described in Section 3. In order to make a fair comparison both algorithms were imple- mented and executed using the same computational environment and restricted to 1 hour (3,600 seconds) of computation.
Computational environment. All the experiments were performed using an In- tel(R) Core(TM) i3-4005U CPU @ 1.70GHz with 4GB of RAM memory. The programming language used was C/C++ and we used GUROBI-C++ API v6.5. ip solver. All the cuts, heuristics and preprocessing were turned off to avoid confusing variables in the analysis.
Instances. Three sets of instances were used in the experiments: the two sets from [12], Classic Instances and Realistic Instances, and a new set constructed based on the set of Classic Instances but with all the parameters multiplied by some factor. This set is called Big Instances. There are five Classic Instance groups called nrp-1 to nrp-5. Each of these instances was generate following the rules in Table 1. In that table the symbol “/” indicates a separation between levels, therefore, according to the first line, nrp-1, for example, has three levels with 20, 40 and 80 requirements, respectively at the first, second and third levels. The second line of the table indicate the range of the costs of each requirement at each level. The meaning of the remaining lines can be inferred from its description column. All the details missing are fulfilled randomly. To obtain an instance of nrp we still need a budget so, for each instance group three budget values are generated corresponding to 30% of the sum of all the requirements costs, 50% and 70%. These same budget ratios were used in all instance sets.
Table 1. Generation rules for Classic Instances.
Instance Group nrp-1 nrp-2 nrp-3 nrp-4 nrp-
Cost of req. 1-5/2-8/5-10 1-5/2-7/3-9/4-10/5-15 1-5/2-8/5-10 1-5/2-7/3-9/4-10/5-15 1-3/2/3-
Value of client 10-50 10-50 10-50 10-50 10-
The Big Instances set can be divided into two sets, the x1.6 set and the x2. set. For each of them, the name of the set indicate the multiplication factor used
solved to optimality by each algorithm within the given time limit, and we can compare the times necessary to solve the instances. For the Realistic Instances both algorithms solved all the instances to optimality within the time limit. The same is true for the Classic Instances. For the Big Instances of set x1.6, the b&b algorithm was able to solve all the instances while b&c was unable to solve one of the instances (nrpx1.6-2-0.5). Regarding set x2.2, both algorithms were unable to solve 5 out of 15 instances. It is noteworthy that the unsolved instances are the same for both algorithms. In order to compare the times we calculate the ratio between the time spent by b&c over the time spent by b&b. Therefore, if this ratio is bigger than 1, it means that the b&c was slower while a ratio between 0 and 1 means it was faster. After calculating the ratio for each instance we calculated the geometric mean. Since we are dealing with ratios, this kind of mean have the nice property that the inverse of the mean is equal to the mean of the inverses, therefore, our results are not affected by the choice of numerator and denominator. We calculate the mean for each set of instances and also, the mean considering only the instances solved to optimality by both algorithms. Table 4 summarize these results. Notice from Table 4 that on average, the b&c algorithm is slower than b&b for the Classic Instances and the Realistic Instances but is faster for the Big Instances. One possible explanation for this is that the instances in the first two sets are too easy, therefore, the time spent by the separation routine is not compensated. Meanwhile, the sets of Big Instances are hard enough for making the use of cuts worth.
Table 4. Geometric Means of the ratio time(b&c)/time(b&b) considering all the in- stances of each group and only the instances solved to optimality by both algorithms.
Instance set Classic Realistic Big x1.6 Big x2. GMean 1.248 1.741 0.943 0. GMeanOpt 1.248 1.741 0.885 0.
nrp is strongly N P-hard and does not admit an fptas, however, it is still not clear whether there is a ptas or if there is a limit on its approximability. Despite having exponential time complexities, ip based algorithms have shown their usefulness. Furthermore, the b&c algorithm suggests that there is still room for improvement, since this algorithm was able to solve bigger instances quicker than a simple b&b algorithm. A first step to better understanding these algo- rithms would be to perform a polyhedral study and determine the strength of the known valid inequalities.