Sie sind auf Seite 1von 7

GLPK Implementation for Minimum Bounded Degree Spanning Tree

Alessandro Baroni, Paolo Bozzelli, Giuseppe Cascavilla July 26, 2011

Introduction

This work provides an implementation of Minimum Bounded Degree Spanning Tree (MBDST, hereafter) problem. This problem is described in detail by Goemans in [Goe06]. MBDST is dened as follows: given an undirected graph G = (V, E) where V is the vertexes set and E is the edges set a cost function c : E R and an integer k 2, nd a spanning tree of maximum degree at most k and of minimum cost. We followed the Goemans approach [Goe06], giving a formulation of the problem as follows. min e ce x e s.t. x(E(S)) |S| 1 S V x(E(V )) |V | 1 x((v)) k vV xe 0. eE (1) (2) (3) (4)

routines for time and resource analysis. In section 2, we describe the two proposed solutions to the problem: a branch-and-boundbased approach and a solution based on an exhaustive formulation of MBDST problem. In section 3, we discuss about the structure of our project, describing involved les and libraries, the usage of executables, and output les. In section 4, we analyse the computation of results in terms of time and memory usage, with respect to selected node amount ranges and selected solution method. In section 5, we state our conclusions.

Proposed methods

MBDST problem dened in [Goe06] leads to a non-polinomial number of constraints: x(E(S)) |S| 1, S V First, second and fourth constraints are about means that the formulation contains conthe spanning tree polytope [Edm71], whereas straints for all the possible subgraphs of G; the the third constraint is about the bound on the cardinality of this subset is exponential as |V | nodes degree, where (v) are the incident edges increases in terms of edges involved, with reon vertex v V . We worked on the implemen- spect to the number of nodes of each subset. tation of this problem using GLPK routines. For this reason, our work focused on two dierGLPK (GNU Linear Programming Kit) [FSF] ent solution methods: package is intended for solving large-scale lin exhaustive formulaton method, concernear programming (LP), mixed integer programing the complete formulation with all the ming (MIP), and other related problems. It is subgraphs constraints; a set of routines written in ANSI C and organized in the form of a callable library. We branch-and-bound -based method, conused a function subset of this library dedicated cerning the formulation without the subto linear programming problem and graphs cregraphs constraints (BBC formulation 1 , ation and manipulation. In addition, we used hereafter), the automatic improvement of
1 BBC

is from Baroni-Bozzelli-Cascavilla, authors of this work.

STRUCTURE

that formulation with constraints generated by the separation oracle and the consequent resolution of the problem with branch-and-bound technique. Exhaustive formulation method provides the complete MBDST formulation: rst our software generates a random graph instance and related formulation without subgraphs constraints; then, it takes as input the generated graph and the generated linear programming formulation, generates all the possible constraints from all the possible subgraphs from the original graph, solves the problem and shows the solution in terms of objective function value and x 0 1 vector. Note that the cardinality of the subsets equals to:

Structure

In this section, we explain the structure of our implementation in terms of executable les and libraries, usage and output le.

3.1

Files and libraries

The following description is splitted in three parts: executable les, data les, and linear programming formulation les. 3.1.1 Executable les

mbdst-formulation.out This executable le allows the user to get a rst solution of the incomplete formulation (without subgraphs constraints). It creates a random input specication as a undirected connected graph, with respect to an user-dened range of minimum n n n + + ... + and maximum number of vertexes, and an user2 3 k dened range of minimum and maximum edges weight. In addition, it needs for a k value, for 2 k n. It is evident that, as n grows, given by command line. Once it created the the number of possible constraints in the for- graph, it creates the problem in according to mulation increases exponentially. Despite the the generated graph: rst, it adds the spanning exponential number of constraints, this formu- tree constraint; then, it adds all the bounded lation returns the optimal integer solution. degree constraints; the (4) MBDST formulaBranch-and-bound-based solution method ini- tion constraint is automatically created when tially provides an BBC formulation, an incom- it creates the variables of the problem. Once plete formulation that is made up of constraints the formulation is created, it nds a solution by (1), (2) and (4). Our software solves the cur- means of simplex method (glp simplex funcrent problem: since the minimum spanning tree tion). solution contains cycles, it is an admissible solution for the current problem because it contains separazione.out This executable le alno suitable constraints to avoid cycle presence. lows the user to improve the BBC formulation In order to remove cycles - and then to provide by means of generation of subtour elimination a correct solution that satises the denition of constraints. These constraints are generated tree -, our software solves the separation prob- solving separation problem for each vertex of lem starting from the current solution; it adds the graph. For this reason, it generates n sepsubtour elimination constraints to the original aration problem formulations, for n = |V |. formulation, with respect to separation oracle Let wij = zi zj , the separation problem is the violated constraints. It solves the original for- following: mulation again, until it is impossible to add new subtour elimination constraints. If the - max ijE xij jV zj nal x vector solution does not contain fractional s.t. wij zi 0 (1) values, it means that the solver found the optiwij zj 0 ij E (2) mal integer solution; if the nal x vector soluwij zi zj 1 (3) tion contains fractional values, the branch-andzk = 1 eE (4) bound technique is used: z {0, 1}|V | w {0, 1}|E| (5)

3.1

Files and libraries

<max n> the maximum number of vertex that the graph can have; <min w> the minimum edges weight of the graph; <max w> the maximum edges weight of the This implies that the constraints is always sat- graph; <k> the bounded degree value. ised because min{zi , zj } > zi + zj 1 Deleting these constraints from the formulation, we can state that coecients matrix is totally unimodular. For this reason, integrity constraint (5) can be removed from the formulation. separazione.out works on this reduced version of the formulation. solver.out This executable le checks whether there are violated constraints in separation problems or not. If there is no violated constraints, it checks for fractionary variables. If there is no fractionary variables, it found the optimal integer solution. This is the best case for our implementation. If violated constraints exist, it adds them to the initial BBC formulation, it solves again the problem with new constraints and automatically calls separazione.out in order to check for new violated constraints. When there arent any new violated constraints, it checks for fractionary variables: if any, it executes the branch-and-bound algorithm. This is the worst case for our implementation. Obviously, if there are no fractionary variables, it found the optimal integer solution. bnb.out This executable le executes the branch-and-bound algorithm [Cla97] on the current problem formulation. 3.1.2 Usage Branch-and-bound-based method The rst iteration is the following: $ ./mbdst-formulation.out <min n> <max n> <min w> <max w> <k> $ ./separazione.out $ ./solver.out $ ./bnb.out If theres an integer solution without cycles and not connected vertex, the optimal solution is found. Otherwise, you need to solve separation problem to add violated constraints (subtour elimination constraints). Then, the formulation has a number of subtour elimination constraints. Solve again the problem with this improved formulation. The last execution solves the problem and show the current solution. If the solution does not contain fractionary variables, it found the optimal integer solution; otherwise, branch-and-bound execution need to be done. In this step, it automatically recalls mbdst-formulation.out, solver.out, and separazione.out on each subinstance of the problem. 3.1.3 Output les

Note that the (3) constraints are not included in our separation problem formulation because wij coecients are non-negative, that means that wij = min{zi , zj }

In this section, we explain which output les are generated and what they bring. generated graph.txt This le contains the input specication as a graph. We have been inspired by the DIMACS format used by GLPK, providing and extended format with edge weight and the objective function value. 4 1 1 2 3 5 2 3 3 4 3.000000 34.000000 32.000000 19.000000 30.000000

Exhaustive formulation method $ ./mbdst-formulation.out <min n> <max n> <min w> <max w> <k> $ ./mbdst-formulation-ex.out <min n> the minimum number of vertex that the graph can have;

3.1

Files and libraries

separazione*.lp These les containt sepThe rst line indicates the number of vertexes aration problems formulation. Note that these in the graph, the number of edges in the graph les have to be removed after an iteration, typand the value of the objective function. Note ing $ rm separazione*.lp. that this value is set only after a problem solv- Note that for the branch-and-bound-based ing procedure. The other lines indicate edge method, each of these les is located in a subfolder that indicates the problem that the tail, edge head and edge weight. branch-and-bound is currently resolving. 1 4 29.000000 mbdst-formulation.lp This le contains the BBC formulation, generated by mbdst-formulation.out. 3.1.4 mbdst-formulation-ex.lp This le contains the exhaustive formulation, generated by mbdst-formulation-ex.out. It contains all the constraints from the Goemans formulation.

Library ourlib.h

We made this library in order to help ourselves in graph creation and manipulation, and to provide randomization functions with respect to number of vertexes and number of edges range.

COMPUTATIONAL ANALYSIS

Computational Analysis
Second analysis: k = |V | . 2 Nodes # Time (secs) .lp le size 2 0.002 248 byte 3 no feasable 372 byte 4 0.002 600 byte 5 0.002 955 byte 6 0.002 0.002 MB 7 0.004 0.002 MB 8 0.004 0.004 MB 9 0.006 0.014 MB 10 0.011 0.038 MB 11 0.008 0.068 MB 12 0.128 0.078 MB 13 0.331 0.327 MB 14 0.537 0.993 MB 15 1.362 1.9 MB 16 1.304 2.9 MB 17 1.051 14 MB 18 9.552 20.6 MB 19 10.284 24.8 MB 20 killed

Euxhastive formulation First analysis: k = |V | 1. Nodes # Time (secs) .lp le size 2 0.003 249 byte 3 0.002 371 byte 4 0.003 670 byte 5 0.002 915 byte 6 0.003 0.001 MB 7 0.003 0.002 MB 8 0.004 0.005 MB 9 0.007 0.014 MB 10 0.018 0.02 MB 11 0.077 0.109 MB 12 0.137 0.25 MB 13 0.107 0.304 MB 14 0.649 0.692 MB 15 0.352 1.3 MB 16 4.297 3.6 MB 17 8.825 10.9 MB 18 7.276 24 MB 19 6.43 34.5 MB 20 killed

Third analysis: (xed) k = 3. Nodes # Time (secs) .lp le size 2 0.003 248 byte 3 0.002 432 byte 4 0.011 601 byte 5 0.003 894 byte 6 0.002 0.002 MB 7 0.004 0.002 MB 8 0.011 0.008 MB 9 0.011 0.04 MB 10 0.042 0.045 MB 11 0.083 0.105 MB 12 0.163 0.204 MB 13 0.097 0.332 MB 14 0.307 0.358 MB 15 1.042 2.4 MB 16 2.432 2.7 MB 17 7.353 16.4 MB 18 20.057 31 MB 19 killed 20 killed

COMPUTATIONAL ANALYSIS

Branch-and-bound-based method From the previous analysis experience, we got that analysis with k = |V | is the most informative one. For this reason, we did analysis on branch2 and-bound-based method with respect to k = |V | only. 2 Nodes 2 3 4 5 6 7 8 9 10 11 12 First analysis: k = |V | . 2 # Time (secs) Nodes folder size 0.001 47.2 KB 0 47.3 KB 0.001 47.5 KB 0.001 48 KB 0.001 48.4 KB 0.001 48.9 KB 0 49.9 KB 1.681 1 MB 1.526 1 MB 2.586 1.1 MB 1052.787 84.9 MB son, we can state that is not relevant to analyse the BBC formulation solving. Due to lack of analysis expressiveness, we focused on analysis with k = |V | only for 2 the branch-and-bound-based method. Both in terms of time and in terms of memory usage, we can state that branch-and-bound-based implementation is driven by the number of vertexes of the input specication and by the number of branching nodes. We can also state that, with our implementation, branch-and-bound-based method works properly and in a reasonable time of execution with a maximum number of vertexes of 11. For memory usage, note that we consider the generated folder representing branching nodes for the branch-and-bound algorithm. We expect that implementing all features about branch-and-bound algorithm (such as breadthrst search, incumbent calculation euristhics, etc.) we can get better results by the branchand-bound-based method rather than by exhaustive formulation method.

In this section, we compare two proposed methods in terms of comupational parameters: we make our analysis in terms of vertex number and bounded degree k with respect to time and memory used. For k value, we set its value in three dierent ways, in order to show how it can make the number of constraint increase in the formulation. As we expected, the complexity of our exhaustive formulation implementation is driven by the number of vertexes of the input specication. Both in terms of time and in terms of memory usage, we can state that exhaustive formulation can be solved in a proper way and with a reasonable resource exploting by our software for a maximum number of vertexes equal to 18. Note that we dont take into account the mbdst-formulation.lp le, because mbdst-formulation-ex.out reads from it and extend the formulation itself. In addition, solving the BBC formulation takes a few time (0.004 seconds, at most). For this rea-

REFERENCES

References
[Cla97] Jens Clausen. Branch and bound algorithms - principles and examples. Parallel Computing in Optimization, 1997.

[Edm71] Jack Edmonds. Matroids and the greedy algorithm. Mathematical Programming, 1:127 136, 1971. 10.1007/BF01584082. [FSF] FSF. Glpk (gnu linear programming kit) - http://www.gnu.org/s/glpk/.

[Goe06] Michel X. Goemans. Minimum bounded degree spanning trees. Foundations of Computer Science, Annual IEEE Symposium on, 0:273282, 2006.

Das könnte Ihnen auch gefallen