Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen TU Dortmund University, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max Planck Institute for Informatics, Saarbruecken, Germany
6681
Mikhail Atallah Xiang-Yang Li Binhai Zhu (Eds.)
Frontiers in Algorithmics and Algorithmic Aspects in Information and Management Joint International Conference, FAW-AAIM 2011 Jinhua, China, May 28-31, 2011 Proceedings
13
Volume Editors Mikhail Atallah Purdue University, Department of Computer Science West Lafayette, IN 47907, USA E-mail:
[email protected] Xiang-Yang Li Illinois Institute of Technology, Department of Computer Science Chicago, IL 60616, USA E-mail:
[email protected] Binhai Zhu Montana State University, Department of Computer Science Bozeman, MT 59717, USA E-mail:
[email protected]
ISSN 0302-9743 e-ISSN 1611-3349 ISBN 978-3-642-21203-1 e-ISBN 978-3-642-21204-8 DOI 10.1007/978-3-642-21204-8 Springer Heidelberg Dordrecht London New York Library of Congress Control Number: Applied for CR Subject Classification (1998): F.2, G.2, F.1, J.1, I.2 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues
© Springer-Verlag Berlin Heidelberg 2011 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com)
Preface
The papers in this volume were presented at the 5th International Frontiers in Algorithmics Workshop and the 7th International Conference on Algorithmic Aspects in Information and Management (FAW-AAIM 2011), jointly held during May 28-31, 2011, in Jinhua, China. The topics cover most areas in algorithms, combinatorial optimization and applications. Submissions to the conference this year were conducted electronically. A total of 92 papers were submitted, of which 35 were accepted. The papers were evaluated by two International Program Committees overseen by the Program Committee Co-chairs: Mikhail Atallah, Xiang-Yang Li, Binhai Zhu and Xuding Zhu. It is expected that most of the accepted papers will appear in a more complete form in scientific journals. The submitted papers were from 19 countries/regions: Canada, China, Denmark, France, Germany, Greece, Hong Kong, Hungary, India, Iran, Israel, Japan, Korea, Poland, Singapore, Slovakia, Taiwan, UK and USA. Each paper was evaluated by at least three Program Committee members (and in some case by five Program Committee members), assisted in some cases by sub-reviewers. In addition to the selected papers, the conference also included four invited presentations by Jin-Yi Cai, Michael Fellows, Elias Koutsoupias and Jack Snoeyink. We thank all the people who made this meeting possible: the authors for submitting papers, the Program Committee members and external reviewers (listed in the proceedings) for their excellent work, and the four invited speakers. Finally, we thank Zhejiang Normal University and SIAM for the support and the local organizers and colleagues for their assistance. May 2011
Mikhail Atallah Xiang-Yang Li Binhai Zhu
Organization
General Chairs John Hopcroft Franco Preparata Jianming Zhao
Cornell University, USA Brown University, USA Zhejiang Normal University, China
Program Committee Co-chairs Mikhail Atallah Xiang-Yang Li Binhai Zhu Xuding Zhu
Purdue University, USA Illinois Institute Technology, USA Montana State University, USA Zhejiang Normal University, China
FAW 2011 Program Committee Members Heep-Kap Ahn Lars Arge Tetsuo Asano Gill Barequet Danny Chen Alon Efrat Xin Han Haitao Jiang Minghui Jiang Samir Khuller Michael Langston Hao Li Minming Li Guohui Lin Stefano Lonardi Pinyan Lu Jun Luo Andrew McGregor Petra Mutzel Detlef Seese Michiel Smid
Pohang University of Science and Technology, Korea University of Aarhus, Denmark JAIST, Japan Technion, Israel University of Notre Dame, USA University of Arizona, USA Dalian University of Technology, China Shandong University, China Utah State University, USA University of Maryland, USA University of Tennessee, USA LRI, CNRS and Universit´e Paris-Sud 11, France City University of Hong Kong, Hong Kong University of Alberta, Canada University of California at Riverside, USA Microsoft Research Asia, China Shenzhen Institute of Advanced Technology, China University of Massachusetts, USA University of Dortmund, Germany KIT, Germany Carleton University, Canada
VIII
Organization
Xuehou Tan Shin-ichi Tanigawa Jianping Yin Binhai Zhu (Track Chair)
Tokai University, Japan Kyoto University, Japan National University of Defense Technology, China Montana State University, USA
AAIM 2011 Program Committee Members Gruia Calinescu Illinois Institute of Technology, USA Wei Chen Microsoft Research Asia, China Xi Chen Columbia University, USA Francis Chin University of Hong Kong, Hong Kong Marek Chrobak University of California at Riverside, USA Bhaskar DasGupta University of Illinois at Chicago, USA Xiaotie Deng University of Liverpool, UK Rudolf Fleischer Fudan University, China Jie Gao University of Stony Brook, USA Mordecai Golin HKUST, Hong Kong Ming-Yang Kao Northwestern University, USA Sanjiv Kapoor Illinois Institute of Technology, USA Erran Li Bell Labs, USA Fei Li George Mason University, USA Xiang-Yang Li (Track Chair) Illinois Institute Technology, USA Chung Keung Poon City University of Hong Kong, Hong Kong Jie Wang University of Massachusetts-Lowell, USA Yajun Wang Microsoft Research Asia, China Xiaodong Wu University of Iowa, USA Jinhui Xu State University of New York at Buffalo, USA Yinfeng Xu Xi’an Jiaotong University, China Yinyu Ye Stanford University, USA Ke Yi HKUST, Hong Kong Huaming Zhang University of Alabama at Huntsville, USA Xianchao Zhang Dalian University of Technology, China
Organizing Committee Xin Guan Chenghua Lin Zhangxing Wu (Chair) Xiangfu Zhao
ZJNU, ZJNU, ZJNU, ZJNU,
China China China China
Organization
Referees Mohammad Abam Saeed Alaei Hajo Broersma Laurent Bulteau Zhiping Cai Xue Chen Hu Ding Zheng Fang Matt Gibson Dongfeng Han Rafi Hassin Yoon-Ho Hwang Lucian Ilie Sungjin Im Sang-Sub Kim Irina Kostitsyna
Henry C.M. Leung Jian Li Yong Li Weifa Liang Yunlong Liu Qiang Liu Sanaz Mostaghim Chung Wah Ngo Sudhir Naswa Dong-Woo Park Liuying Peng Charles Phillips Manolis Pountourakis Youming Qiao Sadish Sadasivam Wanbin Son
Branislav Stojkovic Haitao Wang Kai Wang Lixin Wang Shiguang Wang Weiwei Wu Yongan Wu Lei Xu Ping Xu Xiaohua Xu Jie Yang Yubin Zhan Jialin Zhang Yongding Zhu Bingbing Zhuang
IX
Table of Contents
Invited Lectures Progress in Complexity of Counting Problems . . . . . . . . . . . . . . . . . . . . . . . Jin-Yi Cai
1
Recent Developments in the Theory of Pre-processing . . . . . . . . . . . . . . . . Michael R. Fellows
4
Recent Developments in the Mechanism Design Problem for Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Elias Koutsoupias Degree-Driven Design for Correct Geometric Algorithms . . . . . . . . . . . . . . Jack Snoeyink
6 8
Contributed Papers Approximation Algorithm for the Uniform Bounded Facility Problem . . . Kerui Weng
10
The k-Canadian Travelers Problem with Communication . . . . . . . . . . . . . . Huili Zhang and Yinfeng Xu
17
An Improved Competitive Algorithm for One-Dimensional Incremental Median Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wenqiang Dai and Yi Feng
29
Approximation Scheme for Scheduling Resumable Proportionally Deteriorating Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wenchang Luo and Lin Chen
36
An Improved Approximation Algorithm for the Complementary Maximal Strip Recovery Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Zhong Li, Randy Goebel, Lusheng Wang, and Guohui Lin
46
Greedy Routing via Embedding Graphs onto Semi-metric Spaces . . . . . . . Huaming Zhang and Swetha Govindaiah
58
On Variants of the Spanning Star Forest Problem . . . . . . . . . . . . . . . . . . . . Jing He and Hongyu Liang
70
An Implicit Degree Condition for Cyclability in Graphs . . . . . . . . . . . . . . . Hao Li, Wantao Ning, and Junqing Cai
82
XII
Table of Contents
Parallel Enumeration of Lattice Animals . . . . . . . . . . . . . . . . . . . . . . . . . . . . Gadi Aleksandrowicz and Gill Barequet Parameterized Edge Dominating Set in Cubic Graphs (Extended Abstract) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mingyu Xiao and Hiroshi Nagamochi On Some Geometric Problems of Color-Spanning Sets . . . . . . . . . . . . . . . . Chenglin Fan, Wenqi Ju, Jun Luo, and Binhai Zhu Approximation Algorithms for Cutting a Convex Polyhedron Out of a Sphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xuehou Tan and Gangshan Wu
90
100
113
125
An Algorithm for Optimal Acyclic Edge-Colouring of Cubic Graphs . . . . Edita M´ aˇcajov´ a and J´ an Maz´ ak
136
Complexity of Total {k}-Domination and Related Problems . . . . . . . . . . . Jing He and Hongyu Liang
147
The Min-Power Multicast Problems in Wireless Ad Hoc Networks: A Parameterized View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Weizhong Luo, Jianxin Wang, Qilong Feng, and Jiong Guo
156
Constant Sum Flows in Regular Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tao-Ming Wang and Shi-Wei Hu
168
2D Knapsack: Packing Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Min Chen, Gy¨ orgy D´ osa, Xin Han, Chenyang Zhou, and Attila Benko
176
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ioannis Caragiannis, Christos Kaklamanis, and Maria Kyropoulou Algorithms for Interval Structures with Applications . . . . . . . . . . . . . . . . . Danny Z. Chen and Ewa Misiolek Single Machine Scheduling with an Operator Non-availability Period to Minimize Total Completion Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yong Chen, An Zhang, and Zhiyi Tan PSAEC: An Improved Algorithm for Short Read Error Correction Using Partial Suffix Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Zhiheng Zhao, Jianping Yin, Yubin Zhan, Wei Xiong, Yong Li, and Fayao Liu Two Hardness Results on Feedback Vertex Sets . . . . . . . . . . . . . . . . . . . . . . Wei Jiang, Tian Liu, Tienan Ren, and Ke Xu
185
196
208
220
233
Table of Contents
Approximation Algorithms for Unrelated Machine Scheduling with an Energy Budget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lin Chen, Wenchang Luo, and Guochuan Zhang
XIII
244
Plane-Filling Properties of Directed Figures . . . . . . . . . . . . . . . . . . . . . . . . . Wlodzimierz Moczurad
255
An Iterative Method for Generating Loop Invariants . . . . . . . . . . . . . . . . . . Shikun Chen, Zhoujun Li, Xiaoyu Song, and Mengjun Li
264
Algorithms for Computing Bidirectional Best Hit r-Window Gene Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Trong Dao Le, Melvin Zhang, and Hon Wai Leong
275
Contracted Webgraphs: Structure Mining and Scale-Freeness . . . . . . . . . . Yushi Uno and Fumiya Oguri
287
Hardness of Finding Two Edge-Disjoint Min-Min Paths in Digraphs . . . . Longkun Guo and Hong Shen
300
Online Algorithm for 1-Space Bounded Multi-dimensional Bin Packing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yong Zhang, Francis Y.L. Chin, Hing-Fung Ting, Xin Han, and Zhuo Chang
308
Online Algorithms for Maximizing Weighted Throughput of Unit Jobs with Temperature Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Martin Birks, Daniel Cole, Stanley P.Y. Fung, and Huichao Xue
319
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Martin Birks and Stanley P.Y. Fung
330
Visibility Testing and Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sharareh Alipour and Alireza Zarei The Nearest Neighbor Spearman Footrule Distance for Bucket, Interval, and Partial Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Franz J. Brandenburg, Andreas Gleißner, and Andreas Hofmeier
343
352
Minimum Width Rectangular Annulus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Joydeep Mukherjee, Priya Ranjan Sinha Mahapatra, Arindam Karmakar, and Sandip Das
364
An Experimental Study on Generating Planar Graphs . . . . . . . . . . . . . . . . Sascha Meinert and Dorothea Wagner
375
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
389
Progress in Complexity of Counting Problems Jin-Yi Cai University of Wisconsin-Madison
[email protected]
Abstract. There has been remarkable progress in the classification program of the complexity of counting problems. This program is carried out in at least three interrelated formulations: Graph Homomorphisms, Counting CSP, and Holant Problems. In each formulation, complexity dichotomy theorems have been achieved which classify every problem in a given class to be either solvable in polynomial time or #P-hard.
The primary goal of complexity theory is to classify computational problems according to their inherent computational complexity. The success of this theory is judged by how complete a classification one can obtain. Unfortunately we cannot yet separate complexity classes such as P vs. NP. Instead, classification is in terms of completeness, which has the implication that, e.g., assuming P = NP, then every NP-complete problem is not solvable in polynomial time. For counting problems the corresponding notion is #P-completeness or more generally #P-hardness. Assuming #P is separate from P, an assumption stronger than P = NP, every #P-hard function cannot be computed in polynomial time. As an overly ambitious goal, one might wish to classify every function in #P to be either computable in polynomial time or #P-hard. Such a result is called a complexity dichotomy theorem [10]. However for the whole #P this is known to be false, assuming #P is separate from P. Therefore, for counting problems, assuming #P is separate from P, one aims to achieve such a complete classification for as broad a class of problems as possible. Recently there has been remarkable progress on this classification program. Progress has been made in at least three frameworks: Graph Homomorphisms, Counting CSP, and Holant problems. In each case substantial complexity dichotomy theorems have been achieved. Graph homomorphism is defined as follows [9,8]. Given a k × k matrix A, the graph homomorphism function, a.k.a. partition function, ZA (G) is defined as Aξ(u),ξ(v) , ZA (G) = ξ:V →[k] (u,v)∈E
where G = (V, E) is any input graph. If A is symmetric and G is an undirected graph, then this is graph homomorphism for undirected graphs, which has been studied more intensively with a longer history. The function ZA (G) can encode many interesting graph E.g. counting vertex covers corresponds to properties. 01 (the matrix form of the binary Or function), and the 2 by 2 matrix 11 M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 1–3, 2011. c Springer-Verlag Berlin Heidelberg 2011
2
J.-Y. Cai
counting k-colorings corresponds to the k by k matrix with 0’s on the diagonal and 1’s off diagonal (the binary DisEquality function on domain size k). For undirected graph homomorphism, a complete dichotomy theorem has been achieved, where the matrix A can be an arbitrary complex-valued symmetric matrix [3]. For directed graph homomorphism, the strongest result is for all A with non-negative entries [2]. The difficult case when the matrix A can take negative or complex values, and therefore there is cancellation in the partition function, remains open for undirected graph homomorphism. For unweighted counting CSP, denoted as #CSP, the problem is defined as follows: Let D be an arbitrary fixed finite domain and let Γ be an arbitrary fixed finite set of constraint relations {R1 , . . . , Rk } over D, where each Ri has some arity ri . An instance of #CSP(Γ ) consists of two parts. The first part is a finite set of variables X = {x1 , . . . , xn } each taking values in D. The second part is a finite sequence of relations in Γ , each applied to a subset of X. These are the constraints to be satisfied for this instance. Let R be the n-ary relation over D defined to be the Boolean conjunction of these constraints. The (unweighted) #CSP(Γ ) problem asks for the cardinality of R, namely the number of assignments satisfying all the constraints in the input instance. More generally, in a non-negatively weighted #CSP, Γ is replaced by a fixed finite set of constraint functions F = {f1 , . . . , fk }, where each fi maps D ri to non-negative reals R+ . An instance of #CSP(F ) consists of variables X, ranging over D, and a sequence of constraint functions from F , each applied to a subset of X. It defines an n-ary function F : For any (x1 , . . . , xn ) ∈ D n , F (x1 , . . . , xn ) is the product of the constraint function evaluations. The output of #CSP(F ) is the sum of F over all assignments, known as the partition function for #CSP(F ). Clearly unweighted #CSP is the special case where each constraint function fi is 0-1 valued. #CSP can encompass an enormous varieties of counting problems which can be expressed by choosing a particular D, and a particular Γ or F . Graph Homomorphism corresponds to the special case of #CSP with a single binary function expressed as the matrix A. In 2008, Bulatov [1] gave a dichotomy theorem for all (unweighted) #CSP(Γ ). The theorem states that for every D and Γ , #CSP(Γ ) is either computable in polynomial time or #P-complete. This proof uses deep structural theorems from Universal Algebra. Dyer and Richerby [7] gave an alternative proof of Bulatov’s dichotomy theorem for unweighted #CSP. They also showed that the decision problem, given D and Γ whether #CSP(Γ ) satisfies the criterion for being #P-complete, is decidable in NP. This theorem has been extended to all non-negatively weighted #CSP(F ) [2]. Again, the difficult case when the constraint functions can take negative or complex values, and therefore there is cancellation in the partition function, remains open. The Holant framework is as follows. D is a finite set called a domain, and F is a finite set of functions over D. A signature grid Ω = (G, F , π) consists of a labeled graph G = (V, E) where π labels each vertex v ∈ V with a function fv ∈ F. We consider all edge assignments ξ : E → D; fv takes inputs from its
Progress in Complexity of Counting Problems
3
incident edges E(v) at v and outputs values in C. The counting problem on the instance Ω is to compute fv (ξ |E(v) ). HolantΩ = ξ:E→D v∈V
For example, if we take D = {0, 1} and attach the Exact-One function at every vertex v ∈ V , then Holant(Ω) computes exactly the number of perfect matchings of G. #CSP is the special case of Holant problems where Equality functions of all arities are assumed to be present in F . In fact each #CSP instance can be realized as a signature grid on a bipartite graph where each vertex on the LHS is labeled by a variable xi attached with an Equality function and each vertex on the RHS is labeled by a constraint function of the #CSP instance. For Holant problems there is a strong interaction with holographic algorithms [11,4], and the issue of cancellation is of the foremost concern. Some dichotomy theorems have been achieved in this framework, mostly on domain size 2 (Boolean domain) [5,6]. The primary challenge is to deal with domain size greater than 2.
References 1. Bulatov, A.A.: The complexity of the counting constraint satisfaction problem. In: Proceedings of the 35th International Colloquium on Automata, Languages and Programming, pp. 646–661 (2008) 2. Cai, J.-Y., Chen, X.: A decidable dichotomy theorem on directed graph homomorphisms with non-negative weights. In: Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science, pp. 437–446 (2010) 3. Cai, J.-Y., Chen, X., Lu, P.: Graph homomorphisms with complex values: A dichotomy theorem. In: Proceedings of the 37th International Colloquium on Automata, Languages and Programming (2010), Full version in http://arxiv.org/abs/0903.4728 4. Cai, J.-Y., Lu, P.: Holographic algorithms: from art to science. In: STOC 2007: Proceedings of the Thirty-Ninth Annual ACM Symposium on Theory of Computing, pp. 401–410. ACM, New York (2007) 5. Cai, J.-Y., Lu, P., Xia, M.: Holant problems and counting CSP. In: Proceedings of the 41st Annual ACM Symposium on Theory of Computing, pp. 715–724 (2009) 6. Cai, J.-Y., Lu, P., Xia, M.: Holographic algorithms with matchgates capture precisely tractable planar #CSP. In: Proceedings of the 51st Annual IEEE Symposium on Foundations of Computer Science, pp. 427–436 (2010) 7. Dyer, M.E., Richerby, D.M.: On the complexity of #CSP. In: Proceedings of the 42nd ACM Symposium on Theory of Computing, pp. 725–734 (2010) 8. Hell, P., Neˇsetˇril, J.: Graphs and Homomorphisms. Oxford University Press, Oxford (2004) 9. Lov´ asz, L.: Operations with structures. Acta Mathematica Hungarica 18, 321–328 (1967) 10. Schaefer, T.J.: The complexity of satisfiability problems. In: Proceedings of the 10th Annual ACM Symposium on Theory of Computing, pp. 216–226 (1978) 11. Valiant, L.G.: Holographic algorithms. SIAM J. Comput. 37(5), 1565–1594 (2008)
Recent Developments in the Theory of Pre-processing Michael R. Fellows Parameterized Complexity Research Unit, Charles Darwin University, Darwin, Northern Territory, Australia
[email protected]
Abstract. Although pre-processing is a practical computing strategy almost universally employed for real-world attacks on NP-hard problems, it is perhaps surprising that for more than thirty years there has been no mathematically-disciplined theory of the subject. The parameterized / multivariate view of computational complexity makes such a theory possible, and this turns out to be deeply productive and useful. In the theory of parameterized complexity and algorithmics, the subject is termed kernelization. We survey the origins, recent developments and applications of the theory of polynomial-time kernelization.
1
Summary
It is surprising that a computational strategy — pre-processing — that is so important in practical computing, has for so long acked an effective mathematical theory. The subject was relegated to heuristics, and remarkably effective heuristic pre-processing strategies were discovered for some NP-hard problems. On the side of computational theory, the main ideas until recently, were focused on a one-dimensional outlook, the single dimension being the overall input size n, the number of bits of a reasonable encoding of the input, and the central central notion of polynomial time. From an engineering point of view, the main distinction has been between algorithms that run in time polynomial in n (such as we have for Sorting, Inverting Matrices, Testing Primality, Network Flow, Maximum Matching, Shortest Paths, Minimum Weight Spanning Trees, and for various problems depending on these few polynomial-time workhorses) and problems that in the worst-case require time O(2p(n) ) where the exponent p(n) is usually a polynomial function of n, such as for all of the problems in the one-dimensional decision problem class NP. The difficulty for the one-dimensional theory of “P versus NP”, in regards the potential for a theory of polynomial-time preprocessing, is that if you had any polynomial-time algorithm guaranteed to shrink the input of an NP-hard problem, then by repeatedly applying it, you would have a proof that P=NP. Consequently, there has been no mathematically-powered theory of pre-processing for the last four decades of computer science theory. It is a lesson in the importance of intellectual frameworks that empower the asking of the right questions. M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 4–5, 2011. c Springer-Verlag Berlin Heidelberg 2011
Recent Developments in the Theory of Pre-processing
5
As the multivariate view of computational complexity has gradually come into focus, beginning with the two-dimensional framework of parameterized complexity, there has emerged a beautiful and useful and deep mathematical theory of pre-processing. The following concrete results may entice and illustrate. (1) If you are interested in deciding whether a graph G (on n vertices) has a vertex cover of size at most k, in other words, the bivariate input is (G, k), then there is a polynomial-time pre-processing (kernelization) algorithm that can efficiently solve the “easy parts”, and return to you a (G , k ) where: • G has a size k vertex cover if and only if G has a size k vertex cover • k ≤ k • G has at most 2k vertices (2) Similarly (after several rounds of improvements), if you are interested in deciding whether there is, in an undirected graph G, a set of at most k vertices that are a Feedback Vertex Set, that is to say, every cycle in the graph must contain one of these vertices, then there is a P-time kernelization algorithm that returns a pair (G , k ) where: • G has a size k feedback vertex set if and only if G has a size k feedback vertex set • k ≤ k • G has at most k 2 vertices (3) For the problem of Connected Vertex Cover of size k, it is now known that there is no polynomial-time kernelization to a graph G on a polynomial-in-k number of vertices (compare (1) and (2) above) unless the Polynomial Hierarchy collapses to the third level. Polynomial-time pre-processing has always been useful for hard problems. Theory seems to be catching up to the issue, and is now providing both highpowered routines for instance condensation and data-reduction, going far beyond the established heuristic approaches, as well as illuminating intrinsic lower bounds for such algorithm design efforts, as in (3) above. This adds up to a substantial reconfigurization of the relationship of theory and practice in Computer Science.
Recent Developments in the Mechanism Design Problem for Scheduling Elias Koutsoupias University of Athens
[email protected]
Scheduling unrelated machines is a classical optimization problem in which we want to minimize the makespan of executing m tasks on n machines when machine i can execute task j in time tij . Nisan and Ronen [6] posed the following problem: if the machines are selfish, how well can an incentive compatible mechanism approximate the minimum makespan? This is an important multiparameter problem in mechanism design and this question has been one of primary motivating problems in algorithmic game theory. There has been little progress in resolving this question. The best known upper bound for the approximation ratio of truthful deterministic mechanisms is given in the original paper by Nisan and Ronen: the mechanism has approximation ratio n and it allocates each task independently using the classical VCG (secondprice) auction. There is a wide gap between this upper bound and the best known deterministic lower bound of 2.61. For randomized algorithms which are truthful in expectation the situation is similar: the best known upper bound is (n + 1)/2 [3,4] and the best known lower bound is 2. On the other hand, there are more successes for specific cases. For example, for anonymous truthful mechanisms, Ashlagi, Dobzinski and Lavi [1] showed that they cannot do better than the VCG allocation (which gives an n-approximation to the makespan). On the positive side, Lavi and Swamy [5] give a truthful deterministic mechanism with an O(1) approximation for the special case when all jobs take one of two values. Furthermore, a truthful in expectation O(1) approximation is possible when all jobs on a specific machine take one of two values. Extending these results to more than two values has also proven very elusive. We will give an overview of these attempts and we will describe recent developments on this problem. We will discuss a mechanism which, with high probability, will guarantee a (1 + )-approximation for makespan minimization, if the job sizes are bounded from above and from below. Our mechanism is an “implementation in undominated strategies”: although the agents may have various strategic considerations, as long as they are rational and do not use strategies that are strictly dominated by other strategies, the result holds. Moreover, our result holds, not only for makespan minimization, but for a large class of other problems including many combinatorial auction settings. At the heart of our technique is a “real life application” (in undominated strategies) of bribing a prison guard to avoid being sent to the mines. (This is joint work with Amos Fiat and Angelina Vidali.) M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 6–7, 2011. c Springer-Verlag Berlin Heidelberg 2011
Recent Developments in the Mechanism Design Problem for Scheduling
7
We will also discuss the design of coercive algorithms: allocation algorithms that are announced to the players (machines) which in turn play a game trying to minimize their execution time. We seek truthful or non-truthful coercive algorithms without payments that have small price of anarchy or price of stability.
References 1. Ashlagi, I., Dobzinski, S., Lavi, R.: An optimal lower bound for anonymous scheduling mechanisms. In: Proceedings of the Tenth ACM Conference on Electronic Commerce, pp. 169–176 (2009) 2. Christodoulou, G., Koutsoupias, E., Kov´ acs, A.: Mechanism design for fractional scheduling on unrelated machines. ACM Transactions on Algorithms 6(2) (2010) 3. Christodoulou, G., Koutsoupias, E., Vidali, A.: A Lower Bound for Scheduling Mechanisms. Algorithmica 55(4), 729–740 (2009) 4. Koutsoupias, E., Vidali, A.: A lower bound of 1+φ for truthful scheduling mechanisms. In: Mathematical Foundations of Computer Science (MFCS), Krumlov, Czech Republic, August 26-31, pp. 454–464 (2007) 5. Lavi, R., Swamy, C.: Truthful mechanism design for multi-dimensional scheduling via cycle monotonicity. In: ACM Conference on Electronic Commerce, EC (2007) 6. Nisan, N., Ronen, A.: Algorithmic mechanism design (extended abstract). In: Proceedings of the Thirty-First Annual ACM Symposium on Theory of Computing (STOC), pp. 129–140 (1999)
Degree-Driven Design for Correct Geometric Algorithms Jack Snoeyink Department of Computer Science, University of North Carolina, Chapel Hill, NC 27599–3175, USA
[email protected] Abstract. This talk surveys results from applying an idea of Liotta, Preparata and Tamassia: that a designer of geometric algorithms could consider the arithmetic precision necessary to guarantee a correct implementation as a resource whose use is to be minimized, much as we do with running time and memory space. As is often the case, constraints can inspire creativity in design of new algorithms for classic problems; examples include point location, segment intersection, and Voronoi diagram construction. Keywords: computational geometry, geometric predicates.
Why do we analyze the running time and memory space of algorithms in theoretical computer science? We obtain many benefits from doing so: measuring these resources gives us a way to measure the quality of a solution and to recognize and appreciate new ideas; analyzing algorithms promotes understanding of both the solutions and the problems, making it more likely that our solutions are not only efficient, but also correct; limiting resources inspires creativity, and has provided a fertile ground for the study and development of mathematical ideas. But the original motivation comes from the fact that we develop algorithms for abstract models of computation that are unrealistic by allowing infinite time or memory, so we need to restrict these resources to make our algorithms implementable on real hardware. Geometric algorithms are typically built on several levels of abstraction. Algorithm invariants are often geometric and/or topological relationships (e.g., is a point in a polygon). These may be determined by evaluating geometric predicates (e.g., is a point above or below a line) or performing constructions (computing the intersection point of two line segments) in Euclidean or some other geometry. These, in turn, are determined by numerical computation on coordinate values. Error can creep into geometric algorithms at all levels. The highest levels are the realm of the algorithms designer – ensuring that the invariants are maintained as events are processed, that sufficient structural information is stored in the data structures, and that the proofs of correctness are sound. Thus, most descriptions in papers and textbooks occurs at the predicate level and above. It is common to assume the realRAM model of computation to avoid precision issues, and to assume general position for the input to avoid tedious discussion of special case handling. M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 8–9, 2011. c Springer-Verlag Berlin Heidelberg 2011
Degree-Driven Design for Geometric Algorithms
9
a = (0, 4) When an algorithm is implemented, however, the base levels can intrude. Geometric predicates typically depend on the sign of a result, and errors introduced by finite precision arithmetic in the b = (0, 3) 1 8 q = (3, 3) computer can easily change the sign of values at or near zero, and invalidate the properties that we expect from geometry. The figure d = (1, 2) at right shows a simple example in which the intersection of segments ac and bd, calculated as IEEE 754 doubles, lies on ac, but not on bd. Thanks to a quirk of the order of rounding, when I mirror the configuration about x = y then the intersection doesn’t lie c = (1, 0) on either segment! If we used rational arithmetic or homogeneous coordinates, then the computation is exact. A typical implementer, however, will change all comparisons against zero to some arbitrarily chosen ε, such as 10−8 , which really just hides the first errors encountered, creating new errors elsewhere that are hard to debug. In my experience with large data sets, e.g. triangulating billions of LIDAR points, though the chance of an individual error may be very small, they occur, and the more clever or efficient the algorithm, the more damaging a predicate error can be, as the results of many predicates are inferred from the few that are evaluated. The abstraction of predicates and constructions has been very important to the field of computational geometry: It has separated the tasks of establishing geometric/topological correctness and numerical correctness, allowing researchers in the field to greatly improve on the former for published papers and textbooks. (E.g., Before 1988, every published 2d convex hull algorithm has some input on which it fails to compute the desired output.) It has also allowed researchers to clearly enunciate possible demands on the latter, including Yap’s Exact Geometric Computation paradigm,which demands that the execution path of an implementation of an algorithm on given hardware should be the same as the execution path on an ideal machine with infinite precision, and to develop arbitrary precision arithmetic, lazy expression evaluation with fast filters, and bounds on arithmetic error, and package these approaches insophisticated libraries, such as CGAL and LEDA. But what about improving our textbook implementations for the non-sophisticated student or application programmer? Liotta, Preparata, and Tamassiasuggested to consider arithmetic precision as a resource whose use is to be optimized in the design of algorithms and data structures, much like memory space and running time. This resource can be measured, up to constants, by the degree of polynomials in predicates and constructions. This approach follows Yap’s Exact Geometric Computation paradigm by a simple form of static analysis– pre-calculating the degrees of predicates and guaranteeing correct evaluation, as long as the assumptions of input precision are satisfied. In this talk I give examples where restricting designers to low degree predicates forced creative new solutions to classical problems – solutions that are only a little more complex than the standard ones, yet can be correctly implemented on native machine arithmetic with no need for multi-precision arithmetic packages, floating point filters, or sophisticated libraries.
Approximation Algorithm for the Uniform Bounded Facility Problem Kerui Weng School of Economy and Management, China University of Geosciences Wuhan 430070, P.R. China
[email protected]
Abstract. The uniform bounded facility location problem (UBFLP) seeks to the optimal way of locating facilities to minimize total costs (opening costs plus routing costs), while the maximal routing costs of all clients are at most a given bound d. After building a mixed 0-1 integer programming model for UBFLP, the paper gives lnn+1-approximation algorithm for UBFLP on general graph. Then, we present the first constant-factor approximation algorithm with an approximation guarantee of 6.853 + for UBFLP on plane, which is composed of the algorithm by Dai and Yu [1] and the schema of Xu and Xu [2].
1
Introduction
Facility location problem asks for the optimal decision on number and location of facilities needed to provide some services to a set of clients. A lot of location problems have to consider both the total costs and the maximal routing costs. For example, the carriers have to locate the freight depots carefully to obtain a minimal transportation cost, while all services distance should be small enough to fulfil the promised delivery time. Similarly, when locating the ambulances and firehouses, the governments desire minimizing the average responses time for emergencies from all residents of cities, while the maximal arrival time for remote districts of cities should be smaller than their promised time. This kind of location decisions also arise in network design when exits or entrances location must be considered. For instance, in the case of designing the mouth of underground tunnel network of mines, the planner aims at optimal routing costs between working places and entrances, while the maximal distance should be short enough to escape when emergency happened. All above cases object at lowest total routing costs as well as opening costs of facilities, and the largest routing costs should be satisfied with certain restrictions. We classify these location decisions as bounded facility location problem. The formal definition of this problem is: Given an undirected graph G(N, A), we want to find a subset F ⊆ N such that each vertex j in V is assigned to the closest facility in F with connect costs no more than a given number dj and the total opening costs plus routing costs are minimized. If the bounded numbers dj for all j in N are uniform, our problem will become uniform bounded facility location problem (UBFLP). M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 10–16, 2011. c Springer-Verlag Berlin Heidelberg 2011
Approximation Algorithm for Uniform Bounded Facility Problem
11
In classical location problems, the uncapacitated facility location and the weighted set covering problem consider the service costs and the bounds respectively. The uncapacitated facility location problem is to find the optimal facilities such that the total traffic costs plus total building costs are minimized, which attracts a good many researches interest on its models, algorithms as well as extended problems. Shmoys et al. [4] present the first constant approximation algorithm for metric uncapacitated facility location in 1997, which is based on linear program rounding algorithm. Then, several techniques were subsequently found to improve the constant approximation ratio, including the LP-rounding [5] and [6], the primal-dual schema [7], and the scaling & greedy augmentation [8]. Mahdian et al. [9] developed a 1.52-approximation algorithm. Recently, 1.50approximation algorithm was found by Byrka [10], which is the best performance ratios untill now and still does not yet arrive the lower bound of 1.46 [11]. An interesting variant of facility location problem is facility location with penalties (FLWP). The FLWP allows each client is either assigned to an opened facility or rejected by paying a penalty and aims at minimal total costs including opening costs, routing cost as well as penalty costs. Charikar et al gave the first constant approximation algorithm to FLWP with 3 ratios [3]. Then it was improved to 2 by Jain et al [7]. Recently, Xu and Xu [2] presents 1.853-approximation algorithm for FLWP which will be used in our algorithm in section 4. Weighted Set covering problem is to select the facilities with minimal opening costs to cover all vertexes. Feige [12] showed that there is no (1 − )lnn-approximation algorithm to the problem unless N P ⊆ DT IM E(nloglogn ) where > 0. When it comes to plane and the cover range is uniform, the problem becomes minimum weighted dominating set problem in unit disk graph (MWDS in UDG). Amb´ uhl et al [13] gave the first constant-factor approximation algorithm with 72 ratios for MWDS in UDG. Then the ratios was improved to 6 + by Huang et al [14]. Recently, Dai and Yu [1] found a 5 + -approximation algorithm. Our algorithm in section 4 will also make use of their algorithm. For UBFLP, the exact algorithms for solving bounded facility location in exponential time were studied in [15] and [16]. Piotr and Roberto [17] proved that the bounded p-median problem can not be approximated within a factor 1 smaller than 1 + e1+ unless N P ⊆ DT IM E(nloglogn ), and showed the known approximation schema of metric facility location on UBFLP usually violates the feasibility of routing bounds. To the best of our knowledge, there are no other researches on approximation algorithms about UBFLP. This article is organized as follows. In section 2, we present the model of UBFLP. Section 3 describes the lnn+1-approximation algorithm of UBFLP on general graph. In section 4, we present the constant-factor approximation algorithm for UBFLP on plane.
2
UBFLP Model
Given a connected network G(N, A) where N = {1, · · · , n} is the set of nodes, A is the set of edges. Let cij be the cost from i to j, fi be the opening cost of
12
K. Weng
node i. And let Yi = {0, 1} be 1 if node i is selected as a facility and 0 otherwise, Xij = {0, 1} be 1 if node j is serviced by node i and 0 otherwise, d be the bounded routing cost. Now, we can formulate the UBFLP as P 1. P 1 minimize cij Xij + f i Yi (1) i
j
i
subject to Xij ≤ Yi ∀(i, j) Xij = 1 ∀j
(2) (3)
i
Xij cij ≤ d ∀i, j
(4)
Yi = 0, 1; Xij = 0, 1 ∀i, j
(5)
In P 1, the objective function (1) accounts for the minimization of the total routing costs plus opening costs. Constraints (2) and (3) require that every node j must be serviced by a selected facility. Constraint (4) ensures the closest facility to j is within required bound. If d = max∀i,j cij , then P 1 became an uncapacitated facility location. So, UBFLP is a generalization of uncapacitated facility location problem, which means that it is NP-hard since its special case is NP-hard.
3
Greedy Approximation Algorithm for UBFLP on General Graph
UBFLP doesn’t likely have an approximation algorithm better than lnn because set covering is also a special case of UBFLP. This section presents a lnn + 1 approximation algorithm using greedy technique. The key idea of the schema is that it selects a facility with minimal average operation costs to service new clients at every step until all nodes have been assigned. Let wi = {j|cij ≤ d} be the set of nodes that can be covered by i, E be the set of uncovered nodes, C be the set of already selected facilities, and Dj be the shortest distance between j from facilities of C. As Fig. 1 showed, the nodes serviced by C can be divided into X1 , X2 , and X3 . Dj = ∞ if node j has not been covered. Define s as the new selected facility, which would serve X3 and X4 in Fig. 1 where X4 = ws ∩ E. When s is selected, X2 would still be assigned to C while X3 would serviced by s. Let
θs =
fs +
j∈X4
cij −
|X4 |
j∈X3 (Dj
− csj )
(6)
The equation (6) shows that the average operation costs induced by s including opening costs of s, routing costs of X4 , and then decreased costs by saving routing costs of X3 .
Approximation Algorithm for Uniform Bounded Facility Problem
X
1
C
X X 2
3
13
X
4
s
Fig. 1. Add New Facility
The following gives the procedure of our algorithm for UBFLP. 1. Initialize C = ∅, S = N , E = N , X1 = ∅, ALG = 0, Dj = ∞ for ∀ j. 2. While E = ∅, for ∀i ∈ S, compute X4 = wi ∩ E, X2 = {j|j ∈ X1 , Dj ≤ cij }, X3 = {j|j ∈ X1 , Dj > cij }, and then choose s = argmini∈S θi while θi is defined as equation (6), renew C = C ∪ s, S = S \ {s}, E = E \ {X4 }, X1 = X1 ∪ X4 , ALG = ALG + θs |X4 |, Dj = cjs for ∀j ∈ X3 ∪ X4 . 3. End. And C is set of facilities to be opened. The procedure above can be finished in O(n3 ) time. When the algorithm ended, we have the opening facilities C, and the serviced distance Dj for node j, as well as the totalcosts ALG. Besides, by j∈N Dj , we obtain the total routing costs. And by i∈C fi , we get the total opening costs. Now, we analyze the performance of the algorithm. Theorem 1. ALG ≤ (lnn + 1)OP T where ALG is the solution cost of the algorithm and OP T is the total cost of the optimal solution. Proof. In the algorithm, we select facilities by the efficiency of their unassigned nodes, or number of uncovered elements per operation cost. For every picked s, we have θs which is the minimal mean operation costs. For every node j, let si be the first picked facility that covers it. Node j has toafford the costs of cost(j) = θsi . And the total costs of the algorithm ALG = j∈N cost(j). We order the nodes in the order that they were joined to X1 . At the iteration t of step 2, the algorithm has selected facilities s1 , s2 , · · · , st . We define Et as the set of unassigned nodes after that time. Then the average cost of service Et is at T OP T most OP |Et | . So, there is at least one node in Et who afford costs cost(i) ≤ |Et | . T Actually we can obtain a facility with θst+1 ≤ OP |Et | at iteration t + 1, since θst+1 is the minimal average operation costs. In the ordered sequence, let j be the first node assigned in iteration t + 1, and T OP T notice that |Et | = n − j + 1. So cost(j) = θst+1 ≤ OP |Et | ≤ n−j+1 . Now, we have n n 1 ALG = j∈N cost(j) ≤ OP T j=1 n−j+1 = OP T j=1 1j ≤ (lnn + 1)OP T .
14
4
K. Weng
Constant-Factor Approximation Algorithm for UBFLP on Plane
In general graph, there are no approximation algorithm better than lnn unless N P ⊆ DT IM E(nloglogn ) for UBFLP. However, when it came to plane, we may improve the approximation guarantee by taking advantages of geometry characteristics of plane graph. In this section, we present the constant approximation algorithm with for UBFLP on plane, which is composed of the algorithm by Dai and Yu [1] and the schema of Xu and Xu [2]. The following gives the procedure of our algorithm for UBFLP on plane. 1. Compute a set W which can cover all nodes of N . Let Cj be the minimal routing costs of node j serviced by W. 2. Compute a set V such that all nodes of N is either assigned to a facility of V or pay the penalty Cj . 3. Let F be the union of W and V , and assign all nodes to the closet facility in F . In step 1, the algorithm actually chose a weighted dominating set W which assure that all nodes can assigned to a facility with a routing costs no more than d. And we compute a FLWP in step 2 such that the routing costs of all nodes can be further decreased. When the algorithm ended, the node j in N is either assigned to V or to W with routing cost Cj . The following gives the performance analysis of our algorithm. Lemma 1. Let W ∗ be the optimal solution for weighted dominating set, and OP Tw be total costs of W ∗ , then OP Tw ≤ OP Tf , where OP Tf is the opening costs of optimal solution for UBFLP. Proof. Given the optimal solution F ∗ of UBFLP, then all nodes in N can be assigned a facility in F ∗ while their routing cost is at most d, which means F ∗ is a dominating set of N . Since W ∗ is the minimum weighted dominating set, so OP Tw ≤ OP Tf . Let zj = {0, 1} be 1 if node j is assigned to W in step 2. The FLWP in step 2 can be programmed as P 2. P 2 minimize
i
subject to
j
cij Xij +
f i Yi +
j
Xij ≤ Yi ∀(i, j) Xij + zj ≥ 1 ∀j
zj Cj
(7)
j
(8) (9)
i
Yi = 0, 1; Xij = 0, 1 ∀i, j
(10)
In P 2, the objective (7) minimizes the total opening costs, routing costs as well as penalties. constraint (9) ensures that the node j ∈ N is either served by a
Approximation Algorithm for Uniform Bounded Facility Problem
15
facility in V, or covered by W which counts cost Cj . Let V ∗ be the optimal solution of P 2 with objective value OP Tf lwp = OP Tv + OP Tr + OP Tp , where OP Tv , OP Tr , and OP Tp are the opening costs, routing costs, penalties of the optimal solution respectively. Lemma 2. OP Tv + OP Tr + OP Tp ≤ OP T where OP T is the optimal cost of UBFLP. Proof. Suppose to the contrary, there exists a solution H of UBFLP whose total costs F + R (opening costs F plus routing costs R) is less than OP Tf lwp . Let rj be smallest routing costs of j assigned to H. Then we can construct a feasible solution for P 2. Let H be the opened facilities of FLWP. Node j is assigned to H if rj ≤ Cj , and get penalties Cj if rj > Cj . Obviously the total routing costs COSTr plus penalties COSTp are not great than R. Now, OP Tv + OP Tr + OP Tp ≤ F + COSTr + COSTp ≤ F + R, a contradiction. We note that the optimal solution V ∗ of step 2 should have no common facilities with W. If there is a common facility j, we can delete j, and let all nodes assigned to j get penalties, which would not increase the total costs since the penalties should no more than the routing costs to j in W. Theorem 2. There exists a 6.853 + -approximation algorithm for UBFLP on plane in polynomial time. Proof. Dai and Yu [1] gave a polynomial time algorithm with approximation guarantee 5 + for MWDS in UDG. And Xu and Xu [2] presented a 1.853approximation algorithm for FLWP in O(n3 ) times. So if we compute step 1 by the schema of Dai and Yu [1], let W be the cost we obtained, then we have can cover all nodes by W ≤ (5 + )OP Tw . If we compute step 2 by the algorithm of Xu and Xu [2], let V, R, P be the opening costs, routing costs, penalties of the solution respectively, and then we have V + R + P ≤ 1.853(OP Tv + OP Tr + OP Tp ). By Lemma 2 and Lemma 3, the total costs of out algorithm W +V +R+P ≤ (5+)OP Tw +1.853(OP Tv +OP Tr +OP Tp ) ≤ (6.853+)OP T.
5
Conclusion
The uniform bounded facility location problem has a wide range of application in the location of warehouses, network designs, fire engines as well as ambulances. We present a O(lnn)-approximation for UBFLP on general graph. And the 6.853 + -approximation algorithm for UBFLP on plane is also obtained. The great mass of the algorithm cost is the computing for MWDS in UDG at step 1. To reduce the ratios by computing a feasible dominating set with lower costs may be promising to improve on the first step. Another interesting open problem would be the bounded facility location in the case when the bounds are different.
16
K. Weng
Acknowledgment The research was supported by the Special Fund for Basic Scientific Research of Central Colleges, CUG090113.Thanks are also due to the anonymous referees who provided very valuable comments and advises.
References 1. Dai, D., Yu, C.: A 5+-approximation algorithm for minimum weighted dominating set in unit disk graph. Theoretical Computer Science (2008), doi:10.1016/j.tcs.2008.11.015 2. Xu, G., Xu, J.: An improved approximation algorithm for uncapacitated facility location problem with penalties. Journal of Combinatorial Optimization 17, 424– 436 (2008) 3. Charikar, M., Khuller, S., Mount, D. Narasimhan, G.: Algorithms for facility location problems with outliers. In: Proceedings of the symposium on discrete algorithms, pp. 642–651 (2001) ´ Aardal, K.: Approximation algorithms for facility location 4. Shomys, D., Tardos, E., problems. In: Proceedings of STOC, pp. 265–274 (1997) 5. Sviridenko, M.: An improved approximation algorithm for the metric uncapacitated facility location. In: Proceedings of IPCO, pp. 240–257 (2002) 6. Chudak, F., Shomys, D.: Improved approximation algorithms for the uncapacitated facility location problem. SIAM J. Comput. 33, 1–25 (2003) 7. Jain, K., Mahdian, M., Saberi, A.: Approximation algorithms for metric facility location and k-median problems using the primalCdual 8. Charikar, M., Guha, S.: Improved combinatorial algorithm for facility location problems. SIAM J. Comput. 34, 803–824 (2005) 9. Mahdian, M., Ye, Y., Zhang, J.: Approximation algorithms for metric facility location problems. SIAM J. Comput. 36, 411–432 (2006) 10. Byrka, J.: An optimal bifactor approximation algorithm for the metric uncapacitated facility location problem. In: Charikar, M., Jansen, K., Reingold, O., Rolim, J.D.P. (eds.) RANDOM 2007 and APPROX 2007. LNCS, vol. 4627, pp. 29–43. Springer, Heidelberg (2007) 11. Byrka, J., Aardal, K.: The approximation gap for the metric facility location problem is not yet closed. Oper. Res. Lett. (2006) 12. Feige, U.: A Threshold of ln n for Approximating Set Cover. J. ACM 45, 634–652 (2006) 13. Amb¨ uhl, C., Erlebach, T., Mihal´ ak, M., Nunkesser, M.: Constant-factor approximation for minimum-weight (Connected) dominating sets in unit disk graphs. In: D´ıaz, J., Jansen, K., Rolim, J.D.P., Zwick, U. (eds.) APPROX 2006 and RANDOM 2006. LNCS, vol. 4110, pp. 3–14. Springer, Heidelberg (2006) 14. Huang, Y., Gao, X., Zhang, Z., Wu, W.: A better constant-factor approximation for weighted dominating set in unit disk graph. J. Comb. Optim., 1573–2886 (2008) 15. Berman, O., Yang, E.K.: Medi-center location problems. Journal of the Operational Research Society 42, 313–322 (1991) 16. Choi, I.C., Chaudhry, S.S.: The p-median problem with maximum distance constraints: a direct approach. Location Science 1, 235–243 (1993) 17. Piotr, K., Roberto, S.: Approximation algorithms for bounded facility location problems. Journal of Combinatorial Optimization 5, 233–247 (2001)
The k-Canadian Travelers Problem with Communication Huili Zhang1,2,3, and Yinfeng Xu1,2,3 1
2 3
School of Management, Xi’an JiaoTong University, Xianning West Road, Xi’an, 710049, China State Key Lab for Manufacturing Systems Engineering, Xi’an, 710049, China Ministry of Education Key Lab for Process Control & Efficiency Engineering, Xi’an, 710049, China
[email protected],
[email protected]
Abstract. From the online point of view, this paper studies a variation of the k-Canadian Traveler Problem (k-CTP), in which there are multiple travelers who communicate with each other to share real-time information. The objective is to find a route from the origination to the destination as soon as possible. Based on different communication levels, we consider two problems with full communication(P1 ) and with limited communication(P2 ) respectively. We present lower bounds for the two problems respectively. Considering the urban traffic environment, we propose a Retrace-Alternating strategy for both problems, and prove that increasing the proportion of full communication travelers may not always improve the competitive performance of online strategies. Keywords: online k-CTP; multiple travelers; communication; competitive analysis.
1
Introduction
The Canadian Traveler Problem (CTP) is a routing problem under uncertain environment. Given an undirected graph G = (V,E) with one source node O and one destination node D. A traveler plans to travel from O to D, and knows in advance the original structure of the graph and the costs of all the edges. However, some edges may be timelessly blocked during travel, and the blocking can not be observed until the traveler reaches one endpoint of a blocked edge. When the traveler meets a blocked edge in the preplanned route, it is necessary to adjust the planned route to avoid the blocked edge. The traveler needs to devise a good travel strategy from O to D with smallest cost in the above online environment. This problem was introduced by Papadimitriou and Yannakakis [1], and was proved that devising an online algorithm with a bounded competitive ratio is PSPACE-complete. Several variations of the CTP have been studied since the introduction. One variation is the k-CTP problem where the number of blocked edges is no more than
Corresponding author.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 17–28, 2011. c Springer-Verlag Berlin Heidelberg 2011
18
H. Zhang and Y. Xu
k. Bar-Noy and Schieber [2] investigated the problem by the worst-case criterion which aims at a strategy where the maximum cost is minimized [2]. Westphal [3] considered the online version of k-CTP and gave an optimal deterministic strategy with the competitive ratio 2k + 1. Westphal [3] also showed a lower bound of k + 1 of the competitive ratio for any randomized online algorithm against an oblivious adversary. Xu et al. [4] gave two deterministic strategies, the Comparison strategy and the Greedy strategy, and showed the corresponding tight competitive ratio 2k+1 and 2k+1 −1. Particularly, they explained why the Greedy strategy is usually carried out in the urban environment. Another variation is the recoverable CTP problem where one blockage recovers after some non-negative time. Bar-Noy and Schieber [2] and Su et al. [5] studied the problem from the perspective of worst-case analysis and competitive analysis, respectively. CTP with multiple travelers is an interesting variation which plays an important role in many real life situations. Itai and Shachnai [6] studied the packet routing problem in Internet. Burgard et al [7] and Simmons et al [8] started the research of the collaborative multi-robot exploration problem, in which a team of robots explores an unknown environment. The problem has been widely studied in the last decade. Lita et al [9] modified the problem to the situation of disaster, where the multiple relief trucks corporately attempt to reach multiple target locations in a heavily destroyed network, and aim to get the largest reward which exponentially decays in cost. As mentioned above, the CTP with multiple travelers is mainly studied with unknown or almost unknown graph. Whereas we usually face more practical situations in which there are just a few number of uncertain edges in the network. For example, when there is a big fire in the city, the traffic network is mostly fine except a few affected edges. Although the study on the totally unknown map can be used in this situation, it is meaningful to take the advantage of map information for designing better routing strategies for the multiple trucks. In view of competitive analysis, this paper studies the k-Canadian Travelers Problem with multiple travelers. Two communication levels among the travelers are introduced in the problem. The first level is of full communication, which means that all the travelers can receive and send information on blockages with each other at any time. The second level is of limited communication, which means that some travelers can both receive and send information while the others can only receive information. The organization of this paper is as follows. Section 2 describes the k-Canadian Travelers Problem, and gives some assumptions. In Sections 3 and 4, we study the k-Canadian Travelers Problem based on two different communication levels, respectively. In Section 5, we examine the performance of the Retrace-Alternating strategy with different communication levels in a special urban traffic environment.
2
Problem Description
Let G = (V, E) denote an undirected network, O the source and D the destination. Let l(ei ) denote the weight or passing time of edge ei , and Ei = {e1 , e2 , . . . , ei } the
The k-Canadian Travelers Problem with Communication
19
set of blocked edges. Ei is unknown to travelers at the beginning. Suppose that there are multiple travelers who plan to travel from O to D. The objective is to find a feasible route spending as little time as possible. It is natural to consider the following questions: If the travelers can share their travel information by communication, what will be different from the situation without communication? Does the level of communication affect the performance of strategies and to what extent? Before answering these questions, we first present several fundamental assumptions. 1) There are L (> 1) travelers who have the knowledge of original structure and edge cost of the graph but not Ei in advance. 2) Each traveler take ei time to pass through edge l(ei ) given that ei is not in Ei . 3) At most k (L < k) edges may fail during travel. 4) A traveler knows that edge ei = (vi , vi+1 ) is blocked either he reached one of the endpoints or at least one another traveler sends the blockage information. 5) The block of an edge is irrecoverable and timeless, and graph G is connective after the blocked edges are removed from the graph. Competitive ratio We use the competitive analysis [10] to measure the performance of an online strategy. For any input blockage sequence I, let con (I) denote the time spent by the L travelers who adopt the online strategy AON , and copt (I) the time spent by an optimal offline strategy. In this paper, the cost is time from the starting out of the first traveler to the arrival of the earliest traveler. We say that AON is c-competitive if con (I) ≤ c · copt (I) + v where v is a constant. We also say that c is the competitive ratio of AON . A strategy is optimal if its competitive ratio matches the lower bound of competitive ratio.
3
The k-Canadian Travelers Problem with Full Communication (P1 )
In this section, we present a lower bound for k-Canadian Travelers Problem with full-communication (P1 ) and give an optimal strategy for a special case. In P1 , all travelers are equipped with the facilities to receive and send information at any time. For example, the fire engines have radios and telephones which are used to assist the emergency process. Suppose that there are L travelers and at most k blocked edges, we have the following theorem. Theorem 1. There is no deterministic online strategy with competitive ratio less than 2 Lk + 1 for P1 .
20
H. Zhang and Y. Xu
Proof. Consider a special graph in Fig.1 where the lengths of all the paths are the same. Let AON be any deterministic strategy which contains a permutation {(x1 , t1 ), . . . , (xi , ti ), . . . , (xn , tn )}, where (xi , ti ) means that xi travelers are sent to D along the different paths at time ti , and tn is the starting time of the earliest arrival. v1
1
v
1 1
O
1 1
H
2
H
v3
D
H H H
vk
vk 1 Fig. 1. A special graph
Assume that there exists a strategy {(x1 , t1 ), . . . , (xi , ti ), . . . , (xn , tn )} where tn < 2 Lk . We derive a contradiction to the assumption in the following. Let tn = 2 Lk −δ (δ > 0) and divide the time interval [0, tn ] into n segments by Ti = 2i−δ (i = 1, . . . , n = Lk ) as showed in Fig.2. The strategy can be redefined as ({y1 , (T0 , T1 )}, {z1 , T1 }, . . . , {yi , (Ti−1 , Ti )}, {zi, Ti }, . . . , {yn , (Tn−1 , Tn )}, {zn, Tn }), where T0 = 0, Tn = tn , yi is the total number of travelers who set out for the node D during the time interval (Ti−1 , Ti ), and zi (i = 1, 2, . . . , n) is the number of travelers who set out at time Ti .
y2
y3
z3
0
2 G
4 G
"
6 G "
yn 1 zn 1
yn
zn
^ ^
z2
^ ^
^
y1 z1
2n 2 G
2n G
Fig. 2. Divided Time Interval
Obviously, the length of time interval [Ti−1 , Ti ) is at most 2 which is the necessary time for a traveler to leave from O and then go back to O after observing a blocked edge. Therefore, there are at most L − yi travelers at the node O at Ti because the yi travelers who were sent out during [Ti−1 , Ti ) are still on the way at the time. Obviously, there are two choices for the L − yi travelers. The first one is that some of L − yi travelers leave for D at Ti while the others leave later, then at Ti+1 they will find at most L − yi blockages but less than L − yi travelers return to O. The second choice is that all of the L − yi travelers go to D at Ti , it is certain that they will find L − yi blockages and the same number
The k-Canadian Travelers Problem with Communication
21
of travelers will return to O. Thus, the later choice (zi = L − yi ) is not worse than the former one (zi < L − yi ). To draw a smallest competitive ratio, we select the later choice, i.e., zi = L−yi . n n The total number of blockages to be find until tn + 1 is Σi=1 (yi + zi ) = Σi=1 (yi + k L − yi ) = nL = L L ≤ k, which means every traveler who leaves for D at time tn can still be blocked in the worst case. This contradicts to the assumption tn < 2 Lk , which is the starting time of the earliest arrival traveler. Hence, it is a contradiction, and thus tn ≥ 2 Lk for any strategy {(x1 , t1 ), . . . , (xi , ti ), . . . , (xn , tn )}. The cost of online travelers is con ≥ 2 Lk + δ + (1 + ε), and the optimal cost is copt = 1 + ε. c=
2 k + δ + (1 + ε) con ≥ L copt 1+ε
As ε → 0, c → 2 Lk + 1. The theorem follows.
Below we present a strategy for the case where there are exactly two travelers with full communication. Alternating strategy: Let one traveler (A) takes the shortest path SPG (O, D) on graph G, and the other traveler (B) waits at node O. If the path of A is blocked on any edge e1 , then A returns to O and B takes the shortest path SPG−{e1 } on the graph G = G − {e1 } at the time A finds a blockage; if the edge e2 of the path taken by B is blocked, B returns to O and A takes the shortest path SPG−{e1 ,e2 } (O, D) on the graph G − {e1 , e2 } when B is blocked and A is at node O. The two travelers leave for D in turn and repeatedly until one of the travelers arrives at D. Theorem 2. When L = 2, the Alternating algorithm is k+1-competitive for P1 . Proof. At any time when one traveler finds a blocked edge, the traveler returns to O at once and at the same time the other one sends out. Obviously, the cost of finding a blockage on graph G − {e1 , . . . , ei } is at most l(SPG−{e1 ,...,ei } ). Suppose the travelers arrive at D after they have found i blockages. Then the online cost is con = l(SPG ) + l(SPG−{e1 } ) + . . . + l(SPG−{e1 ,e2 ,...,ei ,ei+1 } ) ≤ (i + 2)l(SPG−{e1 ,e2 ,...,ei ,ei+1 } The optimal cost is copt = l(SPG−{e1 ,e2 ,...,ei ,ei+1 } . Hence, the competitive ratio is c = max { i≤k−1
The theorem follows.
con }=k+1 copt
Note: If k is even, the competitive ratio is optimal; otherwise the competitive ratio is 1 larger than the lower bound.
22
4
H. Zhang and Y. Xu
The k-Canadian Travelers Problem with Limited Communication (P2 )
In this section, we present a lower bound for the k-Canadian Travelers Problem with limited communication (P2 ). The limited communication means that some travelers can both receive and send traffic information, but the others can only receive. For example, some fire engines can both receive and send information, such as the communication fire engine which is used to manage the process. There are also special fire engines only to take water or lighting installation or something else used in emergency. Consider the following situation: L travelers are leaving from O to D. L1 of the L travelers can both receive and send information, and are defined as R&S-type. The others can only receive information, and are defined as R-type. There are at most k blockages on the graph. This problem is defined as P2 (L, L1 ). Since the R-type travelers can not share their travel information, they might repeat the infeasible path that the other R-travelers have already taken. Consider the graph showed in figure 1, the following lemmas hold. Lemma 1: In P2 , it does not improve competitive ratio when the R-type travelers take different paths. Lemma 2: P2 (L, L1 ) equals to P1 with L1 travelers with full communication and at most k − 1 blockages. Proof. According to Lemma 1, all the R-type travelers can be regarded as one traveler in any deterministic strategy for P2 . The R&S -type travelers can communicate with each other, but they don’t know the path taken by the R-type travelers. Therefore, in the worst case they will take the way R-type travelers have taken. However, when the number of unknown blockages (x) equals to that of R&S-type travelers at O, the R-type travelers get this information from R&Stype travelers, and will select a different way. In this case, there are x + 1 paths selected and at most x blockages unknown. Obviously, at least one traveler will arrive at D. Above all, the R-type travelers will detect one blockage and leave the k − 1 blockages to the L1 travelers with full communication. The lemma follows. Theorem 3. For P2 (L, L1 ), there is no deterministic online algorithm with competitive ratio less than 2 k−1 L1 + 1. Proof. According to Lemma 2 and Theorem 2, the online cost of the travelers in Fig.1 is con ≤ 2 k−1 + 1 + ε. The offline cost is copt = 1 + ε. As ε → 0, L1 con k−1 → 2 + 1. copt L1 The theorem follows.
The k-Canadian Travelers Problem with Communication
5
23
Retrace-Alternating Strategy in Urban Environment
In this section we propose a Retrace-Alternating strategy for the k-Canadian Travelers Problem in urban environment, and examine the performance of the strategy for both P1 and P2 . Because of the overlap among different paths on the general network, it is difficult to design a good strategy including multiple paths without overlaps for all the travelers. However, most urban city traffic networks are highly connected and there usually exist several paths without overlap from O and D. These paths are not much longer than the shortest path SPG on the graph G. What’s more, when some edges are blocked, there are still such paths on the new graph G , such as the graphs showed in Fig.3.
Fig. 3. Part of the traffic network of Barcelona, Spain and Xi’an, Shannxi, China
Based on this fact, we assume that: 1) d denotes the degree of node D. There are at least d paths without overlap and their lengths are in the interval [l(SPG ), αl(SPG )] (α > 1). Furthermore, there still exist such paths even when several edges are blocked and their lengths are in the interval [l(SPG ), αl(SPG )]. 2) Px is the detouring path of the edge e(vi , D) on path P , and l(Px ) = 2xl(e(vi , D)) < 2l(P ), where x is the number of the blockages needed to be detoured. The following is the Retrace-Alternating strategy in the urban traffic network for P1 . Retrace-Alternating strategy for P1 : Case 1. L ≤ d: Step1: i = 1, Ei = φ, x = L; Step2: x travelers leave for node D along separate paths on graph G without overlap. If the selected paths are all blocked and no blockage is connected to D, all the travelers return to node O, i = i + 1, add all the blocked edges to set Ei , G = G − Ei , go to step2; if all the paths are blocked and there is any blockage edge whose the other endpoint is exactly D, go to step3; otherwise if at least one traveler reaches the node D, stop; Step3: Let the traveler who is at one endpoint of the blocked edge whose the other endpoint is D detour until arriving at D, stop.
24
H. Zhang and Y. Xu
Case 2. L > d: Step1: Let i = 1, x1 = d, x2 = min{d, L − d}, Ei = φ. Step2: When there are at least x1 travelers at O, the x1 travelers go to D along separate paths on graph G without overlap. If the x1 paths are all blocked and no blockage is connected to D, all the x1 travelers retrace to O, i = i + 1, add all the blocked edges to set Ei , G = G − Ei , and go to step 3; if all the paths are blocked and there is at least one blocked edge whose the other endpoint is D, go to step 4; otherwise if some traveler reaches D, stop; Step3: When there are at least x2 travelers at node O, x2 travelers go to D along separate paths on graph without overlap. If all the x2 paths are blocked and no blockage is connected to D, i = i + 1, add all the blocked edges to set Ei , G = G − Ei , the x2 travelers all retrace to O, return to step 2; if all the paths are blocked and there is at least one blockage edge connected to D, go to step 4; if some traveler reaches D, stop; Step4: Let the traveler who is at one endpoint of the blocked edge whose the other endpoint is D detour until arriving at D, stop. Theorem 4. The competitive ratio of Retrace-Alternating strategy for P1 is ⎧ ⎨ α(2 Lk + 1) L ≤ d k c = α(2 X + 2) a = 0, L > d , ⎩ k α(2 X + 3) a = 1, L > d k 1 k − X X − d ≥ 0 where X = min{L, 2d} and a = . 0 else Proof. Case 1. L ≤ d. According to the process of strategy, there are mainly two cases. One is that strategy executes step 3, and the other is that strategy doesn’t execute step 3. Case 1.1: Doesn’t execute Step 3. In this case, all the L travelers will return to O when the selected paths on the graph G are all blocked and the cost is at most 2αl(SPG ). Step 2 is repeated at most i = Lk times. The total online i cost is con ≤ 2αΣj=1 l(SPG−Ej ) + αl(SPG−Ei+1 ). The offline optimal cost is cof f = l(SPG−Ei+1 ). In this subcase, the ratio c1 =
con k ≤ α(2 + 1). cof f L
Case 1.2: Execute Step 3. In this case, before the strategy executes the step 3, it continues to return to O when all the selected paths are blocked. Suppose the strategy goes to step 3 on graph G − Ei+1 , the cost before the strati egy executes the step 3 is at most 2αΣj=1 l(SPG−Ej ) + αl(SPG−Ei+1 ). Because it is blocked on graph G − Ei+1 , the length of the detouring path in step 3 is l(Px ) = 2xl(e(vi , D) ≤ 2αl(SPG−Ei+1 ). Therefore, the total cost is con ≤ i 2αΣj=1 l(SPG−Ej ) + αl(SPG−Ei+1 ) + 2αl(SPG−Ei+1 ) ≤ α(2i + 3)l(SPG−Ei+1 ). The offline optimal cost is cof f ≥ l(SPG−Ei+1 ). k Obviously, i < L , otherwise some traveler must have arrived at D and there is no need to detour.
The k-Canadian Travelers Problem with Communication
25
The ratio in this subcase is c2 =
con k ≤ α(2 + 1). cof f L
The competitive ratio of the strategy is then given by k c = max{c1 , c2 } = α(2 + 1). L Case 2. L > d. The analysis is similar to Case 1, the details are presented in Appendix 1. We can easily get the competitive ratio of the strategy for P1 when L > d is k α(2 X + 2) a = 0, L > d c= , k α(2 X + 3) a = 1, L > d k 1 k X X − d ≥ 0 where X = min{L, 2d} and a = . 0 else The theorem follows. The following is the Retrace-Alternating strategy in the urban traffic network for P2 . Retrace-Alternating strategy for P2 According to Theorem 3, P2 (L, L1 ) equals to P1 with L1 travelers and at most k − 1 blockages. The Retrace-Alternating strategy for P1 can be used to P2 after a little modification when the number of unknown blockages equals to that of the R&S-type travelers at O. The details are listed in Appendix 2. Similar to the proof of Theorem 4, we have the competitive ratio of the Retrace-Alternating strategy for P2 . Theorem 5. The competitive ratio of Retrace-Alternating strategy for P2 is ⎧ k−1 ⎨ α(2 L1 + 1) L1 ≤ d c = α(2 k−1 + 2) a = 0, L1 > d , X ⎩ α(2 k−1 + 3) a = 1, L1 > d X k 1 k − X X − d ≥ 0 where X = min{L1 , 2d} and a = . 0 else Comparing the competitive ratio of Retrace − Alternating strategy for P1 and P2 with the same number of travelers (by Theorem 4 and Theorem 5), we can find: 1) if L ≤ 2d and L1 ≤ 2d, the Retrace-Alternating strategy for the problem with full communication (P1 ) has better competitive ratio than that with limited communication(P2 ). Moreover, a larger L1 indicates a smaller difference between P1 and P2 ; 2) if L > 2d and L1 ≤ 2d, the competitive ratio of the strategy for (P1 ) does not change as L increases. Furthermore, a larger L1 also indicates a smaller difference between P1 and P2 ;
26
H. Zhang and Y. Xu
3) if L > 2d and L1 > 2d, the strategy for P1 behaves as well as that for P2 . Hence, we conclude that the increase of the proportion of travelers with full communication does not always improve the competitive ratio.
6
Conclusion
This paper studied the k-Canadian Travelers Problem with different communication abilities: full communication (P1 ) and limited communication (P2 ).We presented lower bounds of the competitive ratio for the two subproblems. The results showed that the more travelers with full communication, the smaller the lower bound is. Based on the urban traffic environment, the paper studied the performance of the Retrace-Alternating strategy of the two communication situations. The results indicated that the increase of the proportion of full communication travelers does not always improve the competitive ratio, which is actually related to the structure of network.
Acknowledgments The authors would like to acknowledge the financial support of Grants (No. 71071123, 60736027 and 60921003.) from NSF of China.
References 1. Papadimitriou, C.H., Yannakakis, M.: Shortest paths without a map. Theoretical Computer Science 84, 127–150 (1991) 2. Bar-Noy, A., Schieber, B.: The Canadian Traveller Problem.In: Proceedings of the second annual ACM-SIAM symposium on discrete algorithms, pp. 261–270, San Francisco (1991) 3. Westphal, S.: A note on the k-Canadian Traveler Problem. Information Processing Letter 106, 87–89 (2008) 4. Xu, Y.F., Hu, M.L., Su, B., Zhu, B.H., Zhu, Z.J.: The Canadian Traveller Problem and its competitive analysis. Journal of combinatorial optimization 18, 195–205 (2009) 5. Su, B., Xu, Y.F.: Online recoverable Canadian Traveler Problem on a road. Information 7, 477–486 (2004) 6. Itai, A., Shachnai, H.: Adaptive source routing in high-speed networks. Journal of Algorithms 20, 218–243 (1996) 7. Burgard, W., Fox, D., Moors, M., Simmons, R., Thrun, S.: Collaborative multirobot exploration. In: Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), San Francisco, pp. 476–481 (2000) 8. Simmons, R., Apfelbaum, D., Burgard, W., Fox, M., Moors, D., Thrun, S., Younes, H.: Coordination for multi-robot exploration and mapping. In: Proceedings of the Seventeenth National Conference on Artificial Intelligence and Twelfth Conference on Innovative Applications of Artificial Intelligence, Austin, pp. 852–858 (2000) 9. Lita, L.V., Schulte, J., Thrun, S.: A System for Multi-Agent Coordination in Uncertain Environments. In: Proceedings of the Fifth International Conference on Autonomous Agents, Montreal, pp. 21–22 (2001) 10. Borodin, A., El-Yaniv, R.: Online Computation and Competitive Analysis. Cambridge University Press, Cambridge (1998)
The k-Canadian Travelers Problem with Communication
27
Appendix Appendix 1. Competitive analysis of Retrace-Alternating strategy for P1 . Case 2. L > d. Let X = x1 + x2 = min{L, 2d}. According to the process of the strategy, there are mainly two cases. One is that the strategy executes step 4, the other is that the strategy doesn’t execute step 4. Case 2.1: Doesn’t execute Step 4. In this case, the two groups travelers go to the destination alternatively when the other group is blocked. All the x1 /x2 travelers will return to O when the selected paths are all blocked and the cost to find a blockage on graph G − Ej is at most l(SPG−Ej ). Step 2 and step 3 are k totally repeated at most i = 2α X times. The total cost of the online strategy i is con ≤ αΣj=1 l(SPG−Ej ) + αl(SPG−Ei+1 ) + aαl(SPG−Ei+2 ), where a = 0 when some of the x1 travelers reach D and ka = 1 when some of the x2 travelers 1 k− X X−d≥0 reach D. That is to say a = . The offline optimal cost 0 else l(SPG−Ei+1 ) a = 0 is copt ≥ . l(SPG−Ei+2 ) a = 1 k α(2 X + 1) a = 0 on The ratio in this subcase is c1 = ccopt ≤ k α(2 X + 2) a = 1 Case 2.2: Execute Step 4. In this case, before the strategy executes the step 4, it continues to return to O when all the selected paths are blocked. Suppose the strategy goes to step 4 on graph G − Ei+1 and the cost at this time is con ≤ i αΣj=1 l(SPG−Ej ) + αl(SPG−Ei+1 ). The length of the detouring path in step 4 will be l(Px ) = 2xl(e(vi , D) ≤ 2αl(SPG−Ei+1 ). Therefore, the total cost is con ≤ i αΣj=1 l(SPG−Ej )+αl(SPG−Ei+1 )+2αl(SPG−Ei+1 ) ≤ α(2i+3)l(SPG−Ei+1 ). The offline optimal cost is cof f ≥ l(SPG−Ei+1 ). on The ratio is c2 = ccof ≤ α(i + 3). f k Obviously if a = 0, i < 2 X ; else there are must some traveler arrived at D k and no need to detour . The worst case is c2 ≤ α(2 X + 2). k Else if a = 1, i ≤ 2 X ; else there are must some traveler arrived at D and k no need to detour . The worst case is c2 ≤ α(2 X + 3). k α(2 X + 2) a = 0 So the ratio in this subcase is c2 = k α(2 X + 3) a = 1 Above all, the competitive ratio of the Retrace-Alternating strategy when L > d is k α(2 X + 2) a = 0 c = max{c1 , c2 } = , X = min{L, 2d}. k α(2 X + 3) a = 1
Appendix 2. Retrace-Alternating strategy for P2 . Case 1. L1 ≤ d: Step1: i = 1, Ei = φ, x = L, N o = 0; Step2: x travelers go to node D along separate paths on graph G without overlap. If the selected paths are all blocked and no blockage is connected to D, the travelers all retrace to node O, i = i + 1, add all the blocked edges to set
28
H. Zhang and Y. Xu
Ei , G = G − Ei , N o = N o + 1, let x = x + 1 when k − N o = x, go to step 2; if all the paths are blocked and there is blockage connected to D, go to step 3; if at least one traveler reaches the node D, stop; Step3: Just let the traveler who is blocked by the edge connected to D detour until the arrival at node D, stop. Case 2. L1 > d: Step1: Let i = 1, x1 = d, x2 = min{d, L1 − d}, Ei = φ, N o = 0. Step2: When there are at least x1 travelers at O, the x1 travelers go to D along separate paths on graph without overlap. If the x1 path are all blocked and no blockage is connected to D, the x1 travelers all retrace to O, i = i + 1, add all the blocked edges to set Ei , G = G − Ei , N o = N o + x1 , let x2 = x2 + 1 when k − N o = x2 , go to step 3; if all the paths are blocked and there is at least one blockage connected to D, go to step 4; if some traveler reaches D, stop; Step3: When there are x2 travelers at node D, x2 travelers go to D along separate paths on graph without overlap. If all the x2 paths are all blocked and no blockage is connected to D, i = i + 1, add all the blocked edges to set Ei , G = G − Ei , N o = N o + x2 , let x2 = x2 + 1 when k − N o = x1 , the x2 travelers all retrace to O, go to step 2; if all the paths are blocked and there is at least one blockage connected to D, go to step 4; if some traveler reaches D, stop; Step4: Just let the traveler who is blocked by the edge connected to D detour until the arrival at node D, stop.
An Improved Competitive Algorithm for One-Dimensional Incremental Median Problem Wenqiang Dai and Yi Feng School of Management and Economics, University of Electronic Science and Technology of China, Chengdu, Sichuan, 610054, P.R. China {wqdai,fengyi}@uestc.edu.cn
Abstract. The incremental median problem consists of finding an incremental sequence of facility sets F1 ⊆ F2 ⊆ · · · ⊆ Fn , where each Fk contains at most k facilities. We say that this incremental medians sequence is c-competitive if the cost of each Fk is at most c times of the optimum cost of k-median problem. The smallest such c is called the competitive ratio. A particular case of the problem is considered in this paper: both the clients and facilities are located on the real line. [5] and [14] presented a polynomial-time algorithm for this one-dimensional case that computes an incremental sequence with competitive ratio 8. The √ best algorithm available has competitive ratio (1 + 2)2 ≈ 5.83[19]. In this paper we give an improved polynomial-time algorithm with competitive factor 4.
1
Introduction
The k-median problem is a classical facility location model and is also one of several problems considered fundamental in the field of combinatorial optimization, operation research and management science, see, e.g. several survey articles and books [16,3,18,7,8,6]. In the standard metric k-median version, we are given two sets: a set C of clients and a set F of n facilities, with a metric distance function d(x, y) ≥ 0 defined for each x, y ∈ C ∪ F, a weight function w(c) ≥ 0 defined for each c ∈ C. We define the distance of a point x to a point set S is d(x, S) = min d(x, y) and y∈S
|S| is the number of points in S. For any facility subset F ⊆ F, let its cost be cost(F ) = y∈C d(y, F )w(y). Given k, the objective of k-median problem is to give a k facilities subset F ⊆ F with minimum cost. The k-median problem is a very hard combinatorial optimization problem and has been the subject of a great deal of previous work. Here we just review some significant theoretical analysis. Lin and Vitter [15] proved that, in general, even
Supported in part by the NSF of China under Grant No.70901012, the Specialized Research Foundation for the Doctoral Program of Higher Education of China, Grant No. 200806141084, and Science Foundation of UESTC for Youths(JX0869). Supported by the Social Science Funding of China Education Ministry, Grant No. 10XJC630005.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 29–35, 2011. c Springer-Verlag Berlin Heidelberg 2011
30
W. Dai and Y. Feng
finding an approximate solution to the k-median problem is NP-hard. The problem remains hard if restricted to metric spaces. Guha and Khuller [11] proved that this problem is MAX-SNP Hard. Jain, Mahdian and Saberi [13] provided the best known lower bound of 1 + 2/e on the approximation ratio for this problem unless N P ⊆ DT IM E(nO(log log n) ). Now the best known approximation ratio is 3+, for any > 0, given by Arya et al.[2]. In the specific case of points in plane, Arora et.al [1] developed a PTAS. Recently several generalizations of the k-meidan problem have been considered. As investigated in Mettu and Plaxton [17], we consider the incremental version of k-median problem and its competitive algorithm in this paper. Such an algorithm produces an incremental sequence of facility sets Fˆ = (F1 , F2 , · · · , Fn ) such that (i) F1 ⊆ F2 ⊆ · · · ⊆ Fn ⊆ F; (ii) for any k = 1, 2, · · · , n, |Fk | ≤ k; (iii) for any k, cost(Fk ) ≤ c · optk , where optk denotes the corresponding optimum cost of k-median problem and c is called competitive ratio. For the incremental median problem, Mettu and Plaxton [17] proposed a linear time competitive algorithm with competitive ratio ≈ 29.98. Chrobak et. al. [5] gave a competitive algorithm (and Lin et.al.[14] also independently gave an analogous algorithm) with competitive ratio 8α, where α is the approximation ratio of k-median problem, thus achieving factor 24 + . Chrobak √ and Hurand [4] presented a competitive algorithm with competitive ratio (2 + 4 2)α. Lin et.al [14] further gave a competitive algorithm with competitive ratio 16. Consider a particular case of the incremental median problem in which both clients and facilities lie on the real line. Although this topology is the simplest model for location problems, the problem under consideration remains as hard to solve as in the general case. Due to the fact of that one-dimensional k-median problem can be solved in polynomial time[12], α = 1, the previous algorithms √ for the one-dimensional case thus present 8-competitive [5,14] and (2 + 4 2)competitive [4]. Recently, Shenmaier [19] gave a polynomial time competitive √ algorithm with ratio factor (1 + 2)2 ≈ 5.83. In this paper, we give a polynomial time incremental algorithm to prove that the competitive ratio factor is improved to 4. The rest of this paper is organized as follows. Section 2 presents the competitive algorithm, following section 3 gives the competitive ratio analysis. Section 4 puts a proof of an important and detail inequality which has been used in the proof of competitive ratio in section 3. The final section, section 5, concludes this paper and describes future research.
2
Algorithm Description
The basic idea of the algorithm coincides with that of the algorithm in [5,14,19]. We firstly find the solutions F1∗ , F2∗ , · · · , Fn∗ for the usual k-median problem for k = 1, 2, · · · , n. In this case, these are the exact solutions because the onedimensional k-median problem can be solved in polynomial time[12].
Algorithm for One-Dimensional Incremental Median Problem
31
Next, the algorithm determines a set E consisting of a subscript sequence E = {T (1), T (2), · · · , T (m)} in which T (1) = 1 and, for k = 1, 2, · · · , m − 1, the index T (k + 1) is the minimal subscript such that cost(FT∗ (k+1) ) ≤
1 cost(FT∗ (k) ) 2
Thus we have T (m) = n. Note that, when the algorithm of [19] is used, the √ analogous constant used in RHS is divided by 1 + 2. We then construct a partial solution to the incremental median problem corresponding to the indices in E. Let FT (m) = FT∗(m) , and for k = m − 1, · · · , 1, we put FT (k) as the method in [19] as following: ∀f ∈ FT∗(k) , we consider the set C(f ) of clients for which f serves them in Fi∗k , that is, C(f ) = {c ∈ C|d(c, f ) ≤ d(c, g), ∀g ∈ FT∗(k) , g = f } This set is called the cluster of f . We determine the facilities in FT (k+1) nearest to f in the line both from the left and the right, which have at most 2 nodes and at least one of these exist, under the following criteria: we pick the best of them from the viewpoint of minimizing the weighted sum of the distances to the customers in C(f ). The facilities chosen in this way for all f ∈ FT∗(k) constitute the set FT (k) . Henceforth, we denote this construction of FT (k) by Γ ; i.e., FT (k) = Γ (FT∗(k) , FT (k+1) ) Note that FT (k) ⊆ FT (k+1) , and the number of points in FT (k) is at most the size of FT∗(k) , which is equal to T (k). Note also that, in the algorithm of [5,14], during the construction of FT∗ (k) , the analogous function Γ is determined as the facility in FT∗ (k+1) nearest to f . Now we have obtained a partial solution FT (1) ⊆ FT (2) ⊆ · · · ⊆ FT (m) for the incremental median problem for indices in E. For t ∈ {1, 2, ..., n} \ E, we just let Ft = Ft− , where t− = max{i ∈ E|i ≤ t}. This completes the constructed process. The complexity of this algorithm is determined by the complexity of finding the initial sequence F1∗ , F2∗ ,· · · , Fn∗ , which in turn coincides with the complexity of finding k-median problem on a real line. Since the latter problem can be solved in polynomial time, thus the algorithm is also a polynomial one.
3
Competitive Ratio Analysis
Let us introduce the following concept: a configuration is a triple consisting of an arbitrary weighted set C of clients and two sets S and S ∗ of facilities, of which the second is the exact solution to the k-median problem with k = |S ∗ | and the set C of clients. We have the following result.
32
W. Dai and Y. Feng
Lemma 1. Given an arbitrary configuration C, S, S ∗ , we have the following inequality cost(Γ (S, S ∗ )) ≤ β(cost(S) + cost(S ∗ )), β = 1
(1)
We prove this lemma in the next section. Note that the constant in [19] is √ β = 1+2 2 . Now we consider the competitive ratio factor for the algorithm. Lemma 2. ∀k ∈ {1, 2, 3, · · · · · · , n}, cost(Fk ) ≤
m l=i,T (i)=k−
cost(FT∗(l) ).
Proof. If k ∈ E, let k = T (i), now by Lemma 1, we have cost(FT (i) ) = cost(Γ (FT∗(i) , FT (i+1) )) ≤ cost(FT∗(i) ) + cost(FT (i+1) ) thus cost(Fk ) = cost(FT (i) ) ≤ cost(FT∗ (i) ) + cost(FT (i+1) ) ≤ cost(FT∗ (i) ) + cost(FT∗(i+1) ) + cost(FT (i+2) ) ≤ ······ m−1 ≤ cost(FT∗(l) ) + cost(FT (m) ) =
l=i,T (i)=k m l=i,T (i)=k
cost(FT∗(l) ))
If k ∈ / E, we have k − ∈ E and Fk = Fk− , thus cost(Fk ) = cost(Fk− ) ≤
m
cost(FT∗(l) )).
l=i,T (i)=k−
Thus, we have the main result of this paper. Theorem 1. By the algorithm, the obtained set {F1 , · · · · · · , Fn−1 , Fn } satisfy the following: (1) F1 ⊆ F2 ⊆ · · · · · · ⊆ Fn ; (2) ∀k = 1, 2, ..., n, |Fk | ≤ k; (3) ∀k = 1, 2, ..., n, cost(Fk ) ≤ 4 · optk . That is, the algorithm has competitive ratio 4. Proof. Firstly we prove (1) and (2). By our algorithm, we have F1 ⊆ F2 ⊆ · · · · · · ⊆ Fn and ∀k, |Fk | ≤ k. Actually, if k ∈ E, then ∃i such that k = T (i), thus we have |Fk | = |FT (i) | = |Γ (FT∗(i) , FT (i+1) )| ≤ |FT∗ (i) | ≤ T (i) = k. Now if k∈ / E, we have |Fk | = |Fk− | ≤ k − ≤ k, thus the (1) and (2) are done.
Algorithm for One-Dimensional Incremental Median Problem
33
Now we prove (3). By Lemma 2 and the construction method of E, we have ∀k, cost(Fk ) ≤
m
cost(FT∗ (l) ) ≤
l=i,T (i)=k−
m l=i,T (i)=k−
1 cost(FT∗(i) ) ≤ 2cost(Fk∗− ) 2l−i
Now if k ∈ E, cost(Fk ) ≤ 2cost(Fk∗− ) = 2cost(Fk∗ ) = 2optk . If k ∈ / E, denote T (i) = k − , cost(Fk ) ≤ 2cost(Fk∗− ) ≤ 4cost(FT∗(i+1) ) ≤ 4optk , as desired.
4
Proof of Lemma 1
In this section, we prove the Lemma 1. Proof. Suppose the lemma 1 does not work, that is, for some configuration C, S, S ∗ , we have the converse: cost(Γ (S, S ∗ )) > cost(S) + cost(S ∗ )
(2)
We will use 5 simplifying operations as following to construct a substantially simpler k-median problem instance in which (2) holds as well and then obtain a contradiction. Note that the operation 1-4 here is analogous as in [19], which √ 1+ 2 ∗ have been used under the assumption cost(Γ (S, S )) > 2 (cost(S)+cost(S ∗ )). Here for our later used, we restate them and argument that these operations will also hold under assumption (2). Simplification 1.By (2), there exists at least one facility s ∈ S ∗ such that (2) still holds. Consequently, if we let S ∗ = {s} and C = C(s) then (2) still holds. Observe that the set {C, S, s} is still a configuration as the point s is the optimal 1-median of its cluster. Now denote the nearest neighboring facilities of s in S on the left and on the right respectively by a and b. Let d = a+b 2 and without loss of generality, we can assume s ≤ d, the case in which s > d is completely symmetric and can be dealt with similarly. Denote the costs of the sets S, {s},{a}, {b}, respectively by f , f s , f a , f b . Then inequality (2) assumes the following form min(f a , f b ) > f s + f
(3)
To concluded this lemma, we will prove (3) does not hold. Simplification 2. Consider the clients and facilities in S in the interval of the real line to the left of a. Move these clients to point a and delete these facilities. All quantities in (3) do not increase, while f s , f a , and f b decrease by the same constant. Consequently, (3) still holds. Repeat this for the clients and facilities located to the right of b. It can be observed that, following this simplification, facility set S will contain only two facilities a and b and there does not exist clients in the interval (−∞, a) ∪ (b, +∞). Simplification 3. Consider the clients in the intervals (a, s) ∪ (s, d) ∪ (d, b). Observe that the weighted sum of the distances from a facility to the clients located on one side of the facility is equal to the distance from this facility to
34
W. Dai and Y. Feng
the center of mass of these clients multiplied by their total weight. Thus, The quantities f a , f b , f s , and f do not change if we replace these clients with the set consisting of two clients located at the endpoints of the interval and having the same total weight and center of mass. Only four clients a, s, d, and b remain now. Simplification 4. Consider the client located on d. Move this client to the point s. Observe that f b does not decrease while f a , f s and f decrease by a same constant. Thus (3) still holds and then only three clients a, s and b remain now. By [9,10], we can know that a point on the line is a median if and only if the total weight of the clients located on one side of it is at most the total weight of the clients on the other side and at the point itself. Since Simplifications 1-4 preserve this property, the point s is still an optimal 1-median among the configuration {a, s, b}. Now normalize the coordinates of all points and let d(a, s) = x ≤ 12 . We have the following fact. Fact 1.w(a) < w(b). Proof. We write out explicitly the terms f a , f s , f : f a = xw(s) + w(b), f = xw(s), f s = xw(a) + (1 − x)w(b). Now by (3) we have f a > f s + f , that is xw(s) + w(b) > xw(s) + xw(a) + (1 − x)w(b) or w(a) < w(b) as desired. Simplification 5. Decrease the weight of the client s by w(s), while increase the weight of the client a by (1 − 2x)w(s) and remain the weight of the client b unchanged. Observe that f a and f b decrease by a same constant xw(s), and f s + f decrease by 2x2 w(s). Due to 0 ≤ x ≤ 12 , (3) still holds. Note also that, during the analysis of [19], this step is instead by decreasing the weights of the clients a and b by w = min(w(a), w(b)) = w(a). Now we have three clients: a = 0, s = x, 0 ≤ x ≤ 0.5, and b = 1 with the weights w(a), 0, and w(b), respectively. we write out explicitly the terms in the inequality (3): f a = w(b), f b = w(a), f s = xw(a) + (1 − x)w(b), f = 0. and then the inequality (3) is the following: min(w(a), w(b)) > xw(a) + (1 − x)w(b) this contradiction result completes the proof of the lemma.
Algorithm for One-Dimensional Incremental Median Problem
5
35
Conclusion
This paper presents a competitive algorithm for one dimensional incremental median problem. We have given an improved upper bound of 4 for this problem. There are still various open problems for future research. For example, the optimal lower and upper bound of the competitive ratio for this problem is still unknown.
References 1. Arora, S., Raghavan, P., Rao, S.: Approximation schemes for Euclidean k-medians and related problems. In: STOC 1998, pp. 106–113 (1998) 2. Arya, V., Garg, N., Khandekar, R., Munagala, K., Pandit, V.: Local search heuristics for k-median and facility location problems. In: STOC 2001, pp. 21–29 (2001) 3. Brandeau, M.L., Chiu, S.S.: An overview of representative problems in location research. Management Science 35(6), 645–674 (1989) 4. Chrobak, M., Hurand, M.: Better bounds for incremental medians. In: Kaklamanis, C., Skutella, M. (eds.) WAOA 2007. LNCS, vol. 4927, pp. 207–217. Springer, Heidelberg (2008) 5. Chrobak, M., Kenyon, C., Young, N.E.: Oblivious medians via online bidding. In: Correa, J.R., Hevia, A., Kiwi, M. (eds.) LATIN 2006. LNCS, vol. 3887, pp. 311–322. Springer, Heidelberg (2006) 6. Daskin, M. (ed.): Network and Discrete Location. Wiley, New York (1995) 7. Drezner, Z. (ed.): Facility Location: A Survey of Applications and Methods. Springer, New York (1995) 8. Drezner, Z., Hamacher, H. (eds.): Facility Location: Applications and Theory. Springer, Berlin (2002) 9. Goldman, A.J.: Optimal center location in simple networks. Transportation Science 5, 212–221 (1971) 10. Goldman, A.J., Witzgall, C.J.: A localization theorem for optimal facility location. Transportation Science 4, 406–409 (1970) 11. Guha, S., Khuller, S.: Greedy strikes back: Improved facility location algorithms. Journal of Algorithms 31, 228–248 (1999) 12. Hassin, R., Tamir, A.: Improved complexity bounds for location problems on the real line. Operations Research Letters 10, 395–402 (1991) 13. Jain, K., Mahdian, M., Saberi, A.: A new greedy approach for facility location problems. In: STOC 2002, pp. 731–740 (2002) 14. Lin., G.L., Nagarajan, C., Rajamaran, R., Williamson, D.P.: A general approach for incremental approximation and hierarchical clustering. In: SODA 2002. ACM/SIAM (2006) 15. Lin, J.H., Vitter, J.S.: -approximations with minimum packing constraint violation. In: STOC 1992, pp. 771–782 (1992) 16. Love, R.F., Morris, J.G., Wesolowsky, G.O. (eds.): Facilities Location: Models and Methods. North Holland, New York (1988) 17. Mettu, R.R., Plaxton, C.G.: The online median problem. SIAM Journal of Computing 32(3), 816–832 (2003) 18. Mirchandani, P., Francis, R. (eds.): Discrete location theory. Wiley Interscience, Hoboken (1990) 19. Shenmaier, V.V.: An Approximate Solution Algorithm for the One-Dimensional Online Median Problem. Journal of Applied and Industrial Mathematics 2(3), 421– 425 (2008)
Approximation Scheme for Scheduling Resumable Proportionally Deteriorating Jobs Wenchang Luo1, and Lin Chen2 1
2
Faculty of Science, Ningbo University, Ningbo, 315211, China
[email protected] College of Computer Science, Zhejiang University, Hangzhou, 310027, China
[email protected]
Abstract. In this paper, we investigate the problem of scheduling resumable proportionally deteriorating jobs on a single machine with a non-availability constraint. The goal is to minimize the total completion time. We show the problem is NP-hard. Furthermore, we present a fully polynomial time approximation scheme (FPTAS). Keywords: Scheduling; Complexity; Resumable; Non-availability.
1
Proportionally
deteriorating;
Introduction
Scheduling with deteriorating jobs and scheduling with machine non-availability constraints are two important variants of the traditional scheduling problems and have been extensively investigated in the last two decades. For recent related surveys, we refer readers to [1] and [9]. Since 2003, problems of scheduling deteriorating jobs on a single machine with the non-availability constraints have begun to receive considerable attention (see [4] [5] [6] [7] [11]). In such problems, job processing is interrupted by the non-availability periods of a machine, during which the maintenance, for example, takes place. Generally there are 2 different versions with respect to the job preemption by the non-availability periods. One is the resumable version, the other is the non-resumable version. In the resumable version the processing of one job is preempted by the nonavailability periods of the machine and can be resumed later at no extra cost when the machine becomes available again. But in the non-resumable version the job preemption is not allowed, i.e., once the processing of one job is interrupted by the non-availability periods of the machine, it has to be restarted after the machine is available again. Motivated by the work of Gawiejnowicz and Kononov [5], in this paper we consider the problem of scheduling resumable proportionally deteriorating jobs on a single machine with a non-availability constraint to minimize the total completion time. More detailed description of this model is as follows.
Supported in part by NFSC (11071215) and Science Foundation of Ningbo University (No. xk1061).
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 36–45, 2011. c Springer-Verlag Berlin Heidelberg 2011
Scheduling Resumable Proportionally Deteriorating Jobs
37
Problem statement. We are given a set of n proportionally deteriorating jobs J = {J1 , J2 , · · · , Jn } to be processed on a single machine, all of which are available to be processed at time t0 (> 0). The machine, however, is not available all the time. A non-availability period [s, d] of the machine is given in advance, and the processing of each job can be only preempted by this interval [s, d] and resumed without extra cost when the machine becomes available. Let pj and Cj denote the processing time and the completion time of job Jj respectively. By saying proportionally deteriorating job we mean pj is defined as pj = αj sj , where αj (> 0) is the deteriorating rate of job Jj and sj (≥ t0 ) its starting time. We aim to schedule all these jobs such that the total completion time is minimized. Following the three-field notation of Graham et al. [3], we denote the problem as 1, r − na|pj = αj sj | j Cj . Related work. For scheduling proportionally deteriorating jobs on a single machine without non-availability constraints, Mosheiov [8] show that arbitrary order of the jobs achieves the same makespan and the smallest-deteriorating-rate (SDR) first rule gives the minimum total completion time. For scheduling proportionally deteriorating jobs on a single machine with a non-availability constraint in the non-resumable version, Ji et al. [6] consider the problems with the objectives of minimizing makespan as well as total completion time. They show that both problems are NP-hard and admit pseudo-polynomial time exact algorithms. An FPTAS is presented for the problem of minimizing makespan and a heuristic algorithm with numeric experiments is proposed for the problem of minimizing total completion time. For scheduling proportionally deteriorating jobs on a single machine with a non-availability constraint in the resumable version, Wu and Lee [11] first show the problem of minimizing makespan can be solved using the 0 − 1 integer program technique. Some special cases when the 0 − 1 integer program could be solved efficiently are discussed in their paper, yet the computational complexity of the general problem remains unknown. Very recently, Gawiejnowicz and Kononov [5] also consider the same problem proposed by Wu and Lee [11] and show that it is weakly NP-hard and also propose an FPTAS. Furthermore, they prove that instead of a single non-availability period, if two or more non-availability periods are allowed, then no polynomialtime approximation algorithm with a constant worst-case ratio exists, unless P=NP. Our results. In this paper, we first show that the problem 1, r − na|pj = αj sj | j Cj is NP-hard through reduction from the subset production problem. We observe that, every feasible schedule has at most one job preempted by the non-availability period of the machine, thus our algorithm starts by guessing which job is preempted in the optimum solution. Once this job is determined, dynamic programming for the remaining job yield a pseudo-polynomial time exact algorithm, and through the framework proposed by Woeginger [10] with some elaborate modification an FPTAS could then be derived.
38
W. Luo and L. Chen
The remainder of the paper is organized as follows. In section 2 we introduce some definitions which will be used in subsequent section. In Section 3 we show the problem is NP-hard. In Section 4 we propose an FPTAS. Some concluding remarks are given in Section 5.
2
Preliminaries
In this section, we introduce a lemma and some definitions used in subsequent section. The following lemma is due to Mosheiov [8] and will be used in our analysis. Lemma 1. Let a machine starting from time t0 , execute jobs from set J without idle times, and let the processing times of the jobs be in the form of pj = αj sj for j ∈ J, where J denotes the set of indices of these jobs, then the completion time of the last job from set J is equal to t0 j∈J (1 + αj ) and it does not depend on the order of the jobs. For problem 1, r −na|pj = αj sj | j Cj , without loss of generality we can assume n that t0 j=1 (1 + αj ) > s, since otherwise by Mosheiov [8], the SDR order of jobs in the set J = {J1 , J2 , · · · , Jn } gives an optimal schedule for the problem 1, r − na|pj = αj sj | j Cj . Given a schedule π, let (π(1), π(2), · · · , π(n)) denote the permutation of schedule π. We define the job which has been started before and completed strictly larger than the starting time s of non-availability period as a critical job. For schedule π, let π(k) be a critical job, i.e., sπ(k) < s and Cπ(k) > s. Then according to the resumable definition by Wu and Lee [11], the completion time of job Jπ(k) can be described as CJπ(k) = t0 kj=1 (1 + απ(j) ) + d − s. Following [5], an approximation algorithm is called ρ−approximation algorithm, if for a real number ρ > 1 it returns a solution which is at most ρ times worse than the optimal one. A family of (1 + ε)−approximation algorithms is called a polynomial time approximation scheme (PTAS), if for an arbitrary real number ε > 0 the running time of any algorithm from this family is polynomial. If in addition the PTAS is running in polynomial time with respect to 1/ε, it is called a fully polynomial time approximation scheme (FPTAS).
3
The Complexity
In this section by using the subset production problem for the reduction we show the problem 1, r − na|pj = αj sj | j Cj is NP-hard. Theorem 1. The problem 1, r − na|pj = αj sj | j Cj is NP-hard. Proof. To show that the problem is NP-hard, we use the subset production problem [2] for the reduction. Subset Production Problem: Given a finite set R = {1, 2, · · · , r}, a positive integer xj ∈ Z + for each j ∈ R, and a positive integer B, does there exist
Scheduling Resumable Proportionally Deteriorating Jobs
39
a subset R1 ⊆ R such that the product of the integers of the elements in R1 satisfies j∈R1 xj = B ? Given an arbitrary instance Isp of the subset product problem, we construct = α s | the corresponding instance I of problem 1, r − na|p j j j j Cj . Let X = j∈R xj and A = X/B. There are n = r + 5 proportionally deteriorating jobs to be processed on a single machine such that αj = xj − 1 for j = 1, 2, · · · , r and 5 large jobs αr+1 = XA−1, αr+2 = XB−1, αr+3 = αr+4 = X 3 −1, αr+5 = X 6 −1. All jobs are available after t0 = 1. The non-available period [s, d] of the machine satisfies s = t0 X 5 + 1 and d = s + t0 X 11 . Let G = t0 X 2 + t0 X 5 + 2t0 X 11 + 2(r + 1)t0 X 13 + 2t0 X 16 . For the constructed instance I, we show that a schedule π such that j Cj (π) ≤ G exists if and only if the instance Isp has a solution. To prove our result, we need the following lemmas. Lemma 2. (Ji et al. [6]) For any subset R1 ⊂ R, we have B j∈R\R1 xj + A j∈R1 xj ≥ 2X, and the equality holds if and only if j∈R1 xj = B and j∈R\R1 xj = A. Lemma 3. If there exists a schedule π for the instance I of problem 1, r − na|pj = αj sj | j Cj with the total completion time Z(π) ≤ G, where Z(π) denote the total completion time of schedule π, then the following claims hold: – (1) Job Jr+5 is the critical job; – (2) one of the jobs Jr+3 and Jr+4 is started before the non-availability period, and the other after the non-availability period; – (3) one of the jobs Jr+1 and Jr+2 is started before the non-availability period, and the other after the non-availability period. Proof. (1) we claim that job Jr+5 must be started before the non-availability period. Since if Jr+5 are started after the non-availability period, then Cr+5 ≥ (t0 X 5 + 1 + t0 X 11 )(1 + αr+5 ) = t0 X 11 + X 6 + t0 X 17 > G, which achieves a contradiction. (2) Assume that jobs Jr+3 and Jr+4 are started before the non-availability period, then job Jr+5 must be started after the non-availability period, which achieves a contradiction. Assume that jobs Jr+3 and Jr+4 are started after the non-availability period, then at least one of their completion times will be greater than (t0 (1 + αr+5 ) + t0 X 11 )(1 + αr+3 )(1 + αr+4 ) = t0 X 11 + t0 X 17 > G, which also achieves a contradiction. Thus the claim holds. (3)Assume that jobs Jr+1 and Jr+2 are started before the non-availability period, then from (2), either job Jr+3 or Jr+4 are started before the non-availability period. Then the maximum completion time of these jobs will be no less than t0 X 6 (> s), which achieves a contradiction. Assume that jobs Jr+1 and Jr+2 are started after the non-availability period, similarly we can achieve a contradiction. Thus the claim also holds. Now we come back to the proof of theorem 1. Assume that there exists a subset R1 ⊂ R satisfying j∈R1 xj = B (i.e., j∈R2 xj = A, where R2 = R\R1 ). Let S1 and S2 denote the the subset of
40
W. Luo and L. Chen
jobs corresponding to R1 and R2 , respectively. Construct a schedule π in the following way: Starting from t0 , first schedule the jobs in S1 according to SDR order, and jobs Jr+1 , Jr+3 , Jr+5 , then schedule the jobs in S2 according to SDR order with jobs Jr+2 , Jr+4 following them. For simplicity we denote the schedule π as π = (S1 , Jr+1 , Jr+3 , Jr+5 , [s, d], Jr+5 , S2 , Jr+2 , Jr+3 ). It can be easily seen that job Jr+5 encounter the non-availability period and be preempted, then be resumed after the non-availability period. We shall show that j Cj (π) ≤ G. Clearly we have Cr+1 = t0 (1 + αj )(1 + αr+1 ) = t0 X 2 , j∈S1
Cr+3 = Cr+1 (1 + αr+4 ) = t0 X 5 , Cr+5 = Cr+5 (1 + αr+5 ) + t0 X 11 = 2t0 X 11 , (1 + αj )(1 + αr+2 ) = 2t0 X 13 , Cr+2 = Cr+5 j∈S2
Cr+4 = Cr+2 (1 + αr+4 ) = 2t0 X 16 . Because Cj < Cr+2 = 2t0 X 13 for j = 1, 2, · · · , r, we conclude Z(π) ≤
r j=1
Cj +
5
Cr+k < t0 X 2 +t0 X 5 +2t0 X 11 +2(r +1)t0 X 13 +2t0 X 16 = G.
k=1
Conversely, assume that there exists a schedule π such that Z(π) ≤ G. By Lemma 3 and the fact that jobs Jr+3 and Jr+4 are the same, we only need to consider two cases. Case 1. Jobs Jr+1 and Jr+3 are started before the non-availability period, and jobs Jr+2 and Jr+4 are started after the non-availability period; Case 2. Jobs Jr+2 and Jr+3 are started before the non-availability period, and jobs Jr+1 and Jr+4 are started after the non-availability period. ˆ {J1 , J2 , · · · , Jr }) denote the jobs started after Consider Case 1. Let S2 ⊂ J(= ˆ 2 . Then the the non-availability period except the 5 large jobs and S1 = J\S completion time of the job Jr+5 is Cr+5 = t0 (1 + αj )(1 + αr+1 )(1 + αr+3 )(1 + αr+5 ) + t0 X 11 j∈S1
= t0 X 10 (A
(1 + αj )) + t0 X 11 ,
j∈S1
and the completion time of the job Jr+4 is (1 + αj )) + t0 X 11 ) (1 + αj )(1 + αr+2 )(1 + αr+4 ) Cr+4 = (t0 X 10 (A j∈S1
j∈S2
Scheduling Resumable Proportionally Deteriorating Jobs
= t0 X 16 + t0 X 15 (B
41
(1 + αj )).
j∈S2
Hence, we have Z(π) > Cr+5 + Cr+4 = t0 X 10 (A
(1 + αj )) + t0 X 11 + t0 X 16
j∈S1 15
+t0 X (B
(1 + αj ))
j∈S2
= t0 X 11 + t0 X 16 + t0 X 15 (B −(t0 X 15 − t0 X 10 )(A
(1 + αj ) + A
j∈S2
(1 + αj ))
j∈S1
(1 + αj )).
j∈S1
5 ByLemma 3 we have t0 j∈S1 (1 + α j )(1 + αr+1 )(1 + αr+3 ) ≤ t0 X + 1, i.e., A j∈S1 (1 + αj ) ≤ X, which implies j∈S1 (1 + αj ) ≤ B. Now suppose there is nosolution for the instance Isp , then j∈S1 (1+α j ) < B. ByLemma 2, we have B j∈S2 xj + A j∈S1 xj > 2X, and thus B j∈S2 xj + A j∈S1 xj ≥ 2X + 1. With some simple calculations we conclude Z(π) > t0 X 11 + t0 X 16 + 2t0 X 16 + t0 X 15 − (t0 X 15 − t0 X 10 )(A
(1 + αj ))
j∈S1
> t0 X 11 + t0 X 16 + 2t0 X 16 + t0 X 15 − (t0 X 15 − t0 X 10 )X > 2t0 X 11 + 2t0 X 16 + t0 X 15 > G, which achieves a contradiction, thus j∈S1 (1 + αj ) = B, i.e., there exists a solution for instance Isp . For Case 2, the proof is similar to Case 1, and we omit it.
4
An FPTAS
In this section, we propose an FPTAS for the problem 1, r−na|pj = αj sj | j Cj . From the proof of the complexity, we know that choosing the right job to be the critical job is the most important, thus our algorithm starts by guessing the critical job of the optimum solution. For each guess a dynamic programming is then proposed, then utilizing the framework by Woeginger [10] with some elaborate modification we transform the dynamic programming into an FPTAS. The following lemma can be easily proved by using the interchange argument. Lemma 4. In the optimal schedule, the jobs scheduled before the critical job are scheduled according to the smallest deteriorating rate (SDR) first order, and so are the jobs after the critical job.
42
W. Luo and L. Chen
Dynamic programming Without loss of generality we assume the critical job in the optimal schedule is Jc and the corresponding deteriorating rate is αc . For the critical job Jc , clearly there exists n possible choices. For each choice, we execute the following dynamic programming. First we remove the critical job, then by Lemma 4 we renumber the remaining jobs according to SDR order, i.e., α1 ≤ α2 ≤, · · · , ≤ αn−1 . Consider the first i jobs (0 ≤ i ≤ n − 1), we use a five-dimensional vector [i, F1 , F2 , Z1 , Z2 ] as a state to encode a schedule, where i denotes the first i jobs that we currently scheduled, F1 denotes the maximum completion time of jobs completed before the non-availability period (i.e., before s), F2 denotes the maximum product j:sj >d (1 + αj ) of jobs started after the non-availability period (i.e., after d) and Z1 denotes the the total completion time of all the jobs completed before s, Z2 denotes the sum of product j:sj >d (1 + αj ) of all the jobs started after d. The state space V Si consists of all five-dimensional vectors for schedules for the first i jobs. For i = 1, the state space contains [1, t0 (1+α1 ), 1, t0 (1+α1), 1] and [1, t0 , (1+α1 ), 0, (1+α1 )] two elements. For i ≥ 2, every state [i−1, F1 , F2 , Z1 , Z2 ] in state space V Si−1 can be extended either by assigning job Ji before s or by assigning job Ji after d. This yields the following two states in V Si : [i, F1 + αi F1 , F2 , Z1 + (1 + αi )F1 , Z2 ] and [i, F1 , F2 (1 + αi ), Z1 , Z2 + F2 (1 + αi )]. States with F1 ≤ s are called feasible and all unfeasible states are then deleted. To the end, for each choice on the critical job (at most n choices), we obtain the objective value from V Sn−1 by minimizing Z = Z1 +F1 (1+αc )+d−s+(F1 (1+αc )+d−s)F2 for all [n − 1, F1 , F2 , Z1 , Z2 ] ∈ V Sn−1 and in last choose the minimal objective value as the optimal solution. The above dynamic programming runs in O(n4 s2 ( nj=1 (1 + αj ))2 ) time and is pseudo-polynomial. Next we describe the details about how to transform the above dynamic programming into an FPTAS by applying the framework proposed by Woeginger [10] with elaborate modification. Now, we provide the Algorithm H1 as follows. Algorithm H1 Step 1. For each choice on the critical job Jc = {J1 , J2 , · · · , Jn }, first we remove the critical job, then renumber the remaining jobs according to SDR order, i.e., α1 ≤ α2 ≤, · · · , ≤ αn−1 . Step 2. Let Δ = 1 + ε/(2(n − 1)), we split – the interval [t0 , s] into q1 = logΔ s/t0 subintervals [t0 , t0 Δ], · · · , [t0 Δk , t0 Δk+1 ], · · · , [t0 Δq1 −1 , s]; n−1 n−1 – the interval [1, j=1 (1 + αj )] into q2 = logΔ j=1 (1 + αj ) subintervals n−1 [1, Δ], · · · , [Δk , Δk+1 ], · · · , [Δq2 −1 , j=1 (1 + αj )]; – the interval [t0 , (n − 1)s] into q3 = logΔ(n − 1)s/t0 subintervals [t0 , t0 Δ], · · · , [t0 Δk , t0 Δk+1 ], · · · , [t0 Δq3 −1 , (n − 1)s];
Scheduling Resumable Proportionally Deteriorating Jobs
43
n−1 n−1 – and the interval [1, (n − 1) j=1 (1+αj )] into q4 = logΔ (n − 1) j=1 (1 + αj ) n−1 subintervals [1, Δ], · · · , [Δk , Δk+1 ], · · · , [Δq4 −1 , (n − 1) j=1 (1 + αj )] . Then we construct a four-dimension grid with the boxes Ik1 k2 k3 k4 , 1 ≤ k1 ≤ q1 , 1 ≤ k2 ≤ q2 , 1 ≤ k3 ≤ q3 , 1 ≤ k4 ≤ q4 . Step 3. Let V S1 = V S1 = {[1, t0 (1 + α1 ), 1, t0 (1 + α1 ), 1], [1, t0 , 1 + α1 , 0, 1 + α1]}. , do the For i ∈ {2, 3, · · · , n − 1}, for every state [i − 1, F1 , F2 , Z1 , Z2 ] in V Si−1 following. 1. If F1 + αi F1 ≤ s, put [i, F1 + αi F1 , F2 , Z1 + (1 + αi )F1 , Z2 ] into V Si . 2. Put [i, F1 , F2 (1 + αi ), Z1 , Z2 + (1 + αi )F2 ] into V Si . For the states in the same box we choose the state with minimum F1 and remove all the other states, i.e., reduce the state space V Si into V Si . Step 4. Output the vector [n − 1, F1 , F2 , Z1 , Z2 ] that minimize the value Z = Z1 + (F1 (1 + αc ) + d − s) + (F1 (1 + αc ) + d − s)Z2 and denote the corresponding schedule as π(c). Step 5. Output the schedule π = arg min1≤c≤n Z(π(c)) as the solution, where Z(π(c)) denote the objective value of schedule π(c). To show that Algorithm H1 is an FPTAS for the problem 1, r − na|pj = αj sj | j Cj , we give the following lemmas.
Lemma 5. Every state [i, F1 , F2 , Z1 , Z2 ] in the (un-reduced) state space V Si satisfies F1 ≤ F1 ≤ F1 Δi , F2 /Δi ≤ F2 ≤ F2 Δi , Z1 /Δi ≤ Z1 ≤ Z1 Δi and Z2 /Δi ≤ Z2 ≤ Z2 Δi , where the state [i, F1 , F2 , Z] is in the reduced state space V Si . Proof. For i = 1, we have V Si = V Si . Hence, the statement is trivial. Now assume that the statement is true up to i − 1. Consider an arbitrary state [i, F1 , F2 , Z1 , Z2 ] in V Si . The dynamic program ming algorithm puts the state [i, F1 , F2 , Z1 , Z2 ] into V Si when it assign job Ji from some feasible state for the first i − 1 jobs. Let [i − 1, F1∗ , F2∗ , Z1∗ , Z2∗ ] be the feasible state that yields the state [i, F1 , F2 , Z1 , Z2 ]. Two cases can be dis tinguished: either [i, F1 , F2 , Z1 , Z2 ] = [i, F1∗ + αi F1∗ , F2∗ , Z1∗ + (1 + αi )F1∗ , Z2∗ ] or [i, F1 , F2 , Z1 , Z2 ] = [i, F1∗ , F2∗ + αi F2∗ , Z1∗ , Z2∗ + (1 + αi )F2∗ ].
Case 1. [i, F1 , F2 , Z1 , Z2 ] = [i, F1∗ + αi F1∗ , F2∗ , Z ∗ + (1 + αi )F1∗ , Z2∗ ]. Since [i − 1, F1∗ , F2∗ , Z1∗ , Z2∗ ] ∈ V Si−1 , there exists [i − 1, F1 , F2 , Z1 , Z2 ] ∈ such that F1 ≤ F1∗ ≤ F1 Δi−1 , F2 /Δi−1 ≤ F2∗ ≤ F2 Δi−1 , Z1 /Δi−1 ≤ V Si−1 ∗ Z1 ≤ Z1 Δi−1 and Z2 /Δi−1 ≤ Z2∗ ≤ Z2 Δi−1 . Consequently, the state [i, F1 + αi F1 , F2 , Z1 + (1 + αi )F1 , Z2 ] is generated. However, it may be removed when the state space is reduced. Let [i, F1 , F2 , Z1 , Z2 ] be the state chosen in V Si such that it is in the same box with [i, F1 + αi F1 , F2 , Z1 + (1 + αi )F1 , Z2 ], i.e., F1 ≤ F1 + αi F1 ≤ F1 Δ, F2 /Δ ≤ F2 ≤ F2 Δ, Z1 /Δ ≤ Z1 + (1 + αi )F1 ≤ ZΔ and Z2 /Δ ≤ Z2 + (1 + αi )F1 ≤ Z2 Δ. With some simple calculations we have
44
W. Luo and L. Chen
F1 ≤ F1∗ +αi F1∗ ≤ F1 Δi , F2 /Δi ≤ F2∗ ≤ F2 Δi , Z1 /Δi ≤ Z1∗ +(1+αi )F1∗ ≤ Z1 Δi and Z2 /Δi ≤ Z2∗ ≤ Z2 Δi .
Case 2. [i, F1 , F2 , Z1 , Z2 ] = [i, F1∗ , F2∗ + αi F2∗ , Z1∗ , Z2∗ + (1 + αi )F2∗ ]. The proof is similar to Case 1. We omit it.
Lemma 6. The size of every reduced state space V Si is polynomial bounded by O(n7 (logD)4 /ε4 ), where D = max{s, (1 + αj ), j = 1, · · · , n}. Proof. Clearly, when Algorithm H1 is executed, every box in four-dimension grid contains at most one state, there are at most logΔ q1 logΔ q2 logΔ q3 logΔ q4 boxes, i.e., every state space V Si contains at most logΔ q1 logΔ q2 logΔ q3 logΔ q4 states. Then the size of V Si is bounded from above by logΔ q1 logΔ q2 logΔ q3 logΔ q4 ≤ O(n7 (logD)4 /ε4 ). Lemma 7. Algorithm H1 is an FPTAS running in O(n9 (logD)4 /ε4 ) time. Proof. Let Jc∗ be the critical job and [n − 1, F1∗ , F2∗ , Z1∗ , Z2∗ ] be the state that yields the optimal objective value, then Z ∗ = Z1∗ + (F1∗ (1 + α∗c ) + d − s) + (F1∗(1 + in which the α∗c ) + d − s)Z2∗ . Clearly there exists a reduced state space V Sn−1 critical job is Jc∗ . By Lemma 5, V Sn−1 contains a state [n − 1, F1 , F2 , Z1 , Z2 ] such that F1 ≤ F1∗ , F2 ≤ F2∗ Δn−1 , Z1 ≤ Z1∗ Δn−1 , Z2 ≤ Z2∗ Δn−1 . Let Z = Z1 + (F1 (1 + α∗c ) + d − s) + (F1 (1 + α∗c ) + d − s)Z2 . Thus Z ≤ Z1∗ Δn−1 + (F1∗ (1 + α∗c ) + d − s) + (F1∗ (1 + α∗c ) + d − s)Z2∗ Δn−1 , i.e., Z ≤ Z ∗ Δn−1 ≤ Z ∗ (1 + ε/(2(n − 1))n−1 ≤ (1 + ε)Z ∗ , where the inequality (1 + x/m)m ≤ 1 + 2x for real numbers x with 0 ≤ x ≤ 1 and for integer m ≥ 1 is adopted. Clearly by Step 5 in Algorithm H1 we have Z(π) ≤ (1 + ε)Z ∗ . Because there is at most n choices for the critical job, by Lemma 6 Algorithm H1 runs in O(n9 (logD)4 /ε4 ) time.
5
Concluding Remarks
In this paper, we studied the problem of scheduling resumable proportionally deteriorating jobs on a single machine with a non-availability period. The goal is to minimize the total completion time. We show that the problem is NP-hard. Furthermore, we propose an fully polynomial time approximation scheme. It is challenging to design a fast approximation algorithm with the worst-case ratio of 2.
References 1. Cheng, T.C.E., Ding, Q., Lin, B.M.T.: A concise survey of scheduling with timedependent processing time. European Journal of Operation Research 152, 1–13 (2004) 2. Garey, M.R., Johnson, D.S.: Computer and Intractability: A Guide to the Theory of NP-Completeness. Freeman, San Francisco (1979)
Scheduling Resumable Proportionally Deteriorating Jobs
45
3. Graham, R.L., Lawler, E.L., Lenstra, J.K., Rinnooy Kan, A.H.G.: Optimization and approximation in deterministic sequencing and scheduling: A survey. Annals of Discrete Mathematics 5, 287–326 (1979) 4. Gawiejnowicz, S.: Scheduling deteriorating jobs subject to job or machine availability constraints. European Journal of Operational Research 180, 472–478 (2007) 5. Gawiejnowicz, S., Kononov, A.: Complexity and approximability of scheduling resumable proportionally deteriorating jobs. European Journal of Operational Research 200, 305–308 (2010) 6. Ji, M., He, Y., Cheng, T.C.E.: Scheduling linear deteriorating jobs with an availability constraint on a single machine. Theoretical Computer Science 362, 115–126 (2006) 7. Ji, M., Cheng, T.C.E.: Scheduling resumable simple linear deteriorating jobs on a single machine with an availability constraint to minimize makespan. Computers & Industrial Engineering 59(4), 794–798 (2010) 8. Mosheiov, G.: Scheduling jobs under simple linear deterioration. Computers & Operations Research 21, 653–659 (1994) 9. Ma, Y., Chu, C., Zuo, C.: A survey of scheduling with deterministic machine availability constraints. Computers & Industrial Engineering 58, 199–211 (2010) 10. Woeginger, G.J.: When does a dynamic programming formulation guarantee the existence of a fully polynomial time approximation scheme (FPTAS)? Informs Journal on Computing 12, 57–75 (2000) 11. Wu, C.C., Lee, W.C.: Scheduling linear deteriorating jobs to minimize makespan with an availability constraint on a single machine. Information Processing Letters 87, 89–93 (2003)
An Improved Approximation Algorithm for the Complementary Maximal Strip Recovery Problem Zhong Li1 , Randy Goebel1 , Lusheng Wang2 , and Guohui Lin1, 1
Department of Computing Science, University of Alberta, Edmonton, Alberta T6G 2E8, Canada 2 Department of Computer Science, City University of Hong Kong, Kowloon, Hong Kong, China {zhong4,rgoebel,guohui}@ualberta.ca,
[email protected]
Abstract. Given two genomic maps G1 and G2 each represented as a sequence of n gene markers, the maximal strip recovery (MSR) problem is to retain the maximum number of markers in both G1 and G2 such that the resultant subsequences, denoted as G∗1 and G∗2 , can be partitioned into the same set of maximal strips, which are common substrings of length greater than or equal to two. The complementary maximal strip recovery (CMSR) problem has the complementary goal to delete the minimum number of markers. Both MSR and CMSR have been shown NP-hard and APX-complete, and they admit a 4-approximation and a 3-approximation respectively. In this paper, we present an improved 7 -approximation algorithm for the CMSR problem, with its worst-case 3 performance analysis done through a sequential amortization. Keywords: Maximal strip recovery, approximation algorithm, sequential amortized analysis.
1
Introduction
In comparative genomics, one of the first steps is to decompose two given genomes into syntenic blocks — segments of chromosomes that are deemed homologous in the two input genomes. Many decomposition methods have been proposed, but they are vulnerable to ambiguities and errors, which are isolated points that do not co-exist with other points in genomic maps [4,10]. The maximal strip recovery (MSR) problem was formulated for eliminating these noise and ambiguities. In the more precise formulation, we are given two genomic maps G1 and G2 each represented as a sequence of n distinct gene markers (which form the alphabet Σ), and we want to retain the maximum number of markers in both G1 and G2 such that the resultant subsequences, denoted as G∗1 and G∗2 , can be partitioned into the same set of maximal strips, which are common substrings of length greater than or equal to two. Each retained marker thus belongs to
Correspondence author.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 46–57, 2011. c Springer-Verlag Berlin Heidelberg 2011
Approximating the Complementary MSR Problem
47
exactly one of these substrings, which can appear in the reversed and negated form and are taken as nontrivial chromosomal segments. The deleted markers are regarded as noise or errors. The MSR problem, and its several close variants, have been shown NPhard [9,2,3]. More recently, it is shown to be APX-complete [6], admitting a 4-approximation algorithm [3]. This 4-approximation algorithm is a modification of an earlier heuristics for computing a maximum clique (and its complement, a maximum independent set) [4,10], to convert the MSR problem to computing the maximum independent set in t-interval graphs, which admits a 2t-approximation [1,3]. In this paper, we investigate the complementary optimization goal to minimize the number of deleted markers — the complementary MSR problem, or CMSR for short. CMSR is certainly NP-hard, and was proven to be APX-complete recently [7], admitting a 3-approximation algorithm [5]. Our main result is an improved 73 -approximation algorithm for CMSR. As we will show later, the key design technique is a local greedy scheme to retain the most possible isolates while deleting some isolate(s); and the performance ratio is proven using a novel technique called delayed sequential amortized analysis. Some preliminary ideas of the design and analysis have appeared in [5].
2
Preliminaries
In the sequel, we use a lower case letter to denote a gene marker. A negation sign together with the succeeding gene indicate that the gene is in its reversed and negated form. We reserve the bullet symbol “•” for connection use, that is, a • b means gene b comes directly after gene a (in a specific sequence). When a common substring (also called strip, or syntenic block) of the two current target sequences (G1 and G2 , or their remainders after deleting some letters) is specified, it is of length greater than or equal to two, unless otherwise explicitly stated that it is a single letter; The substring will (often) be labeled using a capital letter. We abuse this capital letter a bit to also denote the set of gene markers in the substring, when there is no ambiguity. We present several important structural properties of the CMSR problem in this section, which are used in the design of the approximation algorithm and its performance analysis in the next section. We first look at a warm-up instance. In this instance, G1 = a, b, c, d, e, f, g, h, i, j, k, and G2 = −i, −d, −g, −f, h, a, c, b, −, −k, −j, −e (commas are used to separate the gene markers for easier reading). By deleting markers c, d, e, and h from both G1 and G2 , the remainder sequences are G∗1 = a, b, f, g, i, j, k, and G∗2 = −i, −g, −f, a, b, −, −k, −j. These two remainder sequences can be decomposed into three maximal common substrings S1 = a • b, S2 = f • g • i (appearing in the reversed and negated form in G∗2 ), and S3 = j • k • (appearing in the reversed and negated form in G∗2 ). In the rest of the paper, we use OP T to denote an optimal solution to the instance of the CMSR problem. That is, OP T is a minimum-size subset of letters that, deleting them from G1 and G2 gives the remainder sequences, denoted G∗1 and G∗2 , respectively, which can be partitioned into maximal common substrings.
48
Z. Li et al.
Given any CMSR instance, in at most quadratic time, we can determine all maximal common substrings of G1 and G2 (of length at least two) and the isolated letters that do not belong to any of the common substrings. We use unit to refer to a maximal common substring or an isolated letter. A unit and its reversed and negated form are considered identical. The above determined units form a common partition of G1 and G2 , i.e., every letter occurs in exactly one of these units. For ease of presentation, these maximal common substrings are called type-0 substrings; the isolated letters are called isolates. Note that every letter appears exactly once in each of the two sequences G1 and G2 ; for distinction purpose we use an isolate copy to refer to exactly one copy of the isolate. In our algorithm Approx-CMSR to be presented in the next section, all the type-0 substrings are kept in the final sequences and our goal is to eliminate the isolates, by either deleting them from the input sequences, or to “merge” them into substrings while deleting some other isolates from the input sequences. Here “merging” refers to either appending an isolate to some existing substring, or forming two isolates into a novel common substring, which is called a type-1 substring. Lemma 1. [5] For any CMSR instance, there exists an optimal solution OP T such that 1) for each type-0 substring S, either S ⊆ OP T or S ∩ OP T = ∅; 2) if |S| ≥ 4, then S ∩ OP T = ∅. The above Lemma 1 tells that in the optimal solution, for every type-0 substring, either all its letters are deleted or none of them is deleted. We partition OP T into a subset O3 of length-3 type-0 substrings, a subset O2 of length-2 type-0 substrings, and a subset O1 of isolates: OP T = O3 ∪ O2 ∪ O1 . These substrings and isolates are referred to as units of OP T in the sequel. 2.1
Favorable Operations
Consider an isolate x in the given sequences G1 and G2 . For ease of presentation we append an imaginary type-0 substring H to the head of G1 and to the tail of G2 , and another imaginary type-0 substring T to the tail of G1 and to the head of G2 . It follows that x has exactly four neighboring letters in G1 and G2 — duplicates are counted separately. Assume without loss of generality that the two neighboring letters in G1 are a and b, and the two neighboring letters in G2 are c and d. In the most extreme case, {a, b, c, d} reduces to a set of two isolates (see the first row in Table 1) and deleting x enables the merging of a and b into a novel length-2 substring. (Remark: There is another possible configuration where a • x • b appears in G1 and a • −x • b appears in G2 , which can be identically discussed. For the same reason, in the following operations, reversed and negated gene form is skipped.) Such a scenario is favorable in the sense that a gain of one letter is achieved — deleting one while keeping two. Our algorithm ApproxCMSR will execute the deleting and the subsequent merging, referred to as an operation 1, which is given the top priority.
Approximating the Complementary MSR Problem
49
In another interesting case, a • b appears in G2 and c • d appears in G1 . When these four letters are distinct isolates (see the second row in Table 1), then deleting x enables the merging of a and b and the merging of c and d into two novel length-2 substrings. Such a scenario is also favorable for a gain of three letters. Our algorithm Approx-CMSR will execute the deleting and the subsequent merging, referred to as an operation 2, which is also given the top priority. Table 1. Nine different isolate elimination operations with three levels of priorities, where a smaller number indicates a higher priority. In these operations, lower case letters are isolates, while the capital ones are existing substrings. Priority Operation Local configuration 1
1
. . . aj • xj • bj . . . . . . − bj • xj • −aj . . .
2
. . . aj • xj • bj . . . cj • dj . . . . . . aj • bj . . . cj • xj • dj . . .
3
. . . aj • xj • bj . . . cj • S . . . . . . aj • bj . . . cj • xj • S . . .
4
. . . aj • xj • S1 . . . cj • S2 . . . . . . aj • S1 . . . cj • xj • S2 . . .
5
. . . aj • xj • S . . . . . . aj • S . . .
6
Comments Uj = {xj }; Vj = {aj , bj } aj , bj , cj , dj distinct; Uj = {xj }; Vj = {aj , bj , cj , dj } aj , bj , cj distinct; Uj = {xj }; Vj = {aj , bj , cj } Uj = {xj }; Vj = {aj , cj }
Uj = {xj }; Vj = {aj } a , b , c , d , e distinct; . . . aj • xj • bj • yj • cj . . . dj • ej . . . j j j j j Uj = {xj , yj }; . . . aj • bj • cj . . . dj • xj • yj • ej . . . Vj = {aj , bj , cj , dj , ej }
2
7
. . . aj • xj • bj . . . . . . aj • bj . . .
3
8
. . . aj • xj • yj • bj . . . . . . aj • bj . . .
9
. . . aj • xj • bj . . . . . . aj • yj • bj . . .
Uj = {xj }; Vj = {aj , bj } Uj = {xj , yj }; Vj = {aj , bj } Uj = {xj , yj }; Vj = {aj , bj }
If exactly one of these four letters, say d, resides in an existing substring S and the other three are distinct isolates (see the third row in Table 1), then deleting x enables the merging of a and b and the appending of c to S. This scenario is also favorable in the sense that a gain of two letters is achieved. Our algorithm Approx-CMSR will execute the deleting and the subsequent merging
50
Z. Li et al.
and appending, referred to as an operation 3, which is given the top priority too. If exactly two of these four letters reside in substrings (see the 4th row in Table 1) such that deleting x enables two separate appending of the neighboring isolates to the two substrings respectively, it is also favorable for a gain of one letter. Approx-CMSR will execute the deleting and the subsequent appending, referred to as an operation 4, which is given the top priority too. There are two other top priority operations. In an operation 5, deleting x enables one appending of a neighboring isolate to a substring, for zero gain of letters (see the 5th row in Table 1). As one sees, both operations 3 and 4 are special cases of an operation 5, with additional gains out of deleting the other copy of isolate x. In an operation 6, the neighborhood of isolate x overlaps with the neighborhood of another isolate y (see the 6th row in Table 1), such that deleting x and y simultaneously enables the formation of a novel length-2 substring and a novel length-3 substring, using the involved five distinct neighboring isolates in the union of the two neighborhoods. An operation 6 has a gain of three letters. Notice that wherever an operation 6 can be applied, deleting one and only one of x, y, and b enables a merging of two its neighboring isolates into a novel length-2 substring. For example, from the 6th row in Table 1, deleting b enables the merging of x and y. It is however very important to recognize that in this scenario both x and y should be deleted. The operation 7, in which one isolate is deleted and its two neighboring isolates are merged into a novel length-2 substring (see the 7th row in Table 1), has a lower priority than all the above six operations. This might look odd since an operation 7 has a gain of one letter, seemingly better than an operation 5; but giving it a lower priority is crucial in the proof of performance guarantee in Lemma 9, where we cannot afford to execute an operation 7 to delete isolate b and form substring x • y, which prevents the formation of substrings a • c and d • e. Also as one sees (analogous to operations 3 and 4 against an operation 5), both operations 2 and 3 are special cases of an operation 7, with additional gains out of deleting the other copy of isolate x. The last two operations have the lowest priority, in both of which two isolates x and y are deleted and (only) one novel length-2 substring is formed using their two neighboring isolates a and b. In an operation 8, x and y reside in between a and b in one sequence, while a and b are adjacent in the other sequence (see the 8th row in Table 1); In an operation 9, x and y reside in between a and b separately one in each of the two sequences (see the 9th row in Table 1). These two operations must have a lower priority than an operation 7, which means the removal of the other copy of x or y does not save any other isolate, a condition used in the proofs of their performance guarantees in Lemma 9.
3
A 73 -Approximation Algorithm
We assume at hand an optimal solution OP T stated in Lemma 1, and it is partitioned into O3 , O2 , and O1 .
Approximating the Complementary MSR Problem
3.1
51
The Approx-CMSR Algorithm
In the first step of our approximation algorithm, denoted as Approx-CMSR, it retains all type-0 substrings. That is, Approx-CMSR will only delete isolates from the input sequences (in the second and the third steps). In the second step, Approx-CMSR iteratively removes one or two isolates; the candidate isolates have to be in one of the nine cases listed in Table 1, and the one with the top priority is chosen (tie breaks arbitrarily) for removal at the time of consideration. In each of the nine cases, the isolate removal can give rise to a novel length-2 or length-3 common substring to the remainder sequences (all except operations 4 and 5), and/or allow an isolate to be appended to an existing common substring in the remainder sequences (operations 3, 4, and 5). If a novel common substring is formed, it is referred to as a type-1 substring; if an existing substring is extended, it retains its type for ease of presentation. The involved isolates, in either scenario, lose their isolate identity and are retained by Approx-CMSR. Algorithm Approx-CMSR: Input: two sequences (permutations) G1 and G2 on the same set of letters. Output: two subsequences of G1 and G2 respectively, that can be partitioned into maximal common substrings of length at least 2. 1. Determines all type-0 substrings of G1 and G2 , and retains them; 2. While (there are feasible operations in the current sequences G1 and G2 ), do 2.1. finds an operation of the currently highest priority; 2.2. removes the letters of Uj from G1 and G2 ; 2.3. retains the letters of Vj in G1 and G2 by forming appropriate substrings; 3. Deletes all the remaining isolates from G1 and G2 . Fig. 1. A high-level description of the algorithm Approx-CMSR
Let U = {U1 , U2 , . . . , Um }, where Uj denotes the set of isolates deleted by Approx-CMSR in the j-th iteration of the second step. Associated with each Uj , for j = 1, 2, . . . , m, let Vj denote the set of isolates that are retained by ApproxCMSR in the j-th iteration. In Table 1, the Uj and Vj for each of the nine operations are specified. Let R denote the set of remaining isolates at the time the algorithm finds no operations to execute (at the end of the m-th iteration). In the third (the last) step of the algorithm, Approx-CMSR deletes all letters of R from the two sequences. A high-level description of the algorithm Approx-CMSR is depicted in Figure 1. 3.2
Performance Analysis
m Let U = ∪m j=1 Uj and V = ∪j=1 Vj . The following two lemmas state some preliminary observations on algorithm Approx-CMSR.
52
Z. Li et al.
Lemma 2. The set of all isolates is the union of the disjoint sets U1 , U2 , . . . , Um , V1 , V2 , . . . , Vm , and R, that is, U ∪ V ∪ R; Algorithm Approx-CMSR deletes exactly all isolates of U ∪ R. Lemma 3. (Once adjacent, always adjacent) In the j-th iteration of algorithm Approx-CMSR, for j = 1, 2, . . . , m, if two letters aj and bj (at least one of them is an isolate of Vj , while the other can be in Vj too or inside an existing substring) are made adjacent into a common substring, then aj and bj are maintained adjacent toward the termination of the algorithm. Moreover, in the two original input sequences G1 and G2 , all the letters in between aj and bj belong to ∪ji=1 Ui . Lemma 4. Assume two letters aj and bj are made adjacent into a common substring in the j-th iteration of algorithm Approx-CMSR, for some j = 1, 2, . . . , m. If both aj and bj are kept in G∗1 and G∗2 but they are not adjacent to each other, then they do not reside in the same substring of G∗1 and G∗2 . Proof. Due to space limit, the detailed proof is provided in [8].
We use W to denote the set of such isolates aj ∈ Vj − O1 , which is adjacent to bj in the Approx-CMSR output but does not reside with bj in the same substring of G∗1 and G∗2 . Note that there are two possible cases, in one case bj is not kept in G∗1 and G∗2 at all, while in the other case bj is kept but resides in a different substring. We have the following lemma. Lemma 5. For any j = 1, 2, . . . , m, if O1 ∩ (Uj ∪ Vj ) = ∅, then Vj ⊆ W . Proof. Due to space limit, the detailed proof is provided in [8].
In the sequel, we estimate the size of U ∪ R in terms of the size of OP T . We do this by attributing all isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 , where V 8 is defined after Definition 1 as a subset of V , to the letters of OP T , through a sequential amortized analysis, and prove that every letter of OP T is attributed with at most 73 isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 . Note that W ⊆ (V − O1 ). When an isolate x of U ∪R and an isolate w of W are identified as a pair, we say they cancel out each other in the sense that, to whichever letter o ∈ OP T w is attributed, w is replaced by x at the end of the attribution process. That is, these attributed isolates of W relay the isolates of U ∪ R during the attribution process. For ease of presentation, we create a bin B to load the letters of OP T once they are proven to be attributed with 73 isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 . Consider the inverse process of deleting units of OP T from G1 and G2 to obtain the optimal subsequences G∗1 and G∗2 . In this inverse process, we add the units of OP T back to G∗1 and G∗2 using their original positions in G1 and G2 to re-construct G1 and G2 . At the beginning of this process, there are no isolated letters in G∗1 and G∗2 ; each isolate of U ∪ V ∪ R thus either is a unit of O1 , or is in some substring of G∗1 and G∗2 but then singled out at some point of the inverse process when inserting a unit of OP T back into G∗1 and G∗2 , which breaks the substring (or one of its fragments if already broken) into fragments, one of which is the single isolate. In either case, when the isolate is known to be in U ∪ R ∪ (V − O1 ) ∪ V 8 , it is
Approximating the Complementary MSR Problem
53
generated by the inserting unit of OP T and is thus attributed to the unit. Since there could be multiple units of OP T that are able to single out this particular isolate, we will set up the conditions for proper attribution, according to the order of the isolates deleted by algorithm Approx-CMSR. At any time of the process, inserting one unit of OP T back to the current G1 and G2 can generate at most four single-letter fragments, since in the worst case two current length-2 substrings, one in each of current sequences G1 and G2 , can be broken into four such fragments. We firstly insert units of O3 and O2 , one by one; all the isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 that are singled out by inserting a unit of O3 ∪ O2 are attributed to the unit. Lemma 6 summarizes this fact that every letter in a unit/substring of O3 ∪ O2 is classified into B. The resultant sequences are denoted as G01 and G02 . Lemma 6. Every letter in a substring of O3 ∪ O2 is in B. Proof. Due to space limit, the detailed proof is provided in [8].
Consider an isolate x ∈ U ∪ R that resides in a common substring of G01 and G02 . Let x • y be the adjacency in G01 and G02 , such that in the inverse process when it is broken x becomes an isolated letter. Since inserting all units of O1 has to single x out, we conclude that there are units of O1 residing in between x and y in the original sequences G1 and G2 . Denote this subset of units of O1 as X, inserting each of which back into G01 and G02 will break the adjacency between x and y. If X contains more than one unit, then two of them are attributed with half of x each; If X contains exactly one unit, then this unit is attributed with the whole x. This is the attributed rule to be followed in the subsequent inverse process. We next insert isolates of O1 ∩ (Uj ∪ Vj ) back into G01 and G02 , for j = 1, 2, . . . , m, sequentially, and show that they all belong to bin B. Right after inserting isolates of O1 ∩ (Uj ∪ Vj ), the achieved sequences are denoted as Gj1 and Gj2 . We emphasize that this sequential order is very important, as we need it in the proof of Lemma 9, each of which counts the number of isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 that are attributed to the isolates of O1 ∩ (Uj ∪ Vj ), when one of the nine different operations is executed in the j-th iteration of algorithm Approx-CMSR. Lemma 7. For any j = 1, 2, . . . , m, 1) a letter of Uj and a letter not of Uj cannot reside in the same substring of Gj1 and Gj2 ; 2) except that algorithm Approx-CMSR executes an operation 8 in the j-th iteration, letters of Uj are isolates in Gj1 and Gj2 . Proof. Due to space limit, the detailed proof is provided in [8].
Lemma 8. In the j-th iteration of algorithm Approx-CMSR, for j = 1, 2, . . . , m, assume two letters aj and bj are made adjacent into a common substring. If aj ∈ W and aj • z is an adjacency in G∗1 and G∗2 such that z ∈ / Uj , then this j−1 and G . adjacency is not broken by inserting bj into Gj−1 1 2
54
Z. Li et al.
Proof. Notice that if bj is in G∗1 and G∗2 , then it is not inserted into Gj−1 and 1 ∗ ∗ Gj−1 . So the lemma holds when b is kept in G and G , which resides in a j 1 2 2 different substring from aj . j−1 Consider first the case Uj ⊆ O1 . Note that all letters of ∪j−1 i=1 Ui are in G1 j−1 and G2 ; and by Lemma 7 for each i = 1, 2, . . . , j − 1, the letters of Ui are either isolated letters or they form a length-2 substring. Therefore, in Gj−1 and Gj−1 , 1 2 there is no adjacency at aj involving another letter in between aj and bj in the original sequences G1 and G2 , since by Lemma 3 such a letter belongs to ∪j−1 i=1 Ui . j−1 j−1 If bj ∈ O1 and aj is adjacent to a letter z in G1 and G2 , we claim that z resides at the opposite side of aj with respect to bj (in both original sequences G1 and G2 ); for otherwise, bj is closer to aj than z and thus inserting bj alone into G∗1 and G∗2 achieves a better than optimum solution, a contradiction. It follows that inserting bj changes nothing to this adjacency. In the other case of Uj − O1 = ∅, for the same reason as in the first case, if bj ∈ O1 and aj is adjacent to a letter z ∈ / Uj in Gj−1 and Gj−1 1 2 , then z resides at the opposite side of aj with respect to bj (in both original sequences G1 and G2 ). Thus, inserting bj into Gj−1 and Gj−1 will not break this adjacency. 1 2 Definition 1. If Approx-CMSR executes an operation 8 in the j-th iteration, and xj • yj is a length-2 substring in G∗1 and G∗2 , then in our attribution process each of xj and yj is counted as a 23 -isolate, and each of aj and bj is counted as a 13 -isolate. Let V 8 denote the set of all those isolates aj and bj in Definition 1, and let U 8 denote the set of corresponding isolates xj and yj . Clearly the letters of V 8 ⊆ V are not deleted by algorithm Approx-CMSR. In the following Lemma 9, we show that every isolate of O1 ∩(Uj ∪Vj ) can be put into bin B, when the j-th iteration of Approx-CMSR executes an operation 1, 2, 3, 4, 5, 6, 7, 8, or 9, respectively. A special care is paid to canceling pairs, when an aj ∈ V 8 becomes involved then the corresponding xj must be in U 8 for the sake of proper relay. Lemma 9. For any j = 1, 2, . . . , m, O1 ∩ (Uj ∪ Vj ) ⊆ B, i.e., every isolate of O1 ∩ (Uj ∪ Vj ) is attributed with at most 73 isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 . Proof. The proof of this lemma is long, and is actually separated for each of the nine operations [8]. In this extended abstract, we prove it for operation 1 only. Recall that an operation 1 deletes isolate xj , and forms a length-2 type-1 substring aj • bj , i.e., Uj = {xj } and Vj = {aj , bj } (see Table 1). From Lemma 3, we know that in the original sequences G1 and G2 all letters in between aj and bj belong to ∪ji=1 Ui . If aj ∈ O1 , inserting it into Gj−1 and Gj−1 in the worst case would break two 1 2 distinct adjacencies, one in each sequence, giving rise to a maximum of 4 isolated letters. For each such adjacency that results in two isolated letters, denoted as r • s, either {r, s} = Ui for some i < j which is resulted from an operation 8, or {r, s} ∩ Ui = ∅ for all i < j from Lemma 7. Moreover, in the first case, due to priority of an operation 8 being lower than that of an operation 7, we conclude
Approximating the Complementary MSR Problem
55
that there is at least one other isolate from O1 , which breaks this adjacency too if it is inserted back into Gj−1 and Gj−1 alone. Therefore, according to 1 2 the attribution rule, aj is attributed with only one of the two newly generated isolates r and s, while the other isolate of O1 is attributed with the other newly generated isolate. Note also that from Definition 1, both r and s are counted as 23 -isolates. In the second case, if xj ∈ / {r, s}, then r and s must not reside in between aj and bj by Lemma 3, but thus at different sides, in both original sequences G1 and G2 . We discuss two cases. In the first case, xj ∈ O1 . Again let r • s denote an adjacency broken by aj ∈ O1 when it is inserted into Gj−1 and Gj−1 1 2 . If this broken adjacency gives rise to at most one isolated letter, we are done in the sense that this adjacency attributes at most one isolate of U ∪R∪(V −O1 )∪V 8 to aj ; else if {r, s} = Ui for some i < j which is resulted from an operation 8, we are also done since this adjacency attributes at most 23 isolate of U ∪R∪(V −O1 )∪V 8 to aj ; otherwise, we conclude that bj ∈ O1 as well from the last paragraph, and r and s are attributed together to aj and bj . It follows that in the worst case, on average each of aj and bj , when they are in O1 , is attributed with at most 2 newly generated isolated letters of U ∪ R ∪ (V − O1 ) ∪ V 8 . Afterwards, xj is inserted back. Again let r • s denote an adjacency broken by this insertion, then {r, s} = Ui for some i < j which is resulted from an operation 8 from Lemmas 3 and 7. For the same priority reason one of them is attributed to xj ; it follows from Definition 1 that xj is attributed with 73 isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 , including itself. In the other case, xj ∈ / O1 . Similarly, let r • s denote an adjacency broken by aj ∈ O1 when it is inserted into Gj−1 and Gj−1 1 2 . If this broken adjacency gives rise to at most one isolated letter, we are done; else if {r, s} = Ui for some i < j which is resulted from an operation 8, we are also done. Otherwise, when xj ∈ / {r, s}, we similarly conclude that bj ∈ O1 as well from the second paragraph in this proof, and r and s are attributed together to aj and bj . When xj = s, r must reside at the same side of aj with respect to xj in one of the original sequences G1 and G2 and at the opposite side of aj with respect to xj in the other original sequence. Consequently, bj ∈ O1 as well, and r and xj are attributed together to aj and bj . It follows that in the worst case, on average each of aj and bj , when they are in O1 , is attributed with at most 2 newly generated isolated letters of U ∪ R ∪ (V − O1 ) ∪ V 8 . This proves the lemma that every isolate of O1 ∩ (Uj ∪ Vj ) is attributed with at most 73 isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 . Denote O1 = O1 ∩ R. For an isolate, we call each of its appearance in one of the original sequences G1 and G2 an isolate copy. That is, each isolate has two isolate copies, one in each of the original sequences. Note that at the end of the m-th iteration in the algorithm Approx-CMSR, deleting two isolate copies is impossible to form a novel type-1 substring, neither deleting one isolate copy is possible to append an isolate to an existing substring. In other words, for any two remaining isolates r1 , r2 ∈ R that are not separated by any existing (type0 or type-1) substring in both sequences, there are at least three other isolate
56
Z. Li et al.
copies in between them, in two sequences; and for any remaining isolate r1 ∈ R, there are at least two other isolate copies in between it and each neighboring substring, in two sequences. We have the following lemma. m Lemma 10. In Gm 1 and G2 ,
1) if there is an adjacency r1 • r2 for r1 , r2 ∈ R, then r1 and r2 are separated by at least three isolate copies of O1 ; 2) if there is an adjacency r • a for r ∈ R and a ∈ Σ − U − R, then r and a are separated by at least two isolates of O1 ; 3) if there is an adjacency xj • yj for xj , yj ∈ U 8 , then xj and yj are separated by at least two isolate copies of O1 ; 4) if there is an adjacency vj • a for vj ∈ V 8 and a ∈ Σ − U − R, then v and a are separated by at least two isolate copies of O1 . Proof. Due to space limit, the detailed proof is provided in [8].
m In the sequences Gm 1 and G2 obtained after inserting units of O3 ∪O2 ∪(O1 − O1 ) ∗ ∗ into G1 and G2 , some units of R are already isolates, while the other still reside in substrings (of length at least two). From Lemma 9, we know that all units of m U ∪ V are in Gm 1 and G2 . From Lemma 7 we know that if an xj ∈ Uj is not an m m isolate in G1 and G2 , then xj ∈ U 8 . After inserting all the isolates of O1 back m into Gm 1 and G2 , we will obtain the two original sequences G1 and G2 and thus m all letters of U ∪ V ∪ R, if still residing in substrings of Gm 1 and G2 , have to be singled out. Recall that W ⊆ V .
Lemma 11. O1 ⊆ B. Proof. Every isolate of O1 has two isolate copies, some of which could have been attributed with isolates of U ∪ R ∪ (V − O1 ) ∪ V 8 in the inverse process achieving 2 m Gm 1 and G2 . For each such isolate copy, it was attributed with exactly 3 isolates of U , and in fact of Ui for some i where an operation 8 is executed by algorithm Approx-CMSR. We examine next those letters of U ∪ V ∪ R that still reside in substrings of m m Gm 1 and G2 . For each letter of U , if it is still residing in a substring of G1 and m G2 , then it falls into Case 3 of Lemma 10 by Lemma 7. For each letter of V , m if it is still residing in a substring of Gm 1 and G2 , then it does not participate in any canceling pair and it is counted as at most a 13 -isolate, see Definition 1. m Also by Lemma 7, any adjacency involving a letter of U ∪ V ∪ R in Gm 1 and G2 falls into one of the four cases listed in Lemma 10. Therefore, every isolate copy that can break the adjacency is attributed with at most 23 isolates of U ∪ V ∪ R. The above two paragraphs state that every isolate of O1 is attributed with at most 43 isolates of U ∪ V ∪ R. As O1 ⊆ R, we attribute each isolate of O1 to itself. This proves the lemma. Theorem 1. Algorithm Approx-CMSR is a 73 -approximation algorithm for the CMSR problem.
Approximating the Complementary MSR Problem
57
Proof. From Lemma 11 we conclude that all isolates of U ∪ R (in fact, isolates of (V − O1 ) ∪ V 8 as well) have been attributed to letters of OP T , and Lemmas 6, 9, and 11 together guarantee that each letter of OP T is attributed with at most 7 isolates. Therefore, Approx-CMSR is a 73 -approximation algorithm. 3
4
Conclusions
In this paper, we presented a 73 -approximation algorithm Approx-CMSR for the CMSR problem. An infinite series of instances provided in [8] show that this performance ratio 73 is tight.
References 1. Bar-Yehuda, R., Halld´ orsson, M.M., Naor, J.S., Shachnai, H., Shapira, I.: Scheduling split intervals. SIAM Journal on Computing 36, 1–15 (2006) 2. Bulteau, L., Fertin, G., Rusu, I.: Maximal strip recovery problem with gaps: hardness and approximation algorithms. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 710–719. Springer, Heidelberg (2009) 3. Chen, Z., Fu, B., Jiang, M., Zhu, B.: On recovering synthetic blocks from comparative maps. Journal of Combinatorial Optimization 18, 307–318 (2009) 4. Choi, V., Zheng, C., Zhu, Q., Sankoff, D.: Algorithms for the extraction of synteny blocks from comparative maps. In: Giancarlo, R., Hannenhalli, S. (eds.) WABI 2007. LNCS (LNBI), vol. 4645, pp. 277–288. Springer, Heidelberg (2007) 5. Jiang, H., Li, Z., Lin, G., Wang, L., Zhu, B.: Exact and approximation algorithms for the complementary maximal strip recovery problem. Journal of Combinatorial Optimization (2010) (accepted for publication on November 3, 2010) 6. Jiang, M.: Inapproximability of maximal strip recovery. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 616–625. Springer, Heidelberg (2009) 7. Jiang, M.: Inapproximability of maximal strip recovery: II. In: Lee, D.-T., Chen, D.Z., Ying, S. (eds.) FAW 2010. LNCS, vol. 6213, pp. 53–64. Springer, Heidelberg (2010) 8. Li, Z., Goebel, R., Wang, L., Lin, G.: An improved approximation algorithm for the complementary maximal strip recovery problem. Technical Report TR11-02, Department of Computing Science, University of Alberta (January 2011) 9. Wang, L., Zhu, B.: On the tractability of maximal strip recovery. Journal of Computational Biology 17, 907–914 (2010); Correction 18, 129 (2011) 10. Zheng, C., Zhu, Q., Sankoff, D.: Removing noise and ambiguities from comparative maps in rearrangement analysis. IEEE/ACM Transactions on Computational Biology and Bioinformatics 4, 515–522 (2007)
Greedy Routing via Embedding Graphs onto Semi-metric Spaces Huaming Zhang and Swetha Govindaiah Computer Science Department University of Alabama in Huntsville Huntsville, AL, 35899, USA {hzhang,sg0017}@cs.uah.edu Abstract. In this paper, we generalize the greedy routing concept to use semimetric spaces. We prove that any connected n-vertex graph G admits a greedy embedding onto an appropriate semi-metric space such that (1) each vertex v of the graph is represented by up to k virtual coordinates (where the numbers are from 1 to 2n − 1 and k ≤ deg(v)); and (2) using an appropriate distance definition, there is always a distance decreasing path between any two vertices in G. In particular, we prove that, for a 3-connected plane graph G, there is a greedy embedding of G such that: (1) the greedy embedding can be obtained in linear time; and (2) each vertex can be represented by at most 3 virtual coordinates from 1 to 2n − 1. To our best knowledge, this is the first greedy routing algorithm for 3-connected plane graphs, albeit with non-standard notions of greedy embedding and greedy routing, such that: (1) it runs in linear time to compute the virtual coordinates for the vertices; and (2) the virtual coordinates are represented succinctly in O(logn) bits.
1 Introduction Routing is one of the most important algorithmic problems in networking. Extensive research has been devoted to discover efficient routing algorithms (see [5,18]). Previously, routing was done via routing protocols (e.g., see [5,18]). This approach is space inefficient and requires considerable setup overhead, which makes it infeasible for some networks (e.g., wireless sensor networks). Recently, an alternative approach geometric routing has been proposed. Geometric routing uses geometric coordinates of the vertices to compute the routing paths. The simplest geometric routing is greedy routing, in which a vertex simply forwards messages to a neighbor that is closer to the destination. Greedy routing is simple, but also imposes some problems. First, GPS devices, typically used to determine geometric coordinates, are expensive and increase energy consumption. (This should be avoided, especially, for sensor networks). More importantly, a bad network topology and geographical location of network nodes can lead to routing failures because a void position has been reached. (Namely, a packet has reached a node all whose neighbors are farther from the destination than the node itself). For example, for a star-shaped network K1,6 embedded in R2 , as in Figure 1, greedy routing fails due to the fact that the vertex u is at a void position: all neighbors (only one) of u are farther from the destination w than itself in the embedding.
Research is supported by NSF grant CCF-1017366.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 58–69, 2011. c Springer-Verlag Berlin Heidelberg 2011
Greedy Routing via Embedding Graphs onto Semi-metric Spaces
59
c u
v
Fig. 1. Greedy routing fails for K1,6 at u. u is at a void position
To solve these problems, an elegant solution was proposed by Rao et al. in [15]. Instead of using the real geometric coordinates (e.g., GPS coordinates), one could use graph drawing, based on the structure of a network G, to compute vertex coordinates in the drawing. The drawing coordinates are used as the virtual coordinates of the vertices of G. Then geometric routing algorithms rely on virtual coordinates to compute routes. Greedy drawing is introduced as a solution for greedy routing. Simply speaking, a greedy drawing is a drawing of the graph G into a metric space in which greedy routing works. More precisely: Definition 1. [16] Let S be a set and d(∗, ∗) a metric function over S. Let G = (V, E) be a graph. 1. A drawing of G in S is a mapping δ : V → S such that u = v implies δ(u) = δ(v). 2. The drawing δ is a greedy drawing with respect to d if for any two vertices u, w of G (u = w), u has a neighbor v such that d(δ(u), δ(w)) > d(δ(v), δ(w)). Consider a greedy drawing δ for G in a metric space S, endowed with a metric function d(∗, ∗). Let’s define dδ : V → R as follows: dδ (u, w) = d(δ(u), δ(w)). Then it is easy to see that dδ (∗, ∗) is a metric function defined on the vertex set V of G. We will simply call this metric function the induced metric function for G from d(∗, ∗) and δ, and always denote it by dδ . Consider any two vertices u = w of G in the greedy drawing δ. According to the definition of a greedy drawing, it is easy to see that there is a distance decreasing path between u and w in the drawing with respective to the metric function dδ (see [16]). Namely, there is a path (u = v1 , v2 , · · · , w = vk ) in G such that dδ (vi , w) < dδ (vi+1 , w). Therefore, greedy routing simply forwards the message from u to such a neighbor v, which is closer to the destination w than u. The forwarding process continues and the distance to the destination w keeps dropping. Eventually, the distance become 0 and the message reaches the destination w. Therefore, when there is a greedy drawing of G into a metric space S, greedy routing always succeeds. 1.1 Greedy Drawing in the Euclidean Spaces After [15], there has been intense research on the existence of greedy drawings of graphs in natural metric spaces. It turns out that the existence of greedy drawings of a graph G
60
H. Zhang and S. Govindaiah
depends heavily on the choices of the metric spaces. Not surprisingly, research initiated the search from the Euclidean plane R2 . Unfortunately, as proved by Papadimitriou et al. [16], K1,6 does not admit any greedy drawing in R2 . Later, Goodrich and Strash proved that [10], star graphs (consisting of a central vertex adjacent to an arbitrarily large number of leaves) does not have greedy drawing into any fixed-dimensional Euclidean space. They observed that, by a simple packing argument, there has to be two leaves in such a graph, that are closer to each other than to the central vertex. Afterwards, research focuses on more restricted networks in which their underlying topology are 3-connected planar graphs. Papadimitriou and Ratajczak [16] showed that any 3-connected planar graph admit a greedy embedding in R3 , albeit with respect to a non-standard metric function. They conjectured that greedy drawing is possible in the Euclidean plane R2 . This conjecture has drawn a lot of interests [2,6,8,10,11,12,13]. Greedy drawings in R2 were first discovered only for graphs containing power diagrams [6], then for graphs containing Delaunay triangulations [12]. The existence of greedy drawing for plane triangulations were proved in [8]. However, the proof was not constructive. Leighton and Moitra [11] eventually settled this conjecture positively by giving an algorithm to produce a greedy drawing of any 3-connected planar graph in R2 . A similar result was independently found by Angelini et al. [2]. However, neither of the two papers presents time efficiency analysis of their algorithms, it is not clear whether their algorithms run in polynomial time. 1.2 Succinctness in Greedy Drawing More importantly, as pointed out in [9], in the worst case, the above two greedy drawing algorithms by Leighton and Moitra [11] and Angelini et al. [2] requires Ω(nlogn) bits to represent their virtual coordinates. Thus, these greedy approaches to greedy routing have the same space usage as traditional routing approaches. Even worse, the above greedy drawing approaches have inferior bandwidth requirements, since they use message headers of length Ω(nlogn) bits in the worst case, whereas traditional routing table approaches use message headers of size Θ(logn) bits [9]. Since the utmost reason for greedy drawings is to improve and to simplify traditional routing schemes, if drawings are to be useful for geometric routing purposes, they should be succinct. That is, every virtual coordinate should be representable in a number of bits that is polylogarithmic in n. Such a greedy drawing will be called a succinct greedy drawing. Thus, the main obstacle for the applicability of greedy routing is not only the existence of a greedy drawing, but also the existence of a succinct greedy drawing. Angelini et al. [1] proved that succinct greedy drawing does not always exist in R2 . They proved that there are infinitely many trees which are greedy drawable in R2 , but all greedy drawings need exponential size grids. In their recent work [10], Goodrich and Strash used the property of Leighton-Moitra drawing to formulate a new coordinate systems (not the underlying coordinates used for embedding), where coordinate corresponds to certain information on the Leighton-Moitra drawing, and each vertex is assigned a triplet of three such coordinates for the routing purposes. Since each element of the triple can take on values in the range [0..n], the triple can be stored using O(log n) bits. This O(log n) representation is totally different from the real underlying greedy drawing, which still needs Ω(n log n) bits in the worst case, according to [9].
Greedy Routing via Embedding Graphs onto Semi-metric Spaces
61
In [19], a generalized greedy routing algorithm based on Schnyder drawing was introduced. The routing decision is based on rules other than decreasing distance. So it is not a true greedy drawing either. In [20], using a non-standard metric over R2 , He and Zhang presented a linear time succinct greedy drawing algorithms for plane triangulations, with respect to a non-standard metric function on R2 . However, up to the time of writing the paper, the problem of finding polynomial-time algorithm for producing succinct greedy drawing for general 3-connected plane graphs in R2 remains open, even if allowing non-standard metric functions over R2 . 1.3 Succinct-Greedy Drawing in the Hyperbolic Plane To circumvent the existence issue of succinct greedy drawings for graphs in R2 , several researchers (e.g., see [9,13,14]) began to look for other metric spaces, in particular, the hyperbolic plane. Kleinberg proved that [14] any tree, and hence any connected graph, admits a greedy drawing in the hyperbolic plane. However, as pointed out by Eppstein and Goodrich [9], their drawing are not succinct. Their algorithms requires Ω(nlogn) bits in the worst case to represent such virtual coordinates. Recently, Eppstein and Goodrich [9] proved that any n-vertex connected graph admit a succinct greedy drawing in the Hyperbolic plane, in which every virtual coordinate can be represented in O(logn) bits. However, there are two drawbacks for their algorithm. First, their algorithm uses a sophisticated data structure to facilitate the computation of the greedy drawing. Secondly, their algorithm runs in unknown degree polynomial-time (it appears to be high degree polynomial time). We feel that the two drawbacks prevent this algorithm from being deployed to some networks, such as wireless sensor networks, in which the computation power of the agents are too limited to support such heavy computation. To summarize, up to this writing, there is no known linear time succinct greedy routing algorithms for general 3-connected planar graphs, even if one allows to use any metric space for such an embedding. 1.4 Our Approach and Results We feel that, there is no compelling reason that greedy routing should be so-closely and even somewhat awkwardly tied with greedy drawing into metric spaces. The awkwardness can be seen from several of the above results. For example, for both of the greedy drawing algorithms presented for 3-connected plane graphs in R2 [2] and [11], neither of the drawings is planar. Then a natural question would be: if the drawing is not planar, then what is the advantage of using R2 ? In [20], the greedy drawing presented for plane triangulations over R2 is planar, but the metric used is not the standard Euclidean metric. Again, one may ask: if the metric is not the standard Euclidean metric, then why use R2 ? Even worse, if using metric spaces such as the Hyperbolic plane, then as one can imagine, the greedy drawing in the Hyperbolic plane would greatly distort the true geometric distance between any underlying nodes in the network. As a matter of fact, for all the above greedy drawing algorithms, the virtual coordinates are computed purely from the underlying topology of the network. The topology of the network is extracted purely from the network connectivity (i.e., there is an edge between two vertices if and only if they are connected in the underlying network). No information for the true
62
H. Zhang and S. Govindaiah
geometric distances between the network nodes have been kept in the network topology whatsoever. Therefore, regardless of what metric space we use, R2 or the Hyperbolic plane, the virtual coordinates and the virtual distances (as computed from the virtual coordinates) have no tie to the true geometric locations of the network nodes, nor do they have tie to the true geometric distance between the network nodes. Thus, when coming to greedy routing via greedy drawing in metric spaces, the bottom line truth is that the true geometric distance between the network nodes has lost its trace since its very beginning. Thus, judging from the greedy routing perspective, the requirement for drawing a graph in R2 , or the Hyperbolic plane, or any other metric spaces is simply artificial. Indeed, in greedy routing, all we care are the following: (1) virtual coordinates can be easily computed. Ideally, they should be computable in linear time. (2) Virtual coordinates should always be succinct. (3) Using the virtual coordinates, a virtual distance (i.e., a distance computed from the virtual coordinates. From now on, we will simply use distance to mean virtual distance) between any two vertices can be computed easily. Ideally, the distance between any two vertices can be computed in constant time from the virtual coordinates. (4) Using such distances, for any two distinct vertices u and w, there is always a distance decreasing path connecting u and w. Therefore, a message can be forwarded to the destination w along such a distance decreasing path. In this paper, we propose a new notion of greedy drawing. Instead of using greedy drawing of graphs in metric spaces, we use greedy embedding of graphs in semi-metric spaces. In such an embedding, each vertex will be assigned a finite set of virtual coordinates, a distance can be easily computed from the virtual coordinates and a distance decreasing routing path can be easily computed between any two vertices. Applying these concepts, we present a simple linear time algorithm to find such a greedy embedding for a 3-connected plane graph G in which: (1) each vertex has 1 to 3 virtual coordinates. The virtual coordinates are integers between 1 and 2n− 1; (2) The distance between any two vertices can be computed in constant time from the virtual coordinates. To our best knowledge, this algorithm is the first linear time algorithm which provides a practical greedy routing algorithm for such graphs. Generalization of such results to arbitrary connected graphs is also included in the paper. In Section 2, we present related concepts and our main result.
2 Greedy Routing via Embedding Graphs into Semi-metric Spaces 2.1 Greedy Routing via Semi-metric Spaces Definition 2. Let S be a set. A semi-metric on S is a function d : S × S → R that satisfies the following three conditions: 1. d(x, y) ≥ 0. 2. d(x, y) = 0 if and only if x = y. 3. d(x, y) = d(y, x). Now, we have the following definition, which is a generalization from Definition 1. The only difference is that now we use a semi-metric space instead of a metric space.
Greedy Routing via Embedding Graphs onto Semi-metric Spaces
63
Definition 3. [16] Let S be a set and d(∗, ∗) a semi-metric function over S. Let G = (V, E) be a graph. 1. An embedding of G into S is a mapping δ : V → S such that u = v implies δ(u) = δ(v). 2. The embedding δ is a greedy embedding with respect to d if for any two vertices u, w of G (u = w), u has a neighbor v such that d(δ(u), δ(w)) > d(δ(v), δ(w)). Let δ be a greedy embedding of a graph G = (V, E) into a semi-metric space S, whose semi-metric function is d(∗, ∗). Consider the vertex set V of G, for any two vertices u and v in V , if we define dδ (u, v) = d(δ(u), δ(v), then dδ (∗, ∗) is a semi-metric function defined on the vertex set V of G, dδ (∗, ∗) is called the induced semi-metric function for G. Note that, given a greedy embedding into a semi-metric space, greedy routing works exactly the same as for the case of greedy drawing in metric spaces. Consider a greedy embedding δ for G into a semi-metric space S, equipped with a semi-metric function d(∗, ∗). Consider any two distinct vertices u = w of G, there is a distance decreasing path between u and w in the embedding. Namely, there is a path (u = v1 , v2 , · · · , w = vk ) in G such that dδ (vi , w) < dδ (vi+1 , w). Therefore, greedy routing simply needs to forward the message to such a neighbor which is closer to the destination. The message keeps forwarded, the distance keep dropping until the message reaches the destination w (whose distance to w is 0). Since all that matters are the existence of a greedy embedding, it does not matter whether the space is associated with a metric function or a semi-metric function, nor does it matter what kind metric function or semi-metric function the space has. This relaxation gives us great flexibility in choosing an ideal semi-metric space so that efficient greedy routing algorithms can be built upon. In the next subsection, we will introduce such kind semi-metric spaces. 2.2 A Group of Semi-metric Spaces We use N to denote {1, 2, · · · , n, · · ·}, i.e. the set of natural numbers. We use P (N ) to denote the power set of N . We have the following definition: Definition 4. A proper subset Π of P (N ) is called a perfect sub-power set of N if Π satisfies all the following conditions: 1. 2. 3. 4.
Π = ∅ and Π is a finite set. ∅∈ / Π. For any two distinct elements x and y ∈ Π, x ∩ y = ∅. Every element x ∈ Π is a finite set of natural numbers. We define the thickness of Π to be the maximum cardinality of all its elements, which will be denoted by TΠ .
We have the following technical lemma: Lemma 1. Let Π be a perfect sub-power set of N . x and y be two elements in Π. Let d(x, y) = min{|xi − yj |: xi ∈ x and yj ∈ y }. Then d(∗, ∗) is a semi-metric function defined on Π.
64
H. Zhang and S. Govindaiah 16 r
r 2
15 1 b
c
3
c
b
5
13
f 4
e
d
6
8
h g
12 e
d
14
f
10
i 7 9 g
(1)
h
11 i
(2)
Fig. 2. (1) A tree T . (2) Virtual coordinates for each vertex in T .
Proof. First note that, both x and y ∈ Π are nonempty and finite, so d(∗, ∗) is well defined. Next, we will verify the three conditions for d(∗, ∗) to be a semi-metric function on Π. 1. d(x, y) = min{|xi − yj |: xi ∈ x and yj ∈ y}, so d(x, y) ≥ 0. 2. If d(x, y) = 0, then there is a xi ∈ x equals a yj ∈ y, so x ∩ y = ∅. According to the definition of a proper sub-power set, we have x = y. On the other hand, if x = y, then obviously, d(x, y) = 0. 3. d(x, y) = d(y, x) is trivially true. Therefore, d(∗, ∗) is a semi-metric function defined on Π. Note that, there are infinitely many such perfect sub-power sets Π. In the remaining of the paper, we will simply use Π to refer to one such perfect sub-power set of N . Its semi-metric function is the function d(∗, ∗) defined above. 2.3 A Simple Greedy Routing Algorithm for Arbitrary Trees In this subsection, we introduce a simple greedy drawing algorithm for arbitrary trees into a semi-metric space. First, we introduce a few terms and notations. A planar graph is a graph which can be drawn in the plane so that the edges do not intersect at any point other than their end vertices. A planar graph with a fixed planar embedding is called a plane graph. A plane graph divides the plane into regions which are called faces. The unbounded region is called exterior face, the other faces are called interior faces. The vertices and the edges on the exterior face are called exterior vertices and exterior edges, respectively. (See [4] for more terms on graphs.) deg(v) represents the degree of v in G. Δ(G) represents the largest degree of all the vertices in G. Let T = (V, E) be a tree with n vertices. Set a vertex r to be the root of T . Consider a fixed planar embedding of T into R2 . Using this embedding, we can talk about
Greedy Routing via Embedding Graphs onto Semi-metric Spaces
65
counterclockwise direction, and the orders of all the children of a specific node in the tree. Consider an internal (i.e., non-leaf) node u, the subtree hangs on its i-th child, from counterclockwise direction, is called the i-th subtree of u. For each edge of T , associate it with a dummy edge so that the two parallel edges enclose a dummy face enclosing no other vertices in it (see Figure 2). Note that, every edge and its corresponding dummy edge are both adjacent to the exterior face of T . It is easy to see that if one starts from the root r, walks along the facial cycle of the exterior face in counterclockwise direction, every edge, including the dummy ones, will be walked through exactly once. Eventually, the walk comes back to r and stops at r. We will use this walk to define a mapping δ from the vertex set V of T to a perfect sub-power set Π. For each vertex v, initially, δ(v) is set to be ∅. When walking counterclockwisely along the exterior facial cycle, we use a timer. The timer starts from time 1. We insert its value 1 into δ(r), while walking along the edges, whenever we reaches a vertex v, the time is increased by 1 and its value is inserted into δ(v). This process stops when we exhaust all the edges and come back to r, including the dummy ones. See Figure 2 (2) for an illustration for the walking of the tree T in Figure 2 (1) (In Figure 2 (2), dummy edges are drawn in dashed lines. The edges are directed according to the way we walk through them.). Consider the vertex C, it is walked through when the timer is at the time 4, 6, 14, 16. Therefore, δ(C) = {4, 6, 14, 16}. Since every time when we walk through a vertex v, the timer is incremented by 1 and its value is insert into δ(v), so for any two distinct vertices u and w, δ(u) ∩ δ(w) = ∅. In addition, every vertex is walked through at least once, so for every vertex v, δ(v) = ∅. Also, it is easy to see that ∪v∈V δ(v) = {1, · · · , 2n − 1}. Therefore, δ : v → delta(v) is a mapping from V onto the perfect sub-power set Π = {δ(v) : v ∈ V }. Such Π is called the corresponding perfect sub-power set of T . Note that, Π has a semi-metric function d(∗, ∗) defined on it. Correspondingly, V has a semi-metric function dδ (∗, ∗) defined on it. Consider a vertex u in T , according to the mapping δ, it is mapped to a set of distinct natural numbers {u1 , · · · , uk }, where u1 < · · · < uk . We have the following technical lemma. Its proof is trivial and hence omitted. Lemma 2. Let T be a tree, r be its root. 1. The root r is mapped to {r1 = 1 < r2 < · · · < rk = 2n−1}, where k = deg(r)+1. 2. If u is a leaf, then u is mapped to a singleton set {u1 }. 3. If u is non-root internal (i.e., non-leaf) vertex, then u is mapped to u1 < u2 < · · · < uk , where k = deg(u). 4. Let u be a non-leaf vertex of T . Let δ(u) = {u1 , · · · , uk }. Then then natural numbers within the open interval (ui , ui+1 ) are not empty and they are the virtual coordinates assigned to the vertices in the i-th subtree of u. 5. Let w and u be two distinct vertices of T . Let δ(w) = {w1 , · · · , wkw } (For a vertex w, the notation kw represents the largest index for w in δ(w). Hence, wkw is the largest number in δ(w).). δ(u) = {u1 , · · · , uku }. Then w is a descendant of u if and only if u1 < w1 ≤ wkw < uku . According to Lemma 2, consider a tree T with maximum vertex degree Δ(T ), then the thickness TΠ of its corresponding Π is at most Δ(T ) + 1. The reason to have a plus 1
66
H. Zhang and S. Govindaiah a=v v
v
u
a b
b
w
w u
(2)
(1)
Fig. 3. (1) Case 3a1. (2) Case 3a2.
term is due to case for the root r (see Lemma 2 (1)). It is easy to see, if we intentionally set a degree-1 vertex as the root r, then the thickness of the corresponding Π can be reduced to Δ(T ), assuming that T is not a single-edge tree. Thus, from now on, we will assume that T is not a single-edge tree and the root r is a degree-1 vertex of T . Hence, the thickness TΠ of Π always equals Δ(T ). Next, we have our main technical lemma: Lemma 3. For any two distinct vertices u, w in T , the unique path between u and w is a distance decreasing path with respect to the semi-metric function dδ (∗, ∗), where dδ (u, w) = d(δ(u), δ(w)). Namely, for δ(w) = {w1 , · · · , wkw }, δ(u) = {u1 , · · · , uku }, dδ (u, w) = min{|wi − uj |}, i = 1, · · · , kw , and j = 1, · · · , ku . Proof. Let u and w be two distinct vertices of T . We need to show that the unique path between u and w in T is a distance decreasing path between u and w. We will apply mathematical induction on the length n of the unique path between u and w in T to prove the lemma. Initial Step: n = 1: u and w are adjacent in T . w itself is a closer neighbor of u to w. Hence the unique path between u and w, namely the edge (u, w) is a distance decreasing path between u and w. Inductive Step: Our inductive assumption is as follows: Let u = w be two distinct vertices in T , and the length n of the unique path between u and w is less than or equal to k, then the unique path between u and w is a distance decreasing path between u and w. Now consider the case where the length n of the unique path between u and w equals k + 1. We have the following several cases: Case 1: u is a non-parent ancestor of w. Let v be a child of u, which is an ancestor of w. Suppose that v is the root of the i-th subtree of u. According to Lemma 2, we have ui < v1 < w1 ≤ wkw < vkv < ui+1 . Therefore, we have u1 < · · · < ui < v1 < w1 ≤ wkw < · · · < vkv < ui+1 < · · · < uku . Hence, dδ (u, w) = min{|ui − w1 |, |ui+1 − wkw |} = min{w1 − ui , ui+1 − wkw }, which is greater than min{w1 − v1 , vkv − wkw } = dδ (v, w). Hence, v is a neighbor of u which is closer to the destination w. Note that the unique path between u and w in T is the edge (u, v) concatenated with the unique
Greedy Routing via Embedding Graphs onto Semi-metric Spaces
67
path between v and w in T . Consider the unique path between v and w in T , its length is k. According to the inductive assumption, the unique path between v and w in T is a distance decreasing path between v and w. Therefore, the unique path between u and w in T is a distance decreasing path between u and w. This proves the inductive step for Case 1. Case 2: u is a non-child descendant of w. The case is similar to Case 2 and can be proved symmetrically. Case 3: u is neither an ancestor nor a descendant of w. Let v be the smallest common ancestor of u and w. Let u be in the i-th subtree of v and w be the j-th subtree of v. Then i = j since v is the smallest common ancestor of u and w. We have the following two symmetric subcases: Case 3a: i < j. Therefore we vi+1 ≤ vj . According to Lemma 2, we have vi < u1 ≤ uku < vi+1 and vj < w1 ≤ wkw < vj+1 . Note that i < j. Hence, vi < u1 ≤ uku < vi+1 ≤ vj < w1 ≤ wkw < vj+1 . So dδ (u, w) = w1 − uku . Consider u’s parent a in T . According to the properties of a tree, the unique path between u and w passes through a. Therefore, according to our inductive assumption, the unique path between a and w is a distance decreasing path between a and w. Therefore, in order to show that the unique path between u and w is a distance decreasing path between u and w, we only need to show that dδ (u, w) > dδ (a, w). We have two subcases: Case 3a1: a = v. Note that, uku < vi+1 ≤ vj < w1 , so dδ (v, w) ≤ w1 − vj ≤ w1 − vi+1 < w1 − uku = dδ (u, w), as to be shown. See Figure 3 (1) for an illustration. Note that, we may or may not have a vertex b in this subcase. Case 3a2: a is a descendant of v. So a is also in the i-th subtree of v. According to Lemma 2, vi < a1 < u1 ≤ uku < aka < vi+1 . Therefore, we have vi < a1 < u1 ≤ uku < aka < vi+1 ≤ vj < w1 ≤ wkw < vj+1 . Hence, dδ (a, w) = w1 − aka < w1 − uku = dδ (u, w), as to be shown. See Figure 3 (2) for an illustration. Note that, we may or may not have a vertex b in this subcase. Case 3b: i > j. This subcase is symmetric to Case 3a and can be proved symmetrically. Applying mathematical induction, principle, we obtain that the unique path between u and w is a distance decreasing path between u and w. Therefore, we have the following theorem: Theorem 1. Let T = (V, E) be a tree. The embedding δ : V → Π = {δ(v) : v ∈ V } is a greedy embedding from T onto Π = {δ(v) : v ∈ V } with respect to its semi-metric function d. The embedding can be obtained in linear time. The thickness TΠ of Π is at most ≤ Δ(T ) + 1. When |V | = n > 2, the thickness TΠ of Π could be reduced to Δ(T ) if one chooses a degree-1 vertex r as its root. Proof. Lemma 3 demonstrates that the embedding δ : V → Π is a greedy embedding. The thickness TΠ of Π is at most ≤ Δ(T ) + 1. It is easy to see that, the embedding can be computed in linear time when given a tree T = (V, E). As noted earlier, if one choose degree-1 vertex as the root of T , then as long as T is not a simple edge, the thickness TΠ of Π is Δ(T ).
68
H. Zhang and S. Govindaiah
When implementing the greedy routing algorithm for a tree T = (V, E), via greedy embedding onto a perfect sub-power set Π = {δ(v); v ∈ V }. Each vertex u needs to store all the numbers in δ(u), which we will also call them virtual locations of u. Each virtual location is represented by a natural number, which is called a virtual coordinate. Apparently, each vertex u stores up to TΠ virtual coordinates. On computing to which neighbor to forward a message, a vertex u needs to know all its virtual coordinates, and all the virtual coordinates of all its neighbors, and all the virtual coordinates of the destination. For any two vertices u and w, if there virtual coordinates are pre-sorted, then the distance between u and w can be computed in TΠ time. Therefore, at any vertex u, the time to find a neighbor to forward a message takes at most Δ(T )×TΠ time, which is bounded by O((Δ(T ))2 ) according to Theorem 1. Therefore, if T is a boundeddegree tree, then such computation only takes constant time. When Δ(T ) ∈ O(logn), such computation only takes O(log 2 n) time. In either case, such computation is very affordable, even for wireless sensor networks. 2.4 Greedy Routing for Connected Graphs When given a regular connected network, modeled as a connected graph G. Then one can first compute a spanning tree T . A greedy embedding δ : V → Π can then be constructed using T . Apparently, δ is also a greedy embedding for the graph G. Obviously, Δ(T ) ≤ Δ(G). Therefore, we have the following theorem. Its proof is trivial and it is omitted. Theorem 2. Let G = (V, E) be a connected graph with n > 2. Then G admits a greedy embedding δ from V onto a perfect sub-power set Π. The embedding can be obtained in linear time. The thickness TΠ of Π is at most Δ(G). Obviously, for such a G, one always wants to find a bounded degree spanning tree, since the thickness of the embedding, and hence the running time for each node of the network to forwarding a message is reduced. Fortunately, there have been extensive literature on computing bounded degree spanning trees, for example, see [7]. In particular, Barnette showed that every 3-connected planar graph G has a spanning tree T with maximum degree 3 [3]. Such a T can be found in linear time [17]. Thus we immediately have: Theorem 3. Let G be a 3-connected planar graph with n > 2 vertices. Then G has a greedy embedding onto a perfect sub-power set Π with thickness 3. Such a greedy embedding can be computed in linear time. Theorem 3 implies that for a 3-connected planar graph, we can find a greedy embedding of G onto a perfect sub-power set such that every node of the graph has at least 1, but at most 3 virtual coordinates. The virtual coordinates are all from 1 to 2n − 1. Hence, the cost of finding a distance decreasing path is cheap. To our best knowledge, for 3-connected plane graphs, this is the first greedy routing algorithm which: (1) runs in linear time to compute the virtual coordinates for the vertices; and (2) the virtual coordinates can be represented succinctly. Every 3-connected graph that excludes K3,3 as a minor has a 3-connected spanning planar subgraph [11]. Hence we have: Corollary 1. Every 3-connected graph of n vertices that excludes K3,3 as a minor has a greedy embedding into a perfect sub-power set Π with thickness 3.
Greedy Routing via Embedding Graphs onto Semi-metric Spaces
69
References 1. Angelini, P., Di Battista, G., Frati, F.: Succinct greedy drawings do not always exist. In: Eppstein, D., Gansner, E.R. (eds.) GD 2009. LNCS, vol. 5849, pp. 171–182. Springer, Heidelberg (2010) 2. Angelini, P., Frati, F., Grilli, L.: An algorithm to construct greedy drawings of triangulations. In: Tollis, I.G., Patrignani, M. (eds.) GD 2008. LNCS, vol. 5417, pp. 26–37. Springer, Heidelberg (2009) 3. Barnette, D.: 3-trees in polyhedral graphs. Isreal Journal of Mathematics 18, 731–736 (1966) 4. Bondy, J.A., Murty, U.S.R.: Graph theory with applications. Elsevier Science Publishing Co., Inc., Amsterdam 5. Comer, D.: Internetworking with TCP/IP, Volume 1: Principles, Protocols, and Architecture. Prentice-Hall, Inc., Upper Saddle River (2006) 6. Ben-Chen, M., Gotsman, C., Wormser, C.: Distributed computation of virtual coordinates. In: Proc. SoCG 2007, pp. 210–219 (2007) 7. Czumaj, A., Strothmann, W.-B.: Bounded degree spanning trees (Extended abstract). In: Burkard, R.E., Woeginger, G.J. (eds.) ESA 1997. LNCS, vol. 1284, pp. 104–117. Springer, Heidelberg (1997) 8. Dhandapani, R.: Greedy drawings of triangulations. In: Proc. SODA 2008, pp. 102–111 (2008) 9. Eppstein, D., Goodrich, M.T.: Succinct greedy graph drawing in the hyperbolic plane. In: Tollis, I.G., Patrignani, M. (eds.) GD 2008. LNCS, vol. 5417, pp. 14–25. Springer, Heidelberg (2009) 10. Goodrich, M.T., Strash, D.: Succinct Greedy Geometric Routing in the Euclidean Plane, submitted ot arXiv: 0812.3893v3 (October 2009) 11. Leighton, T., Moitra, A.: Some results on greedy embeddings in metric spaces. In: Proc. FOCS 2008, pp. 337–346 (2008) 12. Lillis, K.M., Pemmaraju, S.V.: On the efficiency of a local iterative algorithm to compute delaunay realizations. In: McGeoch, C.C. (ed.) WEA 2008. LNCS, vol. 5038, pp. 69–86. Springer, Heidelberg (2008) 13. Muhammad, R.B.: A distributed geometric routing algorithm for ad hoc wireless networks. In: Proceedings of the 4th International Conference on Information Technology (ITNG 2007), pp. 961–963. IEEE Press, Los Alamitos (2007) 14. Kleinberg, R.: Geographic routing using hyperbolic space. In: INFOCOM 2007: 26th IEEE International Conference on Computer Communications, pp. 1902–1909 (2007) 15. Rao, A., Papadimitriou, C.H., Shenker, S., Stoica, I.: Geographic routing without location information. In: Proc. Mobicom 2003, pp. 96–108 (2003) 16. Papadimitriou, C.H., Ratajczak, D.: On a conjecture related to geometric routing. Theoretical Computer Science 344(1), 3–14 (2005) 17. Strothmann, W.B.: Bounded degree spanning trees, Ph.D. thesis, Heinz-Nixdorf-Institut, Universit¨at, Paderborn (1997) 18. Tanenbaum, A.S.: Computer networks, 4th edn. Prentice-Hall, Inc., Upper Saddle River (2003) 19. He, X., Zhang, H.: Schnyder greedy routing algorithm. In: Kratochv´ıl, J., Li, A., Fiala, J., Kolman, P. (eds.) TAMC 2010. LNCS, vol. 6108, pp. 271–283. Springer, Heidelberg (2010) 20. He, X., Zhang, H.: On Succinct Convex Greedy Drawing of 3-Connected Plane Graphs. In: The Proceedings of SODA, the 22nd Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 1477–1486 (2011)
On Variants of the Spanning Star Forest Problem Jing He and Hongyu Liang Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijing, China {he-j08,lianghy08}@mails.tsinghua.edu.cn
Abstract. A star forest is a collection of vertex-disjoint trees of depth at most 1, and its size is the number of leaves in all its components. A spanning star forest of a given graph G is a spanning subgraph of G that is also a star forest. The spanning star forest problem (SSF for short) [14] is to find the maximum-size spanning star forest of a given graph. In this paper, we study several variants of SSF, obtaining first or improved approximation and hardness results in all settings as shown below. 1. We study SSF on graphs of minimum degree δ(n), n being the number of vertices in the input graph. Call this problem (≥ δ(n))-SSF. We give an (almost) complete characterization of the complexity of (≥ δ(n))-SSF with respect to δ(n) as follows. – When 1 ≤ δ(n) ≤ O(1), (≥ δ(n))-SSF is AP X-complete. – When ω(1) ≤ δ(n) ≤ O(n1− ) for some constant > 0, (≥ δ(n))SSF is N P -hard but admits a PTAS. – When δ(n) ≥ ω(n1− ) for every constant > 0, (≥ δ(n))-SSF is not N P -hard assuming Exponential Time Hypothesis (ETH). 2. We investigate the spanning k-tree forest problem, which is a natural generalization of SSF. We obtain the first inapproximability bound of 1 − Ω( k1 ) for this problem, which asymptotically matches 1 the known approximation ratio of 1 − k+1 given in [13]. We then propose an approximation algorithm for it with a slightly improved 1 approximation ratio of 1 − k+2 . 3. We prove that SSF cannot be approximated to any factor larger than 244 in polynomial time, unless P = N P . This improves the 245 previously best known bound of 259 [14]. 260
1
Introduction
All graphs considered in this paper are undirected and simple, that is, they contain neither self-loops nor parallel edges. A star is a tree of depth at most 1, and its root is called the center of it. A star forest is a collection of vertex-disjoint
This work was supported in part by the National Basic Research Program of China Grant 2007CB807900, 2007CB807901, the National Natural Science Foundation of China Grant 61033001, 61061130540, 61073174. Part of this work was done while the authors were visiting Cornell University.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 70–81, 2011. c Springer-Verlag Berlin Heidelberg 2011
On Variants of the Spanning Star Forest Problem
71
stars, and its size is the number of leaves in all its components. A spanning star forest of a graph G is a spanning subgraph of G that is also a star forest. The spanning star forest problem (SSF for short) [14] is the problem of finding a maximum-size spanning star forest of a given graph G . This problem has found applications in aligning multiple genomic sequences [14], comparison of phylogenetic trees [5], and the diversity problem in the automobile industry [1]. Spanning star forests are closely related to dominating sets, which are fundamental in graph theory. A dominating set of a graph G is a subset of vertices with the property that every other vertex is adjacent to at least one vertex in it. The minimum dominating set problem is to find a smallest dominating set of a given graph. Let G be a graph of order n and F be a spanning star forest of it. Then the collection of all centers of F form a dominating set of G, whose size is precisely n minus the size of F . Conversely, any dominating set D of G naturally induces a spanning star forest of G whose centers are exactly those vertices in D. Thus, the spanning star forest problem and the minimum dominating set problem are equivalent in finding the optimum solution. Nevertheless, they appear totally different in terms of approximation. It is proved by Feige [10] that, unless N P ⊆ DT IM E(nO(log log n) ), there is no (1 − ) ln n approximation algorithm for the minimum dominating set problem. In contrast, a 0.5-approximation to SSF can be easily attained by dividing a spanning tree into alternating levels and choosing odd or even levels to be centers depending on which part induces a larger star forest [14]. In their paper initializing the study of SSF, Nguyen et al. [14] proposed a 0.6-approximation algorithm based on a graph-theoretic observation that every graph of order n has a dominating set of size at most 25 n. They also proved that this problem is N P -hard to approximate within a factor of 259 . In addition, they 260 introduced the edge-weighted version of SSF, whose goal is to find a spanning star forest of an edge-weighted graph such that the total weight of edges in the star forest is maximized, and showed a 0.5-approximation algorithm for this variant (with the aforementioned idea of alternating levels). The approximation ratio for unweighted SSF was improved to 0.71 by Chen et al. [7] based on a natural linear programming relaxation combined with randomized rounding. Using similar ideas, they gave a 0.64-approximation algorithm for the nodeweighted SSF, in which the input graph is node-weighted and the objective is to find a spanning star forest with maximum total weight of leaves. Note that node-weighted SSF is just the complement of the weighted dominating set problem, whose goal is to find a minimum-weight dominating set of the given node-weighted graph. Chakrabarty and Goelin [6] proved that edge-weighted and node-weighted SSF cannot be approximated to 10 + and 13 + respectively, 11 14 unless P = N P . Athanassopoulos et al. [4] designed a 0.804-approximation for SSF using the idea of semi-local search for k-set cover [9]. He and Liang studied SSF on c-dense graphs [11], where a graph of n vertices is called c-dense if it contains at least cn2 /2 edges (see [3]). They showed that, for every fixed c ∈ (0, 1), SSF on c-dense graphs √ is AP X-hard and can be efficiently approximated within factor 0.804 + 0.196 c.
72
1.1
J. He and H. Liang
Our Contributions
In this paper, we study several variants of the spanning star forest problem from both algorithmic and hardness points of view, and obtain first or improved approximation and inapproximability results in all settings. Part 1. We study the spanning star forest problem in graphs with minimum degree constraints. More specifically, we consider the spanning star forest problem on graphs in which every vertex has degree at least δ(n) for some function δ : N → N, where n is the order (i.e., the number of vertices) of the graph. Denote this problem by (≥ δ(n))-SSF. We prove threshold behaviors for the complexity of the problem with respect to δ(n). To be precise, we show that: – When 1 ≤ δ(n) ≤ O(1), (≥ δ(n))-SSF is AP X-complete. – When ω(1) ≤ δ(n) ≤ O(n1− ) for some constant > 0, (≥ δ(n))-SSF is N P -hard but allows a PTAS. – When δ(n) ≥ ω(n1− ) for every constant > 0, (≥ δ(n))-SSF is not N P -hard assuming Exponential Time Hypothesis (ETH) [12]. We note that graphs of minimum degree cn for some constant c > 0 are called everywhere-c-dense graphs [3], which form a subclass of c-dense graphs. Our results indicate that spanning star forest on everywhere-c-dense graphs are easier than on c-dense graphs, since SSF on c-dense graphs is AP X-hard for every fixed c ∈ (0, 1) [11]. Part 2. We next investigate a generalization of SSF, called the spanning k-tree forest problem, which is introduced in [13]. A forest is called a k-tree forest if every component of it can be regarded as a tree of depth at most k. The size of a k-tree forest is the number of non-root vertices of it (which equals to the number of vertices of the forest minus the number of its components). A spanning k-tree forest of G is a spanning subgraph of G that is also a k-tree forest. The goal of the spanning k-tree forest problem is to find a maximum-size spanning k-tree forest of the input graph. When k = 1, this is just the ordinary spanning star 1 forest problem. We propose a (1 − k+2 )-approximation algorithm for the spanning k-tree forest problem, which slightly improves the previously known bound 1 of 1 − k+1 [13]. What is more interesting is that we also prove an asymptotically matching hardness result. Namely, it is N P -hard to approximate the problem to 1 − Ω( k1 ). To our knowledge, this is the first inapproximability result for this problem. Part 3. We finally give a short note on the hardness aspect of the original (unweighted) spanning star forest problem. We show, by using the results from Chleb´ık and Chleb´ıkov´a [8], that the spanning star forest problem is N P -hard to approximate within ratio 244 245 even on graphs of maximum degree 5. This improves the previously best known hardness factor of 259 [14]. 260
On Variants of the Spanning Star Forest Problem
1.2
73
Notation Used for Approximation Algorithms
Let Π be a maximization (resp. minimization) problem and 0 < β ≤ 1 (resp. β ≥ 1). Let A be an algorithm for solving Π. We say A is a β-approximation algorithm for Π if, on every instance of Π, it runs in polynomial time and finds a solution with objective value at least (resp. at most) β times the value of the optimum solution. The parameter β is called the approximation ratio, or alternatively approximation factor or performance guarantee of A for the problem Π. Usually β is considered to be a constant, but sometimes it can also be regarded as a function of the input size or some given parameters. We say Π has a polynomial time approximation scheme (PTAS) if for every constant > 0, there is a (1 − ) (resp. (1 + ))-approximation algorithm for Π. We say Π is AP X-hard if it does not have a PTAS, and say Π is AP X-complete if it has a constant factor approximation algorithm and is AP X-hard. We refer the readers to [15] for standard definitions and notations not given here.
2
Spanning Star Forest in Graphs with Minimum Degree Constraints
In this section, we study the spanning star forest problem on graphs with minimum degree δ(n), where n is the order of the graph and δ : N → N is a function satisfying 1 ≤ δ(n) ≤ n − 1 for all n ∈ N. Denote this restricted problem by (≥ δ(n))-SSF. Putting on the requirement 1 ≤ δ(n) ≤ n − 1 does not lose generality, since we only consider simple connected graphs. (For disconnected graphs, we simply run the algorithm for connected graphs on every component of it, and gather the obtained star forests to obtain the final solution. This process clearly preserves the approximation ratio.) By Theorem 1.2.2 in Chap. 1 of [2], it is easy to design a (1 − O( logk k ))approximation algorithm for (≥ k)-SSF. (We temporarily write k instead of δ(n) for notational simplicity.) The next lemma generalizes the argument to node-weighted graphs. Lemma 1. Given any node-weighted graph G of minimum degree k,we can find in polynomial time a dominating set of G of weight at most Θ logk k · W , where W is the total weight of all vertices in G. Proof. Assume G = (V, E) and w : V → R+ ∪{0} be the weight function. Let p = k1 1 1 − k+1 ∈ (0, 1). We pick every vertex v ∈ V randomly and independently with probability p, and denote by U1 the set of picked vertices. Let U2 be the set of vertices not dominated by U1 , i.e., U2 = {v ∈ V | N (v) ∪ {v} ⊆ V \ U1 }, where N (u) denotes the set of neighbors of vertex u. Clearly U1 ∪ U2 is a dominating set of G. Let us bound the expected weight of this set. For all v ∈ V , we have Prob(v ∈ U1 ) = p
74
J. He and H. Liang
and Prob(v ∈ U2 ) = (1 − p)1+|N (v)| . By linearity of expectation, E(w(U1 ∪ U2 )) = w(v) p + (1 − p)1+|N (v)| ≤ p + (1 − p)1+k w(v). v∈V
Substituting p = 1 −
v∈V 1 k+1
1 k
, we get
E(w(U1 ∪ U2 )) ≤ 1 −
k 1
(k + 1)1+ k
W =Θ
log k k
· W.
Therefore, there exists a dominating set of G of weight at most this much. Note that, for any subset V ⊆ V , if all vertice in V have been determined whether to belong to U1 or not, we can calculate the conditional expectation of w(U1 ∪ U2 ) in a similar manner. Thus we can find a dominating set of at least this size in deterministic polynomial time by the standard method of conditional expectation.
Corollary 1. Every node-weighted graph G with minimum degree k has a spanning star forest of weight at least 1 − Θ logk k W , where W is the total weight of all vertices in G. Moreover, such a star forest can be found in polynomial time. The next claim follows from the fact that the maximum weight of a spanning star forest of G never exceeds the total weight of all vertices in G. Corollary 2. There is a 1 − Θ logk k -approximation algorithm for the nodeweighted (≥ k)-SSF problem. The following theorem is straightforward from the hardness result for the spanning k-tree forest problem (Theorem 5) which will be shown later, and thus we omit its proof. Theorem 1. There is a constant c > 0 such that, for every fixed integer k ≥ 2, it is NP-hard to approximate (≥ k)-SSF within a factor of 1 − kc . Notice that (≥ k)-SSF is a subproblem of (≥ k )-SSF whenever k ≥ k . Thus, combined with the fact that SSF has an Ω(1)-approximation algorithm, Theorem 1 directly yields the following corollary, which is the first part of our trichotomy characterization. Corollary 3. (≥ δ(n))-SSF is APX-complete if δ(n) = O(1). Now suppose δ(n) = ω(1) and G = (V, E) is an input graph to (≥ δ(n))-SSF. By Corollary 2 we can find a 1 − Θ ln(δ(n)) -approximation algorithm for δ(n)
(≥ δ(n))-SSF. It is easy to check that the approximation factor becomes 1 − o(1) when δ(n) = ω(1), which immediately implies the following:
On Variants of the Spanning Star Forest Problem
75
Corollary 4. For any function δ(n) with ω(1) ≤ δ(n) ≤ n − 1, (≥ δ(n))-SSF admits a polynomial time approximation scheme (PTAS). A PTAS becomes (almost) useless if the problem can be solved optimally in polynomial time. We next show that, for a large range of δ(n), the restricted problem remains N P -hard, thus establishing the second part of our results. Theorem 2. For any fixed > 0, (≥ n1− )-SSF is N P -hard. Proof. Fix such that 0 < < 1 (the case ≥ 1 is trivial). Let C = 1/ − 1. We now describe a polynomial-time reduction from the original (unweighted) SSF problem (or, (≥ 1)-SSF) to unweighted (≥ n1− )-SSF, thus proving the N P -hardness of the latter. Let G = (V, E) be a simple connected graph. Suppose V = {v1 , v2 , . . . , vn }, where n = |V |. We construct a graph G = (V , E ) from G as follows: Let V = V ∪ {wi,j : 1 ≤ i ≤ n, 1 ≤ j ≤ nC − 1}, and E = E ∪ {(vi1 , wi2 ,j ) : i1 = i2 or (vi1 , vi2 ) ∈ E, 1 ≤ j ≤ nC − 1} ∪ {(wi,j1 , wi,j2 ) : 1 ≤ i ≤ n, 1 ≤ j1 < j2 ≤ nC − 1}. Note that |V | = n + n(nC − 1) = nC+1 . Let us examine the minimum degree of G . For every vertex vi , it is connected to at least one other vertex vi with i = i, together with nC − 1 nodes wi,j , 1 ≤ j ≤ nC − 1. Thus its degree is at least nC . For each vertex wi,j , it is adjacent to vi and nC − 2 other vertices wi,j , j = j. Furthermore, since (vi , vi ) ∈ E for at least one vertex vi with i = i, wi,j is also adjacent to this vi according to our definition of E . Hence C wi,j also has degree at least nC . As nC = |V | C+1 ≥ |V |1− , the graph G is a valid input to (≥ n1− )-SSF. Also note that this construction can be finished in polynomial time, since C is a constant. Let OP T (resp. OP T ) denote the size of the maximum spanning star forest of G (resp. G ). We now prove that OP T = OP T + n(nC − 1), which will finish the reduction. Let S be the set of centers in the maximum-size spanning star forest of G. We know that S is a dominating set of G, and OP T = n − |S|. By the construction of G , the same vertex set S is also a dominating set of G . Thus we have OP T ≥ |V | − |S| = nC+1 − |S| = OP T + n(nC − 1). Now consider the other direction. Let S be the collection of centers in the optimal spanning star forest of G . If there exists wi,j ∈ S for some i, j, we construct a new set of centers S by removing wi,j from S and then declaring vi as a new center (if vi ∈ S); that is, we set S = (S \ {wi,j }) ∪ {vi }. Since every neighbor of wi,j other than vi is also a neighbor of vi , S is a dominating set of G of cardinality no more than that of S. We repeatedly perform the above procedure until all vertices in the center set, denoted S ∗ , are vi for some i. It is clear that S ∗ is a dominating set of G with |S ∗ | ≤ |S|. Thus OP T = |V | − |S| ≤ nC+1 − |S ∗ | = n − |S ∗ | + n(nC − 1) ≤ OP T + n(nC − 1). Combined with the previous result, we have OP T = OP T + n(nC − 1), thus completing the reduction and concluding the N P -hardness of (≥ n1− )-SSF. We now show that the term n1− is actually optimal assuming the following Exponential Time Hypothesis (ETH) [12].
76
J. He and H. Liang
Conjecture 1 (Exponential Time Hypothesis [12]). Any deterministic algorithm for 3-SAT has time complexity 2Ω(n) . Consequently, any N P -hard probΩ(1) lem has time complexity 2n . Theorem 3. Assuming ETH, (≥ δ(n))-SSF is not N P -hard if δ(n) = ω(n1− ) for every constant > 0. Proof. Assume δ(n) = ω(n1− ) for every constant > 0. Let G be a graph of order n and minimum degree δ(n). Let λ(n) = n/δ(n). Then λ(n) = 2o(log n) . δ(n) By Lemma 1 we know that G has a dominating set of size n · O( logδ(n) ) = λ(n) · O(log δ(n)) ≤ 2o(log n) · O(log n) = no(1) . Therefore, we can enumerate all possible subsets of size no(1) to find the minimum dominating set of G and o(1) hence the maximum spanning star forest of G. This takes time O(nn ) = o(1) o(1) O(2n ·log n ) = 2n . However, assuming ETH every N P -hard problem has Ω(1) time complexity 2n , concluding the proof. We end up this section by summarizing the obtained results in Table 1. Table 1. Complexity results for (≥ δ(n))-SSF δ(n) complexity of (≥ δ(n))-SSF 1 ≤ δ(n) ≤ O(1) NP-hard; APX-complete ω(1) ≤ δ(n) ≤ O(n1− ) for some fixed > 0 NP-hard; admits a PTAS ω(n1− ) ≤ δ(n) for any fixed > 0 not NP-hard assuming ETH
3
Spanning k-Tree Forest Problem
In this section we investigate the node-weighted spanning k-tree forest problem, where k is a fixed positive integer. Recall that the objective of this problem is, given a graph G, to find a spanning forest of G, each component of which has depth at most k when one of its vertices is designated as the root, such that the total weight of all non-root vertices is maximized. As before, we assume that the input graph is connected, since otherwise we can run our algorithm on every connected component of it. 3.1
Improved Approximation Algorithm
Liao and Zhang [13] show that a simple algorithm (denoted as Simple-Alg), based on the idea of dividing a spanning tree into k disjoint star forests, can find k a spanning k-tree of weight at least k+1 times the total weight of all vertices in the input graph. We first observe that the spanning k-tree forest problem is the complement of the k-domination problem, where the objective of the latter is to find a minimumweight vertex set of a graph G such that every vertex in G is at distance at most k from some node in this set.
On Variants of the Spanning Star Forest Problem
77
Lemma 2. For every node-weighted graph G, the maximum weight of a spanning k-tree forest of G equals the total weight of vertices in G minus the minimum weight of a k-domination set of G. Proof. Let G = (V, E) and w : V → R+ ∪ {0} be the weight function on vertices of G. If there is a spanning k-tree forest of G of weight W , the roots in this forest form a k-domination set of weight v∈V w(v) − W . If there is a k-domination set of G of weight W , we can perform a breadth-first search rooted at the vertices in this set to construct a spanning k-tree forest of G, which has weight w(v) − W .
v∈V The following lemma is straightforward and we omit its (trivial) proof. Lemma 3. For every graph G, let Gk denote the graph with the same vertex set with G such that every two vertices are adjacent in Gk if and only if they are within distance k from each other in G. Then, every k-domination set of G is a dominating set of Gk , and vice versa. It is easy to see that Gk has minimum degree at least k for any connected graph G with at least k + 1 vertices. Thus the spanning k-tree forest problem is reducible k to the (≥ k)-SSF problem. Note that the Simple-Alg is a ( k+1 )-approximation for the spanning k-tree forest problem, which is better than the performance log k guarantee of 1 − Θ for (≥ k)-SSF obtained before. We next show how to k improve this approximation ratio slightly. The following lemma is due to Chen et. al. [7]. 1
Lemma 4 (Lemma 1 in [7], restated). There is an (1−r) r −1 -approximation algorithm for node-weighted SSF, where r is the ratio of the weight of the optimal solution over the total weight of all vertices in the graph. Algorithm 1. Finding approximate spanning k-tree forest of G 1: Construct Gk from G. 2: Run Rounding-Alg on Gk and Simple-Alg on G, and return the better solution.
We call the algorithm ensured by Lemma 4 Rounding-Alg (since it is based on an LP-rounding scheme). Consider now the algorithm described in Algorithm 1 for the spanning k-tree forest problem given the input graph G. Clearly this algorithm runs in polynomial time. Suppose the total weight of all vertices T in G is W , and the weight of the optimum solution is OP T . Let r = OP W . We k kW have r ≥ k+1 , since Simple-Alg returns a solution of weight k+1 . Note that kW k Simple-Alg has an approximation factor of k+1 /OP T = (k+1)r . The algorithm 1
Rounding-Alg produces a solution with approximation ratio (1 − r) r −1 . By comparing the two algorithms and pick the better one, we obtain the following theorem.
78
J. He and H. Liang
Theorem 4. Algorithm 1 is a k+1 k+2 -approximation algorithm for the nodeweighted spanning k-tree forest problem. Proof. It suffices to show that
min max k r: k+1 ≤r<1
When r ≤ r>
k(k+2) . (k+1)2
k(k+2) (k+1)2
it holds that
As (1 − r)
1 r −1
k 1 , (1 − r) r −1 (k + 1)r k (k+1)r
≥
k+1 k+2 ,
≥
k+1 . k+2
so we only need to prove it for
is monotone increasing with r [7], it suffices to prove
(k+1)2 −1 k(k + 2) k(k+2) k+1 1− ≥ (k + 1)2 k+2 21 k +2k 1 k+1 ⇐ ≥ 2 (k + 1) k+2 k2 +2k 2 k+2 ⇐k+1≤ k+1 k 2 + 2k k+2 ⇐ ln(k + 1) ≤ ln . 2 k+1 When k = 2 it can be directly verified by simple calculation. For k ≥ 3, using x the inequality ln(1 + x) ≥ 1+x for all x ≥ 0, we have ln(k + 1) ≤
k k 2 + 2k ≤ · 2 2
1 k+1 k+2 k+1
≤
k 2 + 2k ln 2
k+2 k+1
.
This completes the proof of Theorem 4. 3.2
Inapproximability Results
We next show an inapproximability ratio of 1 − Ω( k1 ) for the spanning k-tree 1 forest problem, which asymptotically matches our approximation ratio of 1− k+2 . This result holds even for the unweighted case. Theorem 5. There exists a universal constant c > 0 such that, for every integer k ≥ 2, it is N P -hard to approximate the spanning k-tree forest problem within a factor of 1 − kc . Proof. Let > 0 be a constant such that approximating SSF within 1 − is N P -hard [14]. Let k ≥ 2. Given an instance G = (V, E) of SSF, we construct a corresponding instance G of the spanning k-tree forest problem (k-SF for short) as follows. Initially set G = ∅. For every vertex v ∈ V , add k vertices
On Variants of the Spanning Star Forest Problem
79
v (0) , v (1) , . . . , v (k−1) to G together with the edges (v(i) , v (i+1) ) for all 0 ≤ i < k − 1 (i.e., create a chain of length k − 1). For every edge e = (u, v) ∈ E, add to G an edge (u(0) , v (0) ). This finishes the construction of G . We claim that G has a spanning star forest of size m if and only if G has a spanning k-tree forest of size m + n(k − 1), n being the number of vertices in G. First assume G has a spanning star forest of size m. By attaching to every vertex the corresponding chain of length k − 1, we can easily construct a spanning k-tree forest in G of size m + n(k − 1). More formally, letting the edge set of the spanning star forest of G be {(u1 , v1 ), . . . , (um , vm )}, the edges (0) (0) (0) (0) in {(u1 , v1 ), . . . , (um , vm )} ∪ v∈V {(v(0) , v (1) ), . . . , (v (k−2) , v (k−1) )} form a spanning k-tree forest of G of size m + n(k − 1). Now suppose G has a spanning k-tree forest F of size m . For notational simplicity we call i the order of v (i) . We first prove that there exists a spanning k-tree forest of size at least m such that every center has order 0. Suppose v (t) is a center in F of order t > 0. If v (0) is also a center in F , the connected component of F containing v (t) must be a chain, and there exists i s.t. (v (i) , v (i+1) ) ∈ F . We merge this component with that containing v (0) ; that is, we attach the chain (v (1) , v (2) , . . . , v(k−1) ) to v (0) . It is easy to verify that the resulting subgraph is also a spanning k-tree forest, and has size at least m + 1. If v (0) is not a center in F , we declare it as a new center, delete from F the (unique) edge incident on v(0) , and connect the entire chain (v(1) , v (2) , . . . , v (k−1) ) to v (0) . This generates a spanning k-tree forest of size at least m . Hence, w.l.o.g. we may assume that every center in F has order 0. Let v (0) be any order-0 vertex in G . If v(0) is neither a center nor directly connected to a center in F , there must exist some i such that (v (i) , v (i+1) ) is not in F ; otherwise, since v (0) is at distance at least 2 from any center in F , v (k−1) is at distance at least k + 1 from any center in F , contradicting the k-tree property. Let u(0) be the vertex to which v (0) is connected in F (such vertex exists since v (0) is not a center and every center is of order 0). We delete (v (0) , u(0) ) from F and designate v(0) as a new center in F . We then add all edges (v (i) , v (i+1) ) to F (at least 1 new edge is added). Recursively doing this will finally give a spanning k-tree forest F of size ≥ m , in which every vertex of order 0 is either a center itself or is directly connected to another center. Now, deleting edges (v (i) , v (i+1) ) for all v and i (if they are in F ) and then replacing v (0) with v for all v ∈ V will produce a spanning star forest of G, which has size at least m − n(k − 1). We have thus proved that G has a spanning star forest of size m if and only if G has a spanning k-tree forest of size m + n(k − 1), and one solution can be easily converted to another in polynomial time. Suppose the k-SF problem admits an r-approximation algorithm. Denoting by m the size of the optimal solution to G, we know that the optimal solution to G has size m + n(k − 1). Also note that m ≥ n/2 since G is connected. Applying the r-approximation scheme on G and then transforming it back to a solution to G will give us a spanning star forest of size at least r(m + n(k − 1)) − n(k − 1). As approximating SSF within 1 − is N P -hard, there exist an instance G with n, m > 0 such that r(m + n(k − 1)) − n(k − 1) ≤ (1 − )m. We thus have
80
J. He and H. Liang (1−)+ n (k−1)
m r ≤ (1−)m+n(k−1) = 1+ n (k−1) m+n(k−1) m c = /2 completes the proof.
≤
1−+2(k−1) 1+2(k−1)
= 1−
2k−1
≤ 1−
/2 k .
Taking
We note that Theorem 1 follows directly from Theorem 5, since as argued before, the spanning k-tree forest problem is a special case of the (≥ k)-spanning star forest problem.
4
Improved Hardness Results for Spanning Star Forest
In this section we show that, by a careful examine of the reductions used by Chleb´ık and Chleb´ıkov´a [8] for proving hardness for N P -hard problems on lowdegree instances, we can improve the hardness bound for the unweighted spanning star forest problem. Theorem 6. For any > 0, it is N P -hard to approximate the spanning star forest problem to a factor of 244 245 + even on graphs of maximum degree 5. Proof. One of Chleb´ık and Chleb´ıkov´a’s results says that vertex cover in 4-regular graphs cannot be approximated to within 52 assuming P = N P (Corol53 lary 18 in [8]). The reductions in their paper crucially depend on a class of carefully constructed gadgets called consistency gadgets. Revisiting their proof of Theorem 17 in [8], it can be seen that they actually prove the following stronger result: Given any 4-regular graph G of n vertices, it is N P -hard to tell whether −MH )/k+8+ the optimal vertex cover has size at most n 2(VH2V , or has size at least H /k+12 −MH )/k+9− n 2(VH2V , where > 0 is any small constant, H is a fixed consistency H /k+12 gadget (depending on ) and VH , MH , k are parameters of H satisfying that VH = 2MH and MH /k ≤ 21.7. Given a graph G = (V, E), we construct a graph G by adding a vertex ve to V for every e ∈ E, and then connecting ve and the two endpoints of e. More specifically, G = (V , E ) where V = V ∪{ve |e ∈ E} and E = E ∪{(x, ve ), (y, ve )|e = (x, y) ∈ E}. It is easy to argue that the size of the optimum vertex cover of G is equal to that of the optimum dominating set of G , which equals |V | minus the size of the maximum spanning star forest of G . Combining this reduction with the aforementioned gap instances of 4-regular vertex cover, it is easy to argue the following: Given any graph G of 3n vertices with maximum degree −MH )/k+9− 5, it is N P -hard to distinguish whether OP Tssf (G) ≤ n 3 − 2(VH2V H /k+12 2(VH −MH )/k+8+ or OP Tssf (G) ≥ n 3 − , where OP Tssf (G) denote the maxi2VH /k+12 mum size of a spanning star forest of G. Hence, it is N P -hard to approximate unweighted SSF to a factor of 2(VH − MH )/k + 9 − 2(VH − MH )/k + 8 + 3− / 3− 2VH /k + 12 2VH /k + 12 27 + 4VH /k + 2MH /k + 27 + 10 · 21.7 + 244 = ≤ ≤ + , 28 + 4VH /k + 2MH /k − 28 + 10 · 21.7 − 245
for any small > 0, since VH = 2MH and MH /k ≤ 21.7. The theorem is thus proved.
On Variants of the Spanning Star Forest Problem
81
References 1. Agra, A., Cardoso, D., Cerfeira, O., Rocha, E.: A spanning star forest model for the diversity problem in automobile industry. In: Proceedings of the 17th European Conference on Combinatorial Optimization, ECCO XVII (2005) 2. Alon, N., Spencer, J.H.: The Probabilistic Method. Wiley, New York (1992) 3. Arora, S., Karger, D., Karpinski, M.: Polynomial time approximation schemes for dense instances of NP-hard problems. J. Comput. Syst. Sci. 58(1), 193–210 (1999) 4. Athanassopoulos, S., Caragiannis, I., Kaklamanis, C., Kyropoulou, M.: An improved approximation bound for spanning star forest and color saving. In: Kr´ aloviˇc, R., Niwi´ nski, D. (eds.) MFCS 2009. LNCS, vol. 5734, pp. 90–101. Springer, Heidelberg (2009) 5. Berry, V., Guillemot, S., Nicolas, F., Paul, C.: On the approximation of computing evolutionary trees. In: Wang, L. (ed.) COCOON 2005. LNCS, vol. 3595, pp. 115– 125. Springer, Heidelberg (2005) 6. Chakrabarty, D., Goel, G.: On the approximability of budgeted allocations and improved lower bounds for submodular welfare maximization and GAP. In: Proceedings of 49th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 687–696 (2008) 7. Chen, N., Engelberg, R., Nguyen, C.T., Raghavendra, P., Rudra, A., Singh, G.: Improved approximation algorithms for the spanning star forest problem. In: Charikar, M., Jansen, K., Reingold, O., Rolim, J.D.P. (eds.) RANDOM 2007 and APPROX 2007. LNCS, vol. 4627, pp. 44–58. Springer, Heidelberg (2007) 8. Chleb´ık, M., Chleb´ıkov´ a, J.: Complexity of approximating bounded variants of optimizatin problems. Theor. Comput. Sci. 354, 320–338 (2006) 9. Duh, R., Furer, M.: Approximation of k-set cover by semi local optimization. In: Proceedings of the 29th Annual ACM Symposium on the Theory of Computing (STOC), pp. 256–264 (1997) 10. Feige, U.: A threshold of ln n for aproximating set cover. J. ACM 45(4), 634–652 (1998) 11. He, J., Liang, H.: An improved approximation algorithm for spanning star forest in dense graphs. In: Wu, W., Daescu, O. (eds.) COCOA 2010, Part II. LNCS, vol. 6509, pp. 160–169. Springer, Heidelberg (2010) 12. Impagliazzo, R., Paturi, R.: On the complexity of k-SAT. J. Comput. Syst. Sci. 62(2), 367–375 (2001) 13. Liao, C.-S., Zhang, L.: Approximating the spanning k-tree forest problem. In: Deng, X., Hopcroft, J.E., Xue, J. (eds.) FAW 2009. LNCS, vol. 5598, pp. 293–301. Springer, Heidelberg (2009) 14. Nguyen, C.T., Shen, J., Hou, M., Sheng, L., Miller, W., Zhang, L.: Approximating the spanning star forest problem and its applications to genomic sequence alignment. SIAM J. Comput. 38(3), 946–962 (2008) 15. Vazirani, V.: Approximation Algorithms. Springer, Heidelberg (2001)
An Implicit Degree Condition for Cyclability in Graphs Hao Li1,2 , Wantao Ning1 , and Junqing Cai1 1
School of Mathematics and Statistics, Lanzhou University, Lanzhou 730000, China
[email protected],
[email protected] 2 L R I, UMR 8623 CNRS and Universit´e de Paris-Sud 11, F-91405 Orsay, France
[email protected]
Abstract. A vertex subset X of a graph G is said to be cyclable in G if there is a cycle in G containing all vertices of X. Ore [6] showed that the vertex set of G with cardinality n ≥ 3 is cyclable (i.e. G is hamiltonian) if the degree sum of any pair of nonadjacent vertices in G is at least n. Shi [8] and Ota [7] respectively generalized Ore’s result by considering the cyclability of any vertex subset X of G under Ore type condition. Flandrin et al. [4] in 2005 extended Shi’s conclusion under the condition called regional Ore s condition. Zhu, Li and Deng [10] introduced the definition of implicit degrees of vertices. In this work, we generalize the result of Flandrin et al. under their type condition with implicit degree sums. More precisely, we obtain that X is cyclable in a k-connected graph G if the implicit degree sum of any pair of nonadjacent vertices u, v ∈ Xi is at least the order of G, where each Xi , i = 1, 2, · · · , k is a vertex subset of G and X = ki=1 Xi . In [10], the authors demonstrated that the implicit degree of a vertex is at least the degree of the vertex. Hence our result is better than the result of Flandrin et al. in some way. Keywords: Graph, Implicit degree, Cycles, Cyclability.
1
Introduction
In this paper we consider only undirected and simple graphs. For a graph G, V (G) and E(G) denote the vertex set and edge set of G, respectively. Let v be a vertex of G. We denote by N (v) the neighborhood of v and by d(v) the degree of v in G. Let d(v) = |N (v)|. We use δ(G) to show the minimum degree of vertices of G. Other notations appearing in this paper can be found in [1]. A graph G is said to be hamiltonian if G has a cycle containing all vertices of G. This cycle is called a hamiltonian cycle. A subset X of V (G) is defined as cyclable in G if there is a cycle in G containing all vertices of X. We also say that G is X-cyclable. The hamiltonian problem is a basic problem in graph theory. Various sufficient conditions for a graph to be hamiltonian have been given in term of vertex degree conditions, especially the following two theorems due to Dirac and Ore respectively. Obviously Ore’s theorem is an extension of Dirac’s theorem. M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 82–89, 2011. c Springer-Verlag Berlin Heidelberg 2011
An Implicit Degree Condition for Cyclability in Graphs
83
Theorem 1. (Dirac [3]). Let G be a graph on n ≥ 3 vertices. If δ(G) ≥ n/2, then G is hamiltonian. Theorem 2. (Ore [6]). Let G be a graph on n ≥ 3 vertices. If d(u) + d(v) ≥ n for each pair of nonadjacent vertices u, v ∈ V (G), then G is hamiltonian. A graph G being hamiltonian is equivalent to V (G) being cyclable in G. Hence we can regard hamiltonian problem as a special case of cyclable problem. Therefore the following theorem is a generalization of Theorem 2. Theorem 3. (Shi [8], Ota [7]). Let G be a graph of order n and X be a subset of V (G). If G is 2-connected and such that for any pair of nonadjacent vertices x and y in X we have d(x) + d(y) ≥ n, then X is cyclable in G. Many other conditions for cyclability can be found in [2,5] etc. Theorem 3 is improved under the condition called regional Ore s condition by the following theorem. Theorem 4. (Flandrin, Li, Marczyk and Wo´ z niak [4]). Let G = (V, E) be a k-connected graph, k ≥ 2, of order n. Denote by X1 , X2 , · · · , Xk subsets of the vertex set V and let X = X1 ∪ X2 ∪ · · · ∪ Xk . If for each i, i = 1, 2, · · · , k, and for each pair of nonadjacent vertices x, y ∈ Xi , we have d(x) + d(y) ≥ n, then G is X-cyclable. Here we are interested in the following Definition 1 that generalizes the classical degrees. For a graph G and two vertices u, v ∈ V (G), let d(u, v) be the distance between u and v. Define N1 (v) = N (v) = {u ∈ V (G) : d(u, v) = 1} and N2 (v) = {u ∈ V (G) : d(u, v) = 2}. Definition 1. (Zhu, Li and Deng [10]). Let v ∈ V (G). (a) If N2 (v) = ∅ and d(v) ≥ 2, denote by M2 = max{d(u) : u ∈ N2 (v)}. Let d(v) = l+1 and d1 ≤ d2 ≤ d3 ≤ · · · ≤ dl ≤ dl+1 ≤ · · · be the degree sequence of the vertices of N1 (v) ∪ N2 (v). Put ∗
d (v) =
dl+1 , dl ,
if dl+1 > M2 ; otherwise.
Then the implicit degree id(v) of vertex v is defined as id(v) = max{d(v), d∗ (v)}. (b) If N2 (v) = ∅ or d(v) < 2, then id(v) = d(v). It is clear from the definition that id(v) ≥ d(v) for every vertex v. The first result on hamiltonian graph theory that is on the implicit degrees was obtained by Zhu et al. [10].
84
H. Li, W. Ning, and J. Cai
Theorem 5. (Zhu, Li and Deng [10]). Let G be a 2-connected graph of order n. If a and b are two nonadjacent vertices such that id(a) + id(b) ≥ n, then G is hamiltonian if and only if G + ab is hamiltonian. There has another definition of implicit degrees in [9] which is used for Chvat´ al type condition on implicit degree sequences. In this paper, we show the following new result that is of Flandrin et al. type condition (see Theorem 4) with implicit degrees. Theorem 6. Let G be a k-connected graph on n vertices with k ≥ 2. Denote by X1 , X2 , · · · , Xk subsets of the vertex set V (G) and let X = X1 ∪ X2 ∪ · · · ∪ Xk . If for each j, j = 1, 2, · · · , k, and for each pair of nonadjacent vertices u, v ∈ Xj , we have id(u) + id(v) ≥ n, then X is cyclable in G. It is clear that Theorem 6 is an extension of Theorem 4. We postpone the proof of Theorem 6 to next section. Here we have a look at the following example in which a vertex subset X of a graph G does not satisfy the conditions of Theorem 4 but it can be verified to be cyclable by using Theorem 6. Example. Let G be a bipartite graph with order n = 9 as follows (Fig. 1). In this graph, we take X = X1 ∪ X2 , where X1 = {y, u} and X2 = {v, w}. Obviously X is cyclable. We can verify that d(y) = d(u) = d(v) = 5 and d(w) = 3. Also it is easy to get that id(y) = id(u) = id(v) ≥ d(v) = 5 and id(w) ≥ 4. We can not get that X is cyclable from the result of Flandrin et al. because d(v)+ d(w) = 8 < 9. However by Theorem 6 we can show that X is cyclable since id(y) + id(u) ≥ 9 and id(v) + id(w) ≥ 9.
y
u v w Fig. 1.
Remark 1. A complete bipartite graph G[X, Y ] with two partitions X and Y such that |X| = |Y | + 1 can show that the bound of Theorem 6 is tight. We omit the detail.
An Implicit Degree Condition for Cyclability in Graphs
85
Remark 2. Zhu, Li and Deng proposed two kinds of definitions of implicit degrees in [10]. The first one is the Definition 1 above. For the second definition, we need only change d∗ (v) of Definition 1 into ⎧ if dl < m2 ; ⎨ m2 , if dl+1 > M2 ; d∗ (v) = dl+1 , ⎩ dl , if dl ≥ m2 and dl+1 ≤ M2 , where m2 = min{d(u) : u ∈ N2 (v)}. The following Fig. 2 manifests that using the second definition of implicit degrees can not get the cyclablity of a vertex subset X of G under the similar conditions of Theorem 6. In Fig. 2, Km is a complete graph with order m ≥ 6 and x1 , x2 are adjacent to every vertex of Km . Then the order of G is m + 14. In the second definition of implicit degrees, we use the symbol d2 (v) to represent the implicit degree of a vertex v. By the definition, d2 (u0 ) = d2 (u1 ) = d2 (u2 ) = d2 (u3 ) = m + 4. Then d2 (u0 ) + d2 (u1 ) = d2 (u2 ) + d2 (u3 ) = 2m + 8 ≥ m + 14. Hence if we take X = X1 ∪ X2 and X1 = {u0 , u1 }, X2 = {u2 , u3 }, then each pair of nonadjacent vertices in X1 or X2 has implicit degree sum at least m + 14. But we can find directly that X is not cyclable in G.
x1
u1
u3 u0
u2
x2
Km Fig. 2.
2
The Proof of Theorem 6
Let C = u1 u2 · · · uk u1 be a cycle of G with a fixed orientation. We use u+ i and to denote the successor and predecessor of u on C, respectively. For two u− i i distinct vertices x and y of C, the segment of C from x to y, denoted by xCy, is the ordered set of consecutive vertices of C from x to y (x and y included) ¯ denotes the same set but in reverse order. along the direction of C while y Cx If x = y, xCy means the one-vertex set {x}. The analogous notations is used for a path P of G. Let P1 = u1 u2 · · · uk and P2 = v1 v2 · · · vd be two paths. If only uk = v1 , then we use P1 ∪ P2 to denote the path u1 u2 · · · uk v2 v3 · · · vd .
86
H. Li, W. Ning, and J. Cai
If V (P1 )∩V (P2 ) = ∅, then we denote by P1 ∪P2 the path u1 u2 · · · uk v1 v2 v3 · · · vd . We also regard a vertex as a path. Let P (a, b) = v0 v1 v2 · · · vl be a path with v0 = a and vl = b in graph G. Denote by lP (a) = max{i : vi ∈ P (a, b) and vi a ∈ E(G)}, and lP (b) = min{i : vi ∈ P (a, b) and vi b ∈ E(G)}. Let LP (a) = vlP (a) and LP (b) = vlP (b) . Proof of Theorem 6. Let G, Xi , i = 1, 2, · · · , k and X be as in Theorem 6. We prove by contradiction and suppose that X is not cyclable. Since G is k-connected with k ≥ 2, there exists a cycle C in G. Choose C such that it contains as many vertices of X as possible. We give C a direction by the clockwise direction. Since X is not cyclable, there exists at least one vertex x0 in G − C such that x0 ∈ X. Since G is k-connected, by Menger’s theorem, there exist k internal vertex-disjoint paths connecting x0 and C. We may assume Pi , i = 1, 2, · · · , k be k internal vertex-disjoint paths connecting x0 and C and V (Pi ) ∩ V (C) = {ui }. Without loss of generality suppose u1 , u2 , · · · , uk occur on C in the order of their indices along the direction of C. Let us orient the Pi from x0 to ui . Hence P¯i is the path Pi oriented from ui to x0 (Fig 3). − Denote by xi the first vertex of X lying on the segment u+ i Cui+1 . By the + choice of C, there exist at least one vertex of X lying on each ui Cu− i+1 .
x0
Pi
Pj xi ui
uj xj C
Fig. 3.
Claim 1. {x0 , x1 , x2 , · · · , xk } is an independent set. Proof. The proof of this claim can be found in many related papers, see [4,7] etc. We omit its proof.
An Implicit Degree Condition for Cyclability in Graphs
87
We know that {x0 , x1 , x2 , · · · , xk } has k + 1 elements and they all belong to X. Hence at least two elements of them belong to the same Xq for some q ∈ {1, 2, · · · , k}. We let xi and xj belong to the same Xq for 0 ≤ i < j ≤ k. If i = 0, take ¯ j Q = xi Cuj ∪ P¯j ∪ Pi ∪ ui Cx be a path containing more vertices of X than C. If i = 0, take ¯ j Q1 = Pj ∪ uj Cx be a path containing more vertices of X than C. In the following proof, we only discuss the path Q because for Q1 the argument is similar to the discussion of Q. Let G be a graph and M be a subset of V (G). Then we denote by NM (h) = N (h) ∩ M , where h ∈ V (G). Set R = G − Q. Suppose Q = v1 v2 · · · vp . For any vertex subset I of Q, let I − = {vi : vi+1 ∈ I} and I + = {vi : vi−1 ∈ I}. We show a lemma as follows. Lemma 1. Let Q = v1 v2 · · · vp with v1 = xi and vp = xj . If d(u) < id(xi ) for every u ∈ NR (xi ) ∪ {xi }, then there exists some vertex vi ∈ (NQ (xi ))− such that d(vi ) ≥ id(xi ). Proof. Let d(xi ) = l + 1. Since Q has more vertices of X than C and by the choice of C, we can get that xi xj ∈ / E(G). Hence vlQ (xi )+1 ∈ N2 (xi ). Here (NR (xi ) ∪ (NQ (xi ))− − {xi }) ∪ {vlQ (xi )+1 } has l + 1 vertices. Also (NQ (xi ))− ⊆ N1 (xi ) ∪ N2 (xi ) ∪ {xi }. It implies that these l + 1 vertices are in N1 (xi ) or in N2 (xi ). In order to unify with the definition of implicit degrees, let M2 = max{d(u) : u ∈ N2 (xi )} and d1 ≤ d2 ≤ d3 ≤ · · · ≤ dl ≤ dl+1 ≤ · · · be the degree sequence of the vertices of N1 (xi ) ∪ N2 (xi ). By the definition of implicit degrees, we know id(xi ) = dl+1 when dl+1 > M2 . Since d(u) < id(xi ) for every u ∈ NR (xi ) ∪ {xi }, d(u) < dl+1 . Also we have d(vlQ (xi )+1 ) ≤ M2 < dl+1 . Let’s revisit the l + 1 vertices in (NR (xi ) ∪ (NQ (xi ))− − {xi }) ∪ {vlQ (xi )+1 }. Since these vertices belong to N1 (xi ) ∪ N2 (xi ), we get that there exists some vertex vi ∈ (NQ (xi ))− such that d(vi ) ≥ dl+1 = id(xi ). When dl+1 ≤ M2 , id(xi ) = dl . Now we consider the l vertices in NR (xi ) ∪ (NQ (xi ))− − {xi }. Similar to dl+1 > M2 , we can also obtain the desired result. Similar to Lemma 1, the following lemma is obvious. Lemma 2. Let Q = v1 v2 · · · vp with v1 = xi and vp = xj . If d(w) < id(xj ) for every w ∈ NR (xj ) ∪ {xj }, then there exists some vertex vj ∈ (NQ (xj ))+ such that d(vj ) ≥ id(xj ).
88
H. Li, W. Ning, and J. Cai
We consider two cases to look for a special path W . Let’s revisit the path Q = v1 v2 · · · vp with v1 = xi and vp = xj . Case 1. There is a vertex u ∈ NR (xi ) ∪ {xi } such that d(u) ≥ id(xi ). If there is also a vertex w ∈ NR (xj ) ∪ {xj } such that d(w) ≥ id(xj ), then take W = u ∪ Q ∪ w. If every vertex in NR (xj ) ∪ {xj } has degree less than id(xj ), then by Lemma 2 there exists some vertex vj ∈ (NQ (xj ))+ such that d(vj ) ≥ id(xj ). Take W = u ∪ v1 v2 · · · vj−1 vp vp−1 · · · vj . Case 2. Every vertex in NR (xi ) ∪ {xi } has degree less than id(xi ). By Lemma 1, there exists some vertex vi ∈ (NQ (xi ))− such that d(vi ) ≥ id(xi ). Subcase 2.1. There is a vertex w ∈ NR (xj ) ∪ {xj } such that d(w) ≥ id(xj ). In this subcase, take W = vi vi−1 · · · v1 vi+1 vi+2 · · · vp ∪ w. Subcase 2.2. Every vertex in NR (xj ) ∪ {xj } has degree less than id(xj ). By Lemma 2, there exists some vertex vj ∈ (NQ (xj ))+ such that d(vj ) ≥ id(xj ). If i + 1 ≤ lQ (xj ), set W = vi vi−1 · · · v1 vi+1 vi+2 · · · vj−1 vp vp−1 · · · vj . If i + 1 > lQ (xj ), let A = {vq1 : vq1 ∈ (NQ (xj ))− and q1 < i} and B = {vq2 : vq2 ∈ (NQ (xj ))+ and q2 > i + 1} and D = {vq3 : vq3 ∈ (NQ (xj ))+ , q3 < i + 1 and q3 is as large as possible}. Clearly xj ∈ B. Then |A| + |B| + |D| + |NR (xj )| − |{xj }| ≥ d(xj ) and clearly the only vertex in D belongs to N2 (xj ). We also know that the vertices in (A ∪ B ∪ NR (xj )) − {xj } belong to N1 (xj ) ∪ N2 (xj ). By the definition of id(xj ), similar to the proof of Lemma 1, we know that there is some vh ∈ (A ∪ B) − {xj } such that d(vh ) ≥ id(xj ). When vh ∈ B − {xj }, set W = vi vi−1 · · · v1 vi+1 vi+2 · · · vh−1 vp vp−1 · · · vh ,
An Implicit Degree Condition for Cyclability in Graphs
89
and when vh ∈ A, set W = vi vi−1 · · · vh+1 vp vp−1 · · · vi+1 v1 v2 · · · vh . In all cases, we have found a new path W = w1 w2 · · · wt connecting w1 and wt such that d(w1 ) ≥ id(xi ) and d(wt ) ≥ id(xj ). Since W contains more vertices of X than C, we have N (w1 ) ∩ N (wt ) ∩ V (G − W ) = ∅, and
(NW (w1 ))− ∩ NW (wt ) = ∅ and w1 wt ∈ / E(G).
(1)
(2)
(1) and (2) imply that d(w1 ) + d(wt ) ≤ n − 1.
(3)
But from the condition of Theorem 6 and our discussion, we have d(w1 ) + d(wt ) ≥ id(xi ) + id(xj ) ≥ n. (3) and (4) show a contradiction. The proof of Theorem 6 is completed.
(4)
References 1. Bondy, J.A., Murty, U.S.R.: Graph theory with applications. Macmillan and Elsevier, London, New York (1976) 2. Broersma, H., Li, H., Li, J., Tian, F., Veldman, H.J.: Cycles through subsets with large degree sums. Discrete Math. 171, 43–54 (1997) 3. Dirac, G.A.: Some theorems on abstract graphs. Proc. London Math. Soc. 3, 69–81 (1952) 4. Flandrin, E., Li, H., Marczyk, A., Wo´zniak, M.: A note on a generalisation of Ore’s condition. Graphs Combin. 21, 213–216 (2005) 5. Fournier, I.: Th`ese d’Etat. L.R.I., Universit´e de Paris–Sud, France (1985) 6. Ore, O.: Note on Hamilton circuits. Amer. Math. Monthly 67, 55 (1960) 7. Ota, K.: Cycles through prescribed vertices with large degree sum. Discrete Math. 145, 201–210 (1995) 8. Shi, R.: 2-neighborhoods and hamiltonian condition. J. Graph Theory 16, 267–271 (1992) 9. Zhu, Y., Gao, J.: Implicit degrees and Chv´ atal’s condition for hamiltonicity. Systems Sci. Math. Sci. 2, 353–363 (1989) 10. Zhu, Y., Li, H., Deng, X.: Implicit-degree and circumference. Graphs Combin. 5, 283–290 (1989)
Parallel Enumeration of Lattice Animals Gadi Aleksandrowicz and Gill Barequet Center for Graphics and Geometric Computing Dept. of Computer Science Technion—Israel Institute of Technology Haifa 32000, Israel {gadial,barequet}@cs.technion.ac.il
Abstract. Lattice animals are connected sets of lattice cells. When the lattice is in d dimensions, connectedness is through (d − 1)-dimensional features of the lattice. For example, connectedness of two-dimensional animals (e.g., on the rectangular, triangular, and hexagonal lattices) are through edges, connectedness of 3-dimensional polycubes is through faces, etc. Much attention has been given in the literature to algorithms for counting animals of a given size (number of cells) on different lattices. One such algorithm was suggested in 1981 by Redelmeier for counting polyominoes (animals on the 2D orthogonal lattice). This was the first algorithm that generated polyominoes without repetitions. In previous works we extended this algorithm to other lattices and showed how to avoid its (originally) huge memory consumption. In the current paper we describe how to parallelize the extended algorithm. Our implementation runs on the Internet, effectively using an unlimited number of computers running portions of the computation. Thus, we were able to extend the known counts of animals on many types of lattices with values which were previously out of reach. Keywords: Polyominoes, polycubes, leapers, subgraph counting.
1
Introduction
A 2-dimensional polyomino (resp., d-dimensional polycube) of size n is an edgeconnected (resp., (d − 1)-D face-connected) set of n squares (resp., d-D cubes) on the orthogonal lattice Z2 (resp., Zd ). Similarly, one can consider structures on other types of lattices, such as polyamonds on the planar triangular lattice, polyhexes on the planar hexagonal lattice, as well as structures on lattices of higher dimensions. All these structures are usually called lattice animals in the statistical-physics literature. Animals play an important role in computing the mean cluster density in percolation processes, in particular those of fluid flow in random media [BH57], and in modeling the collapse of branched polymer molecules in dilute solution [PG95]. Fixed animals are considered distinct if they differ in their shapes or orientations. That is, animals that match only by rotation are considered distinct. M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 90–99, 2011. c Springer-Verlag Berlin Heidelberg 2011
Parallel Enumeration of Lattice Animals
91
u
(a) Three-dimensional dominoes (b) Three-dimensional trominoes Fig. 1. Fixed three-dimensional dominoes and trominoes
In this paper we consider only fixed animals. Figures 1(a,b) show the three and fifteen polycubes of size 2 and 3, respectively, in three dimensions. Let L be a lattice, and denote by AL (n) the number of fixed animals on L of size n. One of the main open problems related to animals on a nontrivial lattice L is finding a formula for AL (n).1 Since no analytic formula for AL (n) is known for any nontrivial lattice, even not for Z2 , a great portion of the research has so far focused on efficient algorithms for counting animals on lattices. Most work has been done on computing AZ2 (n) (usually denoted in the literature as A2 (n) or simply A(n)) for as high as possible values of n. Redelmeier [Re81] introduced the first efficient algorithm for counting polyominoes, in the sense that it generated all polyominoes sequentially without repetitions. Thus, it wastes time neither on computing previously-generated polyominoes, nor on checking whether a newly-generated polyomino has ever been generated before; it only has to count the generated polyominoes. Since the algorithm generates each polyomino in constant time, its total running time is O(A2 (n)). (This depends on the assumption that any operation on integer numbers can be performed in constant time, an assumption which breaks when we deal with extremely large numbers, as is the case here. The reader is referred to a discussion of this issue in [AB09b].) Redelmeier implemented his algorithm in Algol W and (for efficiency) also in the PDP assembly language. His program required about 10 months of CPU time on a PDP-11/70 to compute the value of A2 (24). The best currently-known algorithm (in terms of running time) for counting two-dimensional fixed polyominoes is that of Jensen [Je01]. This is a so-called transfer-matrix algorithm, which does not even generate all the polyominoes. Instead, it generates representatives of classes of polyominoes with identical “boundaries,” while being able to compute efficiently the number of polyominoes in each such class. Jensen parallelized his algorithm and computed A2 (n) up to 1
Any one-dimensional lattice, for example, is trivial.
92
G. Aleksandrowicz and G. Barequet
n = 56 [Je03]. However, this notion of “boundaries” does not extend easily to higher dimensions and/or different types of lattices. The reader is referred to [AB09b] for an extensive review of the history of counting polyominoes and polycubes. In this work we describe our parallel implementation of the generalization of Redelmeier’s algorithm to any lattice, providing a broad sense to the notion of “neighborhood” of cells on the lattice. The original algorithm [Re81] counts two-dimensional polyominoes. Although it is not presented in this way, it is based on counting connected subgraphs in the underlying graph of the twodimensional orthogonal lattice, that contain one particular (so-called canonical ) node. As already observed (see discussions by Mertens [Me90] and in [AB09b]), Redelmeier’s algorithm does not depend on any particular property of the graph. In our first generalization of this algorithm to higher dimensions and to other lattices [AB09a], we first computed the respective lattice graphs, clipped to the size of the sought-after animals, and then applied the same subgraph-counting algorithm. The main drawback of this approach is that it keeps in memory at all times the entire set of “reachable” cells—that is, all cells that are part of some animal. For d-dimensional polycubes the number of such cells is roughly (2n)d , hence the algorithm becomes useless for relatively small values of d. In [AB09b] we significantly improved the algorithm by not keeping this set of reachable cells in memory at all. Instead, we maintained only the “current” animal and a set of its immediate neighboring cells, entirely omitting the lattice graph. The latter is computed locally “on demand” in the course of the algorithm. Consequently, for d-dimensional polycubes we needed to store in memory only O(nd) cells, which made the new version of the algorithm much more feasible. In the next sections we describe Redelmeier’s original algorithm and mention its generalization to any type of lattice and our new ingredient that eliminates the need to hold the entire underlying graph in memory. The focus of this paper is on the perfect parallelization of the algorithm. This enabled us to count animals on various lattices far beyond any previous attempt. With contemporary computing resources, the bottleneck of the newest version of the algorithm (in higher dimensions) is again its running time and not its consumed amount of memory. This bottleneck is remedied by our ability to run the algorithm simultaneously on practically unlimited number of computers over the Internet.
2
Redelmeier’s Algorithm
We first describe briefly Redelmeier’s algorithm for counting two-dimensional polyominoes. The reader is referred to Redelmeier’s paper [Re81] and to [AB09b] for the full details. The algorithm is essentially a procedure for connected-subgraph counting, where the underlying graph is induced by the orthogonal lattice. Since translated copies of a fixed polyomino are considered identical, one must decide upon a canonical form. Redelmeier’s choice was to fix the leftmost square of the bottom
Parallel Enumeration of Lattice Animals a1
e4
4 3
e3 d3 e5
2
e2 d 2 c2 d 4 e6
1
e1 d1 c1 b1 c3 d5 e7
b1 c1
a1 b2 c4 d6 e8
0
93
b2 c2
d1
d2
d3
c3 d4
c4 d5
d6
-1 -4 -3 -2 -1
0
1
2
3
4
(a) Reachable cells in pentominoes
e1
e2
e3 e4 e5
e6
e7
e8
(b) Corresponding graph
Fig. 2. Pentominoes as subgraphs of some underlying graph
row of a polyomino at the origin, that is, at the square with coordinates (0,0). (Note that coordinates are associated with squares and not with their corners.) Thus, he needed to count the number of edge-connected sets of squares (that contain the origin) in {(x, y) | (y > 0) or (y = 0 and x ≥ 0)}. The squares in this set are located above the thick line in Figure 2(a). The shaded area in this figure consists of all the reachable cells (possible locations of cells) of pentominoes (polyominoes of size 5). Counting pentominoes amounts to counting all the connected subgraphs of the graph shown in Figure 2(b), that contain the vertex a1 . The algorithm, taken verbatim from [Re81, p. 196], is the following: Initialize the parent to be the empty polyomino, and the untried set to contain only the origin. The following steps are repeated until the untried set is exhausted. 1. 2. 3. 4.
Remove an arbitrary element from the untried set. Place a cell at this point. Count this new polyomino. If the size is less than n: (a) Add new neighbors to the untried set. (b) Call this algorithm recursively with the new parent being the current polyomino, and the new untried set being a copy of the current one. (c) Remove the new neighbors from the untried set. 5. Remove newest cell.
Step 4(a) deserves some attention. By “new neighbors” we mean only neighbors of the new cell c (chosen in Step 2) that were not neighbors of any cells of the current polyomino prior to the addition of c. This ensures that we will not count the same polyomino more than once [AB09b, p. 4580, Theorem 1]. When this sequential algorithm is regarded as a subgraph-counting algorithm, one can easily notice it that can be applied to any graph, and that it has the property that it never produces the same subgraph twice. In [AB09a, AB09b] we describe how to generalize Redelmeier’s algorithm to any lattice. In particular,
94
G. Aleksandrowicz and G. Barequet
we describe there in detail the conversion of the orthogonal lattice in any fixed dimension, and also the triangular and hexagonal lattices in the plane, into graphs in which the algorithm can search subgraphs of a given size n, and the counts thereof will be the numbers of animals of size n on these lattices. In [AB09b] we also showed how one can avoid altogether the creation of the underlying graph. At first glance this may seem impossible since any search algorithm must store, for each node of the graph, at least an indication of whether or not the node was already visited in the course of the algorithm. However, it turns out that one can search a lattice graph without actually creating and holding it in memory. The trick is based on the fact that such a graph is repetitive, that is, it locally looks the same at every node. Therefore, the algorithm can avoid storing a “having been visited” indication for each node. Instead, one can implement an oracle, which based on the general structure of the lattice and the direction of entry to the new node (i.e., from which node the new node is entered), predicts correctly (in constant time), upon entering a new node, whether or not this node has already been visited. This, naturally, has some computational cost, but it allows the counting of animals of sizes never reached before on large graphs, such as those of the orthogonal lattices in high dimensions. In a sense, this improved algorithm bears some resemblance with the general reverse search technique of Avis and Fukuda [AF96], which allows to search combinatorial configurations with low time and space resources. In particular, our improved version of Redelmeier’s algorithm is similar to the application of the reverse search to the enumeration of connected subgraphs [ibid, §3.4]. The main difference is that we use heavily the self-repeating structure of the lattice. A minor additional difference is that we enumerate only subgraphs that contain one specific vertex.
3
Parallelism
Our algorithm can be parallelized efficiently, and so it can be run simultaneously on an unlimited number of different computers. This is done in a fashion similar to the one used by Mertens and Lautenbacher [ML92] in their parallelization of the two-dimensional version of Redelmeier’s algorithm (for counting polyominoes in the plane). The parallelism relies crucially on the fact that the execution of any subtree of the recursion does not change the contents of the data structures at the top of the subtree, and so the computation can be distributed between many processors in such a way that only one of them counts the number of animals in some subtree, while all the other processors skip it altogether and count animals in other subtrees. In practice, the main procedure recurses only until some level k < n. Regardless of the value of n, this induces AL (k) subtrees. (Recall that AL (k) denotes the number of animals of size k on the lattice L.) These subtrees can be assigned independently to the processors which we have at hand. The results for all levels m (where 1 ≤ m ≤ n, and, in particular, level n) are collected from all the processors, and their summation yields the values of A(m).
Parallel Enumeration of Lattice Animals
95
The parallelism is perfect in the sense that the split of the computation into parallel tasks can be done at any level 1 ≤ k ≤ n. Setting the level k is based on the desired complexity of a task. Note that for a fixed value of k, the complexities of different subtrees whose roots are at level k may differ significantly. Obviously, setting k = 1 results in a single task, in which case the algorithm runs sequentially. Also note that all tasks involve running the entire algorithm up to level k, and recursing only into the designated subtrees. In principle we could avoid this by transferring over the Internet the initial and target configurations (i.e., contents of the data structures that monitor the recursive algorithm), effectively allowing a “warm restart” of the algorithm at any task. In practice, our experiments showed that with our choices of k, the time wasted on running the entire algorithm up to level k in each task was absolutely negligible. In some cases, care should be taken to differentiate between animals that should be counted and those that should not be counted. For example, when we count only convex polycubes, or proper polycubes (polycubes that span all dimensions,2 or any other specialized type of animals, intermediate animal-like structures do not match the definition of the sought animals, but we cannot skip their creation during the course of the algorithm since subsequent animals may well be of the desired type. Our actual implementation of the parallel version of Redelmeier’s algorithm is based on the “server-client” model. The server was designed to count at the same time several types of animals, hence, it maintains a list of the currently running counters. Each counter is characterized by the type of lattice, the maximum animal size, the value k that controls the parallelization, etc. One of these counters is the active counter, corresponding to the lattice on which animals are counted at the present time. Each counter keeps a list of counting tasks, that is, subtrees or ranges of subtrees of the enumeration tree. A task is characterized by the counter type and by the range of k-level subtrees to be processed. Every counter also keeps an indication, for each of its tasks, whether or not the task was already executed, and if yes, what its counting results are. When a new client introduces itself to the server (by communicating over the Internet), the latter responds with a request to carry out one of the yetunhandled tasks of the currently active counter. The client then invokes a local copy of the polyomino-counting program, performing the entire computation up to level k, and recursing to the subtrees only in the requested range. At the end of the computation, the client forwards the counting results to the server, again, by communicating over the Internet. Upon receiving these data, the server updates its records. Namely, the task is marked as handled, and the counting results are stored and added the total results of the active counter. Then, a new task is assigned to the same client, and the process continues until all tasks are handled. At this time the active counter has finished its execution and another counter, if available, becomes the active counter. 2
For example, in the plane, “stick” (straight-line) polyominoes are not proper because they span only one dimension.
96
G. Aleksandrowicz and G. Barequet
To accommodate situations in which a task is “lost,” that is, the main server never receives the task’s results from the client to which the task was assigned, the server assigns tasks to clients in a cyclic manner. When all tasks are either completed or assigned to clients, the server returns to the beginning of the task list, and for each yet uncompleted task, if a nominal amount of time has passed since its allocation to a client, the task is assigned to the next available client. In principle, this can lead to the execution of the same task by more than one client, and to the reporting of this task’s results more than once. (This happens only towards the completion of executing a counter.) In this case the server checks for contradicting results, and if such results are encountered, a warning message is sent to the operator of the server. (So far we have never experienced such a situation, indicating, so we believe, that the client code is free of bugs.) The main server was implemented using the Ruby on Rails framework, and it is accessible via the http protocol. The client and counting program were written in C++. All the programs can run under either MS Windows or a Linux environment. An extremely-easy-to-install client package (only a few mouse clicks are needed) is found in http://www.cs.technion.ac.il/~gadial/counter.rar .
4
Results
We implemented several engines for counting different types of animals. Each engine considers some type of a lattice, as well as some constraints imposed on the counted animals, in order to create the underlying graph in which subgraphs are sought. We counted, inter alia, the following types of animals.
Table 1. Numbers of fixed d-dimensional polycubes A4 (n) A5 (n) A6 (n) A7 (n) A8 (n) n A151830 A151831 A151832 A151833 A151834 1 1 1 1 1 1 2 4 5 6 7 8 3 28 45 66 91 120 4 234 495 901 1484 2276 5 2162 6095 13881 27468 49204 6 21272 80617 231008 551313 1156688 7 218740 1121075 4057660 11710328 28831384 8 2323730 16177405 74174927 259379101 750455268 9 25314097 240196280 1398295989 5933702467 10 281345096 3648115531 27012396022 139272913892 11 3178474308 56440473990 12 36400646766 886696345225 13 421693622520 14111836458890 14 4933625049464 15 58216226287844
Parallel Enumeration of Lattice Animals
Table 2. Numbers of fixed tree d-dimensional polycubes (T) A2 (n) n A066158 1 1 7 570 13 942651 19 1946892842 25 4444545298879 2 2 8 1908 14 3329608 20 7027047848 26 16229462702152 3 6 9 6473 15 11817582 21 25424079339 27 59347661054364 4 18 10 22202 16 42120340 22 92185846608 5 55 11 76886 17 150682450 23 334925007128 6 174 12 268352 18 540832274 24 1219054432490 (T) (T) (T) (T) (T) (T) n A3 (n) A4 (n) A5 (n) A6 (n) A7 (n) A8 (n) 1 1 1 1 1 1 1 2 3 4 5 6 7 8 3 15 28 45 66 91 120 4 83 228 485 886 1463 2248 5 486 2018 5775 13281 26460 47636 6 2967 18892 73437 213978 516691 1088017 7 18748 184400 979335 3630090 10654378 26424957 8 121725 1857856 13536225 64012932 9 807381 19189675 192393410 10 5447203 202214452 2796392165 11 37264974 12 257896500 13 1802312605 (a) All trees (PT) (PT) (PT) (PT) n A2 (n) A3 (n) A4 (n) A5 (n) 1 0 0 0 0 2 0 0 0 0 3 4 0 0 0 4 16 32 0 0 5 53 324 400 0 6 172 2448 8064 6912 7 568 17041 112824 239120 8 1906 116004 1382400 5445120 9 6471 787965 15998985 104454120 10 22200 5380600 180558848 1839569920 11 76884 37034319 .. .(*) (b) Proper trees (PT) (T) (*) Note that A2 (n) = A2 (n) − 2 since only the two “sticks” are 2D tree polyominoes that are not proper.
97
98
G. Aleksandrowicz and G. Barequet Table 3. Numbers of more types of animals
(LC) n A3 (n) 1 1 2 3 3 15 4 86 5 522 6 3241 7 20256 8 126520 (a) Line Convex, 3D
(Lp(2,1)) A2 (n) n A030444 1 1 2 4 3 28 4 234 5 2162 6 20972 7 209608 8 2135572 9 22049959 10 229939414 11 2416816416 12 25569786440 (b) (1,2)-Leapers
1. Two-dimensional polyominoes, lying on the two-dimensional orthogonal lattice. This was the first implementation of a counter, which mainly served for checking the entire package. 2. d-dimensional polycubes, for any fixed value of d. These animals lie on the d-dimensional orthogonal lattice. 3. Polyamonds, that is, two-dimensional animals on the planar triangular lattice. 4. Polyhexes, that is, two-dimensional animals on the planar hexagonal lattice. 5. Proper d-dimensional polycubes, that is, polycubes that span all the d dimensions, or, equivalently, cannot be embedded in less than d dimensions. (The number of all polycubes in d dimensions is related to the numbers of proper polycubes in i dimensions, for all 0 ≤ i ≤ d, by Lunnon’s formula [Lu75, p. 366].) 6. Tree polycubes, that is, polycubes whose dual (cell adjacency) graphs are trees. This engine was implemented for any fixed dimension d ≥ 2. In two dimensions, our count confirms all the 27 already-known values. 7. Proper tree polycubes (in any fixed dimension d ≥ 2). 8. (a, b)-leapers, lying on the two-dimensional orthogonal lattice, in which the neighbors of cell (x, y) are defined to be cells (x ± a, y ± b) and (x ± b, y ± a). Under this definition, regular polyominoes are (1,0)-leapers. The term polyknights is usually used for (2, 1)-leapers for obvious reasons. 9. Line-convex three-dimensional polycubes, that is, polycubes whose intersection with an axis-parallel line is continuous.3 3
Note that a “torus” forming a 45◦ angle with the three major axes is line-convex. Probably a more appropriate definition of polycube convexity would be recursive: A d-dimensional polycube p is convex if every intersection of p and a (d−1)-dimensional axis-parallel flat is a convex (d − 1)-dimensional polycube. We are currently working on implementing an engine that counts polycubes convex under this definition.
Parallel Enumeration of Lattice Animals
99
Finally, we provide the most advanced counts of animals that we have at hand at the time of publishing this work. Table 1 shows counts of all polycubes in 4 ≤ d ≤ 8 dimensions. Table 2 shows counts of all (resp., proper) fixed tree polycubes in 2 ≤ d ≤ 8 (resp., 2 ≤ d ≤ 5) dimensions. Table 3 shows additional counts of line-convex polycubes in three dimensions and (1,2)-leapers in the plane. IDs of series which appear in the Encyclopedia of Integer Sequences [EIS] are marked in the tables. All new values, that have never been tabulated before and appear here in the first time, are shown in boldface.
References [AB09a] Aleksandrowicz, G., Barequet, G.: Counting d-dimensional polycubes and nonrectangular planar polyominoes. Int. J. of Computational Geometry and Applications 19, 215–229 (2009) [AB09b] Aleksandrowicz, G., Barequet, G.: Counting polycubes without the dimensionality curse. Discrete Mathematics 309, 4576–4583 (2009) [AF96] Avis, D., Fukuda, K.: Reverse search for enumeration. Discrete Applied Mathematics 65, 21–46 (1996) [BH57] Broadbent, S.R., Hammersley, J.M.: Percolation processes: I. Crystals and mazes. Proc. Cambridge Philosophical Society 53, 629–641 (1957) [EIS] http://www.research.att.com/~ njas/sequences (the on-line encyclopedia of integer sequences) [Je01] Jensen, I.: Enumerations of lattice animals and trees. J. of Statistical Physics 102, 865–881 (2001) [Je03] Jensen, I.: Counting polyominoes: A parallel implementation for cluster computing. In: Sloot, P.M.A., Abramson, D., Bogdanov, A.V., Gorbachev, Y.E., Dongarra, J., Zomaya, A.Y. (eds.) ICCS 2003. LNCS, vol. 2659, pp. 203–212. Springer, Heidelberg (2003) [Lu75] Lunnon, W.F.: Counting multidimensional polyominoes. The Computer Journal 18, 366–367 (1975) [Me90] Mertens, S.: Lattice animals: A fast enumeration algorithm and new perimeter polynomials. J. of Statistical Physics 58, 1095–1108 (1990) [ML92] Mertens, S., Lautenbacher, M.E.: Counting lattice animals: A parallel attack. J. of Statistical Physics 66, 669–678 (1992) [Re81] Redelmeier, D.H.: Counting polyominoes: Yet another attack. Discrete Mathematics 36, 191–203 (1981) [PG95] Peard, P.J., Gaunt, D.S.: 1/d-expansions for the free energy of lattice animal models of a self-interacting branched polymer. J. Phys. A: Math. Gen. 28, 6109–6124 (1995)
Parameterized Edge Dominating Set in Cubic Graphs (Extended Abstract) Mingyu Xiao1 and Hiroshi Nagamochi2 1
2
School of Computer Science and Engineering, University of Electronic Science and Technology of China, China
[email protected] Department of Applied Mathematics and Physics, Graduate School of Informatics, Kyoto University, Japan
[email protected]
Abstract. In this paper, we present an improved algorithm to decide whether a graph of maximum degree 3 has an edge dominating set of size at most k or not, which is based on enumeration of vertex covers. We first enumerate vertex covers of size at most 2k and then construct an edge dominating set based on each vertex cover to find a satisfied edge dominating set. To enumerate vertex covers, we use a branch-and-reduce method that will generate a search tree of size O(2.1479k ). Then we get the running time bound of the algorithm.
1
Introduction
Given a graph G = (V, E), an edge dominating set of the graph is a subset M ⊆ E of edges such that each edge in E − M is adjacent to at least one edge in M . The minimum edge dominating set problem (EDS) is to find an edge dominating set of minimum size. EDS is a basic graph problem and one of the early-known NP-hard problems [4]. It is related to many other important problems, such as matching problems in graphs. A matching in a graph is an independent subset of edges of the graph, i.e., a subset of edges such that no pair of them share a common endpoint. Clearly, a matching is an edge dominating set. The maximum matching problem, to find a matching of maximum size in a graph, is a well-known problem that can be solved in polynomial time. However, the minimum maximal matching problem (MMM), to find a matching of minimum size such that no edge can be added into the matching to get another matching, is NP-hard. In fact, MMM is equivalent to EDS, since a minimum maximal matching is also a minimum edge dominating set and a minimum maximal matching can be constructed from any minimum edge dominating set in linear time. Therefore, many papers discuss these two problems together. EDS is also related to the famous vertex cover
The work is supported in part by National Natural Science Foundation of China Grant No. 60903007.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 100–112, 2011. c Springer-Verlag Berlin Heidelberg 2011
Parameterized Edge Dominating Set in Cubic Graphs
101
problem. A vertex cover in a graph is a subset of vertices removal of which leaves no edges. The set of endpoints of all edges in an edge dominating set is a vertex cover, which lights a way to solve EDS based on enumeration of minimal vertex covers. To find an edge dominating set of size k, we may enumerate vertex covers of size at most 2k and construct edge dominating sets from the vertex covers. In fact, many previous exact and parameterized algorithms for EDS are based on enumeration of vertex covers. In this paper, we further study EDS algorithms based on this framework and get an improved parameterized algorithm for the edge dominating set problem in graphs of maximum degree 3. In parameterized algorithms, an edge dominating set instance I together with a parameter k is given, we are going to design an algorithm with running time f (k)poly(|I|) to decide whether the graph has an edge dominating set of size ≤ k, where f (k) is a function of parameter k and poly(|I|) is a polynomial of input size |I|. We use k-EDS to denote this problem. EDS is a basic problem introduced in Garey and Johnson’s work on NPcompleteness [4]. Yannakakis and Gavril [15] further showed that EDS is NPhard even in planar or bipartite graphs of maximum degree 3. Randerath and Schiermeyer [8] designed an O∗ (1.4423m)-time1 algorithm for EDS, where m is the number of edges in the graph, which was improved to O∗ (1.4423n ) by Raman et al. [7], where n is the number of vertices in the graph. Fomin et al. [3] improved the result to O∗ (1.4082n) by considering the treewidth of the graph. Rooij and Bodlaender [9] designed an O∗ (1.3226n)-time algorithm by using the ‘measure and conquer’ method. For k-EDS, Fernau [2] gave an O∗ (2.6181k)-time algorithm. Fomin et al. [3] improved the result to O∗ (2.4181k ). Wang et al. [10] also studied the problem of enumerating weighted edge dominating sets of small size. For EDS in graphs of maximum degree 3, the best exact and parameterized algorithms are the O∗ (1.2721n)-time and O∗ (2.2306k )-time algorithms due to Xiao [12]. Xiao designed the parameterized algorithm by using a result of kernelization in graphs of maximum degree 3. In this paper, we improve the result of O∗ (2.2306k) to O∗ (2.1479k ) by designing an algorithm based on enumeration of vertex covers. Note that recently there are many interesting results on basic graph NP-hard problems in sparse and low-degree graphs, such as the O∗ (1.0854n)-time algorithm for the independent set problem in graphs of maximum degree 3 [1], the O∗ (1.1616k )-time time algorithm for the k-vertex cover problem in graphs of maximum degree 3 [11], the O∗ (1.251n )-time algorithm for TSP in cubic graphs [5] and so on. This is the reason why we have special interests in the problem in degree-3 graphs.
2
Enumeration-Based Algorithms
For a set M of edges, we use V (M ) to denote the set of vertices appearing in at least one edge in M . Many previous algorithms for the edge dominating set problem are based on enumeration of minimal vertex covers, such as the 1
In this paper, notation O∗ suppresses all polynomially bounded factors. For two functions f and g, we write f (n) = O∗ (g(n)) if f (n) = g(n)nO(1) .
102
M. Xiao and H. Nagamochi
algorithms in [2,9,10,3]. In this framework, we first find out a set C ∗ of vertices that is the vertex set V (M ) of a minimum edge dominating set M . Then we find a maximum matching in the induced graph G[C ∗ ] and add an edge for every unmatched vertex in C ∗ to get a minimum edge dominating set. In fact, sometimes set C ∗ may just be a subset of V (M ), but the edge dominating set can be found in polynomial time if C ∗ is given. The vertex set C ∗ may not be easy to compute. We will enumerate minimal vertex covers to find C ∗ . This step may cause exponential time. Since all minimal vertex covers can be enumerated in O(1.4423n ) time [6], we can solve EDS in O∗ (1.4423n) time. For k-EDS, we may use a branch-and-reduce method to find vertex covers of size up to 2k by fixing part of a vertex cover. Assume that the size of a vertex cover to be constructed in addition to a fixed partial vertex cover is at most p (initially p = 2k). For any vertex v, we can branch on it into two branches by either including it into the vertex cover or excluding it from the vertex cover. For the second branch, we should include all neighbors N (v) of v into the vertex cover. Then we can get the following recurrence on p: C(p) ≤ C(p − 1) + C(p − |N (v)|),
(1)
where C(p) denotes the worst running time to enumerate minimal vertex covers up to size p in any graphs.2 If we always select a vertex of maximum degree to branch on, then we can branch on vertices of degree at least 2. By solving C(p) ≤ C(p − 1) + C(p − 2),
(2)
Fernau [2] showed that the edge dominating set problem can be solved in O∗ (1.6181p) = O∗ (2.6181k) time. The method of iteratively branching on maximum degree vertices is simple and powerful. It is interesting to know whether we can get further improvement on this method. For example, if we can guarantee the vertices to be branched on are of degree at least 3, then we can always get recurrence C(p) ≤ C(p − 1) + C(p − 3),
(3)
which solves to O∗ (1.4656p) = O∗ (2.1479k ). Some drafts claimed this improvement. However, the proofs are incomplete. In this paper, we show that this improvement for k-EDS can be achieved in graphs of maximum degree 3. The details omitted due to space limitation can be found in the full version of this paper [14]. In this paper, we will use the branch-and-reduce method to find the vertex cover C ∗ of size at most p. For a subset C ⊆ V and an independent set I ⊆ V − C in G, an edge dominating set M is called a (C, I)-eds if C ⊆ V (M ) and 2
In many algorithms, we may not enumerate all minimal vertex covers of size at most p. But we will guarantee to find at least one satisfied vertex cover, based on which we can find an edge dominating set of size at most k in polynomial time, if it exists. Then C(p) should be the worst running time to solve the corresponding problem.
Parameterized Edge Dominating Set in Cubic Graphs
103
I ∩ V (M ) = ∅ hold. To search the vertex cover V (M ) of a minimum (C, I)-eds M , we will keep track of a partition of the vertices of G in four sets: C, I, U1 and U2 (initially C = I = U1 = ∅ and U2 = V ) such that I is an independent set in G, and each connected component of G[U1 ] is a clique of G[V \(C ∪ I)] (In our algorithm, G[U1 ] may also contain pseudo-cliques, which are defined in Section 4 and can just be regarded as cliques). The vertices in U1 ∪ U2 are called undecided vertices. Note that G[U1 ] may not be the set of all cliques in G[V \(C ∪ I)] or U2 may contain a vertex adjacent to I so that some cliques are allowed to exist in G[U2 ] in order to get an amortized time complexity. We use a five-tuple (G, C, I, U1 , U2 ) to denote the state described above. Rooij and Bodlaender proved the following lemma in [9]: Lemma 1. Given a five-tuple (G, C, I, U1 , U2 ), let qi = |Qi | denote the size of clique Qi of G[U1 ], if U2 = ∅, a minimum (C, I)-eds M of G can be found in polynomial time. Lemma 1 implies that we can avoid branching on clique components in the graph to reduce the size of our search tree. Initially, let U2 = V (G) and C = I = U1 = ∅. While U2 = ∅, pick up a vertex v of maximum degree in G[U2 ] and branch on it by including it into the vertex cover or excluding it from the vertex cover. In the first branch, we include v into C and reduce p by 1. In the second branch, we include v into I, include N (v) to C and reduce p by |N (v)|. In each branch, if we move any newly created clique component Q in G[U2 ] into U1 , then we can reduce p by |V (Q)| − 1 at least. In this case, we have a recurrence C(p) ≤ C(p − 1 − qv ) + C(p − |N (v)| − qN (v) ),
(4)
where qv (resp., qN (v) ) denotes the sum of |V (Q)| − 1 over all cliques Q in G[U2 ] generated by removing v (resp., N (v)) from U2 . A path v0 v1 · · · vl with l + 1 vertices is called an l-path and a cycle with l vertices is called an l-cycle. If there is a degree-2 vertex v1 having one degree-1 neighbor v0 and the other neighbor v2 of degree > 1, we say path v0 v1 v2 is a tail. If there is a degree-3 vertex adjacent to two degree-1 vertices, we call this vertex a good vertex.
3
Branching on Graphs of Maximum Degree 2
When the remaining graph in G[U2 ] has a vertex of degree ≥ 3, we can branch on this vertex with recurrence (3) or a better one. In this section, we show that there are three types of graphs of maximum degree 2 for which our branching requires a recurrence worse than (3). This suggests that we need to avoid creating such a “bad component” in G[U2 ] even when we branch on a vertex of degree ≥ 3. Before we identify “bad components”, we first introduce two branching rules that will be used in our algorithm. Branching on tails. Recall that a tail v0 v1 v2 is a path such that v0 is a degree-1 vertex, v1 is a degree-2 vertex and v2 is a vertex of degree > 1. Branching on a tail
104
M. Xiao and H. Nagamochi
v0 v1 v2 means branching on v2 . We have qv2 = 1 since v0 v1 is a clique component in G[U2 ] after removing v2 . Since v2 is a vertex of degree > 1, |N (v2 )| ≥ 2. By (4), we can get recurrence C(p) ≤ 2C(p − 2)
(5)
or a better recurrence by branching on a tail. Branching on 4-cycles. Let C4 = v0 v1 v2 v3 be a 4-cycle in G[U2 ], where each vertex vi can be of degree > 2 in G[U2 ]. It is shown that for any 4-cycle v0 v1 v2 v3 , any vertex cover in the graph contains either {v0 , v2 } or {v1 , v3 } [13]. Branching on a 4-cycle v0 v1 v2 v3 means branching by including v0 and v2 into C or including v1 and v3 into C. By branching on a 4-cycle, we can also get recurrence (5) or a better one. When the graph has maximum degree 2, our algorithm will do in this way: if there is a tail or a 4-cycle, branch on the tail or 4-cycle, else pick a degree-2 vertex and branch on it by including it into C or I. It turns out that only for a component of a 2-path or 6-cycle or 7-cycle, we will get a recurrence worse than (3) (see the full version [14] for more details). Then we say a component of a 2-path or 6-cycle or 7-cycle a bad component. If we guarantee that after each operation no bad component is created in G[U2 ], then we can get the claimed improvement. In fact, we will show that for many cases a clique component is also created in G[U2 ] whenever a bad component is created in G[U2 ]. We call such a clique component the saving clique of the bad component, and keep the saving clique until we branch on the bad component, where p is further reduced by 1 by moving the saving clique into U1 . This is the main idea of our algorithm. There are finite local structures by branching on which we may get bad components in a graph of degree bounded by 3. We will use different branching rules to deal with those local structures and then get the improvement. Before presenting our algorithm, we introduce some techniques first.
4
Some Techniques
We introduce a new concept: “pseudo-clique”. In our algorithm, we move a clique component from U2 to U1 without branching. A pseudo-clique is a connected graph similar to a clique. We can also move a pseudo-clique to U1 directly. Let Q be a connected graph in G[U2 ]. If there is a minimum (C, I)-eds M such that |V (Q) − V (M )| ≤ 1, we call Q a pseudo-clique. Roughly speaking, a pseudoclique has at most one vertex not contained in the vertex cover V (M ) if a solution M exists. Any clique is a pseudo-clique. We give another example of pseudo-clique: a 2-path component v0 v1 v2 in G[U2 ] is a pseudo-clique if v1 is a degree-2 vertex in the original graph G. For a pseudo-clique, we can add an edge between any two nonadjacent vertices and the size of the minimum (C, I)-eds M will not increase. Therefore, we can simply move pseudo-cliques to U1 . Sometimes it is easy to check if a 2-path component is a pseudo-clique or not for EDS in degree-3 graphs. This is the reason why we can get the improvement
Parameterized Edge Dominating Set in Cubic Graphs
105
for the problem in degree-3 graphs. We say a degree-2 vertex v in G[U2 ] a crucial vertex, if there is a minimum (C, I)-eds M such that v ∈ V (M ) or vu ∈ M where u is a vertex in U2 . For a 2-path component v0 v1 v2 in G[U2 ], if v1 is a crucial vertex, then v0 v1 v2 is also a pseudo-clique. We may also use the technique of amortized transfer of cliques. In some operation which generates cliques, we usually move all the generated cliques into U1 immediately. However, the recurrence in the operation may still be good enough for our analysis if we do not include some clique uv into U1 in this step (we may reduce p less than 1 in some later branch). We keep the clique uv as the saving clique of any bad components created in this operation without including it into U1 . In the next step, we branch on the bad components after moving the saving clique uv into U1 . In our algorithm, when we save a clique there are at most two bad components can be created. By branching on the two bad components, we can get recurrence C(p) ≤ C(p − 2) + 2C(p − 3) + C(p − 4) or a better one. Since we can also reduce p by 1 by moving the saving clique uv into U1 . Then we can get recurrence C(p) ≤ C(p − 3) + 2C(p − 4) + C(p − 5) at least, which is better than (3).
5
The Algorithm
We say a cycle a leaf cycle if there is exactly one degree-3 vertex in the cycle. In our algorithm, we will first deal with leaf 6-cycles and leaf 7-cycles in G[U2 ]. When the graph G[U2 ] has no such kind of 6-cycles or 7-cycles, we may use some techniques to avoid creating 6-cycle or 7-cycle components in our algorithm. Then we only need to deal with 2-path components. We call a vertex v an (x, y) vertex, if no component of a 6-cycle or 7-cycle is created and x 2-path components are created after deleting v, and no component of a 6-cycle or 7cycle is created and y 2-path components are created after deleting N (v). We assume that initially there is no bad component in G[U2 ], since an arbitrary edge from each bad component in a given graph G with C = I = ∅ can be directly included into a minimum (C, I)-eds M without branching, leaving no bad component in G[U2 ]. In our algorithm, we will effectively avoid creating bad components by saving cliques of size 2 for any newly created bad components in each step. The main steps of our algorithm are listed in Fig. 1. In the subsequent sections, we show that in each step, there is a branching rule such that its recurrence is not worse than (3) and no bad component is newly created. By definition, branching on a (0,0) vertex of degree 3 in Step 5 does not create a bad component and its recurrence is (3). Hence we shall investigate Steps 3, 4, 6, 7, 8 and 9. 5.1
Dealing with Leaf 6-Cycles
Assume that the algorithm will branch on a leaf 6-cycle v0 v1 v2 v3 v4 v5 in G[U2 ] in Step 3. We assume that v0 is the degree-3 vertex in it and u is the third neighbor of v0 . Note that either no bad component is created after removing v0 or no bad
106
M. Xiao and H. Nagamochi
Algorithm P EDS3(G, C, I, U1 , U2 , p) Input: A degree-3 graph G = (V, E), sets C, I, U1 and U2 partitioning V (initially C = I = U1 = ∅, U2 = V ), and an integer p (initially p = 2k). Output: A (C, I)-eds of size ≤ k in G if it exists. 1. While there is a clique component Q in G[U2 ], do move it into U1 and reduce p by |Q| − 1. 2. If p < 0, halt. 3. If there is a leaf 6-cycle in G[U2 ], use the branching rules in Section 5.1 to branch on it. 4. Elseif there is a leaf 7-cycle in G[U2 ], we use the branching rules in Section 5.2 to branch on it. 5. Elseif there is a (0, 0) degree-3 vertex v in G[U2 ], branch on it. 6. Elseif there is a (3, 0) degree-3 vertex v in G[U2 ], use the branching rules in Section 5.3 to branch on it. 7. Elseif there is a good vertex or a tail in G[U2 ], use the branching rules in Section 5.4 to branch on it. 8. Elseif there is 4-cycle v0 v1 v2 v3 in G[U2 ], branch on the 4-cycle. 9. Elseif the graph G[U2 ] is not an empty graph, we pick a vertex v of maximum degree in G[U2 ], and use the branching rules in Section 5.6 to branch on it. 10. Compute a minimum (C, I)-eds M by Lemma 1 (here: U2 = ∅, C ∪I ∪U1 = V ) and return M . Fig. 1. Algorithm P EDS3(G, C, I, U1 , U2 , p)
component is created after removing v0 and u.We distinguish the following two cases to design our branching rules. Case 1: no bad component created after removing v0 from G[U2 ]. We branch in the following way. First, we branch on v3 by including it into C or including it into I (also including v2 and v4 into C). Then in the first branch we further branch on v0 by including it into C or including it into I. We will get three subbranches. In the first subbranch, we include v3 , v0 into C, include v1 , v2 , v4 , v5 into U1 , and reduce p by 4, creating no bad component by the assumption. In the second subbranch, we include v3 , u into C, include v0 into I, include only v4 into U1 (leaving v1 , v2 in U2 ), and reduce p by 3, keeping v1 v2 as the saving clique for any bad components newly created by removing v0 and u. In the third subbranch, we include v2 , v4 into C, include v3 into I and reduce p by 2, creating no bad component. Then we get the following recurrence C(p) ≤ C(p − 2) + C(p − 3) + C(p − 4),
(6)
which solves to O(1.4656p). In the second subbranch, we keep a saving clique v1 v2 for the new bad components. Then in the next step we will directly move v1 v2 into U1 and branch on the bad component created. Since at most two bad components can be created in the second subbranch after removing v0 and u.
Parameterized Edge Dominating Set in Cubic Graphs
107
By branching on these bad components we can get recurrence C(p) ≤ C(p − 2) + 2C(p − 3) + C(p − 4) at least (if a 6-cycle or 7-cycle is created, we will get a better recurrence). Consider that we can also reduce p by 1 from the saving clique v1 v2 . Then we can branch with C(p) ≤ C(p − 3) + 2C(p − 4) + C(p − 5) at least to deal with all bad components created in this subbranch. This recurrence solves to C(p) = O(1.4253p) and is better than (3). Therefore, when there is a saving clique, we can always branch with a recurrence better than (3) without leaving any bad component in G[U2 ]. Case 2: no bad component created after removing v0 and u in G[U2 ]. First, we branch on v3 by including it into C or including it into I (also including v2 , v4 into C). Then in the first branch we further branch on v0 by including it into C or including it into I. We will get three subbranches. In the first subbranch, we include v0 , v3 into C, include only v4 , v5 into U1 , and reduce p by 3, keeping v1 v2 as the saving clique for any bad components newly created by removing v0 . In the second subbranch, we include v3 , v1 , v5 , u into C, include v0 into I, include v2 , v4 into U1 and reduce p by 4, where no bad component is created by the assumption. In the third subbranch, we include v2 , v4 into C, include v3 into I and reduce p by 2, creating no bad component. Analogously with Case 1, we can branch on the new bad components with its saving clique, and we also get (6) without leaving any bad component in G[U2 ]. Lemma 2. If there is a leaf 6-cycle in G[U2 ], Algorithm P EDS3 can always branch with (6) or a better recurrence in Step 3 without creating any bad component in each branch. 5.2
Dealing with Leaf 7-Cycles
In Step 4, there is no leaf 6-cycle in G[U2 ]. Assume that the algorithm will branch on a leaf 7-cycle v0 v1 v2 v3 v4 v5 v6 in this step. We also let v0 be the degree-3 vertex and u the third neighbor of v0 , and distinguish the following two cases. Case 1: no bad component created after removing v0 in G[U2 ]. Case 2: a bad component created after removing v0 in G[U2 ]. For each case, we can also branch with (6) at least without creating any bad components (see the full version [14] for more details). Then we get Lemma 3. If there is a leaf 7-cycle in G[U2 ], Algorithm P EDS3 can always branch with (6) or a better recurrence in Step 4 without creating any bad component in each branch. 5.3
Dealing with (3, 0) Vertices
Let v be the (3, 0) vertex in G[U2 ] selected by the algorithm in Step 6. It is easy to see that the component containing v has exactly 10 vertices. There are only four possibilities of the component, which are shown in Fig. ??. For each kind of component, we have different branching rules. Let M be a minimum (C, I)-eds for the current partition (C, I, U1 , U2 ).
108
M. Xiao and H. Nagamochi
v
v
a2
a1 c1
b1
a3 b2
c2 D
a2
a1 c3
b3
c1
b1
a3
v
c1
b1
c2
c3
b3
v
a3
a2
a1
b2
c2 E
b2
a2
a1 c3
b3
c1
F
b1
c2
a3 b2
c3
b3
G
Fig. 2. Components containing a (3, 0) vertex v in Step 6
For 2(a), we branch into four branches: v ∈ V (M ); va1 ∈ M ; va2 ∈ M ; va3 ∈ M . For the first branch, we include v into I, include N (v) into C and move the remaining 6 vertices into U1 . Note that each ci ai bi (i = 1, 2, 3) becomes a pseudo-clique when v is included into I before including N (v) into C. Then we can reduce p by at least 2 from each ci ai bi before including N (v) into C. Totally, we reduce p by 6 in this branch. For the second branch, we include v and a1 into C and move the remaining 8 vertices into U1 . Note that here a2 b2 c2 and a3 b3 c3 are two pseudo-cliques since va1 ∈ M and va2 , va3 ∈ M can be assumed. We will reduce p by 4 from these two pseudo-cliques. Totally, we reduce p by 6 in this branch. For the third and fourth branches, we do in the same way as the second branch. Then we can get recurrence C(p) ≤ 4C(p − 6),
(7)
which solves to C(p) = O(1.2600p). For 2(b), we also branch into four branches as we do in the case of 2(a). For the first branch, we include v into I, include N (v) into C and move the remaining 6 vertices into U1 . Note that when v is included into I, each ci ai bi (i = 2, 3) becomes a pseudo-clique and a1 b1 c1 also becomes a pseudo-clique (a1 is required to be in C since it is a neighbor of v and at least one vertex of b1 and c1 should be in C). Then we can reduce p by at least 2 from each ci ai bi before including a1 , a2 and a3 into C. Totally, we reduce p by 6 in this branch. For the second branch, we include v and a1 into C and move the remaining 8 vertices into U1 . Note that c1 b1 is a clique, and a2 b2 c2 and a3 b3 c3 are two pseudo-cliques in the resulting graph. We will reduce p by 5 from those pseudo-cliques. Totally, we reduce p by 7 in this branch. For the third branch, we further branch into two subbranches by including b1 into C or I. In the first subbranch, we include b1 , v, a2 into C, move the remaining vertices into U1 , and reduce p by 5 (3 from
Parameterized Edge Dominating Set in Cubic Graphs
109
{b1 , v, a2 } and 2 from pseudo-clique a3 b3 c3 ). In the second subbranch, we include a1 , c1 , v, a2 into C, include b1 into I, move the remaining vertices into U1 , and reduce p by 6. The fourth branch is the same case as the third branch. Then we get recurrence C(p) ≤ 2C(p − 5) + 3C(p − 6) + C(p − 7),
(8)
p
which solves to C(p) = O(1.3648 ). For 2(c) and (d), we have the similar branching rules. In fact, only the amount of p being reduced may be different in these two cases. We analyze the case of 2(c) first. We branch into four branches: include b1 and b2 into C; include b1 into C and b2 into I; include b1 into I and b2 into C; include b1 and b2 into I. For the first branch, we further branch into two subbranches by including v into C or I. In the first subbranch, v ∈ V (M ) means vai ∈ M , where we can assume that va3 ∈ M , since the other neighbors of a1 and a2 belong to C and if vai (i = 1, 2) is in M we can replace it with va3 to obtain another (C, I)-eds with the same size. Hence we include b1 , b2 , v, a3 into C, move the remaining vertices into U1 , and reduce p by 4. In the second subbranch, we include b1 , b2 , a1 , a2 into C, include v into I, move the remaining vertices b3 , a3 , c3 , c1 , c2 into U1 , and reduce p by 6 (note that b3 a3 c3 is a pseudo-clique when we include only v into I and then we can reduce p by 2 from b3 a3 c3 ). For the second branch, we further branch into two subbranches by including a3 into C or I. In the first subbranch, we include b1 , a2 , c2 , a3 into C, include b2 into I, move the remaining vertices into U1 , and reduce p by 5 (4 from {b1 , a2 , c2 , a3 } and 1 from va1 ). In the second subbranch, we include b1 , a2 , c2 , N (a3 ) into C, include b2 , a3 into I, move the remaining vertices c1 , a1 into U1 , and reduce p by 6. The third branch is the same as the second branch. For the fourth branch, we also further branch into two subbranches by including a3 into C or I. In the first subbranch, we include a1 , c1 , a2 , c2 , a3 into C, include b1 , b2 into I, move the remaining vertices into U1 , and reduce p by 6 (note that all neighbors of a3 are not in C and a3 is in C. Any (C, I)-eds M needs to contain at least one of a3 ’neighbors, and this further decreases p by 1). In the second subbranch, we include a1 , c1 , a2 , c2 , N (a3 ) into C, include b1 , b2 , a3 into I, and reduce p by 7. Therefore, we can get recurrence C(p) ≤ C(p − 4) + 3C(p − 5) + 3C(p − 6) + C(p − 7),
(9)
which solves to C(p) = O(1.4615p ). For the case of 2(d), we have the following result. In the first branch, we further branch into two subbranches by reducing p by either 4 or 6 (4 from {b1 , b2 , v, a3 } and 1 from b3 c3 ). In the second and third branches, we further branch into two subbranches by reducing p by either 5 or 6. In the fourth branch, we further branch into two subbranches by reducing p by 6. Then we get recurrence C(p) ≤ 3C(p − 5) + 5C(p − 6),
(10)
p
which solves to C(p) = O(1.4516 ). Lemma 4. In Step 6, Algorithm P EDS3 can always branch with (9) or a better recurrence to deal with a (3, 0) degree-3 vertex without creating any bad component in each branch.
110
5.4
M. Xiao and H. Nagamochi
Branching Rules in Step 7
Step 7 branches on a good vertex v with N (v) = {u1 , u2 , u3 } (if any) by either including v, u3 into C or including u1 , u2 , u3 into C, where u1 and u2 are of degree-1. When there is a tail v0 v1 v2 in G[U2 ], we will branch on v2 by including it into C or I. If no bad component is created in each branch, we can simply get recurrence (5) without creating any bad component. Otherwise, we consider the following six cases. Case 1: there are some 6-cycles or 7-cycles created after removing v2 . Case 2: there are some 6-cycles or 7-cycles created after removing N (v2 ). Case 3: v2 is a (0, 1) vertex. Case 4: v2 is a (1, i) vertex, where i ≥ 0. Case 5: v2 is a (2, 0) vertex. Case 6: v2 is a (0, i) vertex, where i ≥ 2. For each of the six cases, we can branch with a recurrence at least (3) (see the full version [14] for more details). Lemma 5. In Step 7, Algorithm P EDS3 can always branch with (3) or a better recurrence without creating any bad component in each branch. 5.5
Branching Rules in Step 8
Let H be a component of G[U2 ] containing a 4-cycle v0 v1 v2 v3 selected by Step 8, where we assume that a 4-cycle containing a degree-2 vertex is selected if any. Step 8 will branch on 4-cycle v0 v1 v2 v3 by either including v0 , v2 or including v1 , v3 into the vertex cover. It is impossible to create a 6-cycle or 7-cycle in a branch, because there is neither leaf 6-cycle nor 7-cycle and no (0, 0) vertex in the graph (if both v0 and v2 are adjacent to a vertex in the cycle, then any degree-3 vertex in the cycle is a (0, 0) vertex. Otherwise there is a leaf cycle). Since there is neither a good vertex nor a tail, it is also impossible to create two 2-path components after removing v0 , v2 (or v1 , v3 ), unless H is given by the graph in 3(a), where we will select 4-cycle v1 v2 v3 u. Then in each branch, at most one 2-path component can be created. If there is only one branch in which a 2-path component is created, then we can branch with C(p) ≤ C(p − 2) + C(p − 2 − 1) + C(p − 2 − 2) = C(p − 2) + C(p − 3) + C(p − 4), i.e., (6), without leaving any bad component. If a 2-path component will be created in each branch, then graph contains exactly 10 vertices, which is shown in 3(b). Then after branching on the 4-cycle with (5), in each branch we will get a 2-path component and a 4-path component without leaving any other bad component. Note that first we branch on a 2-path with C(p) ≤ C(p − 1) + C(p − 2), and then in each branch we further branch on a 4-path with C(p ) ≤ C(p − 2) + C(p − 3), p ∈ {p − 1, p − 2}. Then we get C(p) ≤ C(p − 1 − 2) + C(p − 1 − 3) + C(p − 2 − 2) + C(p − 2 − 3) = C(p − 3) + 2C(p − 4) + C(p − 5), which is better than (3). Lemma 6. In Step 8, Algorithm P EDS3 can always branch with (6) or a better recurrence without creating any bad component in each branch. 5.6
Branching Rules in Step 9
Let v be the vertex chosen in Step 9. First of all, we show the following lemma. Lemma 7. In Step 9, any degree-3 vertex is a (1, 0), (0, 1) or (0, 2) vertex.
Parameterized Edge Dominating Set in Cubic Graphs
v1
111
v1
v0
v2
u
v0
v3
v2 v3
(a)
(b) Fig. 3. Components containing a 4-cycle in Step 8
Proof. Recall that in Step 9, no component in G[U2 ] contains any of a (0, 0) or (3, 0) vertex, a good vertex, a tail, a leaf 6-cycle, a leaf 7-cycle or a 4-cycle. If v is a (2, i) vertex (i ≥ 0), then there is a tail or a good vertex, which is impossible. If v is a (1, i) vertex (i ≥ 1), then there would be a 4-cycle, a tail or a good vertex. If v is a (0, 3) vertex, we can see that the component contains exactly 13 vertices and any neighbor of v is a (0, 0) degree-3 vertex. If some 6-cycle or 7-cycle is created after removing v, then v is adjacent to at least two vertices in the cycle (since there is neither leaf 6-cycle nor leaf 7-cycle). Note that only one bad component can be created after removing v, otherwise there would be a leaf 6-cycle or 7-cycle, a tail or a good vertex. Then any degree-3 vertex in the cycle is a (0, 0) vertex. If some 6-cycle or 7-cycle is created after removing N (v), then any degree-3 vertex in the cycle is a (0, 0) vertex. All of the above cases are impossible. According to Lemma 7, we only need to consider four cases in this step. Case 1: v is a (1, 0) degree-3 vertex. Case 2: v is a (0, 1) degree-3 vertex. Case 3: v is a (0, 2) degree-3 vertex. Case 4: v is a degree-2 vertex. For each of the cases, we can branch with a recurrence at least (3) (see the full version [14] for more details). Lemma 8. In Step 9, Algorithm P EDS3 can always branch with (3) or a better recurrence without creating any bad component in each branch. 5.7
The Finial Result
According to Lemma 2 to Lemma 8, we get that Theorem 1. Algorithm P EDS3 can solve k-EDS in graphs of maximum degree 3 in O∗ (2.1479k) time.
6
Concluding Remarks
In this paper, we have presented an improved algorithm to decide whether a graph of maximum degree 3 has an edge dominating set of size at most k. The algorithm is based on enumeration of vertex covers by the branch-and-reduce
112
M. Xiao and H. Nagamochi
method. We first use a branch-and-reduce method to enumerate vertex covers of small size and then for each vertex cover we construct an edge dominating set. By introducing new techniques such as pseudo-cliques and amortization, we build up a search tree with recurrence relation C(p) ≤ C(p − 1) + C(p − 3) on the size p ≤ 2k of the vertex cover for k-EDS in graphs of maximum degree 3. It is still left as an open problem whether we can achieve this recurrence relation for k-EDS in general graphs.
References 1. Bourgeois, N., Escoffier, B., Paschos, V.T., van Rooij, J.M.M.: Maximum independent set in graphs of average degree at most three in O(1.08537n ). In: Kratochv´ıl, J., Li, A., Fiala, J., Kolman, P. (eds.) TAMC 2010. LNCS, vol. 6108, pp. 373–384. Springer, Heidelberg (2010) 2. Fernau, H.: edge dominating set: Efficient enumeration-based exact algorithms. In: Bodlaender, H.L., Langston, M.A. (eds.) IWPEC 2006. LNCS, vol. 4169, pp. 142–153. Springer, Heidelberg (2006) 3. Fomin, F., Gaspers, S., Saurabh, S., Stepanov, A.: On two techniques of combining branching and treewidth. Algorithmica 54(2), 181–207 (2009) 4. Garey, M.R., Johnson, D.S.: Computers and intractability: A guide to the theory of NP-completeness. Freeman, San Francisco (1979) 5. Iwama, K., Nakashima, T.: An improved exact algorithm for cubic graph TSP. In: Lin, G. (ed.) COCOON 2007. LNCS, vol. 4598, pp. 108–117. Springer, Heidelberg (2007) 6. Johnson, D., Yannakakis, M., Papadimitriou, C.: On generating all maximal independent sets. Information Processing Letters 27(3), 119–123 (1988) 7. Raman, V., Saurabh, S., Sikdar, S.: Efficient exact algorithms through enumerating maximal independent sets and other techniques. Theory of Computing Systems 42(3), 563–587 (2007) 8. Randerath, B., Schiermeyer, I.: Exact algorithms for minimum dominating set. Technical Report zaik 2005-501, Universit¨ at zu K¨ oln, Cologne, Germany (2005) 9. van Rooij, J.M.M., Bodlaender, H.L.: Exact algorithms for edge domination. In: Grohe, M., Niedermeier, R. (eds.) IWPEC 2008. LNCS, vol. 5018, pp. 214–225. Springer, Heidelberg (2008) 10. Wang, J., Chen, B., Feng, Q., Chen, J.: An efficient fixed-parameter enumeration algorithm for weighted edge dominating set. In: Deng, X., Hopcroft, J.E., Xue, J. (eds.) FAW 2009. LNCS, vol. 5598, pp. 237–250. Springer, Heidelberg (2009) 11. Xiao, M.: A note on vertex cover in graphs with maximum degree 3. In: Thai, M.T., Sahni, S. (eds.) COCOON 2010. LNCS, vol. 6196, pp. 150–159. Springer, Heidelberg (2010) 12. Xiao, M.: Exact and parameterized algorithms for edge dominating set in 3-degree graphs. In: Wu, W., Daescu, O. (eds.) COCOA 2010, Part II. LNCS, vol. 6509, pp. 387–400. Springer, Heidelberg (2010) 13. Xiao, M.: A simple and fast algorithm for maximum independent set in 3-degree graphs. In: Rahman, M. S., Fujita, S. (eds.) WALCOM 2010. LNCS, vol. 5942, pp. 281–292. Springer, Heidelberg (2010) 14. Xiao, M., Nagamochi, H.: Parameterized edge dominating set in cubic graphs. Technical Report 2011-005, Kyoto Univ. (2011), http://www-or.amp.i.kyoto-u. ac.jp/members/nag/Technical_report/TR2011-005.pdf 15. Yannakakis, M., Gavril, F.: Edge dominating sets in graphs. SIAM J. Appl. Math. 38(3), 364–372 (1980)
On Some Geometric Problems of Color-Spanning Sets Chenglin Fan1,2 , Wenqi Ju1 , Jun Luo1, , and Binhai Zhu3, 1 Shenzhen Institutes of Advanced Technology Chinese Academy of Sciences, Shenzhen, China 2 School of Information Science and Engineering Central South University, Changsha, China 3 Department of Computer Science Montana State University, Bozeman, MT59717, USA {cl.fan,wq.ju,jun.luo}@siat.ac.cn,
[email protected]
Abstract. In this paper we study several geometric problems of color-spanning sets: given N points with M colors in the plane, choosing M points with distinct colors such that some geometric properties of those M points are minimized or maximized. The geometric properties studied in this paper are the maximum diameter, the largest closest pair, and the minimum planar spanning tree. We give an O(N log N) expected time algorithm for the maximum diameter problem. For the largest closest pair and the minimum planar spanning tree problems, we give hardness proofs.
1 Introduction Most of the classic algorithms in computational geometry are based on the assumption that the locations of input points are known exactly. But, in practice, that is not always the case. We can, more often than not, only obtain data varying within some ranges. For example, the locations of a moving object have some uncertain properties [5]. Moreover, location data obtained from physical devices are inherently imprecise due to the measurement error, sampling error and network latency [10, 12]. Location privacy protection is another issue which may lead to imprecise data [3, 6, 9]. Each imprecise point p can be modelled by a continuous region φ or even a set ψ of discrete points. That means p could be anywhere in φ or any one point of ψ but its exact location is not known. For a set of imprecise points P = {p1 , p2 , ..., pn }, they can be modelled by a set Φ = {φ1 , φ2 , ..., φn } of continuous regions or a set Ψ = {ψ1 , ψ2 , ..., ψn } of sets of discrete points. In the database community, that deals with a similar framework under a different name – they call it “uncertain data” and, in it, each color is called an “object” (the different instances of a color are the different possible instances of the uncertain object). Pei et al [15, 16, 17] have works that pertains to geometric problems in this framework.
This work is supported by Shenzhen Key Laboratory of High Performance Data Mining (grant no. CXB201005250021A). This research is partially supported by NSF of China under grant 60928006, and by the Opening Fund of Top Key Discipline of Computer Software and Theory in Zhejiang Provincial Colleges at Zhejiang Normal University. M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 113–124, 2011. c Springer-Verlag Berlin Heidelberg 2011
114
C. Fan et al.
The problem above is often referred to as the color-spanning problem if each imprecise point is modelled by a set of discrete points since each set of discrete points can be painted by one distinct color. In general, the color spanning problem is to select exactly one point from each color point set such that certain properties (e.g. area, distance, perimeter and so on) of some geometric structures (e.g. convex hulls, minimum spanning trees and so on) based on the selected points with different colors are minimized or maximized. In the following descriptions, we assume that there are N points with M colors for the sake of notation consistency. Zhang et al. [13] propose a brute force algorithm to address the minimum diameter color-spanning set problem (MDCS). The running time is O(N M ). Fleischer and Xu [8] show that the MDCS problem can be solved in polynomial time for the L1 and L∞ metrics, while it is NP-hard for all other Lp metrics even in two dimensions. They also give an efficient algorithm to compute a constant factor approximation. Abellanas et al. [1] show that the Farthest Color Voronoi Diagram (FCVD) is of complexity Θ(N M ) if M ≤ N/2. Then they propose algorithms to construct FCVD, the smallest color-spanning circle based on FCVD, the smallest color-spanning rectangle and the narrowest color-spanning strip of arbitrary orientation. In [7], Das et al. propose an algorithm for identifying the smallest color-spanning corridor in O(N 2 log N ) time and O(N ) space and an algorithm for identifying the smallest color-spanning rectangle of arbitrary orientation with an O(N 3 log M ) running time and O(N ) space. In this paper, we study three color-spanning set problems. The inputs are the same: N points with M colors. We want to choose M points with M distinct colors such that – The diameter of M points is maximized. This problem is called the maximum diameter color-spanning set (MaxDCS) problem. – The distance between the closest pair of M points is maximized. This problem is called the largest closest pair color-spanning set (LCPCS) problem. – The length of the planar minimum spanning tree over those M points is minimized. This problem is called the planar minimum color spanning tree (PMCST) problem. We discuss these three problems in the following four sections and then give conclusions in the last section.
2 Computing the Maximum Diameter Color-Spanning Set Computing the diameter of a point set has a long history. By a reduction to set disjointness, it can be shown that computing the diameter of N points with the same color in Rd requires Ω(N log N ) operations in the algebraic computation tree model [11]. However, to our best knowledge, the maximum diameter color-spanning set (MaxDCS) problem (see an example in Figure 1) has not been studied yet. Let S be a set of N points with M colors. The steps of our algorithm (MaxDCS1) to compute the maximum diameter color-spanning set are as follows: 1. Compute the maximum distance between two points of S in the plane (ignoring colors) using the algorithm in [11]. Let these two points be pa and pb . If pa and
On Some Geometric Problems of Color-Spanning Sets
115
Fig. 1. Illustration of the maximum diameter of color-spanning sets
2.
3.
4.
5. 6.
pb have different colors, then the distance d0 between pa and pb is the maximum diameter D of the color-spanning sets of S, and we can exit the algorithm; else, we continue to the next step. Let the subset of points with the same colors as that of points pa and pb be Sab (Sab also includes pa and pb ). Let Sab = S − Sab . We compute the distance between every pair of points, one in Sab and the other in Sab , and let the resulting maximum distance be dab . Let the set of points of Sab which are on or to the left of the line pa pb be set Sl . Let the set of points of Sab which are on the right of the line pa pb be Sr . For any point p in Sr such that no point in Sl has the same color of p, we put p into set Sr . Symmetrically, for any point p in Sl such that no point in Sr has the same color of p, we put p into set Sl . Let Sl = Sl \ Sl and Sr = Sr \ Sr . Let S1 = Sl Sr and compute the maximum distance dl between two points in S1 (ignoring colors) using the algorithm in [11]. Similarly, let S2 = Sr Sl and compute the maximum distance dr between two points in S2 . Compute the diameter D of point set Sl Sr (considering colors). The details of this step will be given in Algorithm MaxDCS2. Let D = max(dab , dl , dr , D ).
We need to prove the correctness and the time complexity of our algorithm. Lemma 1. For two points pe and pf in set Sl (Sr ), at least one of the four segments pa pe , pa pf , pb pe , pb pf has a length longer than that of pe pf . Proof. Since pe and pf are on the same side of line pa pb , there are only two cases for the positions of four points pa ,pb ,pe ,pf : 1. Four points pa ,pb ,pe ,pf form a convex quadrangle (see Figure 2(a)). If the length of segment pe pf is longer than or equal to the lengths of the segments pa pe , pa pf , pb pe , pb pf , then the angles pe pf pb and pf pe pa are smaller than π/2. Because the length of the segment pa pb is longer than or equal to all the above segments, the angles pa pb pf and pb pa pe are smaller than π/2. This contradicts to the fact that the sum of four angles of convex quadrangle is 2π. 2. The three points pa ,pb ,pe form a triangle and pf is in pa pb pe , pe ph is the height of triangle; moreover, the point ph must be on segment pa pb (see Figure 2(b)).
116
C. Fan et al.
pe pe
pf pf
pa
(a)
pb
pa
ph (b)
pb
Fig. 2. The illustration for the proof of Lemma 1
Otherwise, the length of pa pe or pb pe is longer than pa pb . Since pf is either in the right triangle pa ph pe or in the right triangle pb pe ph , the length of pe pf is shorter than the longer of pe pa and pe pb . Hence the lemma is proven.
Let px and py be the two points corresponding to the maximum diameter of colorspanning sets of S. There are five cases: 1. 2. 3. 4. 5.
px is pa and py is pb . px ∈ Sab and py ∈ Sab . px and py are in set Sl , or px and py are in set Sr . px is in set Sl , while py is in set Sr , or px in set Sl and py in set Sr . px is in set Sl and py is in set Sr .
Cases 1, 2 and 4 are computed at Steps 1, 2 and 4 of the algorithm MaxDCS1. We do not need to compute the diameter in Case 3 according to lemma 1 and the fact that the color of pa (pb ) is different from those points in Sl (Sr ). In other words, the maximum diameter in Case 3 is less than dab in Case 2. Step 1, 3, 4, and 6 can be finished in O(N log N ) time. Step 2 can be finished in O(k N ) time where k is the size of the set Sab . However, if k is larger than O(log N ), in order to reduce the time complexity to O(N log N ), we cannot use a brute force method at Step 2. Instead, we can compute the farthest-point Voronoi diagram of set Sab in O(k log k ) expected time [4]. The Vonoroi cell where each point p in set Sab is located can be found in O(log k ) time, and then we can compute the distance between p and corresponding site in an additional O(1) time. Therefore, Step 2 can be finished in O(N log N ) expected time. How about the time complexity of Step 5 (or algorithm MaxDCS2)? The time consuming parts of MaxDCS2 are two FOR loops. Since those two loops are symmetric, we only analyze the first one. Notice that the difference between the consecutive steps inside the loop are point sets of two colors. In total, each point is inserted and deleted from S once, that means only O(N ) insertions and deletions. It is shown that the diameter for N points without color after each insertion or deletion can be updated in O(log N ) expected time [14]. Therefore, the expected running time of MaxDCS2 is O(N log N ). In steps 4 and 5 of algorithm MaxDCS1, the two points corresponding dl , dr , D could be on the same side of pa pb and be the same color. However, according to lemma 1, those dl , dr , D < dab and we let D = max(dab , dl , dr , D ). Therefore, those dl , dr , D can not be the real diameter D. Our algorithm considers the distances of all points with its farthest point of different color. Hence we have the following theorem:
On Some Geometric Problems of Color-Spanning Sets
117
Algorithm 1. MaxDCS2
Require: Point set Sl and Sr with M colors where M ≤ M − 1; Ensure: Maximum diameter D of color-spanning sets of Sl Sr ; D=0 Let Slk be the kth color points in Sl and Srk be the kth color points in Sr S = Sl Sr1 \ Sl1 Compute the diameter D of S (ignoring colors) D = M ax(D, D ) for k = 2 toM do S = S Srk Slk−1 \ Slk \ Srk−1 Compute the diameter D of S (ignoring colors) D = M ax(D, D ) end for S = Sr Sl1 \ Sr1 Compute the diameter D of S (ignoring colors) D = M ax(D, D ) for k = 2 toM do S = S Slk Srk−1 \ Srk \ Slk−1 Compute the diameter D of S (ignoring colors) D = M ax(D, D ) end for
Theorem 1. Let S be a set of N points of M colors. The maximum diameter of colorspanning sets of S can be computed in O(N log N ) expected time.
3 Hardness of the LCPCS Problem In this section we prove that LCPCS is NP-hard. Theorem 2. LCP CS is NP-hard under the Lp metric, for 1 ≤ p < ∞, in two or higher dimensions. Proof. We prove the hardness of LCPCS by a reduction from 3SAT . We give the proof for the L2 metric in two dimensions and then show how to extend it to any Lp metric and to higher dimensions. Let F be a Boolean formula in conjunctive normal form with n variables x1 , . . . , xn in m clauses c1 , . . . , cm , each of size at most three. We take the following steps to construct an instance I of LCP CS: For each Boolean variable xi , xi in F , let ki be the maximum number of times that xi and xi appear in F . Then we draw a rectangle Vi vertically and separate it into ki − 1 small rectangles horizontally. Every small rectangle has length b and height a. The diagonal length of each small rectangle is d (d2 = a2 + b2 , d < 2a). We place 2ki points with different colors on the 2ki vertices of small rectangles (see Figure 3). The 2ki points of different colors are placed on ki rows and two columns. Let Axy (1 ≤ x ≤ ki , 1 ≤ y ≤ 2) denote the point at row x and column y. Then we draw another rectangle Hi horizontally that is far away from Vi and separate it into ki − 1
118
C. Fan et al.
P1
1 2 3
1
b d
a
Q1
2
a
1
1
c
2
3
c
d−ε .. .
ki
ki ···
2 Hi
Q2
Vi Fig. 3. Variable gadget
small rectangles vertically. Every small rectangle has length c (c = d + ε) and height d − ε (see Figure 3). We place 2ki points with different colors on the 2ki vertices of those small rectangles. Let Bxy (1 ≤ x ≤ 2, 1 ≤ y ≤ ki ) denote the point at row x row and column y. When x is an odd number, Ax1 and B2x have the same color, and Ax2 and B1x have the same color. When x is an even number, Ax2 and B2x have the same color, and Ax1 and B1x have the same color (see Figure 3). Let P1 be the set of points Axy where x is odd and y = 1 or x is even and y = 2. Let P2 be the set of points Axy where x is even and y = 1 or x is odd and y = 2. Let Q1 be the set of points Bxy where x = 1 and Q2 be the set of points Bxy where x = 2. The idea is that if we want to maximize the distance between the closest pair with this configuration, we either choose the point sets P1 and Q1 , or point sets P2 and Q2 . The fist case represents the value true for this variable, and the second case represents the value false. The rectangles corresponding to different variables lie far away enough to each other (at least 3d). The points in different variables have totally different colors. For each clause in F , we add three points with the same color, and this color was never used before. We deal with the clauses from left to right. For example, let the ith clause be (x1 ∨ x2 ∨ x3 ), and suppose that x1 appears l1 − 1 times, x2 appears l2 − 1 times, x3 appears l3 − 1 times in the previous i − 1 clauses. Then we put one point next to rectangle H1 and it is right below the point B2l1 with distance ε. The second point is next to rectangle H2 and it is right below B2l2 with distance ε. The third point is next to rectangle H3 and it is right above B1l3 with distance ε (see Figure 4). One of these three points has to be selected for this color. For the distance between the closest pair to be maximum (i.e., equal to d), it is only possible when x1 is true, or x2 is true, or x3 is false. It is easy to see that an assignment to the variables satisfies the 3SAT instance F if and only if the largest distance between the closest pair is equal to d. In order to extend the proof to the Lp metric, the only requirement is d > a and d > b. When 1 ≤ p < ∞, we have d > a and d > b. Only when p = ∞, we have d = a or d = b (then the above construction fails). Also the hardness for two dimensions implies the hardness for higher dimensions. Therefore LCP CS is NP-hard for the Lp metric, for 1 ≤ p < ∞, in two or higher dimensions.
On Some Geometric Problems of Color-Spanning Sets
···
H1 l1
1
2
3
ε
···
H2 l2
1
2
3
119
ε
ε H3
··· 1
2
3
l3
Fig. 4. Clause gadget for (x1 ∨ x2 ∨ x3 ). Different shapes of points also mean different colors
We show next that LCPCS is NP-hard even in one dimension. Theorem 3. LCP CS is NP-hard in one dimension. Proof. Again, we prove the hardness of LCP CS by a reduction from 3SAT . Of course, in this case all points lie on a line l. Given a 3SAT formula F , we make the following construction. For each Boolean variable xi , xi in F , let ki be the maximum number of times that xi and xi appear in F . We first put 2ki points A1 ,. . . ,A2ki on segment li1 (a segment on line l) and the distance between two adjacent points is d/2. Then we put anther 2ki points B1 ,. . . ,B2ki on segment li2 (another segment on line l). The distance between two points Bj and Bj+1 is d − ε when j is odd, or 2d when j is even. Furthermore, we require that Bj+1 and Aj have the same color for 1 ≤ j ≤ 2ki − 1, and B1 and A2ki have the same color (see Figure 5). Let P1 be the set of points Aj when j is odd, and P2 be the set of points Aj when j is even. Let Q1 be the set of points Bj when j is odd, and Q2 be the set of points Bj when j is even. If we want to maximize the distance between the closest pair with this configuration, we either choose the point sets P1 and Q1 , or point sets P2 and Q2 . The fist case represents the value false for this variable, and the second case represents the value true. The distance between different variable gadgets is far away enough to each other (at least 3d). The colors of points in different variable gadgets are totally different. For each clause in F , we add three points Pa , Pb , Pc with the same color, and this color was never used before. We deal with the clauses from left to right. For example, let the ith clause be (xu ∨ xv ∨ xw ), and suppose that xu appears h1 − 1 times, xv appears h2 − 1 times, xw appears h3 − 1 times in the previous i − 1 clauses. Then we put one point Pa on the segment lu2 and it is to the left of point B2h1 −1 with distance ε,
120
C. Fan et al. Q1
P1 l
li1 A3 A 2 A1 d/2 d/2
li2 B1
. . . A2ki
d − ε B2
2d
B3
d − ε B4 2d
...
Fig. 5. Variable gadget for variable xi for one dimension
l
lu2 B B2h1 . . . . . . 2h1 −1 Pa d−ε
lv2 B . . . 2h2 −1 Pb
d−ε
lw2 B2h2 ...
. . . B2h3 −1 B2h3 . . . d−ε Pc
Fig. 6. Clause gadget for (xu ∨ xv ∨ xw ) for one dimension
the second point Pb on lv2 and it is to the left of pointB2h2 −1 with distance ε, and the third point Pc on the segment lw2 and it is to the right of point B2h3 (see Figure 6). One of the three points has to be selected for this color. For the distance between the closest pair to be maximum (i.e., equal to d), it is only possible when xu is true, or xv is true, or xw is false. Now a truth assignment to the variables satisfies F if and only if the largest possible distance between the closest pair is equal to d. Actually we can prove that LCP CS is ( 12 +ε)-APX-hard, which means that it is NP-hard to find any approximation algorithm with an approximation ratio better than 12 . Theorem 4. LCP CS is ( 12 + ε)-APX-hard in one dimension. Proof. Consider Theorem 3 and Figure 5 and 6, and let ε ≤ d/2. Let O∗ be the optimal solution value of LCPCS. We need to consider two cases: (1) O∗ = d if and only if the 3SAT formula F can be satisfied. (2) O∗ = d/2 if and only if the 3SAT formula F cannot be satisfied. Hence, to find an approximation algorithm whose approximation ratio is better than is equivalent to making O∗ = d, which is NP-hard. Therefore the theorem is proven. 1 2
4 NP-hardness for the Planar Minimum Color-Spanning Tree Problem The planar minimum color spanning tree (P M CST ) problem is defined as follows: given N points with M colors in the plane, choosing M points with distinct colors such that the length of the minimum spanning tree over those M points is minimized. We prove that P M CST is NP-hard by a reduction from 3SAT . Given a 3SAT instance F , we will construct gadgets to represent the different variables and clauses of this instance. The main gadget we need in the construction is the variable chain. For each Boolean variable xi , xi in F , let ki be the maximum number of times that xi and xi appear in F . Each variable chain for xi and xi consists of ki
On Some Geometric Problems of Color-Spanning Sets
connect to intermediate point of the other variable gadget f ar away
ki ki − 1
4
Cil
ki − 1
1
Cir
2 db
3 2
121
db
1 ki
4
1
4
ki
2
3 ki − 1 intermediate point
3
da (a)
(b) Fig. 7. (a) Variable chain. (b) Variable gadget.
points. All points on a chain have different colors, and the distance da between all consecutive points are identical and the distances between any other two sites is larger (see Figure 7(a)). Therefore the minimum spanning tree is exactly the chain. Next, we need to construct variable gadgets each of which consists of two copies of variable chains. For every variable, the two copies of chains are connected by some intermediate point whose color is different from any other point (see Figure 7(b)). Therefore the intermediate point has to be selected for the minimum spanning tree. The distance between the intermediate point and the first point of each chain is db (db da ). Let the chain on the left be Cil and the chain on the right be Cir . In order to minimize the length of the spanning tree, we have only two possible choices: select the left chain Cil or the right chain Cir , which corresponds to the true or false state of a variable in F . Then we need clause gadgets. We construct such a gadget by taking three points with the same color, and this color has never be used before. We deal with the clauses from left to right. For example, let the ith clause be (xu ∨ xv ∨ xw ) ( see Figure 8), and suppose that xu appears j1 − 1 times, xv appears j2 − 1 times, and xw appears j3 − 1 times in the previous i − 1 clauses. Then we put the first point at the same position with the j1 th point of chain Cul , the second point at the same position with the j2 th point of chain clv , and the third point at the same position with the j3 th point of chain crw . One of these three points has to be selected to cover this color. To minimize the total length of the spanning tree, it is only possible when xu is true, or xv is true, or xw is false. Finally we need to connect all the variable chains to each other by some fixed branch of the tree, because the whole construction needs to be a tree instead a forest. As the variables of any 3SAT instance can always be laid out, all we need is that the distance between neighboring variables gadgets is large enough to avoid shortcuts. This can be easily done by putting all those intermediate points on a vertical line such that if we draw a circle with two neighboring intermediate points as a diameter of the circle, it does not contain any point on any variable gadget. Hence we have the theorem below. Theorem 5. The problem of computing a planar minimum color-spanning tree is NPhard. In the next section we show that PMCST is not only NP-hrad, in fact, it is NPO-hard.
122
C. Fan et al. ku -1
Cul
2 db
Cur
1
db
1 ku
kv -1
2
Cvl
db
db
j2
kw -1
3
2 db 1
kw
4
4
3
db
kv
2
3
l Cw
ku -1
Cvr
1
1 kv
ku
3
3
j1
4
2
1
kv -1
Cwr
j3
kw
2 3
kw -1
Fig. 8. Clause gadget for (xu ∨ xv ∨ xw ) in PMCST
5 NPO-hardness for P M CST It is known that the weighted 3SAT problem (i.e., the maximum or minimum weighted 3SAT problem), is NPO-hard. (An optimization problem is NPO-hard means that it is NP-hard to compute a constant factor approximation for the problem [2].) We prove below that the P M CST problem is NPO-hard by a reduction from the minimum weighted 3SAT problem (Min-W3SAT). Min-W3SAT Problem: Input: A 3SAT formula ψ, andevery variable xi is assigned a positive weight w(xi ). Output: Return the minimum xi =true w(xi ) such that ψ is satisfiable. Note that each variable xi is assigned a weight w(xi ) in the Min-W3SAT problem. We make some modification on the NP-hardness proof for P M CST . For each variable xi , then substitute db of the left chain with db = db + εi where db da and εi = ε × w(xi ), ε is some given constant (see Figure 9). The length of the spanning tree is minimized if and only if the following two conditions are satisfied: 1. ψ is satisfiable. 2. xi =true w(xi ) is minimized if and only if xi =true εi is minimized.
On Some Geometric Problems of Color-Spanning Sets
123
connect to intermediate point of the other variable gadget f ar away Cil
ki − 1 ki
4
Cir
2 3
1
db
db
1
2
4
ki
3 ki − 1 intermediate point
Fig. 9. The chain after modification
Hence we have the following theorem. Theorem 6. The problem of computing a planar minimum color-spanning tree is NPOhard.
6 Conclusions In this paper we study several geometric problems of color-spanning sets. We give an O(N log N ) expected time algorithm for the maximum diameter problem which is optimal since for N points without color, the time for computing the diameter is Ω(N log N ). We show that the largest closest pair of color-spanning sets problem is NP-hard for the Lp (1 ≤ p < ∞) metric and in two or higher dimensions. Moreover, we prove that the largest closest pair of color-spanning sets problem is ( 12 + ε)-APXhard in one dimension, which means that finding an approximation algorithm whose approximation ratio is better than 12 is NP-hard. We also show that it is NPO-hard to construct the planar minimum color-spanning tree, which means that even finding a constant-factor approximation is NP-hard. For the future work, it will be interesting to investigate whether there exists an 12 -approximation for the largest closest pair of color-spanning sets in one dimension.
References 1. Abellanas, M., Hurtado, F., Icking, C., Klein, R., Langetepe, E., Ma, L., Palop, B., Sacristan, V.: The farthest color Voronoi diagram and related problems. In: Proceedings of the 17th European Workshop on Computational Geometry (EWCG 2001), pp. 113-116 (2001) 2. Ausiello, G., Crescenzi, P., Gambosi, G., Kann, V., Marchetti-Spaccamela, A., Protasi, M.: Complexity and Approximation. Springer, Germany (1999) 3. Beresford, A.R., Stajano, F.: Location privacy in pervasive computing. IEEE Pervasive Computing 2(1), 46–55 (2003) 4. Berg, M., Cheong, O., Kreveld, M., Overmars, M.: Computational Geometry: Algorithms and Applications, 3rd edn. Springer, Heidelberg (2008) 5. Cheng, R., Kalashnikov, D.V., Prabhakar, S.: Querying imprecise data in moving object environments, knowledge and data engineering. IEEE Transactions on Knowledge and Data Engineering 16(9), 1112–1127 (2004)
124
C. Fan et al.
6. Cheng, R., Zhang, Y., Bertino, E., Prabhakar, S.: Preserving user location privacy in mobile data management infrastructures. In: Danezis, G., Golle, P. (eds.) PET 2006. LNCS, vol. 4258, pp. 393–412. Springer, Heidelberg (2006) 7. Das, S., Goswani, P.P., Nandy, S.C.: Smallest color-spanning object revised. International Journal of Computational Geometry and Applications 19(5), 457–478 (2009) 8. Fleischer, R., Xu, X.: Computing minimum diameter color-spanning sets. In: Lee, D.-T., Chen, D.Z., Ying, S. (eds.) FAW 2010. LNCS, vol. 6213, pp. 285–292. Springer, Heidelberg (2010) 9. Gedik, B., Liu, L.: A customizable k-anonymity model for protecting location privacy. In: Proceedings of the 25th International Conference on Distributed Computing Systems (ICDCS 2005), pp. 620–629 (2005) 10. Pfoser, D., Jensen, C.S.: Capturing the uncertainty of moving-object representations. In: G¨uting, R.H., Papadias, D., Lochovsky, F.H. (eds.) SSD 1999. LNCS, vol. 1651, pp. 111– 131. Springer, Heidelberg (1999) 11. Preparata, F.P., Shamos, M.I.: Computational geometry: an introduction. Springer-Verlag New York, Inc., New York (1985) 12. Sistla, P.A., Wolfson, O., Chamberlain, S., Dao, S.: Querying the uncertain position of moving objects. In: Etzion, O., Jajodia, S., Sripada, S. (eds.)Temporal Databases: Research and Practice. LNCS, vol. 1399, pp. 310–337. Springer, Heidelberg (1998) 13. Zhang, D., Chee, Y.M., Mondal, A., Tung, A.K.H., Kitsuregawa, M.: Keyword search in spatial databases: Towards searching by document. In: Proceedings of the 25th IEEE International Conference on Data Engineering (ICDE 2009), pp. 688–699 (2009) 14. Eppstein, D.: Average case analysis of dynamic geometric optimization. Comput. Geom. Theory Appl. 6(1), 45–68 (1996) 15. Pei, J., Jiang, B., Lin, X., Yuan, Y.: Probabilistic Skylines on Uncertain Data. In: VLDB 2007, pp. 15–26 (2007) 16. Cheema, M.A., Lin, X., Wang, W., Zhang, W., Pei, J.: Probabilistic Reverse Nearest Neighbor Queries on Uncertain Data. IEEE Trans. Knowl. Data Eng. 22(4), 550–564 (2010) 17. Yuen, S.M., Tao, Y., Xiao, X., Pei, J., Zhang, D.: Superseding Nearest Neighbor Search on Uncertain Spatial Databases. IEEE Trans. Knowl. Data Eng. 22(7), 1041–1055 (2010)
Approximation Algorithms for Cutting a Convex Polyhedron Out of a Sphere Xuehou Tan1 and Gangshan Wu2 1 2
Tokai University, 4-1-1 Kitakaname, Hiratsuka 259-1292, Japan
[email protected] State Key Lab. for Novel Software Technology, Nanjing University Hankou Road 22, Nanjing 210093, China
Abstract. This paper presents the following approximation algorithms for computing a minimum cost sequence of planes to cut a convex polyhedron P of n vertices out of a sphere Q: an O(n log n) time O(log 2 n)-factor approximation, an O(n1.5 log n) time O(log n)-factor approximation, and an O(1)-factor approximation with exponential running time. Our results significantly improve upon the previous O(n3 ) time O(log 2 n)-factor approximation solution.
1
Introduction
About two and a half decades ago, Overmars and Welzl considered the following problem: Given a polygonal piece of paper Q with a polygon P of n vertices drawn on it, cut P out of Q by a sequence of ”guillotine cuts” in the cheapest possible way [9]. After the hardness of computing an optimal cutting sequence was shown by Bhadury and Chandrasekaran [3], the research has recently been concentrated on finding approximation solutions. Particularly, when both P and Q are convex polygons in the plane, several O(log n) and constant factor approximation algorithms and a PTAS have been proposed [2,4,5,10]. The study of this type of problems is mainly motivated by the application where a given shape needs to be cut out from a parent of material. In three dimensions, Jaromczyk and Kowaluk have studied the problem of cutting polyhedral shapes with a hot wire cut and give an O(n5 ) time algorithm that constructs a cutting path, if it exists [8]. Very recently, S. I. Ahmed et al. considered the following problem in three dimensions: Given a convex polyhedron P of n vertices inside a sphere Q, the objective is to compute a minimum cost sequence of planes to cut Q such that after the last cut of the sequence we have Q = P [1]. Here, the cost of a plane cut is the area of the intersection of the plane with the current polyhedron Q. Their proposed algorithm runs in O(n3 ) time and has the cutting cost O(log2 n) times the optimal. Whether the approximation factor or the time complexity can be improved is left as an open problem. In this paper, we present three approximation algorithms for finding a minimum cost sequence of planes to cut P out of Q: an O(n log n) time O(log2 n)factor approximation, an O(n1.5 log n) time O(log n)-factor approximation, and M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 125–135, 2011. c Springer-Verlag Berlin Heidelberg 2011
126
X. Tan and G. Wu
an O(1)-factor approximation with exponential running time. This gives a significant improvement upon the previous result [1]. Our algorithms make use of graph-decompositions based on the planar separator theorem [7], and extend some known planar frameworks to three dimensions.
2
Preliminaries
Assume that a convex polyhedron P of n vertices is completely contained in a sphere Q. A guillotine cut, or simply a plane cut is a cut that does not intersect the interior of P and divides Q into two convex pieces, lying on both sides of the cut. Particularly, a plane cut is a face/edge/vertex cut if it cuts along a face/edge/vertex of P . After a cut is made, Q is updated to the piece containing P . A cutting sequence is a sequence of plane cuts such that after the last cut in the sequence we have P = Q. The cost of a cut is the area of the intersection of the cut with Q. Our objective is to find a cutting sequence whose total cost is minimum. Let us denote by |S| the cost of a cutting sequence S. An optimal cutting sequence S ∗ is a cutting sequence whose cost |S ∗ | is minimum. A face cutting sequence, denoted by Sf , is a sequence of plane cuts that are all made along the faces of P . An optimal face cutting sequence Sf∗ is a face cutting sequence whose cost |Sf∗ | is minimum among all face cutting sequences. Let f denote a face of the polyhedron P . We will denote by |f | the area of f . Also, we let |P | = |f |, for all f ∈ P , i.e., |P | denotes the surface area of P . For two points x, y, we denote by xy the line segment connecting x and y, and denote by |xy| the length of the segment xy. 2.1
Lower Bounds
In order to estimate the cost performance of our approximation algorithms given in the next two sections, we now establish some lower bounds on |S ∗ |. A trivial lower bound on |S ∗ | is clearly |P |. The following two lower bounds are similar to, but slightly different from, those of [1]. Lemma 1. Suppose that the center o of the sphere Q is contained in the polyhedron P . Let f denote the face of P such that the distance between the supporting plane of f and the center o is minimum, and let R1 denote the radius of the intersection (circle) of Q with the supporting plane of f . Then, |S ∗ | ≥ π2 R12 . Proof. First, an optimal cutting sequence contains a face cut along f ; otherwise, P cannot be cut out, a contradiction. Assume below that the kth cut in S ∗ (= C1 , C2 , . . . , Ck , . . .) is made along the face f . We claim that the total cost of C1 , C2 , . . . , Ck is at least π2 R12 . It is trivially true when k = 1. Assume below that k > 1. Denote by H1 the intersection (circle) of the sphere Q with the supporting plane of f . Let A be the portion of H1 , which is cut out by Ck . See Fig. 1. Clearly, |A| = |Ck |. Denote by D and E the portions of H1 which are to the left and the right of A, respectively. Without
Cutting a Convex Polyhedron Out of a Sphere
Q
Q P o f D C1 C3 A C2 (a)
E
D C1
P o f C5 A
C4 (b)
Q
C2 E C3
D C1
P o f C4 A
127
C2 E C3
(c)
Fig. 1. A planar view of several cuts, with the last one made along the face f
loss of generality, assume that neither D nor E is empty. Assume that Ci and Cj (1 ≤ i, j ≤ k − 1) are the last cuts that cut off D and E, respectively. Also, assume i < j. Consider first the simplest situation in which i = 1 and j = 2. See Fig. 1(a). Since D is contained in the portion of the given sphere Q, which is cut off by C1 , we have |D| ≤ |C1 |. If C2 does not intersect C1 , we also have |E| ≤ |C2 |, and thus 2|S ∗ | > |C1 | + |C2 | + |C3 | ≥ |D| + |E| + |A| = πR12 . The claim is true. In the case that C2 intersects with C1 , E is contained in the portion of the given or original sphere, which is cut off by C1 and C2 . See Fig. 1(a) for an example, where C1 , C2 and E are drawn in bold line. We then have |E| ≤ |C1 | + |C2 |. Hence, 2|S ∗ | > |C1 | + (|C1 | + |C2 |) + |C3 | ≥ |D| + |E| + |A| = πR12 , and the claim also holds. Consider next the situation in which i = 1 and j > 2. Note that C2 , . . . , Cj cut out an outward-convex surface on the resulting polygon Q. If none of C2 , . . . , Cj intersects with C1 , then E is contained in the portion of the given sphere, which is cut off by C2 , . . . , Cj (Fig. 1(b)). Otherwise, E is contained in the portion cut off by C1 , C2 , . . . , Cj (Fig. 1(c)). In either case, we have |E| ≤ |C1 |+|C2 |+. . .+|Cj |, and thus 2|S ∗ | ≥ πR12 . Our claim is true, again. For the last situation in which i > 1 and i < j, we can also see that D (E) is contained the portion of the given or original sphere, which is cut off by the cuts C1 , . . . , Ci (the cuts C1 , . . . , Cj ). So we have |C1 | + . . . |Ci | ≥ |D|, |C1 | + . . . |Cj | ≥ |E|, and 2|S ∗ | ≥ πR12 . Our claim is thus proved, and the lemma follows. 2 Remark 1. In Lemma 3 of [1], it was claimed that |S ∗ | ≥ πR2 , where R denotes the radius of the given sphere Q. Only a short sketch was described, in which two special cases (i.e., P denegerates to a point or the sphere Q itself) are considered [1]. A more strict proof should further be given. Lemma 2. Suppose that the center o of Q is not contained in P . Let p denote the point of P which is closest to o, and let R2 denote the radius of the intersection (circle) of Q with the plane, which is perpendicular to the segment op at the point p. Then, |S ∗ | ≥ π2 R22 .
128
X. Tan and G. Wu
Proof. Denote by H2 the intersection (circle) of the sphere Q with the plane, which is perpendicular to the segment op at the point p. Clearly, H2 touches a face/edge/vertex of P , and does not intersect P . To cut out P from Q, the circle H2 has to be cut out, too. By an argument similar to the proof of Lemma 1, we can then obtain |S ∗ | ≥ π2 R22 . 2
3
An Efficient O(n log n) Time Approximation Algorithm
As in the previous work [1,5], our algorithm consists of two phases: box cutting phase and carving phase. In the box cutting phase, we cut a bounding box B out of Q such that P is contained in B. (Note that B is used for the worst case analysis, and only part of the box B may actually result.) Then in the carving phase, we further cut P out of B. The following new ideas allow us to develop an efficient O(n log n) time approximation solution. Instead of finding a minimum box bounding P used in [1], we present a simple linear-time algorithm to compute a bounding box B, with |B| ≤ 6|P |. In the carving phase. we employ the planar separation theorem, so as to accelerate the process of cutting P out of B. 3.1
Box Cutting Phase
In this section, we present a linear-time algorithm for finding a bounding box B of P with |B| ≤ 6|P |, and then, we show how to cut B out of Q at cost O(|S ∗ |). Lemma 3. For a convex polyhedron P of n vertices, one can compute in O(n) time a bounding box B such that P is contained in B, with |B| ≤ 6|P |. Proof. First, we find two vertices s, t of P such that the z-coordinates of s and t are minimum and maximum, respectively. (Note that two points s, t do not give the diameter of the set of all vertices of P .) Without loss of generality, assume that st is parallel to the z-axis; otherwise, we can simply rotate the coordinate axes such that the z-axis is parallel to st. Clearly, it takes O(n) time to compute s and t. Now, we project all vertices of P into the (x, y) plane vertically. Denote by P2 the set of the projected vertices of P in the (x, y) plane. Next, we compute two points u, v of P2 such that the x-coordinates of u and v are minimum and maximum, respectively. Again, we can assume that uv is parallel to the x-axis. Finally, compute two vertices u , v of P2 such that their y-coordinates, denoted by y(u ) and y(v ), are minimum and maximum, respectively. See Fig. 2. (We cannot assume that u v is parallel to the y-axis. However, the value y(v ) − y(u) is sufficient for the performance analysis of our algorithm.) Let B be the minimum axis-aligned box that encloses P . As discussed above, the lengths of B in three different directions are |st|, |uv| and y(v ) − y(u ). (Remember that s and t (u and v) are two vertices of P (P2 ).) We show below that |B| ≤ 6|P |. Denote by CH(P2 ) the convex hull of the point set P2 in the (x, y) plane, and denote by |CH(P2 )| the area of CH(P2 ). Clearly,
Cutting a Convex Polyhedron Out of a Sphere
129
v' v
u u'
Fig. 2. The orthogonal projection of the vertices of P in the (x, y) plane
|P | ≥ 2|CH(P2 )|. (Note that we needn’t compute CH(P2 ) at all.) Since the segment uv is parallel to the x-axis, we have |CH(P2 )| ≥ (y(v ) − y(u ))|uv|/2. Thus, |P | ≥ (y(v ) − y(u ))|uv|. Since st is parallel to the z-axis, we can similarly obtain |P | ≥ (y(v ) − y(u ))|st| and |P | ≥ |uv| · |st|. In summary, we have |B| = 2((y(v ) − y(u ))|uv| + (y(v ) − y(u ))|st| + |uv| · |st|) ≤ 6|P |, as required.
2
Lemma 4. For a convex polyhedron P of n vertices inside the sphere Q, one can compute in O(n) time a cutting sequence of cost O(|S ∗ |), which cuts the box B (bounding P ) out of Q. Proof. We mainly distinguish two different situations. If the center o of Q is contained in the polyhedron P , then we simply make six cuts along all faces of the box B. From the definition of the radius R1 (see Lemma 1), each of these cuts is of cost no more than πR12 . Thus, the cost of this cutting sequence is at most 12|S ∗ |. In the case that the center o of Q is not contained in P , we first make a cut along the plane, which is perpendicular to the segment op at p, where p is the point of P that is closest to the center o of Q. Following from Lemma 2, its cutting cost πR22 is no more than 2|S ∗ |. For the remaining part of the sphere (that contains P ), we further make six cuts along all faces of the box B. Since any of these six cuts is of cost at most πR22 , the cost of this cutting sequence is at most 14|S ∗ |. Consider now the time required to compute the cutting sequence described above. Since P is convex, whether the center o of Q is contained in P can simply be determined in O(n) time. If o is not contained in P , we further compute in O(n) time the point p of P that is closest to o. It gives the first cutting plane that is perpendicular to op in this case. Since finding the bounding box B of P also takes O(n) time, the proof is thus complete. 2 3.2
Carving Phase
Denote by P + (P − ) the set of the faces of P , whose outward normal has the positive (negative) z value. We describe below how to cut all faces of P + out of
130
X. Tan and G. Wu
the box B. (Cutting P − out of B can be done analogously.) Since P is convex, P + is clearly a planar graph. An important observation made here is that P + can be cut out from the box B using the planar separator theorem [7]. Suppose first that each face of P + has been triangulated. Consider the dual graph of the triangulation of P + , √ which has O(n) edges and nodes. We can select in linear time O( n) edges to form a separator T , which partitions the (dual) graph into two portions with at most two third of the edges on each side of T [7]. Our idea is then to perform a sequence of plane cuts along all faces of T . (Note that each node of the separator T corresponds to a triangle or face of P + .) So P + can be cut out from B using a divide-and-conquer procedure. For each separator T , the other divide-andconquer procedure will also be used to give the face cutting sequence along T , which total cost is O(|S ∗ | · log n). For this purpose, we order all nodes of T from one of its ends to the other, and define the median node of T to be the node of T with the middle index. Lemma 5. The convex polyhedron P can be cut out from the box B in O(n log n) time by a cutting sequence of cost O(|S ∗ | · log2 n). Proof. First, we triangulate each face of P + . Consider the dual graph of the triangulation of√P + , which has O(n) edges and nodes. We can then select in linear time O( n) edges to form a separator T , which partitions the (dual) graph into two portions with at most two third of the edges on each side of T . Let us now consider how to perform a sequence of plane cuts along the found separator T . We use O(log n) recursive steps. In the first step, we find the median node of T , and make a plane cut C1 along its corresponding triangle or face of P + . Clearly, |C1 | ≤ |B|, and the cut C1 divides the separator T into two subseparators. (Note that C1 actually contains all triangles that are on the same face as the chosen triangle.) In the next step, we find the median node in each of the sub-separators, and make two cuts C2 , C3 . Note that |C2 | + |C3 | ≤ |B|. This operation is performed until all plance cuts along the nodes of T are made. In each recursive step, the cutting cost is no more than |B|. Therefore, the total cost taken for the face cutting sequence along T is O(|B|· log n) = O(|S ∗ |·log n). After the cutting sequence along the separator T is made, the problem of cutting out the faces of P + is partitioned into two subproblems; one on each side of T . Denote by B1 , B2 the two portions (of the original box B), which is obtained after the cutting sequence along T is made, on different sides of T . Thus, |B1 | + |B2 | ≤ |B|. Next, we further apply the planar separator theorem to B1 , B2 , and denote by T 1 , T 2 the found planar separators, respectively. Then, perform the cutting sequences along T 1 and T 2 , separately. Again, the cutting costs are O(|B1 |·log n) and O(|B2 |·log n), respectively. So the cutting cost taken in the second step of our algorithm is also O(|S ∗ | · log n). In this way, all faces of P + can be cut out in at most O(log n) recursive steps. Since the cutting cost of each recursive step is O(|S ∗ | · log n), the total cost taken by our algorithm is O(|S ∗ | · log2 n). Finally, since the separator of a planar graph can be found in linear time, the total time required to cut P out of B is O(n log n). 2 The first result of this paper immediately follows from Lemmas 3 to 5.
Cutting a Convex Polyhedron Out of a Sphere
131
Theorem 1. For a given convex polyhedron P of n vertices inside a sphere Q, an O(log2 n)-factor approximation of an optimal cutting sequence for cutting P out of Q can be computed in O(n log n) time.
4
Constant and O(log n) Factor Approximation Algorithms
To obtain a good approximation of an optimal cutting sequence, we will extend some known planar frameworks to three dimensions. First, we show a general property of an optimal cutting sequence S ∗ , i.e., any cut of S ∗ has to touch P . Next, we present a constant factor and an O(log n) factor approximation algorithms for cutting P out of Q. 4.1
A General Property
Assume that both Q and P are the convex polyhedra. Then, we have the following result. Lemma 6. Any cut of an optimal cutting sequence S ∗ for cutting P out of Q has to touch a vertex, an edge or a face of P . Proof. The proof is by contradiction. Suppose that C ∗ is the first cut of S ∗ , which does not touch P . Clearly, moving or deleting C ∗ does not change the cost of the cuts before C ∗ . If no cuts after C ∗ end on the cut C ∗ , then C ∗ can be deleted from S ∗ without increasing the cost of any other cuts; it contradicts the optimality of S ∗ . Denote by X the set of the cuts after C ∗ , which end on the cut C ∗ . Clearly, moving C ∗ will change the cost of the cuts of X. Assume first that C ∗ does not contain any vertex of the current polyhedron Q. Denote by C1 , C2 the two cuts which are obtained by moving C ∗ parallel to itself, towards and away from P , by a very small distance such that the shape of C1 (C2 ) on the surface of Q is similar to that of C ∗ , if the cut C ∗ of S ∗ is replaced by C1 (C2 ). Since is arbitrarily small, neither C1 nor C2 touches P . Then, |S ∗ | cannot be strictly smaller than the cost of either new sequence (i.e., |S ∗ | is equal to the cost of both new sequences), in which the cut C ∗ of S ∗ is replaced by C1 or C2 ; otherwise, due to the similarity, the cost of one new cutting sequence is strictly smaller than |S ∗ |, a contradiction. Assume now that |S ∗ | is equal to the cost of both new sequences. Remember that the current polyhedron Q containing P is always convex. So if we keep to move C ∗ away from P , by a distance every time, the change in the total area of the current cut C ∗ and all the cuts of X, which still end on the current cut C ∗ , is a monotone decreasing function. This implies that either a new position of C ∗ yields an empty set X, or C ∗ is eventually moved outside the polyhedron Q; a contradiction occurs in either case. It requires a little more care of the situation in which C ∗ contains at least one vertex of the current polyhedron Q. Also, denote by C1 (C2 ) the cut, which is obtained by moving C ∗ parallel to itself, towards (away from) P , by a very small distance . Since C1 is not similar to C2 in this case, it needs a slightly different
132
X. Tan and G. Wu
argument. Suppose now that we move the plane containing C ∗ away from P by the same distance , and consider the (convex) region C2 in that plane, which is bounded by its intersection with the planes containing all faces of X. Note that C2 is similar to both C ∗ and C1 . We call C2 a pseudo-cut, and the cutting sequence in which C ∗ of S ∗ is replaced by C2 and the cuts of X are extended to end on C2 (if needed), a pseudo-cutting sequence. As discussed above, |S ∗ | is then equal to the cost of of this pseudo-cutting sequence. It also follows from the convexity of Q and the above construction of the pseudo-cut C2 that C2 ⊇ C2 . Thus, the cost of the cutting sequence in which C ∗ of S ∗ is replaced by C2 , is no more than the cost of the above pseudo-cutting sequence. This implies that the operation of keeping to move C ∗ away from P also works, which eventually leads to a contradiction. The proof is thus complete. 2 4.2
Algorithms in the Carving Phase
Suppose that the box B has been cut out from the sphere Q, as described in Section 3.1. We will focus our attention on the problem of cutting P out of B. For ease of presentation, we still use S ∗ to represent an optimal cutting sequence for cutting P out of B, and Sf∗ an optimal face cutting sequence for cutting P out of B. In the following, we first show that an optimal face cutting sequence for cutting P out of B is a constant factor approximation of an optimal cutting sequence. To obtain an O(log n)-factor approximation, we further employ a dynamic programming technique, which was originally given by Overmars and Welzl [9]. Lemma 7. In the carving phase of cutting P out of B, an optimal face cutting seqeunce Sf∗ is an O(1)-factor approximation of S ∗ . Proof. Our proof is similar to that of its planar counterpart given by Daescu and Luo [4]. Let S ∗ be an optimal cutting seuqence for cutting P out of B. We will construct a face cutting sequence Sf , whose cost is at most 10|S ∗ |. Since |Sf∗ | ≤ |Sf | holds, the lemma then follows. For every optimal cut C ∗ ∈ S ∗ , in order, if C ∗ is a face cut, we simply add it to Sf . Otherwise, C ∗ is tangent to a vertex or an edge of P ; in this case, we add several face cuts to Sf as follows. If C ∗ is tangent to an edge e of P , then we add to Sf two cuts C1 , C2 (in this order), which are made along the two faces of P having the common edge e. A portion of C1 lies outside of C ∗ as viewed from a point inside P , but the whole cut C2 lies inside of C ∗ . Since the original polyhedron containing P is the box B, the portion of C1 lying outside C ∗ is of area at most |C ∗ |. If C ∗ touches a vertex v of P , we first project all the edges having the common vertex v into the plane C ∗ vertically, and find the two edges e1 , e2 such that the smaller angle (less than π) between their projections in the plane C ∗ is maximum among all of these angles. Next, we add to Sf the cuts C11 and C12 (C21 and C22 ), in this order, which are made along the two faces of P having the common edge e1 (e2 ). (Two of these faces may be identical.) Again, the portion of C11 (C21 ) lying outside C ∗ is of area at most |C ∗ |.
Cutting a Convex Polyhedron Out of a Sphere
133
Since some cuts of S ∗ may not be the face cuts, we give below a method to bound the extra cost between |Sf | and |S ∗ |. Denote by B ∗ the portion of the original box B, which is obtained after C ∗ in the cutting sequence S ∗ is made, and Bf the portion of B obtained after the cuts corresponding to C ∗ in Sf are made. It follows from the above construction of Sf that Bf ⊆ B ∗ . For a cut C ∗ ∈ S ∗ , at most four face cuts may have been added to Sf . As discussed above, the portions of these faces lying outside B ∗ are of area at most 2|C ∗ |. So the extra cost taken for all such portions (lying outside B ∗ ) is at most 2|S ∗ |. Let us denote by C1 and C2 (C11 , C12 , C21 and C22 ) the portions of the cuts C1 and C2 (C11 , C12 , C21 and C22 ), which are contained in B ∗ . Let Δ denote the part of B ∗ , which is exactly cut off by the cuts C1 and C2 (C11 , C12 , C21 and C22 ). Since both B ∗ and P are convex, the inner surface of Δ, which consists of C1 and C2 (C11 , C12 , C21 and C22 ), is inward-convex, and the outer surface of Δ, which consists of all other faces (including C ∗ ) of Δ, is outward-convex. Therefore, the area of the inner surface of Δ is no more than that of the outer surface. (It can simply be proved by an argument similar to that given for its planar counterpart [6].) The extra cost between |C ∗ | and |C1 | + |C2 | | + |C12 | + |C21 | + |C22 |) is thus bounded by the total area of the faces f of (|C11 Δ, excluding C ∗ , C1 and C2 (C11 , C12 , C21 and C22 ). Since these faces f belong to the surface of the original box B or some cuts of S ∗ , which are made before C ∗ , the extra cost taken for all the portions of C1 and C2 (C11 , C12 , C21 and C22 ) lying inside B ∗ is at most |B| + |S ∗ |. Putting together all results, we have |Sf | ≤ 2|S ∗ | + |S ∗ | + (|S ∗ | + |B|) ≤ 4|S ∗ | + 6|P | ≤ 10|S ∗ |. This completes the proof. 2 An optimal face cutting sequence Sf∗ can be computed in exponential time, because the number of all face cutting sequences is trivially bounded by n!. So we have the following result. Theorem 2. For a given convex polyhedron P of n vertices inside a sphere Q, an O(1)-factor approximation of an optimal cutting sequence for cutting P out of Q can be computed in exponential time. It is not known whether there exists a polynomial time algorithm for computing Sf∗ . However, optimal face cutting sequences for planar separators employed in the previous section can be computed using dynamic programming. This yields an O(log n)-factor approximation algorithm for computing Sf∗ . Lemma 8. The convex polyhedron P can be cut out from the box B in O(n1.5 log n) time by a face cutting sequence of cost O(|Sf∗ | · log n). Proof. As in the proof of Lemma 5, we employ a divide-and-conquer algorithm to cut P out of B. In every step of cutting along a separator, instead of a simple divide-and-conquer method, we use a dynamic programming algorithm to compute an optimal face cutting sequence for the separator. This allows us to cut P in O(n1.5 log n) time out of B at cost O(|Sf∗ | · log n). The dynamic programming algorithm for plane cuts along a planar separator is essentially the same as that for line cuts along a convex chain in the plane [9].
134
X. Tan and G. Wu
Let T 1 be the separator of P + , which is found in the first step of our algorithm. Let us number the faces of T 1 from 1 to m along the surface of P + . (All triangles on the same plane are considered as a single face.) Then, we compute optimal face cutting sequences of all arc of faces of T 1 , in order of length of the arc, i.e., start with the arc of one face, next arcs of two arcs. Note first that the optimal face cutting sequence for the arcs having only one face fi is the face fi itself, as the cuts along fi−1 and fi+1 are assumed to have been made. (No face cut is made along fi−1 or fi+1 if i = 1 or i = m.) Assume now that all optimal face cutting sequences for the arcs of length no more than j − i − 1, j > i, have been computed. Consider how to cut out the faces between fi and fj . An optimal face cutting sequence consists of a cut along some face fk (i ≤ k ≤ j), followed by at most two optimal cutting sequences; one for all faces between fi and fk−1 and the other for all faces between fk+1 and fj . Trying all possible choices of k clearly gives an optimal face cutting sequence for all faces between fi and fj . Note that a face cut along fk may intersect with the previously made cuts fi−1 and fj+1 , or the surface of the box B. After all the first two cuts along fi and fj (1 ≤ i, j ≤ m) inside B have been precomputed in O(m2 ) time, such a try can be done in constant time. So after an O(m2 )-time preprocessing step, an optimal face cutting sequence for the arc between (any) two faces fi , fj can be computed 2 in O(j − i) time. Since √ the total number of these arcs is bounded by O(m ), and since m is of size O( n), the time required to find an optimal cutting sequence along T 1 is O(m3 ) or O(n1.5 ). An optimal face cutting sequence along the separator T 1 divides the problem of cutting out the faces of P + into two independent subproblems; either subproblem is of size at most 2n/3. Solving the recurrence T (n) = 2T (2n/3) + O(n1.5 ) gives us the time bound O(n1.5 log n). Next, we show that the cutting cost taken in each recursive step of our algorithm is O(|Sf∗ |). Let Sf1 denote the optimal face cutting sequence along T 1 . Clearly, we have |Sf1 | ≤ |Sf∗ |. Denote by B 1 the polyhedron obtained after Sf1 is made. Denote by T 2 , T 3 the two planar separators found in the second step of our divide-and-conquer algorithm, and Sf2 , Sf3 the optimal face cutting sequences along T 2 , T 3 . The problem of cutting P + out of B 1 can then be considered as two independent subproblems, which are separated by T 1 . Since the face cutting sequence Sf2 or Sf3 is optimal only for the separator found in either side of T 1 , the cost (|Sf2 |+|Sf3 |) is no more than the cost of an optimal face cutting sequence for cutting P + out of B 1 . Moreover, since B 1 ⊂ B, the cost of any optimal face cutting sequence for cutting P + out of B 1 is no more than |Sf∗ |. Thus, we have |Sf2 | + |Sf3 | ≤ |Sf∗ |. Analogously, the cutting cost at each recursive step of our algorithm is no more than |Sf∗ |. Since it needs at most O(log n) recursive steps, the total cost of our cutting sequence is O(|Sf∗ | · log n). 2 The main result of this paper follows from Lemmas 4, 7 and 8. Theorem 3. For a given convex polyhedron P of n vertices inside a sphere Q, an O(log n)-factor approximation of an optimal cutting sequence for cutting P out of Q can be computed in O(n1.5 log n) time.
Cutting a Convex Polyhedron Out of a Sphere
5
135
Concluding Remarks
We have presented three approximation algorithms for computing a minimum cost sequence of planes to cut a convex polyhedron P of n vertices out of a sphere Q. Our algorithms with O(n1.5 log n) running time O(log n)-factor approximation and O(n log n) running time O(log2 n)-factor approximation greatly improve upon the previously known O(n3 )-time O(log2 n)-factor approximation solution. Finally, we pose two open questions for further research. First, it is open to find a polynomial-time algorithm for computing an optimal face cutting sequence for cutting the convex polyhedron P out of the box B. Although its planar counterpart is true [9], we find it difficult to obtain the same result in 3D. Also, it is an interesting work to develop an approximation algorithm for cutting P out of another convex polyhedron Q. Again, whether the method used for its planar counterpart [5] can be generalized to 3D remains open.
Acknowledgements We thank the anonymous referees for valuable comments. This work was supported by an oversea project of State Key Lab. for Novel Software Technology, Nanjing University, China.
References 1. Ahmed, S.I., Hasan, M., Islam, M.A.: Cutting a convex polyhedron out of a sphere. In: Rahman, M. S., Fujita, S. (eds.) WALCOM 2010. LNCS, vol. 5942, pp. 94–101. Springer, Heidelberg (2010) 2. Bereg, S., Daescu, O., Jiang, M.: A PTAS for cutting out polygons with lines. Algorithmica 53, 157–171 (2009) 3. Bhadury, J., Chandrasekaran, R.: Stock cutting to minimize cutting sequence. European Journal of Operational Research 88(1), 69–87 (1996) 4. Daescu, O., Luo, J.: Cutting out polygons with lines and rays. International Journal of Computational Geometry & Applications 16(2-3), 227–248 (2006) 5. Dumitrescu, A.: An approximation algorithm for cutting out convex polygons. Computational Geometry: Theory and Applications 29(3), 223–231 (2004) 6. Hershberger, J., Suri, S.: Practical methods for approximating shortest paths on a convex polytope in R3 . Computational Geometry: Theory and Applications 10, 31–46 (1998) 7. Lipton, R.J., Tarjan, R.E.: A separator theorem for planar graphs. SIAM J. Appl. Math. 36, 177–189 (1979) 8. Jaromczyk, J.W., Kowaluk, M.: Sets of lines and cutting out polyhedral objects. Computational Geometry: Theory and Applications 25, 67–95 (2003) 9. Overmars, M.H., Welzl, E.: The complexity of cutting paper. In: Proc. of the 1st Annual ACM Symposium on Computational Geometry, Maryland, USA, pp. 316–321 (1985) 10. Tan, X.: Approximation algorithms for cutting out polygons with lines and rays. In: Wang, L. (ed.) COCOON 2005. LNCS, vol. 3595, pp. 534–543. Springer, Heidelberg (2005)
An Algorithm for Optimal Acyclic Edge-Colouring of Cubic Graphs Edita Máčajová and Ján Mazák Department of Computer Science Faculty of Mathematics, Physics and Informatics Comenius University 842 48 Bratislava, Slovakia {macajova,mazak}@dcs.fmph.uniba.sk Abstract. An acyclic edge-colouring of a graph is a proper edge-colouring such that the subgraph induced by the edges of any two colours is acyclic. The acyclic chromatic index of a graph G is the smallest possible number of colours in an acyclic edge-colouring of G. In [12], we have shown that the acyclic chromatic index of a connected subcubic graph G is at most 4 with the exception of K4 and K3,3 , for which five colors are optimal. Here we give a quadratic-time algorithm that finds an acyclic 4-edge-colouring of a given connected subcubic graph different from K4 and K3,3 .
1
Introduction
Edge-colourings of graphs constitute a broad topic in graph theory. Among the best-known colourings are the so-called proper edge-colourings, that is, edge-colourings such that the edges incident with any vertex receive mutually different colours. A proper k-edge-colouring of a graph G such that there are no two-coloured cycles in G (that is, any cycle contains edges of at least three different colours) is called an acyclic k-edge-colouring of G. The concept of acyclic colourings was introduced by Grünbaum in [11]; the algorithmic aspects of acyclic colourings have recently caught interest because of their applications in matrix computations (see [10] for more details). The chromatic index of a graph G, denoted by χ (G), is the least number of colours needed to colour the edges of G in a proper edge-colouring. Similarly we define the acyclic chromatic index (also called acyclic edge chromatic number) of a graph G, denoted by a (G), to be the least integer k such that G has an acyclic k-edge-colouring. A slighly different point of view is given by an alternative definition: the acyclic chromatic index of a graph G is the minimum number of matchings which suffice to cover all edges of G in such a way that the union of any two matchings does not contain a cycle. Obviously, a (G) ≥ χ (G). All graphs considered in this paper are finite and simple, that is, without multiple edges and loops. Let Δ = Δ(G) denote the maximum degree of a
This author’s work was supported by the APVV project 0223-10 and the VEGA project 1/0406/09. This author’s work was supported by the APVV project 0223-10 and the VEGA project 1/0634/09.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 136–146, 2011. c Springer-Verlag Berlin Heidelberg 2011
Optimal Acyclic Edge-Colouring of Cubic Graphs
137
vertex in a graph G. The Vizing theorem states that a simple graph G with maximal degree Δ has the chromatic index either Δ or Δ + 1. Far less is known about the acyclic chromatic index; in fact, even the value a (Kn ) for a complete graph Kn is not known for all n. The best general bound is a (G) ≤ 16Δ (see [2] and [13]), but recent results (e. g. [1], [4], and [14]) suggest that this bound is far from tight. The conjecture made by Fiamčík [9] and later by Alon, Sudakov, and Zaks [1] says that a (G) ≤ Δ + 2 for every graph G. Burstein’s result in [5] implies that for a cubic graph G, we have a (G) ≤ 5, therefore the conjecture is true for Δ = 3. Skulrattanakulchai [15] described a linear-time algorithm for finding an acyclic 5-edge-colouring of a given subcubic graph. We focus on graphs with Δ = 3 in our work. In 1980, Fiamčík [7] published a paper claiming that K4 is the only cubic graph requiring five colours in an acyclic edge-colouring, nevertheless both the result and the proof were incorrect. Four years later, in [8], he corrected one of the errors of the previous paper, and stated a correct result that there are two exceptional cubic graphs requiring five colours in an acyclic edge-colouring. However, the proof is still essentially incomplete: the usage of Lemma 2 in [7] eliminates the cycles of colours 1 and 2, but it does not ensure that no two-coloured cycles of other pairs of colours are created. This may be the reason why the result of Fiamčík has fallen into obscurity. In [4] Basavaraju and Chandran proved that a (G) ≤ 4 for all connected subcubic graphs (graphs with maximum degree at most 3) that are not cubic, that is, they contain a vertex of degree at most 2. Their proof yields a polynomialtime algorithm for the problem of finding an acyclic 4-edge-colouring of a given subcubic graph that is not cubic. Since the acyclic chromatic index of the graphs K4 and K3,3 is 5, there is no such algorithm for all cubic graphs. Fortunately, as we have shown in [12], the two mentioned graphs are the only exceptional cases and all the other connected cubic graphs have an acyclic 4-edge-colouring. In this paper, we describe a quadratic-time algorithm which constructs such a colouring for arbitrary connected subcubic graph different from K4 and K3,3 . Note that no cubic graph has an acyclic 3-edge-colouring: indeed, in any proper 3-edge-colouring of a cubic graph the edges coloured by any two colours form a 2-factor which consists of two-coloured cycles. Hence our algorithm finds an optimal acyclic edge-colouring of a cubic graph. Since determining whether a given graph has an acyclic 3-edge-colouring is NP-complete (see [3]), we do not hope that there is a polynomial-time algorithm for the problem of finding an optimal acyclic edge-colouring of a given subcubic graph. The proposed algorithm is described in Section 2 and its complexity is determined in Section 3.
2
The Algorithm
Given a connected subcubic graph G not isomorphic to K4 or K3,3 , our algorithm computes one of the acyclic 4-edge-colourings of the given graph G. Before a detailed description of the algorithm we sketch the underlying idea. Our aim is to proceed in a recursive fashion. We remove a cycle from the given
138
E. Máčajová and J. Mazák
graph G and add a few edges obtaining a graph G which has less vertices than G. Then we try to colour G recursively and extend the obtained colouring to G. However, there is a crucial obstacle: the graph G may be disconnected, and if it contained a component isomorphic to K4 or K3,3 , our approach would completely fail because these two graphs have no acyclic 4-edge-colouring. To avoid this possibility, we have to carefully choose the cycle that will be removed from G. It transpired that removing a shortest cycle works, however, we do not know of any linear-time way of finding a shortest cycle in a cubic graph (anything worse than linear-time algorithm for this problem would increase the total time complexity of our algorithm). Therefore, we find a cycle that at least cannot be easily shortened, and this gives rise to many cases. The algorithm proceeds in six Stages; the core of the algorithm is Stage 5. Since the extent of this paper is limited, some details are omitted. An interested reader may find them in the technical report [12]. Throughout the following description, any proper k-edge-colouring uses the colours denoted by 1, 2, . . . , k. Stage 0. Check if G is isomorphic to one of the graphs depicted in Fig. 1. If this is the case, return the given colouring. Otherwise proceed by Stage 1. Stage 1. Find all bridges of the given graph G by the algorithm sketched in [6]. If G is bridgeless, proceed by Stage 2. Otherwise remove all the bridges; the remaining graph is composed of 2-edge-connected components H1 , H2 , . . . , Hr . Neither of these components can be isomorphic to K4 or K3,3 since any of them
(a)
(b)
(c)
(e)
(h)
(d)
(f)
(i)
(g)
(j)
(k)
Fig. 1. Acyclic 4-edge-colourings of small graphs from Stage 0
Optimal Acyclic Edge-Colouring of Cubic Graphs u1
u2
v1
v
v2
139
u2
u1 w
Fig. 2. Creating G from G in Case 1 of Stage 2 (v1 and v2 adjacent)
contains a vertex of degree two. Hence each graph Hi , i ∈ {1, 2, . . . , r}, has an acyclic 4-edge-colouring that can be constructed recursively. It only remains to colour the bridges. This is always possible because we can permute the colours of the edges of one of the components a bridge is connecting. Since the graph T obtained from G by contracting Hi for each i ∈ {1, 2, . . . , r} is a tree, we can start in any vertex v of T , recolour the graphs Hj corresponding to its neighbours if needed, and then continue to the vertices in greater and greater distance from v. Proceeding in this way we never need to permute the colours more than once for any of the graphs Hi . It is clear that any cycle in G is contained in one of the subgraphs H1 , H2 , . . . , Hr , therefore it contains at least three colours and the constructed 4-edgecolouring of G is acyclic. Stage 2. Find the minimum degree of G. This degree is either two or three since G is bridgeless. If G is cubic, proceed by Stage 3. Otherwise pick any vertex v of degree two; this vertex has two neighbours v1 and v2 . We distinguish two cases, either v1 and v2 are adjacent or not. Case 1: the vertices v1 and v2 are adjacent. Since G is bridgeless, either G is a triangle or the vertices v1 and v2 are of degree three and there is no vertex different from v adjacent to both v1 and v2 . If G is a triangle, we colour its edges by three different colours; in the latter case let u1 be the neighbour of v1 different from v and v2 and let u2 be the neighbour of v2 different from v and v1 . We remove the vertices v, v1 , and v2 together with the incident edges from G and add a new vertex w of degree two joined by an edge to u1 and u2 . We denote the resulting graph by G . The graph G is connected and contains a vertex of degree 2, therefore we can recursively find an acyclic 4-edge-colouring ϕ of G . Construct the colouring ϕ of G as follows: ϕ(e) = ϕ (e) for every edge e that is not incident with any of v, v1 , and v2 . Further set ϕ(u1 v1 ) = ϕ(vv2 ) = ϕ (u1 w), ϕ(u2 v2 ) = ϕ(vv1 ) = ϕ (u2 w) and colour the edge v1 v2 by any of the two remaining colours different from ϕ(vv1 ) and ϕ(vv2 ) (see Fig. 2). Clearly, ϕ is an acyclic 4-edge-colouring of G. This concludes Case 1. Case 2: the vertices v1 and v2 are not adjacent. We construct a new graph G by removing the vertex v from G together with the incident edges v1 v and v2 v and adding a new edge v1 v2 . Clearly, G is simple and since G is not isomorphic to the graphs depicted in Fig. 1(a) and (b), we have that G = K4 and G = K3,3 . Thus we can find an acyclic 4-edge-colouring ϕ of G recursively. An acyclic 4-edge-colouring ϕ of G is constructed as follows: We set ϕ(e) = ϕ (e) for every edge e ∈ {vv1 , vv2 }.
140
E. Máčajová and J. Mazák
If the degree of one of the neighbours of v, say v2 , is two, denote by v3 the neighbour of v2 such that v = v3 . We choose ϕ(vv1 ) to be any colour different from already coloured adjacent edges and also different from the colour ϕ(v2 v3 ). To finish the colouring we choose ϕ(vv2 ) to be any colour different from ϕ(vv1 ) and ϕ(v2 v3 ). The resulting colouring is proper, and if there is a 2-coloured cycle in ϕ, it has to contain the vertex v. However, this is not possible, since ϕ(vv1 ) = ϕ(v2 v3 ). If, on the other hand, deg(v1 ) = 3 and deg(v2 ) = 3, let e1 and e2 be the edges incident with v1 but different from vv1 and let e3 and e4 be the edges incident with v2 but different from vv2 . Since ϕ is a proper 4-edge-colouring, we have {ϕ(e1 ), ϕ(e2 )}∩{ϕ(e3 ), ϕ(e4 )} = ∅. If {ϕ(e1 ), ϕ(e2 )} = {ϕ(e3 ), ϕ(e4 )}, we choose for each of ϕ(vv1 ) and ϕ(vv2 ) one of the two remaining colours different from ϕ(e1 ) and ϕ(e2 ), different from each other. If |{ϕ(e1 ), ϕ(e2 )} ∩ {ϕ(e3 ), ϕ(e4 )}| = 1, and, say ϕ(e1 ) = ϕ(e3 ), we set ϕ(vv1 ) = ϕ(e4 ) and ϕ(vv2 ) will be the colour different from ϕ(e1 ), ϕ(e2 ) and ϕ(e4 ). It can be easily seen that in both cases ϕ is an acyclic 4-edge-colouring of G. This concludes Case 2. Stage 3. Find all triangles in G using the breadth-first search to depth 2 from every vertex of G. If there are no triangles, proceed by Stage 4. Otherwise, two cases may occur: either there is a triangle with no edge included in another triangle or there are two triangles that share an edge. First suppose that G contains a triangle with no edge included in another triangle; denote one such triangle C3 and let C3 = v1 v2 v3 . Let vi be the neighbour of vi not contained in C3 . Create a new graph G by removing the vertices of C3 together with the incident edges and introducing a new vertex u connected to v1 , v2 , and v3 . Since no edge of C3 was included in another triangle, G is simple. Moreover, since G is not isomorphic to the graphs in Fig. 1(c) and (d), it holds that G = K4 and G = K3,3 . It follows that we can recursively find an acyclic 4-edge-colouring ϕ of G . We extend ϕ to an acyclic 4-edge-colouring of G: we set ϕ(e) = ϕ (e) for every edge e not incident with a vertex of C3 , set ϕ(vi vi ) = ϕ (vi u), ϕ(v1 v2 ) = ϕ (v3 v3 ), ϕ(v1 v3 ) = ϕ (v2 v2 ), and ϕ(v2 v3 ) = ϕ (v1 v1 ). Now suppose that G contains two triangles sharing an edge, say v1 v2 v3 and v1 v2 v4 , with v3 = v4 . Since G = K4 , the edges v1 v3 , v2 v3 , v1 v4 and v2 v4 are contained in exactly one triangle of G. Let v3 be the neighbour of v3 different from v1 and v2 and let v4 be the neighbour of v4 different from v1 and v2 . Since G does not contain a bridge, we have v3 = v4 . Construct a new graph G by removing the vertices v1 , v2 , v3 , and v4 from G and introducing a new vertex u of degree 2 adjacent to v3 and v4 . Let ϕ be an acyclic 4-edge-colouring of G found recursively. We construct a colouring ϕ of G as follows: we set ϕ(e) = ϕ (e) for every edge e which is not incident with either of vi for i ∈ {1, 2, 3, 4} and ϕ(v3 v3 ) = ϕ(v2 v4 ) = ϕ (v3 u), ϕ(v4 v4 ) = ϕ(v1 v3 ) = ϕ (v4 u). Further, let c1 and c2 be the two colours different from ϕ (uv3 ) and ϕ (uv4 ). To finish the construction of the colouring set ϕ(v2 v3 ) = ϕ(v1 v4 ) = c1 , and, finally ϕ(v1 v2 ) = c2 (see Fig. 3). Clearly ϕ is acyclic.
Optimal Acyclic Edge-Colouring of Cubic Graphs
141
v1 v3
v3
v4
v4
v3
v4 u
v2
Fig. 3. Creating G from G in Stage 3 in case that G contains two triangles that share an edge
Stage 4. Find a cycle of length 4 in G using the breadth-first search to depth 2 from every vertex of G. If there are no such cycles, proceed by Stage 5. If there is a cycle of length 4, then since G is not isomorphic to the graphs depicted in Fig. 1(e)–(k), we can deal with it in a similar way as we have handled a triangle. The details can be found in [12, Section 2, Case 3c]. Stage 5. At this point there are no cycles of length three or four in G. If there is a cycle of length 5 in G, let C be one such cycle (it can be found by a breadth-first search of depth 3 starting at each vertex of G). If there are no cycles of length 5 and there is a cycle of length 6, let C be this cycle. Otherwise we use a breadth-first search starting at an arbitrary vertex v of G and find a shortest cycle C containing the vertex v. This cycle have no chords, otherwise it could be shortened. Moreover, a short analysis shows that there is no vertex of V (G) − V (C) which has two neighbours on C. Altogether, we have picked the cycle C in such a way that it has no chords and that any vertex having two neighbours on C belongs to C; we will call such a cycle nice. Now we distinguish two cases: the length of C can be either even or odd. We will use the fact that G contains no cycles of length 3 or 4 in what follows. Case 1: the length of C is even. Let the vertices of C be u0 , v0 , u1 , v1 , . . . , uk−1 , vk−1 (the indices will be taken mod k in what follows). Let ui and vi be the neighbours of ui and vi , respectively, which do not belong to C (the vertices u0 , v0 , u1 , v1 , . . . are distinct because C is nice). Let G be the graph constructed in the following way: we remove from G the cycle C together with all the edges adjacent to this cycle and join ui to vi for i = 0, 1, 2, . . . , k − 1 (see Fig. 4). The resulting graph G is cubic and simple: a loop in G yields a triangle in G and a multiple edge in G yields a cycle of length 4 in G. Note that G may be disconnected but it contains no component isomorphic to K4 or K3,3 — such a component would yield a cycle of length 4 or 5 in G; we prove this assertion in the next two paragraphs. Assume that G contains a component K isomorphic to K4 or K3,3 . Since G does not contain cycles of length 4, any such cycle in K must contain at least one of the edges added in the construction of G (we call such edges added in what follows). If K = K4 , one can easily check that K must contain two adjacent added edges. Let these two edges form a path xyz. Since xy and yz are added
142
E. Máčajová and J. Mazák
v3 v3 u3
v3
u0 u0
u3
v0
u1 v v2 2 u2
u2
u0
v0
u1
v0
u3
u1
v2
v1
v1
u2
v1
Fig. 4. Creating G from G in Stage 5
edges, the vertex y has two neighbours lying on C and does not belong to C. However, this contradicts the fact that C is nice. If K = K3,3 then K also contains no two adjacent added edges because C was nice. If K does not contain two adjacent added edges, it must contain three added edges constituting a 1-factor of K (otherwise there is a 4-cycle in G). Since no other edges in K are added, the remaining six edges of K constitute a cycle D of length 6 in G. Consequently, the cycle C must have length 6 (otherwise we would have chosen D in place of C at the beginning of this Stage). Therefore, each vertex of C is adjacent to a vertex of D. It is easy to check that in any case G contains a cycle of length 4 or 5, and this contradicts our assumptions. Now we return to the algorithm. The graph G has an acyclic 4-edge-colouring ϕ , which can be found recursively. We extend this colouring to an acyclic 4-edgecolouring ϕ of G. Let ϕ(e) = ϕ (e) for all edges e common for G and G and ϕ(ui ui ) = ϕ(vi vi ) = ϕ (ui vi ). It remains to define ϕ on the edges of C. We do this in several steps. The direction u0 , v0 , u1 , . . . along C will be referred to as clockwise. Let D be a cycle in G other than C. We say that D enters C at a vertex w and leaves C at a vertex w , if the path w–w belongs to both C and D, goes along C in the clockwise direction and cannot be extended in any direction. We say that D is of intersection , if the path w–w has length . The cycle D can have more than one common path with C, in such a case we choose w and w so that their clockwise distance along C is maximal. Now we define ϕ on the remaining edges of G, after this step ϕ will be a proper 4-edge-colouring of G such that any cycle of intersection 1 will contain at least three distinct colours. Consider the edge vi ui+1 . If the colours ϕ(vi vi ) and ϕ(ui+1 ui+1 ) are different, we choose any of the two remaining colours for ϕ(vi ui+1 ). Otherwise we set ϕ(vi ui+1 ) to be the colour different from the colours of the three edges incident with vi . Consider the edge ui vi . It is adjacent to four edges, but two of them (ui ui and vi vi ) are coloured by the same colour, so there is at least one free colour to colour
Optimal Acyclic Edge-Colouring of Cubic Graphs
143
the edge ui vi . We choose one such free colour. We do this for i = 0, 1, . . . , k − 1. Now we have coloured all the edges of G. All cycles disjoint from C contain edges of at least three colours. It is easy to verify that the cycles of intersecion 1 contain at least three colours. Now we modify ϕ to be a proper 4-edge-colouring of G such that any cycle other than C contains at least three colours. The only problematic cycles are those of intersection at least 2. Such a cycle containing only two colours cannot enter C in ui : the colours of ui ui and vi vi are the same, hence the colours ϕ(ui ui ), ϕ(ui vi ), and ϕ(vi ui+1 ) are three different colours contained in this cycle. Let D be a two-coloured cycle which enters C in vi . Then D cannot leave C in vi+1 , because the colours of vi ui+1 and vi+1 vi+1 cannot be the same. Hence the colours of vi ui+1 and vi+1 ui+2 are the same. Now recolour the edge ui+1 vi+1 to have the colour different from ϕ(vi vi ), ϕ(vi ui+1 ) and ϕ(ui+1 ui+1 ). Any cycle of intersection 1 containing the edge ui+1 vi+1 contains at least three colours because any cycle in G contains at least three colours. After these modifications the only possibly two-coloured cycle is C. Assume that it contains only two colours, say 1 and 2. The edges incident with vertices of C but not belonging to C are coloured by colours 3 and 4. If ϕ(u1 u1 ) = ϕ(u2 u2 ) = 3, we can set ϕ(u2 v2 ) = 4 to obtain an acyclic 4-edge-colouring of G. Otherwise we may assume that the edges ui ui for i = 1, 2 . . . , k are coloured alternately by colours 3 and 4 (this assumption allows us to replace colour 1 on the edges of C by colour 2 and vice versa without introducing two-coloured cycles of intersection 1). Moreover, we may assume that ϕ(u1 u1 ) = ϕ(v1 v1 ) = 3, ϕ(u2 u2 ) = ϕ(v2 v2 ) = 4, ϕ(u1 v1 ) = 2 and ϕ(v1 u2 ) = 1. There are three cases for the colours f1 and f2 of the two edges incident with u2 and not incident with u2 : • if {f1 , f2 } = {2, 3}, we set ϕ(v1 u2 ) = 4 and ϕ(u2 u2 ) = 1, • if {f1 , f2 } = {1, 2}, we set ϕ(v1 u2 ) = 4 and ϕ(u2 u2 ) = 3, • if {f1 , f2 } = {1, 3}, we set ϕ(v1 u2 ) = 4 and ϕ(u2 u2 ) = 2 and colour the edges of C different from v1 u2 by colours 1 and 2 alternately to obtain a proper 4-edge-colouring. The resulting colouring ϕ is an acyclic 4-edge-colouring of G. Case 2: the length of C is odd. This case is similar to the previous one. The only difference in the reduction from G to G is that after removing C and adding edges between pairs of vertices of degree two there remains one vertex of degree two. The extension of an acyclic 4-edge-colouring of G to a colouring of G is done in an analogous manner; we refer the reader to the report [12] for further details.
3
The Complexity of the Algorithm
This section is devoted to the analysis of the time complexity of the algorithm from Section 2. The number of steps of the algorithm on a graph G will be expressed as a function of |V (G)|+|E(G)|; for clarity, we will write f (G) in place
144
E. Máčajová and J. Mazák
of |V (G)| + |E(G)|. We will prove that the time complexity of our algorithm is bounded from above by a quadratic function of f (G). Since |E(G)| = O(|V (G)|) for a connected subcubic graph G, it implies that the algorithm is at most quadratic in the number of vertices. The described algorithm will use a list of neighbours for every vertex to represent the given graph. This representation allows us to easily do local modifications of the graph, for example, remove a vertex or a triangle from the graph. If the input is in the form of adjacency matrix, we can transform it into lists of neighbours by using O(|V (G)|2 ) steps. Let the time complexity of our algorithm be T (n). First, we prove the existence of a positive constant α such that for every non-negative integer n, there exists a non-negative integer s and positive integers n1 , n2 , . . . , ns with sum at most n − 1 such that T (n) ≤ T (n1 ) + T (n2 ) + · · · + T (ns ) + αn + α.
(1)
A connected subcubic graph G is given as the input. Let n = f (G). We analyze particular Stages of the algorithm and find an upper bound on the running time T (n). Note that each of Stages 1–5 consists of a preliminary phase (for instance, finding all bridges of G in Stage 1) and then either we move to the next Stage, or we remove some edges or vertices from G and then construct a colouring of G from the recursively obtained colourings of the smaller pieces. Hence either we colour the input graph in Stage 0 directly, or we make recursive calls in only one Stage. Clearly, Stage 0 can be done in O(1) time. In Stage 1, first all bridges are found by using an algorithm sketched in [6] based on depth-first search. This algorithm takes time O(n). If there are no bridges, we proceed toStage 2. Otherwise we recursively colour the graphs H1 , . . . , Hr , which takes ri=1 T (f (Hi )) steps. Obviously, ri=1 f (Hi ) < f (G). Permuting the colours of the components H1 , . . . , Hr and assembling the pieces together takes time linear in n, since every edge (or vertex) of G is manipulated with only constantly many times. In Stage 2, we compute the degrees of vertices of G in linear time. Then either we proceed to Stage 3, or use a recursive call on a graph G such that f (G ) < f (G). After obtaining a colouring c of G , the extension of c to G takes only a constant number of steps. In Stage 3, we do a breadth-first search from each vertex of G. However, each such search has the depth only 2 and G is subcubic, thus the number of steps used by the search from one vertex is bounded from above by a constant. If there is no triangle in G, we proceed to Stage 4. If we have found a triangle, there is more work to be done. It is easy to check if a triangle has an edge in common in another triangle: we only need to check if two vertices of the triangle have two distinct common neighbours; this can be done in constant time. In both the arising cases the reduction from G to G and the extension of the colouring of G to G can be done in constant time. Stage 4 is very similar to Stage 3. First, we do a breadth-first search from each vertex and if there are cycles of length four, we distinguish a few cases according
Optimal Acyclic Edge-Colouring of Cubic Graphs
145
to the local situation around one of the 4-cycles. Then we locally modify G to obtain a smaller graph G , recursively find an acyclic 4-edge-colouring of G and extend it to a colouring of G. All of this can be done in time linear in f (G). The choice of C in Stage 5 can be done in O(n) steps. The various modifications of G and ϕ are linear in the length of C, hence we need at most O(n) steps for them. The recursive calls are done on the components of the graph G which has smaller order and size than G. Altogether, the amount of work done by the algorithm is in O(n) apart from the recursive calls. In each Stage, the sum of the values f (G ) for graphs G on which we call the algorithm recursively is smaller than f (G). Thus no matter how the graph G is constructed, there always exist a constant α and positive integers n1 , n2 , . . . , ns such that T (n) satisfies the bound (1). Finally, we prove that any function T (n) satisfying the recurrence relation (1) is bounded from above by αn2 + α. It will be done by induction on n. Clearly T (0) ≤ α. Let T (k) ≤ αk 2 + α for all k ∈ {0, 1, 2, . . . , n − 1}. Then T (ni ) ≤ αn2i + α, and consequently s 2 ni + sα + αn + α. T (n) ≤ α i=1
Obviously,
s
s 2 2 2 i=1 ni ≤ ( i=1 ni ) ≤ (n − 1) , hence T (n) ≤ α(n − 1)2 + (n − 1)α + αn + α = αn2 + α
and we are done. As we have mentioned in the introduction, the problem of determining the acyclic chromatic index of a given subcubic graph is NP-hard [3]. Note that our algorithm can serve as a base of a 4/3-approximation algorithm for the problem of finding an optimal acyclic edge-colouring of a given connected subcubic graph G. Indeed, if a (G) is 5 or 4, our algorithm finds an optimal acyclic edgecolouring; if a (G) = 3 then the algorithm finds an acyclic 4-edge-colouring, which is within the approximation factor 4/3; and if a (G) is 2 or 1 then the graph G must be a path and it is trivial to construct an optimal acyclic edgecolouring of G. Unless P = NP, there is no approximation algorithm with the approximation ratio better than 4/3.
References 1. Alon, N., Sudakov, B., Zaks, A.: Acyclic edge-colorings of graphs. J. Graph Theory 37, 157–167 (2001) 2. Alon, N., McDiarmid, C.J.H., Reed, B.A.: Acyclic coloring of graphs. Random Struct. Algorithms 2, 277–288 (1991) 3. Alon, N., Zaks, A.: Algorithmic aspects of acyclic edge colorings. Algorithmica 32, 611–614 (2002) 4. Basavaraju, M., Chandran, L.S.: Acyclic edge coloring of subcubic graphs. Discrete Math. (in press)
146
E. Máčajová and J. Mazák
5. Burstein, M.I.: Every 4-valent graph has an acyclic 5-coloring (in Russian). Soobšč. Akad. Nauk Gruzin. SSR 93, 21–24 (1979) (Georgian and English summaries) 6. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn., pp. 558–559. The MIT Press, Cambridge (2001) 7. Fiamčík, J.: Acyclic chromatic index of a graph with maximum valency three. Arch. Math. (Brno) 16, 81–88 (1980) 8. Fiamčík, J.: Acyclic chromatic index of subdivided graph. Arch. Math. (Brno) 20, 69–82 (1984) 9. Fiamčík, J.: The acyclic chromatic class of a graph (in russian). Math. Slovaca 28, 139–145 (1978) 10. Gebremedhin, A.H., Tarafdar, A., Manne, F., Pothen, A.: New acyclic and star coloring algorithms with application to computing Hessians. SIAM J. Sci. Comput. 29(3), 1042–1072 (2007) 11. Grünbaum, B.: Acyclic colorings of planar graphs. Israel Journal of Mathematics, 390–408 (1973) 12. Máčajová, E., Mazák, J.: Optimal acyclic edge-colouring of cubic graphs, technical report (2008), http://kedrigern.dcs.fmph.uniba.sk/reports/download.php?id=18 13. Molloy, M., Reed, B.: Further algorithmic aspects of the local lemma. In: Proceedings of the 30th Annual ACM Symposium on the Theory of Computing, May 1998, pp. 524–529 (May 1998) 14. Nešetřil, J., Wormald, N.C.: The acyclic edge chromatic number of a random dregular graph is d + 1. J. Graph Theory 49, 69–74 (2005) 15. Skulrattanakulchai, S.: Acyclic colouring of subcubic graphs. Information Processing Letters 92, 161–167 (2004)
Complexity of Total {k}-Domination and Related Problems Jing He and Hongyu Liang Institute for Interdisciplinary Information Sciences, Tsinghua University, Beijing, China {he-j08,lianghy08}@mails.tsinghua.edu.cn
Abstract. In this paper, we study the {k}-domination, total {k}-domination, {k}-domatic number, and total {k}-domatic number problems, from complexity and algorithmic points of view. Let k ≥ 1 be a fixed integer and > 0 be any constant. Under the hardness assumption of N P ⊆ DT IM E(nO(log log n) ), we obtain the following results. 1. The total {k}-domination problem is N P -complete even on bipartite graphs. 2. The total {k}-domination problem has a polynomial time ln n approximation algorithm, but cannot be approximated within ( k1 − ) ln n in polynomial time. 3. The total {k}-domatic number problem has a polynomial time ( k1 + ) ln n approximation algorithm, but does not have any polynomial time ( k1 − ) ln n approximation algorithm. All our results hold also for the non-total variants of the problems.
1
Introduction
Domination is a central concept in graph theory and has been thoroughly studied in numerous scenarios. The corresponding optimization problem, namely the dominating set problem, is also very important in various applications such as ad-hoc networks. In this paper, we study several generalizations and variations of the traditional dominating set problem, namely, the {k}-domination, the total {k}-domination, the {k}-domatic number, and the total {k}-domatic number problems. The first two problems are special cases of Y -domination introduced in [2], and the last two are their corresponding partition variants. While previous work mainly focuses on graph-theoretic properties of these concepts, we emphasize on algorithmic and complexity aspects, obtaining N P -completeness results and tight approximation thresholds for the problems. 1.1
Preliminaries
In this paper we only consider simple undirected graphs. We refer to [4] for standard notations and terminologies not given here. Let G = (V, E) be a graph with
This work was supported in part by the National Basic Research Program of China Grant 2007CB807900, 2007CB807901, the National Natural Science Foundation of China Grant 61033001, 61061130540, 61073174.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 147–155, 2011. c Springer-Verlag Berlin Heidelberg 2011
148
J. He and H. Liang
|V | = n. We say the order of G is n. For each v ∈ V , let N (v) = {u | {u, v} ∈ E} denote the neighborhood of v, and N [v] = N (v) ∪ {v}. Let d(v) = |N (v)| denote the degree of v, and δ(G) = minv∈V d(v) be the minimum degree of any vertex in G. A set of vertices S ⊆ V is called a dominating set of G if every vertex in V either is contained in S or has a neighbor in S; that is, N [v] ∩ S = ∅ for all v ∈ V . S is called a total dominating set of G if every vertex in V has a neighbor in S; that is, N (v) ∩ S = ∅ for all v ∈ V [6]. Notice that a graph with isolated vertices does not have any total dominating set. Hereafter we may always assume that the considered graph is connected, thus a total dominating set of a graph always exists. Let γ(G) (resp. γt (G)) denote the minimum size of any dominating set (resp. total dominating set) of G. γ(G) (resp. γt (G)) is also called the domination number (resp. total domination number ) of G. The problem of computing the domination number of a given graph is N P -complete [11], and has a tight approximation threshold around ln n modulo the hardness assumption of N P ⊆ DT IM E(nO(log log n) ) [8]. Similar results also hold for the total domination number. See [12,13] for extensive studies and surveys onrelated topics. For a function f : V → R, the weight of f is ω(f ) := v∈V f (v), and the weight of any subset S ⊆ V is f (S) := v∈S f (v). Let k be a positive integer. A function f : V → {0, 1, . . . , k} is called a {k}-dominating function [7] (resp. total {k}-dominating function [15]) of G if for each v ∈ V , f (N [v]) ≥ k (resp. f (N (v)) ≥ k). The {k}-domination number γ {k} (G) (resp. total {k}-domination {k} number γt (G)) of G is the minimum weight of any {k}-dominating function (resp. total {k}-dominating function) of G. It is clear that γ {1} (G) = γ(G) {1} and γt (G) = γt (G). The {k}-domination problem (resp. total {k}-domination problem is to find a {k}-dominating function (resp. total {k}-dominating function) of G of minimum weight. The {k}-domination problem is proved to be N P -complete for every fixed k [10], and remains N P -complete even on bipartite graphs when k ≤ 3 ([14], Theorem 2.15; see also Table 1.4 on page 38). In this paper we will give the first N P -completeness result for the total {k}-domination problem, and generalize the hardness results for {k}-domination on bipartite graphs to all values of k. A set {f1 , f2 , . . . , fd } of {k}-dominating functions (resp. total {k}-dominating functions) of G is called a {k}-dominating family (resp. total {k}-dominating d family) of G if i=1 fi (v) ≤ k for all v ∈ V . The {k}-domatic number (resp. total {k} {k}-domatic number ) of G, denoted by d{k} (G) (resp. dt (G)), is the maximum number of functions in a {k}-dominating family (resp. total {k}-dominating family) of G. These concepts were defined in [16,17], and has been further explored in [1,5]. The {k}-domatic number problem (resp. total {k}-domatic number problem) is to find a {k}-dominating family (resp. total {k}-dominating family) of G with maximum number of functions. When k = 1, the {k}-domatic number is conventionally called the domatic number, and can be alternatively defined as follows: A domatic partition (resp. total domatic partition) of G is a partition of V into disjoint sets V1 , V2 , . . . , Vt of V such that for each i ∈ [t], Vi is a dominating set (resp. total dominating set) of G; t is called the size of this partition. The domatic number d(G) (resp. total domatic number dt (G)) of G is the
Complexity of Total {k}-Domination and Related Problems
149
maximum size of a domatic partition (resp. total domatic partition) of G. Clearly {1} d(G) = d{1} (G) and dt (G) = dt (G). Feige et al. [9] proved that the domatic number can be approximated within ln n in polynomial time, but cannot be approximated to (1−) ln n in polynomial time unless N P ⊆ DT IM E(nO(log log n) ). In this paper we will generalize this threshold behavior to (both total and nontotal) {k}-domatic number problems. We list some easy observations regarding these graph parameters. Observation 1. Let k ≥ 1 be an integer. Then, {k}
– γt (G) ≤ γt (G) ≤ kγt (G); {k} – dt (G) ≤ dt (G) ≤ δ(G); {k} k|V | | – dt (G) ≤ {k} ≤ γk|V . t (G) γt
(G)
Moreoever, all the inequalities hold similarly for the non-total counterparts of the concepts (for the second one we need to replace δ(G) with δ(G) + 1). 1.2
Summary of Our Contributions
In Section 2, we prove that the total {k}-domination problem is N P -complete for every fixed k, even on bipartite graphs. To our knowledge, this is the first N P -completeness result for the problem. We also prove that the {k}-domination problem remains N P -complete on bipartite graphs for every fixed k, extending the result in [14] which only works for k ≤ 3. We then study the problem from the approximation point of view, and obtain asymptotically tight approximation ratio for every fixed k. In Section 3, we derive tight approximability results for the total {k}-domatic number problem. More precisely, we show that this problem admits a polynomialtime ( k1 + ) ln n approximation algorithm for every fixed > 0, but does not have any polynomial-time ( k1 − ) ln n approximation algorithm unless N P ⊆ DT IM E (nO(log log n) ). The results easily apply to the {k}-domatic number problem.
2
{k}-Domination and Total {k}-Domination
In this section we study the {k}-domination and the total {k}-domination problems from both exact optimization and approximation aspects. 2.1
N P -Completeness Results
Theorem 1. For every fixed integer k > 0, the {k}-domination problem is N P complete even on bipartite graphs. Proof. Let k be a fixed integer. It is proved in [10] that the {k}-domination problem in general graphs is N P -complete. Let G = (V, E) be an input graph to the {k}-domination problem. We construct a bipartite graph H = (X, Y, E )
150
J. He and H. Liang
as follows. Let X = {xv | v ∈ V } ∪ {x}, and Y = {yv | v ∈ V } ∪ {y}. Let E = {{xv , yu } | u ∈ N [v]} ∪ {{y, x } | x ∈ X}. We will show that γ {k} (H) = γ {k} (G) + k, thus proving Theorem 1 since this forms a Karp reduction. On one hand, let g be a {k}-dominating function of G with weight γ {k} (G). We construct a function h : X ∪ Y → {0, 1, . . . , k} as follows. For every v ∈ V let h(xv ) = g(v) and h(yv ) = 0. Let h(x) = 0 and h(y) = k. It is easy to verify that h is indeed a {k}-dominating function of H, and ω(h) = ω(g) + k. Hence, γ {k} (H) ≤ γ {k} (G) + k. On the other hand, let h be a {k}-dominating function of H with weight γ {k} (H). We modify h in the following way to get a finer form, which will help us extract a corresponding weight function of G. Since x only neighbors y in graph H, we have h(x) + h(y) ≥ k. We may assume that h(x) = 0 and h(y) = k, since otherwise we can change h in this way to get a {k}-dominating function of H with no larger weight. Now every vertex in X is {k}-dominated by y. As long as there exists yv ∈ Y \ {y} such that h(yv ) > 0, we can set h(yv ) ← 0 and h(xv ) ← min{h(xv ) + h(yv ), k} to get a new {k}-dominating function of H with no larger weight. (This is because reducing the weight of yv can only affect the vertices in X \ {x}, and every vertex in X \ {x} has already been {k}-dominated by y.) Thus, we may assume that h(yv ) = 0 for all v ∈ V . Now we construct a function g : V → {0, 1, . . . , k} by letting g(v) = h(xv ) for all v ∈ V . It is easy to check that g is a {k}-dominating function of G with weight ω(h) − k, implying that γ {k} (H) ≥ γ {k} (G) + k. Therefore, we have shown that γ {k} (H) = γ {k} (G) + k, completing the proof of Theorem 1. Theorem 1 generalizes the results in [14] for k ≤ 3. We next consider the total variant of the problem. Theorem 2. For every fixed integer k > 0, the total {k}-domination problem is N P -complete even on bipartite graphs. Proof. We perform a similar reduction as used in the proof of Theorem 1. Let k be a fixed integer and G = (V, E) be an input graph to the {k}-domination problem. Construct a bipartite graph H = (X, Y, E ) by making X = {xv | v ∈ V }∪{x}, Y = {yv | v ∈ V }∪{y}, and E = {{xv , yu } | u ∈ N (v)}∪{{y, x } | x ∈ X}. (Note that we do not need edges of the form (xv , yv ) any more.) It suffices {k} to prove that γt (H) = γ {k} (G) + k. Let g be a {k}-dominating function of G with weight γ {k} (G). We obtain a function h : X ∪ Y → {0, 1, . . . , k} as follows. Let h(xv ) = g(v) and h(yv ) = 0 for all v ∈ V . Let h(x) = 0 and h(y) = k. It is easy to verify that h is a total {k}-dominating function of H with weight ω(g) + k, which indicates that {k} γt (H) ≤ γ {k} (G) + k. {k} Now assume h is a total {k}-dominating function of H with weight γt (H). We must have h(y) = k since y is the only neighbor of x. We show that h(x) = 0. Consider an arbitrary vertex yv , v ∈ V . By the definition of total {k}-domination, h(N (yv )) = h({xu | u ∈ N (v)}) ≥ k. This in particular implies h(N (y)) ≥ k, since y neighbors all vertices in X. Hence reducing the weight of
Complexity of Total {k}-Domination and Related Problems
151
x to 0 does not destroy the property of total {k}-domination, contradicting the optimality of h. Thus, we have h(x) = 0. As long as there exists yv ∈ Y \ {y} such that h(yv ) > 0, we can set h(yv ) ← 0 and h(xv ) ← min{h(xv ) + h(yv ), k} to get a new total {k}-dominating function of H with no larger weight, since every vertex in X has already been total {k}dominated by y. Thus, we may assume that h(yv ) = 0 for all v ∈ V . Now we construct a function g : V → {0, 1, . . . , k} by letting g(v) = h(xv ) for all v ∈ V . It is easy to check that g is a total {k}-dominating function of G with weight {k} ω(h)−k, which gives γt (H) ≥ γ {k} (G)+k. Combined with the previous result, {k} we have γt (H) = γ {k} (G) + k, completing the proof of Theorem 2. 2.2
Approximation Results
This subsection is devoted to the approximability of the two problems. Theorem 3. The {k}-domination problem and the total {k}-domination problem can both be approximated within ln n in polynomial time, where n is the order of the input graph. Proof. We reduce the {k}-domination problem to the set k-multicover problem, which is a generalization of the traditional set cover problem in which every element of the universe needs to be covered at least k times by the chosen sets. By [18] (see also [3]) the set k-multicover problem has a polynomial time ln napproximation algorithm, n being the number of elements in the universe. Let G = (V, E) be an input graph to the {k}-domination problem. We construct a set k-multicover instance (U, S) as follows. Let the ground set be U = {uv | v ∈ V }. For every v ∈ V , include in S a set Sv = {uv | v ∈ N [v]}. It is easy to see that every {k}-dominating function of G with weight w naturally induces a set k-multicover of U of cardinality w, and vice versa. Thus, this gives an approximation preserving reduction from the {k}-domination problem to the set k-multicover problem, proving that the former is ln n-approximable in polynomial time. The proof for the total {k}-domination problem is very similar, with the only exception that, in the construction of Sv , we let Sv = {uv | v ∈ N (v)} (instead of using N [v]). Theorem 4. For any fixed integer k > 0 and any constant > 0, there is no polynomial time ( k1 − ) ln n approximation algorithm for the {k}-domination problem, unless N P ⊆ DT IM E(nO(log log n) ). The inapproximability result also holds for the total {k}-domination problem. Proof. By Observation 1, we have γ(G) ≤ γ {k} (G) ≤ kγ(G). Moreover, any {k}dominating function of G of weight w trivially induces a dominating set of G of size at most w (just take those vertices with positive weights). Thus, if wehave a polynomial time ( k1 − ) ln n approximation algorithm for {k}-domination, we can also obtain in polynomial time a dominating set of G whose size is at most ( k1 − ) ln n · kγ(G) = (1 − k) ln n · γ(G). For fixed k, > 0, this implies N P ⊆ DT IM E(nO(log log n) ) by [8]. The proof for total {k}-domination is totally similar.
152
3
J. He and H. Liang
Total {k}-Domatic Number
In this section we derive a tight approximation threshold for the total {k}domatic number problem, modulo the assumption that N P does not have slightly super-polynomial algorithms. Theorem 5. Let k ≥ 1 be a fixed integer and > 0 be an arbitrarily small constant. Given any graph G of order n with n sufficiently large, we can find in polynomial time a total {k}-dominating family of G of size at least (k − )δ(G)/ ln n. Proof. Suppose G = (V, E) is the input graph. Let δ = δ(G) and l = (k − )δ/ ln n. We assume that δ = ω(1), since otherwise the statement is trivial. Denote [m] = {1, 2, . . . , m} for any integer m. For every vertex v ∈ V , associate with it a k-tuple (v1 , . . . , vk ) ∈ [l]k uniformly at random; that is, each coordinate vi is chosen to be j with probability 1/l, for all i ∈ [k] and j ∈ [l]. We can alternatively consider this process as coloring each vertex with k colors, each of which is chosen uniformly at random from a set of l colors {1, 2, . . . , l}. Every color j naturally induces a function fj : V → {0, 1, . . . , k}: just let fj (v) be the number of j’s in the k-tuple associated with vertex v. We also have that j∈[l] fj (v) = k for all v ∈ V . For v ∈ V and j ∈ [l], let E(v, j) denote the event that at most k − 1 tuplecoordinates, among all the k · d(v) coordinates of v’s neighbors, are j. If there is no v ∈ V such that E(v, j) holds, then every vertex v “sees” color j among its neighbors for at least k times, and thus fj is a total {k}-dominating function of G. We will bound the probability that E(v, j) happens in order to establish a large (expected) number of total {k}-dominating functions among {fj | j ∈ [l]}. For all v ∈ V and j ∈ [l], we have k·d(v)−i k−1 k · d(v) 1 i 1 P r[E(v, j)] = 1− i l l i=0 k·d(v)−(k−1) k−1 k−1 k · d(v) 1 1 ≤ 1− l l i i=0 k−1 k · d(v) − (k − 1) 1 ≤ exp − (k · d(v))k−1 l l t n (using 1 + x ≤ ex and ≤ nt ) i i=0 k−1 k · d(v) − (k − 1) k · d(v) = exp − . (k − )δ/ ln n (k − )δ/ ln n k−1 k·d(v)−(k−1) k · d(v) ln n = n− (k−)δ (k − )δ k−1 k · δ ln n − k·δ−(k−1) (k−)δ ≤n (k − )δ
Complexity of Total {k}-Domination and Related Problems
153
(using d(v) ≥ δ and n is sufficiently large) k−1
≤ n−(1+ ) ((1 + ) ln n)
,
where > 0 is some constant depending on k and . (In the last step we also used that δ = ω(1).) By the linearity of expectations, the expected number of pairs (v, j) such that k−1 E(v, j) holds is at most nl · P r[E(v, j)] ≤ l · n− ((1 + ) ln n) = o(l), since k is a fixed integer. This implies that at most o(l) functions induced by the l colors are not total {k}-dominating functions of G. Therefore, the expected number of total {k}-dominating functions among {fj | j ∈ [l]} is at least (1 − o(1))l = (k − )δ/ ln n, where > 0 is some constant such that → 0 as → 0. This {k} also proves that dt (G) ≥ (k − )δ(G)/ ln n for any fixed > 0 and sufficiently large n. To finish the proof of Theorem 5, we need to show that this “coloring” process can be efficiently derandomized. This can be done by the method of conditional probabilities: We assign colors to the kn ccordinates one by one. Each time when a new coordinate needs to be decided, we try all the l possibilities. For each of the possibility, we can compute P r[E(v, j)] conditioned on the current partial coloring for all v ∈ V and j ∈ [l] using standard combinatorial methods in polynomial time (noting that k is a fixed integer). We then choose a color j so as to minimize v∈V,j∈[l] P r[E(v, j)]. After all kn colors have been given, we check through the l functions fj , j ∈ [l] to find out which are total {k}dominating functions. By our method of assigning the colors, the number of total {k}-dominating functions is at least the expected number that has been obtained before, i.e., (k − )δ/ ln n. This completes the whole proof. Theorem 5 directly yields the following statement. Corollary 1. Let k ≥ 1 be a fixed integer and > 0 an arbitrary constant. There is a polynomial time ( k1 + ) ln n approximation algorithm for the total {k}-domatic number problem. {k}
Proof. Use Theorem 5 and the fact that dt
(G) ≤ δ(G) for any graph G.
We next show that this approximation ratio is nearly optimal. We need the following lemma which is proved in [9]. Lemma 1 (Propositions 10 and 13 in [9]). Fix > 0 and assume N P ⊆ DT IM E(nO(log log n) ). Given a graph G of order n, we cannot distinguish in polynomial time between the following two cases: 1. the size of any dominating set of G is at least r; 2. the domatic number of G is at least q, where r, q are some known parameters (dependent on the input) satisfying that q = o(|V |) and qr ≥ (1 − )|V | ln |V |.
154
J. He and H. Liang
Theorem 6. For every fixed integer k > 0 and constant > 0, if there is a polynomial-time ( k1 − ) ln n approximation algorithm for the total {k}-domatic number problem, then N P ⊆ DT IM E(nO(log log n) ). Proof. Let G be a graph of order n, and q, r be the parameters appeared in Lemma 1. We construct another graph G = (V , E ) as follows. Let V = W ∪ X ∪ Y , where X = {xv | v ∈ V }, Y = {yv | v ∈ V }, and W = {w1 , w2 , . . . , wq }. Let E = {{xu, yv } | {u, v} ∈ E} ∪ {{wi , xv } | i ∈ [q], v ∈ V }. This completes the construction of G . Consider the two cases stated in Lemma 1. According to our construction, any vertex yv neighbors precisely those vertices of the form xu with (u, v) ∈ E. Therefore, if the size of any dominating set of G is at least r, then the size of any total dominating set of G is at least r. On the other hand, if the domatic number of G is at least q, we claim that G has a total domatic partition of size at least q. Suppose S1 , . . . , Sq is a domatic partition of G. Consider the following (partial) partition of G : For every i ∈ [q], let Si = {xv | v ∈ Si } ∪ {wi }. It is easy to see that every Si forms a total dominating set of G . Thus, the total domatic number of G is at least q. By Lemma 1, assuming N P ⊆ DT IM E(nO(log log n) ), we can not distinguish between the following two cases in polynomial time: (1) the size of any total dominating set of G is at least r, and (2) the total domatic number of G is at {k} least q. By Observation 1, in the former case we have dt (G) ≤ k(|V | + q)/r = {k} (1 + o(1))k|V |/r since q = o(|V |), and in the latter case we have dt (G) ≥ dt (G) ≥ q. Therefore, it is hard to approximate the total {k}-domatic number q to a factor of (1+o(1))k|V = (1−o(1))qr ≥ ( k1 − 2) ln |V | when |V | is sufficiently |/r k|V | large, since qr ≥ (1 − )|V | ln |V |. This completes the proof of Theorem 6. Corollary 2. For every fixed integer k > 0, if there is a polynomial time algorithm that computes the total {k}-domatic number of a given graph, then N P ⊆ DT IM E(nO(log log n) ). Finally, we note that the {k}-domatic number problem also has the approximation threshold of k1 ln n. The upper bound is easy since every total {k}dominating family of G is also a {k}-dominating family of G, and the lower bound can be derived via a simpler reduction than that used in the proof of Theorem 6, using V = X ∪ Y as the new graph and ignoring the W part.
Acknowledgements The authors would like to thank the anonymous referees for their helpful suggestions and comments on improving the presentation of this paper.
References 1. Aram, H., Sheikholeslami, S.M.: On the total {k}-domination and total {k}domatic number of graphs. Bull. Malays. Math. Sci. Soc. (to appear) 2. Bange, D.W., Barkauskas, A.E., Host, L.H., Slater, P.J.: Generalized domination and efficient domination in graphs. Discrete Math. 159, 1–11 (1996)
Complexity of Total {k}-Domination and Related Problems
155
3. Berman, P., DasGupta, B., Sontag, E.: Randomized approximation algorithms for set multicover problems with applications to reverse engineering of protein and gene networks. Discrete Appl. Math. 155, 733–749 (2007) 4. Bollob´ as, B.: Modern graph theory. Graduate Texts in Mathematics, vol. 184. Springer, Berlin (1998) 5. Chen, J., Hou, X., Li, N.: The total {k}-domatic number of wheels and complete graphs. J. Comb. Optim. (to appear) 6. Cockayne, E.J., Dawes, R.M., Hedetniemi, S.T.: Total domination in graphs. Networks 10, 211–219 (1980) 7. Domke, G.S., Hedetniemi, S.T., Laskar, R.C., Fricke, G.: Relationships between integer and fractional parameters of graphs. In: Proceedings of the Sixth Quadrennial Conference on the Theory and Applications of Graphs, Graph Theory, Combinatorics, and Applications, Kalamazoo, MI, vol. 2, pp. 371–387 (1991) 8. Feige, U.: A threshold of ln n for aproximating set cover. J. ACM 45(4), 634–652 (1998) 9. Feige, U., Halld´ orsson, M.M., Kortsarz, G., Srinivasan, A.: Approximating the domatic number. SIAM J. Comput. 32(1), 172–195 (2002) 10. Gairing, M., Hedetniemi, S.T., Kristiansen, P., McRae, A.A.: Self-stabilizing algorithms for {k}-domination. In: Huang, S.-T., Herman, T. (eds.) SSS 2003. LNCS, vol. 2704, pp. 49–60. Springer, Heidelberg (2003) 11. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman, New York (1979) 12. Haynes, T.W., Hedetniemi, S.T., Slater, P.J.: Domination in Graphs: Advanced Topics. Marcel Dekker, New York (1998) 13. Haynes, T.W., Hedetniemi, S.T., Slater, P.J.: Fundamentals of Domination in Graphs. Marcel Dekker, New York (1998) 14. Lee, C.M.: Labelled Domination and Its Variants. PhD thesis, National Chung Cheng University (2006) 15. Li, N., Hou, X.: On the total {k}-domination number of Cartesian products of graphs. J. Comb. Optim. 18, 173–178 (2009) 16. Sheikholeslami, S.M., Volkmann, L.: The {k}-domatic number of a graph. Aequationes Math. (to appear) 17. Sheikholeslami, S.M., Volkmann, L.: The total {k}-domatic number of a graph. J. Comb. Optim. (to appear) 18. Vazirani, V.V.: Approximation Algorithms. Springer, Heidelberg (2004)
The Min-Power Multicast Problems in Wireless Ad Hoc Networks: A Parameterized View Weizhong Luo1,2 , Jianxin Wang1 , Qilong Feng1 , and Jiong Guo3 1
School of Information Science and Engineering, Central South University, Changsha 410083, P.R. China
[email protected] 2 Hunan Financial & Economic University, Changsha 410205, P.R. China 3 Universit¨ at des Saarlandes, Campus E 1.7, D-66123 Saarbr¨ ucken, Germany
[email protected]
Abstract. Power assignment in wireless ad hoc networks can be seen as a family of problems in which the task is to find in a given power requirement network a minimum power communication subnetwork that satisfies a given connectivity constraint. These problems have been extensively studied from the viewpoint of approximation, heuristic, linear programming, etc. In this paper, we add a new facet by initiating a systematic parameterized complexity study of three types of power assignment problems related to multicast: Min-power Single-source hMulticast, Min-power Strongly Connected h-Multicast and Min-power Multi-source h-Multicast. We investigate their parameterized complexities with respect to the number of terminals and the number of senders. We show that Min-power Single-source h-Multicast is fixed-parameter tractable with respect to the number of terminals and achieve several parameterized hardness results.
1
Introduction
Power assignment is a central issue in wireless ad hoc networks. The main goal of power assignment is to assign transmission power to the wireless nodes so as to guarantee communication between the nodes, while minimizing the overall power consumption of the network. Depending on the communication requirement such as broadcast, multicast, and strong connectivity, power assignment problems come in many flavors, most of them have been proved to be NP-hard. Thus, tremendous researches on power assignment have been conducted from the viewpoints of approximation, heuristic, linear programming, etc. By way of contrast, the study of the parameterized complexity of these problems is much less
This work is supported by the National Natural Science Foundation of China under Grant (61073036,60873265), the Doctoral Discipline Foundation of Higher Education Institution of China under Grant (20090162110056), and the DFG Excellence Cluster “Multimodal Computing and Interaction (MMCI)”.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 156–167, 2011. c Springer-Verlag Berlin Heidelberg 2011
The Min-Power Multicast Problems in Wireless Ad Hoc Networks
157
developed. In this work, we investigate the parameterized complexity of three types of power assignment problems. We first introduce the considered problems. Problem statements. The wireless ad hoc network has no pre-installed infrastructure and is formed by a collection of wireless nodes equipped with omnidirectional antennas for sending and receiving signals. Power is one of the most critical resources and energy efficiency is an important design consideration for these networks. To save energy, each node can adjust its power levels, based on the distance to the receivers and the background noise. Formally, let M = (N, A, c) be a power requirement network, where N represents the set of wireless nodes with |N | = n, A the set of communication links between the nodes and a power requirement function c : A → R+ . Each directed link [xi , xj ] ∈ A has link cost c([xi , xj ]) which is the minimum power that is necessary to sustain link [xi , xj ]. Each node xi ∈ N can choose to transmit at different power levels. Let Pxi be the set of power levels at which node xi can transmit (|Pxi | can be arbitrarily large). Let P = xi ∈N Pxi . Given a power assignment function p : N → P , a directed link [xi , xj ] is supported by p if p(xi ) ≥ c([xi , xj ]). The communication subnetwork H of M consists of all supported links. Power Assignment problems Input: A power requirement network M = (N, A, c) with |N |=n, a famconstraint Q. ily of power level sets Px1 , Px2 , ..., Pxn and a connectivity Task: Find a power assignment p : N → P (P = P ) of the minx i x ∈N i imum total power cost xi ∈N p(xi ) such that the communication subnetwork H satisfies the given connectivity constraint Q and p(xi ) ∈ Pxi for every node xi ∈ N . Multicast is an efficient mechanism for one to many communication. In this paper, we focus on the following connectivity constraints Q related to multicast for the communication subnetwork H: (1) Bounded hop single source multicast (D, r, h) where D ⊆ N , r ∈ N , and h is a non-negative integer: There is a directed path in H from r to each node v ∈ D of length at most h. (2) Bounded hop strongly connected multicast (D, h) where D ⊆ N and h is a non-negative integer: For every s, t ∈ D there is a directed path in H from s to t of length at most h. (3) Bounded hop multi-source multicast (D, S, h) where D ⊆ N , S ⊆ N , and h is a non-negative integer: For each r ∈ S, there is a directed path in H from r to each node v ∈ D of length at most h. We call the nodes in D terminals, a node v in H sender if the out-degree of v is at least one, and h the hop of H. Specifying the connectivity constraint, we obtain the following problems: Minpower Single-source h-Multicast, Min-power Strongly-connected h-Multicast, and Min-power Multi-source h-Multicast. Known Results. The above three multicast-related power assignment problems are NP-hard even under the constraint that the transmission power at each node
158
W. Luo et al.
is fixed or finitely adjustable in a discrete fashion [3,4,12]. The approximability of power assignment problems has received considerable attention. Liang [11] proposed an approximation algorithm with ratio 4lnk (k is the number of terminals) for Min-power Single-source Multicast (hop is unlimited) where the transmission power at each node has limited adjustable discrete power levels. In [12], the authors proposed several approximation algorithms for Min-power Multi-source Multicast where the transmission power is either fixed or adjustable. Calinescu et al. [4] gave an approximation algorithm with ratio 3 + 2 ln(n − 1) for the power assignment with the strongly connectivity constraint. In particular, many papers have studied approximation algorithms for power assignment problems where hops or senders are bounded [1,5,9,10,13]. See [2] for a survey on numerous approximation results for power assignment problems. Our works. We initialize a systematic study of the parameterized complexity of the above three power assignment problems. We assume that each node can choose to transmit messages from a limited number of discrete power levels, i.e., |Pxi | is limited for any node xi ∈ N . Two natural parameters are considered: (1) the parameter k1 that denotes the number of terminals to be connected, (2) an upper-bound k2 on the number of the senders in the solution H. We prove that Min-power Single-source h-Multicast is fixed-parameter tractable with respect to k1 , but is W[2]-hard with respect to k2 . For Min-power Strongly-connected h-Multicast, we obtain W[1]-hardness with respect to the combined parameter (k1 , k2 ). Since Min-power Multi-source h-Multicast is a generation of Min-power Single-source h-Multicast, Min-power Multi-source h-Multicast is also W[2]-hard with respect to k2 . The parameterized complexity of Min-power Multi-source h-Multicast with respect to k1 remains open. Due to lack of space, some proofs are deferred to the full paper.
2
Graph Model and Related Definitions
For simplicity of exposition, based on the wireless network model, we give an equivalent graph model of the power assignment problems. Let G = (V, E) be a directed graph with weighting function weight: E → R+ and let e = [u, v] be a directed edge in G. We say that the edge e goes out from vertex u and comes into the vertex v. The edge e is called an outgoing edge of the vertex u, and an incoming edge of the vertex v. Moreover, u is an in-neighbor of v and v is an out-neighbor of u. For two vertices v, w ∈ V , let d[v, w] be a directed simple path from v to w. The length of a simple path is the number of edges in the path. For a vertex w ∈ V , let out-degree(w) be the number of outgoing edges of w, out(w) be the set of outgoing edges of w and out-weight(w) = {weight(e)|e ∈ out(w)}. Similarly, for a vertex w ∈ V , let in-degree(w) be the number of incoming edges of w, in(w) be the set of incoming edges of w. For a vertex v ∈ V , let Nout (v)= {w|[v, w] ∈ E}. Given a subgraph H of G, let N L(H)= {w|w ∈ V (H) and outdegree(w)≥ 1}, and the vertices in N L(H) are called senders. For w ∈ V , let weightmax (w)=max{weight(e)|e ∈ out(w)}. For a subgraph H of G, we define costw (H) = u∈N L(H) weightmax (u) and cost(H) = e∈E(H) weight(e).
The Min-Power Multicast Problems in Wireless Ad Hoc Networks
159
The three power assignment problems discussed above are formally defined as follows. Min-power Single-source h-Multicast Instance: An edge-weighted directed graph G = (V, E), a set of terminal vertices D ⊆ V , a root r ∈ V , an integer h and a real number q. Question: Is there a subgraph H of G such that for every v ∈ D there is a directed path in H from r to v of length at most h and costw (H) ≤ q? Min-power Strongly Connected h-Multicast Instance: An edge-weighted directed graph G = (V, E), a set of terminal vertices D ⊆ V , an integer h and a real number q. Question: Is there a subgraph H of G such that for every s, t ∈ D there is a directed path in H from s to t of length at most h and costw (H) ≤ q? Min-power Multi-source h-Multicast Instance: An edge-weighted directed graph G = (V, E), a set of terminal vertices D ⊆ V , a set of source vertices S ⊆ V , an integer h and a real number q. Question: If there a subgraph H of G such that for any t ∈ D, s ∈ S there is a directed path in H from s to t of length at most h and costw (H) ≤ q? For two vertices u, v ∈ V with [u, v] ∈ E, let xi , xj be the corresponding nodes in the wireless network model. The weight assigned to [u, v] is the minimum power level p0 supporting transmission from xi to xj , i.e., p0 = min{p | p ∈ Pxi , p ≥ c([xi , xj ])}.
3
Min-power Single-source h-Multicast is in FPT
In this section we propose a fixed-parameter algorithm for the Min-power Singlesource h-Multicast problem. This algorithm is based on an algorithm for the so-called Hop-bounded Directed Steiner Subgraph problem, which is defined as follows. For a directed graph G = (V, E) with vertices colored by white or black and a b w (v)= {u|[v, u] ∈ E, u is a black vertex} and Nout (v)= vertex v ∈ V (G), let Nout {u|[v, u] ∈ E, u is a white vertex}. For two vertices u, v ∈ V , let E(d[u, v]) denote the set of edges of a directed path d[u, v] from u to v and let Eb (d[u, v]) = {e|e = [x, y] ∈ E(d[u, v]), x or y is black vertex}. The pure length of path d[u, v] is the number of edges in Eb (d[u, v]). Hop-bounded Directed Steiner Subgraph Input: An edge-weighted directed graph G = (V, E) with vertices colored black or white, a set of terminals D ⊆ V , a root r ∈ V , an integer h and a real number q. Question: Is there a subgraph H of G such that for every v ∈ D there is a directed path in H from r to v of pure length at most h and cost(H) ≤ q?
160
3.1
W. Luo et al.
Reduction to Hop-bounded Directed Steiner Subgraph
Given an instance (G, D, r, h, q) of Min-power Single-source h-Multicast, an instance (G , D , r , 2h, q) of Hop-bounded Directed Steiner Subgraph is constructed as follows. Step 1. For a vertex xi ∈ V (G), let Li =|out-weight(xi )| and out-weight(xi ) = {c1 , c2 , ..., cLi }. Suppose c1 < c2 < ... < cLi . Construct a graph Gi = (Vi , Ei ) for every xi ∈ V (G). Herein, Vi = {bi , wi,1 , wi,2 , ..., wi,Li }, Ei = Ei ∪ Ei , Ei = {[bi , wi,j ] | 1 ≤ j ≤ Li } and Ei = {[wi,j , wi,j−1 ] | 2 ≤ j ≤ Li }. The weight assigned to [bi , wi,j ] is cj . Each edge in Ei is assigned weight zero. See Figure 1 for an illustration of Gi . n n Step 2. Construct G = (V , E ) with V = i=1 Vi and E = i=1 Ei ∪ Ec , where Ec is defined as follows: Given two vertices xi and xj in G with i = j, if [xi , xj ] ∈ E(G) and weight([xi , xj ]) = cl , then add [wi,l , bj ] to Ec . The weight assigned to [wi,l , bj ] is zero. n Step 3. For G = (V , E ), color all vertices in i=1 {bi } by black, and color all other vertices by white. The set D is set equal to D and r = r. The above translation is called the main translation. Note that our construction is different with that in [11]. It is easy to see that graph G has the following properties. 1. For any two black vertices v, w ∈ V , there is no edge between v and w. For any two white vertices v, w ∈ V , if [v, w] ∈ E , then weight([v, w])= 0. For any black vertex v ∈ V and any white vertex w ∈ V , if [v, w] ∈ E , then weight([v, w]) = 0; if [w, v] ∈ E , then weight([w, v])=0. 2. For any black vertex v ∈ V , let v1 , v2 ∈ Nout (v). Suppose weight([v, v1 ]) > weight([v, v2 ]). Then for any vertex u ∈ V , if v2 can reach u, then v1 can also reach u.
L/L
Fig. 1. The main translation
Lemma 1. Given an instance (G, D, r, h, q) of Min-power Single-source hMulticast, let (G , D , r , 2h, q) be the instance of Hop-bounded Directed Steiner Subgraph obtained by applying the main translation on (G, D, r, h, q). Then (G, D, r, h, q) is a yes-instance of Min-power Single-source h-Multicast if and
The Min-Power Multicast Problems in Wireless Ad Hoc Networks
161
only if (G , D , r , 2h, q) is a yes-instance of Hop-bounded Directed Steiner Subgraph. Proof. ⇒: Suppose (G, D, r, h, q) is a yes-instance of Min-power Single-source hMulticast. Let H be a subgraph of G such that in H for every vertex t ∈ D there is a directed path from r to t of length at most h and costw (H) ≤ q. Without loss of generality, we assume that H is a directed acyclic graph and in-degree(r)= 0. In the following, we show how to obtain a solution for (G , D , r , 2h, q) based on H. We first apply the following translations on H. Translation 1. Delete all vertices v from H that are not from D and have no outgoing edge in H. Translation 2. For all vertices v ∈ V (H) with out-degree(v) >0 and indegree(v) >1 in H, delete all edges in in(v) \ e from H, where e ∈ in(v) and e is in some shortest directed path from r to v. Let T be the resulting graph by applying Translations 1-2 to H. Obviously, for every vertex t ∈ D there is directed path in T from r to t of length at most h and costw (T )≤costw (H) ≤ q. Furthermore, T has the following properties: for any vertex v ∈ V (T ) \ r, in-degree(v) =1 and if out-degree(v)=0 then v ∈ D. Therefore, T is a directed tree rooted at r and spanning all the vertices in D with costw (T )≤ q. We then apply the main translation to T . Let T be the resulting graph. Finally we apply Translation 3 to T . Translation 3. For all black vertices v ∈ V (T ) with out-degree(v) >1 in T , delete all edges in out(v)\e from T , where e is the edge in out(v) with weight(e) = weightmax (v). Let T be the resulting graph by applying Translation 3 to T . It is easy to see that cost(T )= costw (T )≤ q and T is a subgraph of G . Furthermore, for any vertex v ∈ D , there is a directed path in T from r to v of pure length at most 2h. Therefore, T is a solution for the instance (G , D , r , 2h, q) of Hop-bounded Directed Steiner Subgraph. ⇐: Suppose (G , D , r , 2h, q) is a yes-instance of Hop-bounded Directed Steiner Subgraph. Let H be a subgraph of G such that for every vertex t ∈ D there is a directed path in H from r to t of pure length at most 2h and cost(H ) is minimized. In the following, we show how to transform H into another graph H that is a solution for (G, D, r, h, q) of Min-power Single-source h-Multicast. Claim 1 For any black vertex v ∈ V (H ), if out-degree(v) > 0 then outdegree(v) =1. Proof of Claim 1 : To get a contradiction, suppose out-degree(v)= l ≥ 2. Let v1 , v2 , ..., vl be the out-neighbors of v with weight([v, v1 ]) < weight([v, v2 ]) < ... < weight([v, vl ]). Let d[vl , v1 ] be a simple directed path in G from vl to v1 in which all the vertices are white. Based on H , another graph is constructed as follows: delete all the edges going out from v except [v, vl ] in H ; for any vertex w ∈ V (d[vl , v1 ]), if w ∈ / V (H ), then add w to H ; for any edge e ∈ E(d[vl , v1 ]), if e ∈ / E(H ), then add e to H . Let H be the resulting graph by taking above
162
W. Luo et al.
operations on H . Obviously, in H for every vertex t ∈ D there is a directed path from r to t of pure length at most 2h. Since the weight of the added edges is 0, cost(H ) < cost(H ), contradicting to the fact that cost(H ) is minimized. We apply the following translation to H . Translation 4. For any black vertex v ∈ V (H ), delete all the white vertices b in Nout (v) from H . For any black vertex u ∈ Nout (Nout (v)) \ v, let x be the out-neighbor of v and the in-neighbor of u in G , add edge [v, u] to H and assign weight weight([v, x]) to [v, u]. Let H be the resulting graph by applying Translation 4 to H . Remove the colors of vertices in H. Obviously costw (H) = cost(H ) ≤ q and H is a subgraph of G. Furthermore, for any vertex t ∈ D, there is a directed path in H from r to t of length at most h. Therefore, H is a solution for instance (G, D, r, h, q). 3.2
Solving Hop-Bounded Directed Steiner Subgraph
This subsection deals with the description and analysis of an FPT algorithm for the Hop-bounded Directed Steiner Subgraph problem using a nice decomposition property for Steiner trees introduced in [7]. Let (G = (V , E ), D , r , h , q) be the instance of Hop-bounded Directed Steiner Subgraph which is transformed from an instance (G, D, r, h, q) of Min-power Single-source h-Multicast. Suppose ∪ Vwhite where Vblack is the set of black vertices and Vwhite is the set V = Vblack of white vertices in G . For the sake of simplicity, we also define the following notations: s(X, v, i) denotes the cost of a minimum cost subgraph H of G such that there exists a directed path in H from v to each vertex in X of pure length at most i; su (X, u, i) denotes the cost of a minimum cost subgraph H of G such that there exists a directed path in H from u to each vertex in X of pure length at most i and out-degree(u) ≥ 2. \ X. Then, Lemma 2. Let X ⊆ D and v ∈ Vblack s(X, v, i) = minu∈Nout (v) (s(X, u, i − 1) + weight(v, u)). w \ X and w1 ∈ Nout (v). Then, Lemma 3. Let X ⊆ D , v ∈ Vwhite s(X, v, i) = min{minu∈Nout b (v) {s(X, u, i − 1)}, s(X, w1 , i), sv (X, v, i)}, where sv (X, v, i) = minX =∅,X ⊂X {s(X , v, i) + s(X \ X , v, i)}.
Theorem 1. The algorithm Steiner-Hop in Figure 2 solves the Hop-bounded Directed Steiner Subgraph problem in O(3k · n · h + 2k · n2 · h ) time, where n is the number of vertices in the given graph and k is the number of terminals. 3.3
Solving Min-power Single-source h-Multicast
Based on the previous subsection, we can present our algorithm for the Minpower Single-source h-Multicast problem.
The Min-Power Multicast Problems in Wireless Ad Hoc Networks
163
Algorithm Steiner-Hop (G , D , r , h , q) Input: black-white edge-weighted directed graph G = (Vblack ∪ Vwhite , E ), D ⊆ Vblack with |D | = k, vertex r ∈ Vblack , non-negative integer h Output: “Yes” or “No” 1. Initialization: for all X ⊆ D and all v ∈ Vblack do: if {v} = X, then s(X, v, 0)= 0 else s(X, v, 0)= +∞; 2. For i = 1 to h do 2.1 If i is even then 2.2 For j = 1 to k do 2.3 For all X ⊆ D with |X| = j and all v ∈ Vblack \ X do 2.4 s(X, v, i) = minu∈Nout (v) (s(X, u, i − 1) + weight(v, u)) 2.5 For all X ⊆ D with |X| = j and all v ∈ X do 2.6 If |X| ≥ 2 then s(X, v, i) = s(X \ v, v, i) else s(X, v, i) = 0 2.7 else 2.8 For j = 1 to k do 2.9 For all X ⊆ D with |X| = j and all u ∈ Vwhite do 2.10 su (X, u, i) = minX =∅,X ⊂X {s(X , u, i) + s(X \ X , u, i)} 2.11 For all X ⊆ D with |X| = j and all v ∈ Vwhite do 2.12 s(X, v, i) = min{minu∈N b (v) {s(X, u, i − 1)}, out s(X, w1 , i), sv (X, v, i))}. //w1 is the white neighbor of v 3. If s(D , r , h ) ≤ q then return “Yes” else return “No”. Fig. 2. Solving the Hop-bounded Directed Steiner Subgraph problem
Theorem 2. The Min-power Single-source h-Multicast problem on an input instance (G, D, r, h, q) is solvable in time O(3k Lnh + 2k L2 n2 h), where n is the number of vertices in the input graph G, k=|D|, and L = max{|outweight(v)| | v ∈ V (G)}. Proof. The algorithm for Min-power Single-source h-Multicast is described as follows: Given an instance (G, D, r, h, q) of Min-power Single-source h-Multicast, we first translate (G, D, r, h, q) into an instance (G , D , r , 2h, q) of Hop-bounded Directed Steiner Subgraph. Then we apply the algorithm Steiner-Hop to (G , D ,r , 2h, q). If the algorithm returns “Yes”, then (G, D, r, h, q) is a yes-instance of Min-power Single-source h-Multicast, otherwise, (G, D, r, h, q) is a no-instance. The correctness of the algorithm follows directly from Lemma 1 and Theorem 1. With regard to the running time, since G contains O(Ln) vertices and O(Ln+ m) edges, the main translation can be done in time O(Ln + m). According to Theorem 1, the time complexity of algorithm Steiner-Hop is O(3k · n · h + 2k · n2 · h ) where n = O(Ln), h = 2h, and |D |= |D|= k. In summery, the time complexity is O(3k Lnh + 2k L2 n2 h).
4
Parameterized Hardness Results
In this section we present the parameterized hardness results. First, we show that Min-power Strongly Connected h-Multicast is W[1]-hard with respect to
164
W. Luo et al.
the combined parameter (k1 , k2 ) where k1 denotes the number of terminals and k2 the number of senders by a parameterized reduction from the W[1]-complete Multi-colored Clique problem [8], which is defined as follows. Multi-colored Clique problem Instance: An undirected graph G = (V, E), a positive integer k, and a vertex coloring c: V → {1, 2, ..., k} for G. Question: Are there v1 , ..., vk ∈ V such that for all 1≤ i < j ≤ k: (vi , vj ) ∈ E and c(vi ) = c(vj )? Theorem 3. Min-power Strongly Connected h-Multicast is W[1]-hard with respect to the combined parameter (k1 , k2 ). Proof. Let (G, c, k) be an instance of Multi-colored Clique. We replace the undirected edges in G by directed edges: Each undirected edge (u, v) ∈ E(G) is replaced by two directed edges [u, v] and [v, u]. For a given color i ∈ {1, ..., k}, let Vi (G) denote the set of vertices in G colored i. For a given pair of colors i, j ⊆ {1, ..., k} with i = j, let Ei,j denote the set of directed edges [u, v] with c(u) = i and c(v) = j, where c(x) denotes the color of vertex x in G. We construct an instance of Min-power Strongly Connected h-Multicast (G = (V , E ), D, h, q, k1 , k2 ) from (G, c, k). For each color i ∈ {1, ..., k}, we construct a corresponding vertex-selection gadget gi which consists of 1 + |Vi (G)| vertices − one vertex ti associated with the color i, and one vertex vai associated with each vertex a ∈ Vi (G). For each vai ∈ gi , vai has edges to and from ti with weight 1. For each pair of colors i, j ⊆ {1, ..., k} with i = j, we construct a i → j edgeselection gadget gij . The gadget gij consists of 1 + |Ei,j | vertices: one vertex tij ij associated with the pair of colors i → j, and one vertex vab associated with each ij ij edge [a, b] ∈ Ei,j . For each vertex vab ∈ gij , vab has edges to and from tij , each with weight 1. ij For edge [a, b] ∈ E with c(a) = i and c(b) = j, there is an edge from vai to vab ij j with weight 1, and an edge from vab to vb with weight 1. Now we present the construction more formally. The set of vertices V consists of the following vertex subsets: V1 = {ti |i ∈ {1, ..., k}}; V2 = {tij |i, j ∈ {1, ..., k} and i = j}; V3 = {vai |a ∈ Vi (G)}; ij V4 = {vab |a ∈ Vi (G), b ∈ Vj (G), [a, b] ∈ E}. The set of edges E consists of the following edge subsets: E1 = {[vai , ti ], [ti , vai ]|a ∈ Vi (G)}; ij ij E2 = {[vab , tij ], [tij , vab ]|a ∈ Vi (G), b ∈ Vj (G) and [a, b] ∈ E}; ij ij i E3 = {[va , vab ], [vab , vbj ]|a ∈ Vi (G), b ∈ Vj (G) and [a, b] ∈ E}. The weight of each edge in E is set to 1. Let D = V1 ∪ V2 . Then k1 = k 2 . We set q = 2k2 , k2 = 2k 2 and h = 6.
The Min-Power Multicast Problems in Wireless Ad Hoc Networks
165
Obviously, the construction takes polynomial time. We next prove that (G,c,k) is a yes-instance of Multi-colored Clique if and only if (G = (V , E ), D, h, q, k1 , k2 ) is a yes-instance of Min-power Strongly Connected h-Multicast. ⇒: Suppose (G, c, k) is a yes-instance of Multi-colored Clique. Let K be a k-multicolored clique of G. Consider an induced graph H of G by the vertices ij in V1 ∪ V2 ∪ {vai |a ∈ Vi (K)} ∪ {vab |a ∈ Vi (K), b ∈ Vj (K), [a, b] ∈ E(K)}. It is easy to see that H is a solution for (G , D, h, q, k1 , k2 ). Therefore, (G = (V , E ), D, h, q, k1 , k2 ) is a yes-instance of Min-power Strongly Connected h-Multicast. ⇐: Suppose (G = (V , E ), D, h, q, k1 , k2 ) is a yes-instance of Min-power Strongly Connected h-Multicast and H be a solution for (G = (V , E ), D, h, q, k1 , k2 ). Let C = {a ∈ V (G)|vai ∈ V (H)}. Since k2 = 2k2 and q = 2k 2 , by our construction, H contains exactly one vertex in each vertex-selection gadget gi other than ti and exactly one vertex in each edge-selection gadget gij other than tij . Hence, C includes k vertices of distinct colors. We next show that, for any pair of vertices a, b ∈ C, [a, b] ∈ E(G). Suppose c(a) = i and c(b) = j. Since the vertex tij is reachable from the vertex ti in H, by ij → tij with c(x) = i and our construction, there is a directed path ti → vxi → vxy c(y) = j in H. Note that for any c ∈ {1, 2, ..., k}, there is only one vertex in H ij with color c. Hence, x = a and y = b. It follows that [vai , vab ] ∈ E(H). Similarly, ij j since tj is reachable from tij in H, [vab , vb ] ∈ E(H). Therefore, [a, b] ∈ E(G). It follows that (G, c, k) is a yes-instance of Multi-colored Clique. In the following, we show that Min-power Single-source h-Multicast problem is W[2]-hard with respect to the parameter k2 that denotes the number of senders. We provide a FPT-reduction from the W[2]-hard Dominating Set problem [6], which is defined as follows. Dominating Set problem Instance: An undirected graph G = (V, E), and a positive integer k. Question: Is there a subset D ⊆ V of size at most k such that every vertex in V is either in D, or adjacent to at least one vertex in D? Theorem 4. Min-power Single-source h-Multicast is W[2]-hard with respect to the parameter k2 . Proof. Let (G = (V, E), k) be an instance of Dominating Set. For a vertex v ∈ V , let N [v] = {u|(v, u) ∈ E} ∪ {v}. Based on (G, k), We construct an instance (G = (V , E ), D, r, h, q, k2 ) of Min-power Single-source h-Multicast as follows. Let V = {r} ∪ V1 ∪ V2 with r ∈ / V , V1 = V , and V2 = V . For any vertex v ∈ V1 , [r, v] ∈ E and weight([r, v]) = 1. For any two vertices v ∈ V1 and u ∈ V2 in G , if u ∈ N [v] in G, then [v, u] ∈ E and weight([v, u]) = 1. Set D = V2 , k2 = k + 1, q = k + 1 and h = 2. It is clear that the instance (G = (V , E ), D, r, h, q, k2 ) is constructible in polynomial time. We next show that (G = (V, E), k) is a yes-instance of Dominating Set if and only if (G = (V , E ), D, r, h, q, k2 ) is a yes-instance of Min-power Single-source h-Multicast.
166
W. Luo et al.
⇒: Suppose C ⊆ V is a dominating set for G of size at most k. Let C be the set of vertices in V1 corresponding to the vertices in C. Let T be the induced graph of G by the vertices {r} ∪C ∪V2 . It is obvious that, in T , for every vertex v ∈ D there is a directed path from r to v. Furthermore, k2 = |N L(T )|= k + 1. Therefore, T is a solution for (G = (V , E ), D, r, h, q, k2 ). ⇐: Suppose T is a solution for instance (G = (V , E ), D, r, h, q, k2 ) of Minpower Single-source h-Multicast. Let C be the set of senders except r in T . Then |C | ≤ k. Let C be the set of vertices in G corresponding to the vertices in C . Obviously C is a dominating set for G of size at most k. Since Min-power Multi-source h-Multicast is a generation of Min-power Singlesource h-Multicast, the next theorem follows. Theorem 5. Min-power Multi-source h-Multicast is W[2]-hard with respect to the parameter k2 .
5
Conclusions
In this paper, we initiated the study of power assignment problems in wireless ad hoc networks from the viewpoint of parameterized algorithms. We considered three classical power assignment problems: Min-power Single-source h-Multicast, Min-power Strongly Connected h-Multicast and Min-power Multisource h-Multicast. We proved that Min-power Single-source h-Multicast is in FPT with respect to number of terminals, but is W[2]-hard with respect to number of senders. Furthermore, we showed that Min-power Strongly Connected h-Multicast is W[1]-hard with both the number of terminals and the number of senders as parameters. It remains open whether Min-power Multi-source hMulticast is in FPT with respect to the number of terminals.
References 1. Amb¨ uhl, C., Clementi, A.E.F., Di Ianni, M., Lev-Tov, N., Monti, A., Peleg, D., Rossi, G., Silvestri, R.: Efficient algorithms for low-energy bounded-hop broadcast in ad-hoc wireless networks. In: Diekert, V., Habib, M. (eds.) STACS 2004. LNCS, vol. 2996, pp. 418–427. Springer, Heidelberg (2004) 2. Calinescu, G., Frieder, O., Wan, P.J.: A Survey of Algorithms for Power Assignment in Wireless Ad Hoc Networks. CRC Press, Boca Raton (2006) 3. Cagalj, M., Hubaux, J.P., Enz, C.: Minimum-energy broadcast in all-wireless networks: NP-completeness and distribution issues. In: Proc. 8th Annual International Conference on Mobile Computing and Networking (MobiCom 2002), pp. 172–182 (2002) 4. Calinescu, G., Kapoor, S., Olshevsky, A., Zelikovsky, A.: Network lifetime and power assignment in ad-hoc wireless networks. In: Di Battista, G., Zwick, U. (eds.) ESA 2003. LNCS, vol. 2832, pp. 114–126. Springer, Heidelberg (2003) 5. Clementi, A.E.F., Penna, P., Silvestri, R.: The power range assignment problem in radio networks on the plane. In: Reichel, H., Tison, S. (eds.) STACS 2000. LNCS, vol. 2832, pp. 651–660. Springer, Heidelberg (2000)
The Min-Power Multicast Problems in Wireless Ad Hoc Networks
167
6. Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, New York (1999) 7. Dreyfus, S.E., Wagner, R.A.: The steiner problem in graphs. Networks 1, 195–207 (1972) 8. Fellows, M.R., Hermelin, D., Rosamond, F.A., Vialette, S.: On the parameterized complexity of multiple-interval graph problems. Theoret. Computer Sci. 410, 53–61 (2009) 9. Funke, S., Laue, S.: Bounded-hop energy-efficient broadcast in low-dimensional metrics via coresets. In: Thomas, W., Weil, P. (eds.) STACS 2007. LNCS, vol. 2832, pp. 272–283. Springer, Heidelberg (2007) 10. Funke, S., Laue, S., Naujoks, R.: Minimum-energy broadcast with few senders. In: Aspnes, J., Scheideler, C., Arora, A., Madden, S. (eds.) DCOSS 2007. LNCS, vol. 4549, pp. 404–416. Springer, Heidelberg (2007) 11. Liang, W.: Approximate minimum-energy multicasting in wireless ad hoc networks. IEEE Transactions on Mobile Computing 5, 377–387 (2006) 12. Liang, W., Brent, R., Xu, Y., Wang, Q.: Minimum-energy all-to-all multicasting in wireless ad hoc networks. IEEE Transactions on Mobile Computing 8, 5490–5499 (2009) 13. Yang, W., Wang, L.: The investigation of delay-constrained multicasting with minimum-energy consumption in static ad hoc wireless networks. Int. J. Ad Hoc and Ubiquious Computing 4, 237–250 (2009)
Constant Sum Flows in Regular Graphs Tao-Ming Wang and Shi-Wei Hu Department of Applied Mathematics Tunghai University Taichung, Taiwan 40704, R.O.C.
[email protected]
Abstract. For an undirected graph G, a zero-sum flow is an assignment of non-zero integers to the edges such that the sum of the values of all edges incident with each vertex is zero. We extend this notion to a more general one in this paper, namely a constant-sum flow. The constant under a constant-sum flow is called an index of G, and I(G) is denoted as the index set of all possible indices of G. Among others we obtain that the index set of a regular graph admitting a perfect matching is the set of all integers. We also completely determine the index sets of all r-regular graphs except that of 4k-regular graphs of even order, k ≥ 1.
1
Introduction and Preliminaries
Throughout this paper, all terminologies and notations on graph theory can be referred to the textbook by West[8]. We use Z to stand for the set of all integers, and Z∗ the set of all non-zero integers. Let G be a directed graph. A k-flow on G is an assignment of integers with maximum absolute value k − 1 to each edge such that for every vertex, the sum of the values of incoming edges is equal to the sum of the values of outgoing edges. A nowhere-zero k-flow is a k-flow with no zero edge labels. A celebrated conjecture of Tutte says that: (Tutte’s 5-flow Conjecture[7]) Every bridgeless graph has a nowhere-zero 5-flow. Jaeger showed that every bridgeless graph has a nowhere-zero 8-flow[4]. Next Seymour proved that every bridgeless graph has a nowhere-zero-6-flow[6]. One may study the elements of null space of the incidence matrix of an undirected graph. For an undirected graph G, the incidence matrix of G, W (G), is defined as follows: W (G)i,j =
1 if ej and vi are incident, 0 otherwise.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 168–175, 2011. c Springer-Verlag Berlin Heidelberg 2011
Constant Sum Flows in Regular Graphs
169
An element of the null space of W (G) is a function f : E(G) −→ Z such that for all vertices v ∈ V (G) we have f (uv) = 0, u∈N (v)
where N (v) denotes the set of adjacent vertices to vertex v. If f never takes the value zero, then it is called a zero-sum flow on G. A zero-sum k-flow is a zero-sum flow whose values are integers with absolute value less than k. There is a conjecture for zero-sum flows similar to the Tutte’s 5-flow Conjecture for nowhere-zero flows as follows. Let G be an undirected graph with incidence matrix W . If there exists a vector in the null space of W whose entries are nonzero real numbers, then there also exists a vector in that space, whose entries are non-zero integers with absolute value less than 6, or equivalently, (Zero-Sum Conjecture[1]). If G is a graph with a zero-sum flow, then G admits a zero-sum 6-flow. It was proved by Akbari et al. [1] that the above Zero-Sum Conjecture is equivalent to the Bouchet’s Conjecture for bidirected graphs[3]. For regular graphs they obtained the following theorem: Theorem 1. Let G be an r-regular graph (r ≥ 3). Then G has a zero-sum 7-flow. If 3|r, then G has a zero-sum 5-flow. We extend the notion zero-sum flows to a more general one, namely constantsum flows as follows: ∗ Definition 2. For an undirected graph G, if there exits f : E(G) → Z such f (uv) = C for each v ∈ V (G), where C is an integer constant (called that u∈N (v)
an index), then we call f a constant-sum flow of G, or simply a C-sum flow of G. Denote by I(G) the set of all possible indices for G, and call it the index set of G. Remark. Note that 0 ∈ I(G) if and only if G admits a zero-sum flow. We have the following observation for the index set of an r-regular graph: Theorem 3. Let G be r-regular(r ≥ 2) with a perfect matching, then I(G) = Z. Proof Let M be the perfect matching. Note that we have the factorization G = M ⊕ (G\M ), where G\M is an (r − 1)-regular graph. Since for the perfect matching I(M ) = Z∗ , and G\M has indices r−1 and 1−r by labeling 1 and −1 respectively on edges, we have that I(G) = I(M ⊕ (G\M )) ⊇ (r − 1) + Z∗ and I(G) = I(M ⊕ (G\M )) ⊇ (1 − r) + Z∗ . If (r − 1) + Z∗ = (1 − r) + Z∗ , then we are done with I(G) = Z, since (r − 1) + Z∗ = Z∗ \{r − 1} and (1 − r) + Z∗ = Z∗ \{1 − r}. In case (r − 1) + Z∗ = (1 − r) + Z∗ , which implies r − 1 = 1 − r that is r = 1, a contradiction.
170
T.-M. Wang and S.-W. Hu
Moreover, we see that I(G) = Z∗ for 1-regular graphs G, and I(G) = Z or 2Z∗ for 2-regular graphs G based upon the following observation: Lemma 4. Let Cn be an n-cycle, where n ≥ 3. We have the following: (1) I(Cn ) = 2Z∗ , for n odd. (2) I(Cn ) = Z, for n even. Proof (1) Note that in any constant-sum flow of a cycle, the edges should alternatively be labeled the same. Therefore, for n odd, the labels on all edges are all the same. Therefore I(Cn ) = 2Z∗ . (2) For n even, we label the edges 1, x − 1, 1, x − 1, · · · , 1, x − 1 for x ∈ Z\{1} to obtain the index x, and 2, −1, 2, −1, · · · , 2, −1 to obtain the index 1. Therefore I(Cn ) = Z. Corollary 5. Let G be a 2-regular graph. Then I(G) = 2Z∗ if G contains an odd component (a connected component consisting of an odd cycle), and I(G) = Z otherwise. We determine completely the index sets of r-regular graphs in later sections for r ≥ 3, except the index sets of 4k-regular graphs, k ≥ 1.
2
Constant-Sum Flows for Regular Graphs
Lemma 6. Suppose G is a graph and {0, 1} ⊆ I(G), then I(G) = Z. Proof. Let V (G) = {1, 2, · · · , n}, and aij = 0 be the edge labeling from vertex i to vertex j. Since 1 ∈ I(G), aij = 1, ∀i ∈ V (G). j∈N (i)
Pick some x ∈ Z∗ , then x· aij = xaij = x, ∀i ∈ V (G). j∈N (i)
j∈N (i)
Therefore x ∈ I(G), and I(G) = Z.
Remark. In [1] it was proved that all r-regular graphs G admit zero-sum flows if r ≥ 3, that is, 0 ∈ I(G). Therefore it suffices to show I(G) = Z by verifying 1 ∈ I(G). Also it is not hard to see that if m ∈ I(G) then mZ ⊆ I(G) for each positive integer m ≥ 2. Pull Back Labeling Construction In the following we propose a pull back labeling construction mentioned in [1]. First for an undirected loopless graph G, we define a new graph G as follows.
Constant Sum Flows in Regular Graphs
171
Suppose that V (G) = {1, 2, · · · , n}, then G is a bipartite graph with two parts {u1 , · · · , un } and {v1 , · · · , vn }. Join ui to vj in G if and only if the two vertices i and j are adjacent in G. Assume that G admits a constant x-sum flow f . If f (ui vj ) + f (uj vi ) = 0 for any pair of edges ui vj and uj vi in G , then we construct a constant 2x-sum flow f for G, in the following way. For two adjacent vertices i and j in G, let ij be the edge connecting them in G. Then we may define f via f by f (ij) = f (ui vj ) + f (uj vi ). By our assumption, f (ij) ∈ Z∗ . Pick some x in Z∗ , we have f (ui vj ) = x, f (uj vi ) = x, vj ∈N (ui )
thus we find f (ij) = j∈N (i)
uj ∈N (vi )
f (ui vj ) +
vj ∈N (ui )
f (uj vi ) = 2x, ∀i ∈ V (G).
uj ∈N (vi )
This defines a 2x-sum flow for G. If G is r-regular, then G is an r-regular bipartite graph. Thus by Hall’s Marriage Theorem, all edges of G can be partitioned into r perfect matchings. Let E1 , · · · , Er be the set of edges of these matchings. We will use this construction and notations throughout the remaining of this article. 2.1
Odd Regular Graphs
We deal with general odd regular graphs here: Lemma 7. If G is a (2k + 1)-regular graph, then I(G) = Z for all k ≥ 2. Proof Construct G as before, we change the definition of f (e) as follows: Let f0 (e) =
k + 1 , e ∈ E1 ∪ · · · ∪ Ek −k , e ∈ Ek+1 ∪ · · · ∪ E2k+1
This gives that f0 is a zero-sum flow for G and satisfies f0 (ui vj )+f0 (uj vi ) = 0. So f0 (e) ∈ {2k + 2, −2k, 1} is a zero-sum flow for G. Let f1 (e) =
k , e ∈ E1 ∪ · · · ∪ Ek 1 − k , e ∈ Ek+1 ∪ · · · ∪ E2k+1
This gives that f1 is a 1-sum flow for G and satisfies f1 (ui vj ) + f1 (uj vi ) = 0. So f2 (e) ∈ {2k, 2 − 2k, 1} is a 2-sum flow labeling for G. Now we set f (ij) =
f0 (ij) + f2 (ij) for all i, j ∈ V (G). Then f (e) ∈ {2k + 2
1, 1 − 2k, 1} and 1 1 f (ij) = ( f0 (ij) + f2 (ij)) = (0 + 2) = 1. 2 2 j∈N(i)
j∈N(i)
j∈N(i)
172
T.-M. Wang and S.-W. Hu
That is, f is a 1-sum flow for G and 1 ∈ I(G).
Lemma 8. If G is a 3-regular graph, then I(G) = Z. Proof As mentioned in previous remark, we see that it suffices to show I(G) = Z by verifying 1 ∈ I(G) for regular graphs G. Construct G as before, we define the f0 (e) as follows: Let ⎧ ⎨ −2 , e ∈ E1 f0 (e) = 1 , e ∈ E2 ⎩ 1 , e ∈ E3 This gives f0 (e) ∈ {−4, 2, −1} which is a zero-sum flow for G. Define the f1 (e) as follows: Let ⎧ ⎨ −3 , e ∈ E1 f1 (e) = 2 , e ∈ E2 ⎩ 2 , e ∈ E3 This gives f2 (e) ∈ {−6, 4, −1} which is a 2-sum flow for G. 1 (f0 (e) + f2 (e)). Then f (e) ∈ {−5, 3, −1} and 2 1 1 f (ij) = ( f0 (ij) + f2 (ij)) = (0 + 2) = 1. 2 2
Now, we set f (e) =
j∈N(i)
j∈N(i)
j∈N(i)
That is, f is a 1-sum flow for G, same as saying 1 ∈ I(G), and hence I(G) = Z. 2.2
Even Regular Graphs
Note that for any regular graph of odd degree, the number of vertices is always even. Also Petersen[5] proved the following two well known Theorems in 1891: Theorem 9. (Petersen, 1891) Every regular graph of even degree is 2-factorable. Theorem 10. (Petersen, 1891) Let k be a positive integer. If a connected 2kregular graph G has an even number of vertices, then it may be k-factored. That is, G can be factored into the sum of two k-regular spanning subgraphs. Therefore we observe the following for even regular graphs with odd orders: Lemma 11. If G is r-regular graph with odd vertices (therefore r is even), then I(G) = 2Z, for all r ≥ 3. Proof. We show that I(G) ⊆ 2Z first. Suppose c ∈ I(G), then we have 2 f (e) = c|V (G)|. e∈E(G)
Constant Sum Flows in Regular Graphs
173
Since |V (G)| is odd, therefore r must be even, thus I(G) ⊆ 2Z. Conversely, we show I(G) ⊇ 2Z. Let r = 2k. G will have a 2-factor, namely E1 by Theorem 9. We now define a 2-flow by f2 (e) = k, if e ∈ E1 , and f2 (e) = −1 for others edges. Set f0 (e) = k − 1, if e ∈ E1 , and f0 (e) = −1 for others edges would gives a 0-flow. To complete the picture, we need one more Lemma: Lemma 12. If G is a 2k-regular graph with even vertices, where k is odd, then I(G) = Z for all k ≥ 3. Proof Without loss of generality we may assume G is connected. By Petersen’s Theorem 10, G = K1 ⊕ K2 , where K1 and K2 are two k-factors. Since k is odd, I(K1 ) = I(K2 ) = Z by Lemma 7 and Lemma 8. Therefore, I(G) = I(K1 ⊕K2 ) ⊇ I(K1 ) + I(K2 ) = Z. Remark. We complete the picture for all even regular graphs except 4k-regular graphs of even order. In below we present examples of index sets of 4-regular graphs. However the index set of a general 4-regular graph is not known yet. Example 1. I(Cm Cn ) = Z for even m and even n, where Cm Cn is Cartesian product. Example 2. I(G) = Z for the following 4-regular graph G without perfect matching. Note that we give the 0-sum and 1-sum flows.
Fig. 1. A 4-regular graph with 0-sum flow
174
T.-M. Wang and S.-W. Hu
Fig. 2. A 4-regular graph with 1-sum flow
3
Concluding Remarks
To summarize up, we have obtained all index sets of r-regular graphs except 4k-regular graphs, k ≥ 1, with even number of vertices as follows: Theorem 13. The index sets of r-regular graphs G of order n, are as follows: ⎧ ∗ Z , r = 1. ⎪ ⎪ ⎪ ⎪ Z, r = 2 and G contains even cycles only. ⎨ I(G) = 2Z∗ , r = 2 and G contains an odd cycle. ⎪ ⎪ 2Z, r ≥ 3, r even and n odd . ⎪ ⎪ ⎩ Z, r ≥ 3, r = 4k, k ≥ 1, and n even . Even further one may consider the concept constant sum k-flow similar to that of zero-sum k-flow. It would be interesting to study the relationship among these related notions. Calculating the index sets of other graph classes are obviously next sets of research problems to be explored.
Acknowledgment The author T.-M. Wang wishes to express the sincere thanks to his home institution Tunghai University, and DIMACS in Rutgers University for the support and hospitality while he was visiting the center during the Spring 2010, where the paper was partially done.
References 1. Akbari, S., Daemi, A., Hatami, O., Javanmard, A., Mehrabian, A.: Zero-Sum Flows in Regular Graphs. Graphs and Combinatorics 26, 603–615 (2010) 2. Akbari, S., Ghareghani, N., Khosrovshahi, G.B., Mahmoody, A.: On zero-sum 6flows of graphs. Linear Algebra Appl. 430, 3047–3052 (2009)
Constant Sum Flows in Regular Graphs
175
3. Bouchet, A.: Nowhere-zero integral flows on a bidirected graph. J. Combin. Theory Ser. B 34, 279–292 (1983) 4. Jaeger, F.: Flows and generalized coloring theorems in graphs. J. Combin. Theory Ser. B 26(2), 205–216 (1979) 5. Petersen, J.: Die Theorie der regularen graphs. Acta Mathematica (15), 193–220 (1891) 6. Seymour, P.D.: Nowhere-zero 6-flows. J. Combin. Theory Ser. B 30(2), 130–135 (1981) 7. Tutte, W.T.: A contribution to the theory of chromatic polynomials. Can. J. Math. 6, 80–91 (1954) 8. West, D.B.: Introduction to Graph Theory, 2nd edn. Prentice Hall, Englewood Cliffs (2001)
2D Knapsack: Packing Squares Min Chen1 , Gy¨orgy D´ osa2 , Xin Han1 , Chenyang Zhou1 , and Attila Benko2 2
1 School of Software of Dalian University of Technology, China Department of Mathematics, University of Pannonia, Veszpr´em, Hungary {minchen16,hanxin.mail,zcy1988}@gmail.com, {dosagy,benko.attila}@almos.vein.hu
Abstract. In this paper, we study a two-dimensional knapsack problem: packing squares as many as possible into a unit square. Our results are the following: (i) first, we propose an algorithm called IHS(Increasing Height Shelf), and prove that the packing is optimal if there are at most 5 squares packed in an optimal packing, and this upper bound 5 is sharp; (ii) secondly, if all the items have size(side length) at most k1 , where k ≥ 1 is a constant number, we propose a simple algorithm with an 2 approximation ratio k +3k+2 in time O(n log n). k2 (iii) finally, we give a PTAS for the general case, and our algorithm is much simpler than the previous approach[16].
1
Introduction
The knapsack problem is one of the most classical and studied problems in combinatorial optimization and has a lot of applications in the real world[17]. The (classical) knapsack problem is given a knapsack and a set of items with weights and sizes, to maximize the total weight of selected items in the knapsack satisfying the capacity constraint. In this paper, we study a geometry version of 2D knapsack problem, where items are squares with weight 1 and side at most 1 and the knapsack is a unit size square and the objective is to maximize the total number of squares packed in the knapsack. In the packing, item’s sides should be parallel to the corresponding sides of the knapsack and overlapping is not allowed. Related work: It is well-known that 1D Knapsack problem is NP-hard and admit fully polynomial time approximation schemes(FPTAS) and the corresponding fractional problems can be solved by a greedy algorithm[1,6,12,17]. For the 2D geometry Knapsack, in [2] Caprara and Monaci gave a simple algorithm with an approximation ratio 3 + . Jansen and Zhang[15] studied 2D Knapsack problem of packing rectangles and obtained (2 + )-approximation algorithm, where > 0 is sufficiently small. For packing squares with arbitrary weights, Harren[10] gave a ( 54 + )-approximation algorithm, then Jansen and others[16] proposed a
Partially supported by “the Fundamental Research Funds for the Central Universities”.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 176–184, 2011. c Springer-Verlag Berlin Heidelberg 2011
2D Knapsack: Packing Squares
177
(1 + )-approximation algorithm, i.e., PTAS. If an item(square) has its weight equal to its area, for packing squares Han and others[7], Jansen and others[4] gave PTAS independently. As for the online version of Knapsack problem, refer to the current papers[11,8,9,19,18,13,14,20]. Our contributions: We first propose a simple algorithm called IHS(Increasing Height Shelf), in which we sort all the items in ascending order of side length at first, then divide the knapsack into several layers and put as many items as possible into each layer, and prove that the packing by IHS is optimal if there are at most 5 squares packed in an optimal packing, and this upper bound 5 is sharp; secondly if all the items have size(side length) at most k1 , where k ≥ 1 is a constant number, we propose a modified IHS algorithm with an approximation 2 ratio k +3k+2 ; finally, we give a PTAS for the general case, and our algorithm is k2 much simpler than the previous approach[16].
2
Preliminaries and Models
In this section, we formally define our problem. Packing Squares into a Knapsack Input: a square knapsack with a unit size, and a set of square items L = {a1 , . . . , an }. Output: select a set of items F ⊆ L with a maximum number of squares which can be packed into the knapsack subject to the following constrains: 1. there is no overlapping between any two items; 2. the sides of items are parallel to the corresponding sides of the knapsack. We analyze algorithms by using one of the standards: the approximation ratio. Given an input sequence L and an approximation algorithm A, the approximation ratio of algorithm A is defined as follows: RA = sup L
OP T (L) , A(L)
where OP T (L) is the optimal solution and A(L) denotes the number of items packed by algorithm A. In this paper, we denote an item by ai , we also use ai to denote the side length of the item. Lemma 1. Assume a1 ≤ a2 ≤ ... ≤ an in the input L. If OP T (L) = i, then items a1 , a2 , ..., ai can be packed in the knapsack, but items a1 , a2 , ..., ai , ai+1 cannot. Proof. If OP T (L) = i, there exists i items which can be packed into the knapsack together. Since items a1 , a2 , ..., ai are the smallest i-th squares, we can exchange the optimal packing with the smallest i-th items and after exchanging the packing is feasible, i.e., the smallest i-th items can be packed into the knapsack. On the other hand, if items a1 , a2 , ..., ai , ai+1 can be packed in the knapsack, then OP T (L) would have been at least i + 1. Hence we have this lemma.
178
M. Chen et al.
We can use the following lemma to estimate the optimal solution. Lemma 2. Assume a1 ≤ a2 ≤ ... ≤ an in the input L. If α ≤ ki=1 a2i ≤ 1, then OP T (L) ≤ k · α1 . Proof. If OP T (L) ≤ k then the lemma holds. Else assume OP T (L) = j > k. By Lemma 1, items a1 ,...,aj can be packed in the knapsack, where j > k is j the largest index. Then we have i=1 a2i ≤ 1. Due to a1 ≤ a2 ≤ ... ≤ aj , and k 2 i=1 ai ≥ α, then we have α 1 ≤ , k j since the average area of the first k items is not larger than the average area of the first j items. Hence this lemma holds.
3
A Simple Algorithm IHS and Its Applications
In this section, we first propose a simple algorithm called increasing height shelf(IHS) which runs in time O(n log n), where n is the number of items in the input L, then we prove that i) IHS is an optimal packing if OP T (L) ≤ 5, ii) IHS is not optimal for some instance L if OP T (L) ≥ 6. Finally, we analyze algorithm IHS and a modified IHS algorithm, and prove that both algorithms work very when all the items are small, based on the Modified IHS we obtain a polynomial time approximation algorithm for the problem. 3.1
Increasing Height Shelf
In the algorithm IHS, we first sort squares in ascending order of their side length, then pack squares into shelves from small to large, then pack shelves into the knapsack until all the squares are packed or there is no room for a shelf in the knapsack. Algorithm: IHS 1 Sort all the items in ascending order of their side length. Let a1 ≤ a2 ≤ ... ≤ an be the items sorted. 2 Find a maximal index i such that ij=1 aj ≤ 1, pack these items into a shelf with width 1 and height ai . 3 Pack the shelf into the knapsack: if there is no shelf in the knapsack, then pack the shelf on the bottom of the knapsack, else pack the shelf on the top of the last shelf in the knapsack, see Fig. 1. If the shelf exceeds over the top of the knapsack, then cancel packing the shelf and stop, else goto next step. 4 Delete all the squares just packed from the input list. If there are some squares unpacked, then rename all unpacked the squares as a1 ≤ a2 ≤ ... and goto step 2. Else stop.
2D Knapsack: Packing Squares
179
Fig. 1. Increasing Height Shelf
Theorem 1. Algorithm IHS is an optimal packing if OP T (L) ≤ 5, and IHS is not optimal for some instance L if OP T (L) ≥ 6. Proof. For the positive result, we only prove the case: OP T (L) = 5 since the proof is similar for the other cases OP T (L) ≤ 4. Let a1 ≤ a2 ≤ ... ≤ an be the input squares. By Lemma 1, when OP T (L) = 5, squares a1 , a2 , ..., a5 can be packed in the knapsack. Then for any 1 ≤ i < j ≤ 5, we have ai + aj ≤ 1,
(1)
otherwise squares ai and aj cannot be packed together. Due to OP T (L) = 5, we have the following result, a1 + a2 + a3 ≤ 1. (2) 3 Otherwise i=1 ai > 1, in the optimal solution, there are at most 4 items packed. This can be observed as below. Consider an optimal packing, we cut the knapsack into three blocks, where each block has size (1/3, 1). Note that some items may be cut into several parts. Due to the fact ai + aj + ak > 1 for any 1 ≤ i < j < k ≤ 5, we have a2i + a2j + a2k > 1/3, in each block there are at most two items packed. If in any two blocks there are four items packed, then in the rest block there is no item which is cut, hence there are at most four items packed if a1 + a2 + a3 > 1. 5 If i=1 ai ≤ 1 then we are done, since all the five items can be packed in a 4 shelf of size (1, a5 ). Else if i=1 ai ≤ 1 then the five items are packed into two shelves, that is, a1 , ..., a4 are packed a shelf of size (1, a4 ), item a5 is packed into a shelf of size (1, a5 ). By (1) we have a4 + a5 ≤ 1, then the two shelves can be packed into the knapsack. Else if 3i=1 ai ≤ 1 then the five items are also packed
180
M. Chen et al.
into two shelves too, that is, a1 , ..., a3 are packed a shelf of size (1, a3 ), items a4 , a5 are packed into a shelf of size (1, a5 ) due to a4 + a5 ≤ 1. By (1) we have a3 + a5 ≤ 1, then the two shelves can be packed into the knapsack. Next we prove the negative result: when OP T (L) ≥ 6, IHS may not produce an optimal packing. Consider the following input L = {a1 , ..., a6 }. Items a1 , ..., a5 have size 1/3 and item a6 has size 2/3. It is not difficult to see that all the items in L can be packed in the knapsack, whereas IHS only packs a1 , ..., a5 into the knapsack. 3.2
IHS Algorithm for Packing Small Items
In this subsection, we adopt algorithm IHS for packing small items and prove that the algorithm works well. Particularly, if all the small items have size at most 1/k, where integer k ≥ 3, then the approximation ratio of IHS is at most k2 (k−1)(k−2) . Theorem 2. When all the items have side length at most 1/k, the approximak2 tion ratio of IHS is (k−1)(k−2) . Proof. After applying IHS for packing items, if there is no item unpacked, then we are done and the approximation ratio of IHS is 1. Otherwise, assume there are j shelves packed in the knapsack, say S1 , S2 , ..., Sj , where shelf Si has height hi . According to algorithm IHS, we have h1 ≤ h2 ≤ ... ≤ hj ≤ Then we have
j i=1
hi > 1 −
1 , k
j−1 i=1
1 . k
hi > 1 −
(3)
2 k
(4)
otherwise shelf Sj+1 would have been packed. Observe that for 2 ≤ i ≤ j in shelf Si each square has side at least hi−1 and in the horizontal dimension the total size of side lengths is at least 1 − 1/k, hence the total area of squares packed in shelf Si is as least 1 hi−1 · (1 − ). (5) k Then by (5),(4) and (3), the total area of squares packed in S2 , ..., Sk is at least j−1 1 1 2 (1 − ) hi ≥ (1 − )(1 − ). k i=1 k k By Lemma 2, we have the approximation ratio of IHS is theorem holds.
k2 . (k−1)(k−2)
Hence, the
According to theorem 2, IHS gets a pretty good result for small items. For 1 instance, when k = 10, i.e. there is no item bigger than 10 , the approximation ratio is 1.389. But we can not estimate the approximation ratio for k = 1 or k = 2.
2D Knapsack: Packing Squares
3.3
181
A Modified IHS Algorithm for Packing Small Items
In this subsection we propose a modified IHS with an upper bound 1 + k3 + k22 , which is better than the upper bound of algorithm IHS. Also we can estimate the approximation ratio for k = 1 and k = 2. In the algorithm, there are two phases: in phase 1, we construct an infeasible packing based algorithm IHS (the infeasible packing helps us to estimate the upper bound of the optimal solution); then in phase 2, we discard some items to get a feasible packing such that the number of items discarded is too large. The details are the followings. A Modified IHS Algorithm 1. Sort all the items in ascending order of their side length, let L = {a1 , ..., an } be items sorted, where a1 ≤ a2 ≤ ... ≤ an . 2. Construct an infeasible packing: (a) Find a minimal index i such that ij=1 aj ≥ 1, pack these items into a shelf i with width j=1 aj and height ai ; (b) Remove the items just packed from the input list, repeat the above packing, i.e., packing items into a shelf with width equal to or larger than 1 until all the items are packed into shelves. 3. Trim the infeasible packing: (a) Let Si be the shelf generated in the i-th round. Assume the height of Si is hi . (b) Find a maximal index i such that ij=1 hi ≤ 1. (c) Shrink the width of each shelf into 1, if the last item is over packed, then just remove it. All the rest items in shelves Sj for 1 ≤ j ≤ i form a feasible packing.
Theorem 3. When all the items have side length at most 1/k, the approximation ratio of Modified IHS is 1 + k3 + k22 . Proof. Let S1 , S2 , ..., Sm be the shelves generated in Phase 1 of constructing an i infeasible solution. Remember i is the maximal index such that j=1 hi ≤ 1. Observe that in each shelf after Phase 2 of trimming the infeasible packing, there are at least k items packed, since each item has side at most k1 . Intuitively the efficient ratio in the horizontal dimension is k+1 k . Since algorithm IHS is used to generate shelves, we have |S1 | ≥ |S2 | ≥ ... ≥ |Si |, where |Sj | is the number of squares packed in Sj after the second phase. To prove this theorem, we have two cases. Case1 m ≤ i + 1: based on the above observations, the approximation ratio is k+1 k+1 2 1 × = 1 + + 2. k k k k
182
M. Chen et al.
Case2 m ≥ i + 2: we can prove that, before we delete some squares from shelves in Sj , the total area of all the squares in ∪i+2 j=1 Sj is at least 1. According to algorithm IHS, we have 1 . k
(6)
hj > 1,
(7)
h1 ≤ h2 ≤ ... ≤ hi+2 ≤ And we have
i
hj ≤ 1,
j=1
i+1 j=1
otherwise shelf Si+1 would have been selected. Observe that for 2 ≤ j ≤ i + 2 in shelf Sj each square has side at least hj−1 and in the horizontal dimension the total size of side lengths is at least 1, hence the total area of squares packed in shelf Sj is as least hj−1 · 1. (8) Then by (8),(7) and (6), before we shrink the shelves, the total area of squares packed in S2 , ..., Si+2 is at least i+1
hj ≥ 1.
j=1
By Lemma 2, OP T (L) is upper bounded by the total number of squares packed in ∪i+2 j=1 Sj . Hence the approximation ratio of our algorithm is k+2 k+1 3 2 × = 1 + + 2. k k k k Hence, the theorem holds. 3.4
A Simple Polynomial Time Approximation Scheme
Though algorithms IHS and Mofified IHS are good for packing small items. But it is not enough to get a polynomial time approximation scheme (PTAS) for the general case. So, we need other techniques which is described here. Lemma 3. [15] Given a set of items S, assume there is c squares, where c is a constant, then we can verify whether all the squares in S can be packed into the knapsack in a constant time. The main ideas to produce a PTAS are below: we first guess whether OP T (L) is larger than a constant c; if OP T (L) ≤ c then we can enumerate all the cases to get an optimal packing by Lemma 3; else we remove large items then apply Modified IHS algorithm for the rest items. Next we give the details. Take a sufficiently small constant 0 < ≤ 1/7 such that 1 is an integer. Let k = 1 .
2D Knapsack: Packing Squares
183
Polynomial Time Approximation Scheme 1. Guess whether OP T (L) ≥ k3 or not. This can be done by the following: take the smallest k3 -th squares, then verify all the k 3 squares can be packed together or not. 2. If OP T (L) < k 3 then find a maximal i such that the smallest i-th squares can be packed together. Output the packing and i. 3. Else OP T (L) ≥ k3 , then apply a modified IHS for all the items with side at most .
By Lemma 3, we know we could verify whether the smallest k 3 -th items can be packed in constant time. Theorem 4. The approximation ratio of our algorithm is 1 + 5. And the time complexity is O(n log n). Proof. It is not difficult to see that if OP T (L) < k 3 . We can get an optimal solution in a constant time even the constant is quite large, i.e., the approximation ratio is 1. Next we consider the case OP T (L) ≥ k 3 . If an item has side larger than = k1 , then we call it large else small. Then the input L can be divided into sublists Ls for small items and Lb for large items. Then we have k 3 ≤ OP T (L) ≤ OP T (Ls ) + OP T (Lb ) ≤ OP T (Ls ) + k 2 . Then we have OP T (Ls ) ≥ OP T (L) − k 2 ≥ (1 − )OP T (L).
(9)
By Theorem 3, we have A(L)(1+3+22) ≥ OP T (Ls ). By (9), the approximation ratio is (1 + 3 + 22 ) ≤ 1 + 5, 1− where ≤ 1/7. Remarks: we cannot prove the upper bounds of algorithms IHS and Modified IHS are tight. It seems that the upper bounds of both algorithms could be improved. So, to further improve the upper bounds of the two algorithms leaves as an open problem.
References 1. Babat, L.G.: Linear functions on the N-dimensional unit cube. Dokl. Akad. Nauk SSSR 222, 761–762 (1975) (Russian) 2. Caprara, A., Monaci, M.: On the two-dimensional knapsack problem. Operations Research Letters 32, 5–14 (2004)
184
M. Chen et al.
3. Csirik, J., Frenk, J.B.G., Labb´e, M., Zhang, S.: Heuristics for the 0-1 Min-Knapsack problem. Acta Cybernetica 10(1-2), 15–20 (1991) 4. Fishkin, A.V., Gerber, O., Jansen, K., Solis-Oba, R.: Packing Weighted Rectangles into a Square. In: Jedrzejowicz, J., Szepietowski, A. (eds.) MFCS 2005. LNCS, vol. 3618, pp. 352–363. Springer, Heidelberg (2005) 5. G¨ untzer, M.M., Jungnickel, D.: Approximate minimization algorithms for the 0/1 knapsack and subset-sum problem. Operations Research Letters 26, 55–66 (2000) 6. Gene, G., Levner, E.: Complexity of approximation algorithms for combinatorial problems: a survey. ACM SIGACT News 12(3), 52–65 (1980) 7. Han, X., Iwama, K., Zhang, G.: Online Removable Square Packing. Theory Computing Systems 43(1), 38–55 (2008) 8. Han, X., Makino, K.: Online minimization knapsack problem. In: Bampis, E., Jansen, K. (eds.) WAOA 2009. LNCS, vol. 5893, pp. 182–193. Springer, Heidelberg (2010) 9. Han, X., Makino, K.: Online removable knapsack with limited cuts. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 341–351. Springer, Heidelberg (2009) 10. Harren, R.: Approximation algorithms for orthogonal packing problems for hypercubes. Theoretical Computer Science 410(44), 4504–4532 (2009) 11. Horiyama, T., Iwama, K., Kawahara, J.: Finite-State Online Algorithms and Their Automated Competitive Analysis. In: Asano, T. (ed.) ISAAC 2006. LNCS, vol. 4288, pp. 71–80. Springer, Heidelberg (2006) 12. Ibarra, O.H., Kim, C.E.: Fast approximation algorithms for the knapsack and sum of subset problems. Journal of the ACM 22, 463–468 (1975) 13. Iwama, K., Taketomi, S.: Removable online knapsack problems. In: Widmayer, P., Triguero, F., Morales, R., Hennessy, M., Eidenbenz, S., Conejo, R. (eds.) ICALP 2002. LNCS, vol. 2380, pp. 293–305. Springer, Heidelberg (2002) 14. Iwama, K., Zhang, G.: Optimal resource augmentations for online knapsack. In: Charikar, M., Jansen, K., Reingold, O., Rolim, J.D.P. (eds.) RANDOM 2007 and APPROX 2007. LNCS, vol. 4627, pp. 180–188. Springer, Heidelberg (2007) 15. Jansen, K., Zhang, G.: Maximizing the Total Profit of Rectangles Packed into a Rectangle. Algorithmica 47(3), 323–342 (2007) 16. Jansen, K., Solis-Oba, R.: A Polynomial Time Approximation Scheme for the Square Packing Problem. In: Lodi, A., Panconesi, A., Rinaldi, G. (eds.) IPCO 2008. LNCS, vol. 5035, pp. 184–198. Springer, Heidelberg (2008) 17. Kellerer, H., Pferschy, U., Pisinger, D.: Knapsack Problems. Springer, Heidelberg (2004) 18. Lueker, G.S.: Average-case analysis of off-line and on-line knapsack problems. In: Proc. Sixth Annual ACM-SIAM SODA, pp. 179–188 (1995) 19. Marchetti-Spaccamela, A., Vercellis, C.: Stochastic on-line knapsack problems. Math. Programming 68(1, Ser. A), 73–104 (1995) 20. Noga, J., Sarbua, V.: An online partially fractional knapsack problem. In: ISPAN 2005, pp. 108–112 (2005)
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms Ioannis Caragiannis, Christos Kaklamanis, and Maria Kyropoulou Research Academic Computer Technology Institute and Department of Computer Engineering and Informatics University of Patras, 26504 Rio, Greece
Abstract. We consider the frugal coverage problem, an interesting variation of set cover defined as follows. Instances of the problem consist of a universe of elements and a collection of sets over these elements; the objective is to compute a subcollection of sets so that the number of elements it covers plus the number of sets not chosen is maximized. The problem was introduced and studied by Huang and Svitkina [7] due to its connections to the donation center location problem. We prove that the greedy algorithm has approximation ratio at least 0.782, improving a previous bound of 0.731 in [7]. We also present a further improvement that is obtained by adding a simple corrective phase at the end of the execution of the greedy algorithm. The approximation ratio achieved in this way is at least 0.806. Our analysis is based on the use of linear programs which capture the behavior of the algorithms in worst-case examples. The obtained bounds are proved to be tight.
1
Introduction
Set cover is among the most popular combinatorial optimization problems with many applications. In the classical version of the problem, we are given a universe of elements and a collection of sets over these elements and the objective is to compute a subcollection of sets of minimum size that covers all elements. The problem is known to be hard to approximate within sublogarithmic factors [5,12] while the classical greedy algorithm achieves an almost tight approximation ratio of Hn , the n-th harmonic number, where n is the number of elements in the universe [9]. Several variations of the greedy algorithm have been proposed that improve this approximation bound by constant (additive) factors [1,4,10]. A different objective was recently considered by Huang and Svitkina [7]; they call the new combinatorial optimization problem frugal coverage. An instance of frugal coverage consists of a universe of elements and a collection of sets over these elements, and the objective is to compute a subcollection of sets so that the number of elements covered plus the number of sets not chosen is maximized. Without loss of generality, we can assume that each element belongs to at least one set of the input collection. So, the objective can be thought of as computing a subcollection that covers all elements so that the number of sets not chosen plus n (the number of elements in the universe) is maximized. Clearly, an optimal M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 185–195, 2011. c Springer-Verlag Berlin Heidelberg 2011
186
I. Caragiannis, C. Kaklamanis, and M. Kyropoulou
solution for set cover is also an optimal solution for frugal coverage. However, this does not have any direct implication to the approximation guarantee for frugal coverage algorithms. A nice motivation for studying frugal coverage is the problem of locating donation centers (DCL). Instances of DCL consist of a bipartite graph G = (A ∪ L, E). An agent, represented by a node a ∈ A, is connected through an edge e ∈ E to any donation center l ∈ L she would be willing to make a donation. Every agent a has a preference ranking on the corresponding centers, and every donation center l has a capacity, meaning that it can accept at most some specific number of donations. The problem is to decide which centers to open in order to maximize the number of donations, under the restriction that an agent will only donate to her highest ranked open center. Huang and Svitkina [7] present an approximation preserving reduction from frugal coverage to the special case of DCL in which each center has unit capacity and each agent has a degree bound of 2. They also prove that the greedy algorithm has approximation ratio at least 0.731 for both problems. We present a tight analysis of the greedy algorithm. This algorithm, starting from an empty solution, iteratively augments the solution by a set that contains the maximum number of uncovered elements until all elements are covered. We show that its approximation ratio is exactly 18/23 ≈ 0.782, improving the previous bound in [7]. This approximation guarantee can be further improved by adding a simple corrective phase at the end of the execution. Namely, we consider each set in the solution produced that included two uncovered elements when it was selected. If its removal does not leave an element uncovered, we simply remove this set from the solution. The approximation ratio obtained in this way is 54/67 ≈ 0.806. A simple instance shows that this bound is tight. We remark that, even though such a corrective phase can improve the solution obtained by the greedy algorithm with respect to the standard set cover objective, it does not improve the worst-case approximation guarantee. Even though the algorithms we consider are purely combinatorial, our analysis is based on the use of linear programs. The technique can be briefly described as follows. Given an algorithm A, we define a linear program that takes a value f ∈ (0, 1) as a parameter. This linear program witnesses the fact that the algorithm computes an at most f -approximate solution for some instance. The constraints of the LP capture the properties of the algorithm as well as the structure of the corresponding optimal solution. Then, a lower bound of ρ on the approximation ratio of algorithm A follows by showing that the corresponding LP with parameter f = ρ is infeasible. In order to do this, we exploit LP duality. This particular approach was recently proved to be useful for variations of set cover such as spanning star forest and color saving [2]. However, due to the different objective of frugal coverage (and, in particular, the appearance of the number of sets not chosen in the objective function), additional variables (and different constraints) have to be included in the parameterized LPs. Except from variations of set cover [1,11], analysis of combinatorial algorithms through linear programs has also been performed in contexts such as facility location [8],
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms
187
wavelength management in optical networks [3], and the maximum directed cut problem [6]. The use of the LPs in these papers is slightly different than the approach followed here, since the problem objectives allow for LPs that reveal the approximation ratio of the algorithms. We present the analysis of the greedy algorithm in Section 2 and consider its extension with an additional corrective phase in Section 3. We conclude in Section 4.
2
The Greedy Algorithm
We first consider the greedy algorithm (henceforth called GREEDY) which is described as follows. While there is a set that covers at least one uncovered element, choose the set that covers the maximum number of uncovered elements. We show that its approximation ratio for frugal coverage is exactly 18/23 ≈ 0.782. This improves the previous lower bound of 0.732 from [7]. 2.1
The Parameterized LP Lemma
Let f ∈ (0, 1) and consider an instance I = (U, C) of the frugal coverage problem, on which GREEDY computes an at most f -approximate solution. Without loss of generality, we assume that every element of U belongs to at least one set of C. We denote by O the optimal solution of (U, C), i.e., the subcollection of C of minimum size that covers all elements in U. We assume that any set of C belongs either to the optimal solution or is chosen by GREEDY; if this is not the case for the original instance, we can easily transform it to one that satisfies this assumption so that the solution computed by GREEDY is at most f -approximate. The algorithm can be thought of as running in phases, starting from phase k, where k is the size of the largest set in the instance. In each phase i, for i = k, ..., 1, the algorithm chooses a maximal collection of sets, each containing i yet uncovered elements. Let (Ui , Ci ), for i = k, ..., 1, denote the corresponding instance which remains to be solved just before entering phase i of the algorithm. Naturally, Ui consists of the elements in U that have not been covered in previous phases and Ci consists of the sets of C which contain at least one such element. We denote by Oi the sets in O that also belong to Ci . We consider an assignment of all elements to the sets of O so that each element is assigned to exactly one among the sets in O that contains it (if more than one). A set in Oi is called an (i, j)-set if exactly j elements that have not been covered until the beginning of phase i are assigned to it. For the phase i of the algorithm with i = 4, ..., 1, we denote by αi,j the ratio of the number of (i, j)-sets in Oi over the number |O| of optimal sets. Furthermore, let x5 be the ratio of the number of sets in O that are chosen by GREEDY at the phases k, k − 1, ..., 5 over |O|. Also, let xi , for i = 4, ..., 1, denote the ratio of the number of sets in O that are also selected by GREEDY in phase i, over |O|.
188
I. Caragiannis, C. Kaklamanis, and M. Kyropoulou
i By definition, it holds that |Oi | = |O| j=1 αi,j and |Oi | ≤ |O| − 5 |O| j=i+1 xj , for i = 1, ..., 4. Combining these expressions, we get that i
αi,j +
j=1
5
xj ≤ 1.
(1)
j=i+1
We denote by T the ratio |U|/|O|. Our definitions imply that |Ui | = i |O| j=1 jαi,j for i = 1, ..., 4. By the definitions of T and x5 , we have T ≥
4
jα4,j + 5x5 .
(2)
j=1
Clearly, for i = 1, ..., 4, it holds that |Ui \ Ui−1 | = |Ui | − |Ui−1 | ≥ ixi · |O|. We have i
jαi,j ≥
j=1
i−1
jαi−1,j + ixi .
(3)
j=1
Now, consider phase i of the algorithm, for i = 4, 3, 2, and a set chosen by GREEDY during this phase. The i newly covered elements of this set are assigned to at most i sets in Oi . Furthermore, since GREEDY selects a maximal collection of sets in phase i, we know that any set of Oi with i assigned elements intersects some of the sets selected by GREEDY during this phase. This means that the number |Ui \ Ui−1 |/i of sets selected by GREEDY during phase i is at least αi,i |O|/i. We obtain that i
jαi,j −
j=1
i−1
jαi−1,j ≥ αi,i .
(4)
j=1
Now, let SG denote the ratio of the number of sets chosen by GREEDY over |O|. Clearly, GREEDY selects at most |U \ U4 |/5 sets in phases k, k − 1, ..., 5, and exactly |Ui \ Ui−1 |/i sets in phase i, for i = 4, ..., 1. We have that 4 1 1 SG ≤ |U \ U4 | + |Ui \ Ui−1 | /|O| 5 i i=1 ⎛ ⎞ ⎛ ⎞ 4 4 i i−1 1⎝ 1 ⎝ = T− jα4,j ⎠ + jαi,j − jαi−1,j ⎠ 5 i j=1 i=1 j=1 j=1 =
4
i
i=1
j=1
1 1 T+ jαi,j . 5 i(i + 1)
Let OPT(I) denote the benefit of the optimal frugal coverage of I. This naturally corresponds to solution O for (U, C). It holds that 5 OPT(I) = T + SG − xi |O|. i=1
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms
189
Furthermore, let GREEDY(I) denote the profit GREEDY obtains on I. We have that 5 GREEDY(I) = T + 1 − xi |O|. i=1
The assumption that the solution obtained by GREEDY is at most f approximate, i.e., GREEDY(I) ≤ f · OPT(I), implies that ⎛ ⎞ 5 4 i 5 6 1 T +1− xi ≤ f ⎝ T + jαi,j − xi ⎠ . (5) 5 i(i + 1) i=1
i=1
j=1
i=1
By expressing inequalities (1)-(5) in standard form, we obtain our parameterized LP lemma. Lemma 1. If there exists an instance I of the frugal coverage problem for which the greedy algorithm computes a solution of benefit GREEDY(I) ≤ f ·OPT(I) for some f ∈ [0, 1], then the following linear program LP(f ) has a feasible solution. i
5
αi,j +
j=1
xj ≤ 1,
− (i − 1)αi,i −
i−1
jαi,j +
j=1
−
for i = 1, ..., 4
j=i+1
i
jαi,j +
j=1
−T +
i−1
i−1
jαi−1,j ≤ 0,
for i = 2, 3, 4
j=1
jαi−1,j + ixi ≤ 0,
for i = 1, ..., 4
j=1 4
jα4,j + 5x5 ≤ 0
j=1 i
fj 6f )T − αi,j − (1 − f )xi ≤ −1 5 i(i + 1) i=1 j=1 i=1 4
(1 −
αi,j ≥ 0, xj ≥ 0, T ≥0
5
for i = 1, ..., 4 and j = 1, ..., i for j = 1, ..., 5
The proof of the approximation bound is based on the following lemma. Lemma 2. For every f < 18/23, LP(f ) has no feasible solution. Proof. We can assume that LP(f ) is a maximization linear program with objective 0. By duality, if it were feasible, then the optimal objective value of the dual minimization linear program should be 0 as well. We show that this is not the case and that the dual has a solution with strictly negative objective value. This implies the lemma.
190
I. Caragiannis, C. Kaklamanis, and M. Kyropoulou Table 1. The dual of LP(f ) in the proof of Lemma 2
min s.t.
β1 + β2 + β3 + β4 − ζ β1 + γ2 − δ1 + δ2 − ζf /2 ≥ 0 β2 − γ2 + γ3 − δ2 + δ3 − ζf /6 ≥ 0 β2 − γ2 + 2γ3 − 2δ2 + 2δ3 − ζf /3 ≥ 0 β3 − γ3 + γ4 − δ3 + δ4 − ζf /12 ≥ 0 β3 − 2γ3 + 2γ4 − 2δ3 + 2δ4 − ζf /6 ≥ 0 β3 − 2γ3 + 3γ4 − 3δ3 + 3δ4 − ζf /4 ≥ 0 β4 − γ4 − δ4 + η − ζf /20 ≥ 0 β4 − 2γ4 − 2δ4 + 2η − ζf /10 ≥ 0 βi , δi ≥ 0, for i = 1, ..., 4 γi ≥ 0, for i = 2, 3, 4 ζ, η ≥ 0
β4 − 3γ4 − 3δ4 + 3η − ζ3f /20 ≥ 0 β4 − 3γ4 − 4δ4 + 4η − ζf /5 ≥ 0 δ1 − (1 − f )ζ ≥ 0 β1 + 2δ2 − (1 − f )ζ ≥ 0 β1 + β2 + 3δ3 − (1 − f )ζ ≥ 0 β1 + β2 + β3 + 4δ4 − (1 − f )ζ ≥ 0 β1 + β2 + β3 + β4 + 5η − (1 − f )ζ ≥ 0 −η + (1 − 6f /5)ζ ≥ 0
In the dual LP, we use the thirteen variables β1 , β2 , β3 , β4 , γ2 , γ3 , γ4 , δ1 , δ2 , δ3 , δ4 , η and ζ corresponding to the constraints of LP(f ).Variables βi correspond to the first set of constraints (inequality (1)) of LP(f ), variables γi correspond to the second set of constraints (inequality (4)), δi correspond to the third set of constraints (inequality (3)), η corresponds to the next constraint (inequality (2)), and ζ corresponds to the last constraint (inequality (5)). So, the dual of LP(f ) is depicted in Table 1. The solution β1 = f /2 + 1/46, β2 = f /4, β3 = f /3, β4 = 15/46 − f /4, γ2 = f /4, γ3 = f /6, γ4 = 5/46 − f /12, δ1 = 1 − f, δ2 = δ3 = 45/46 − 5f /4, δ4 = 1 − 5f /4, η = 1 − 6f /5 and ζ = 1 satisfies all the constraints. Observe that 15 β1 + β2 + β3 + β4 − ζ = 5f 6 − 23 , which implies that the objective value of the dual program is strictly negative since f < 18 . The lemma follows. 23 Theorem 1. The approximation ratio of the greedy algorithm is at least 18/23. Proof. By Lemmas 1 and 2, we have that for any f < 18/23 and for any instance I of the frugal coverage problem, the greedy algorithm computes a solution of benefit GREEDY(I) > f · OPT(I). Hence, its approximation ratio is at least 18/23. 2.2
The Upper Bound
The instance depicted in Figure 1 proves that our analysis is tight. It consists of 18 elements and 11 sets. GREEDY starts by choosing the 2 horizontal sets of size 3, then it chooses the 3 horizontal sets of size 2, and, finally, it chooses all the vertical sets in order to cover the last 6 elements. Thus, GREEDY uses all 11 sets in order to cover the 18 elements for a profit of 18. The optimal solution consists of the 6 vertical sets of size 3 and has a profit of 23 since it covers the 18 elements without using 5 out of the 11 sets. The upper bound follows.
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms
191
Fig. 1. The tight upper bound for GREEDY
3
Adding a Corrective Phase
In this section we show that an improvement in the performance of GREEDY is obtained by adding a simple corrective phase at the end of its execution. We call the new algorithm GREEDYc and prove that its approximation ratio is exactly 54/67 ≈ 0.8059 for frugal coverage. The definition of the corrective phase is very simple. After the execution of GREEDY, we examine every set s that was chosen during phase 2; if by removing s we still have a cover of the elements, we simply remove s from the solution. 3.1
The Parameterized LP Lemma
We slightly modify the parameterized LP for GREEDY in order to capture the behavior of the corrective phase. We will need some additional definitions. We denote by G2 and G1 the sets included by the algorithm in phases 2 and 1, respectively. A (2, 1)-set of O2 is of type Γ if its uncovered element is included in a set of G2 . A (2, 2)-set of O2 is of type A if both of its uncovered elements are included in sets of G2 and is of type B otherwise. A set of G2 is of type AA if it does not belong to O2 and its newly covered elements (during phase 2) belong to (2, 2)-sets of O2 of type A and is of type kl ∈ {AB, AΓ, BB, BΓ } if its newly covered elements belong to two sets of O2 of types k and l, respectively. A set of G1 is of type Δ if its newly covered element belongs to a (2, 1)-set of O2 . We introduce the variables tAA , tAB , tAΓ , tBB , tBΓ , tΓ Γ , and tΔ to denote the ratio of the number of sets of types AA, AB, AΓ , BB, BΓ , Γ Γ , and Δ over |O|, respectively. We also use variable d to denote the ratio of the number of sets removed during the corrective phase over |O|. The next lemma provides a lower bound on d, which we will use as a constraint in the parameterized LP for GREEDYc . Lemma 3. x1 − tAB − tBB − tBΓ − tΔ − d ≤ 0. Proof. We partition (2, 2)-sets of O2 of type B into two subtypes. Such a (2, 2)ˆ if one of its elements is included in a set of G1 that also belongs set s is of type B ¯ otherwise. Now, we extend the notation tk to denote the to O2 and is of type B ˆ AB, ¯ B ˆ B, ˆ B ˆ B, ¯ B ¯ B, ¯ BΓ, ˆ BΓ ¯ } ratio of the number of sets of G2 of type k ∈ {AB, over |O|.
192
I. Caragiannis, C. Kaklamanis, and M. Kyropoulou
ˆ there exists a set in O1 ∩ G1 (the Observe that for each set s of O2 of type B, one containing the uncovered element of s at the beginning of phase 1) and any other set of O1 ∩ G1 is of type Δ. Hence, x1 ≤ tABˆ + 2tBˆ Bˆ + tBˆ B¯ + tBΓ ˆ + tΔ . Now, observe that the number of sets that will be removed during the corrective ˆ B. ˆ Hence, phase include those of type B d ≥ tBˆ Bˆ ≥ x1 − tABˆ − tBˆ Bˆ − tBˆ B¯ − tBΓ ˆ − tΔ ≥ x1 − tAB − tBB − tBΓ − tΔ ,
as desired.
Variables a1,1 , a2,1 , and a2,2 will not be explicitly used; observe that we can replace them as follows: α1,1 = tAB + 2tBB + tBΓ + tΔ α2,1 = tAΓ + tBΓ + 2tΓ Γ + tΔ , and 3 1 α2,2 = tAA + tAB + tAΓ + 2tBB + tBΓ + x2 . 2 2 The profit GREEDYc (I) is now d|O| more than GREEDY(I), i.e., 5 GREEDYc (I) = T + 1 − xi + d |O|, i=1
while OPT(I) is the same as in the previous section. In this way, we have obtained the following parameterized LP lemma for GREEDYc . Lemma 4. If there exists an instance I of the frugal coverage problem for which GREEDYc computes a solution of benefit GREEDYc (I) ≤ f · OPT(I) for some f ∈ [0, 1], then the linear program LPc (f ) has a feasible solution. tAB + 2tBB + tBΓ + tΔ +
5
xj ≤ 1
j=2
3 3 tAA + tAB + tAΓ + 2tBB + 2tBΓ + 2tΓ Γ + tΔ + x2 + xj ≤ 1 2 2 5
j=3
i
5
αi,j +
j=1
xj ≤ 1,
for i = 3, 4
j=i+1
− 2α3,3 −
2
jα3,j +2tAA +3tAB +2tAΓ + 4tBB + 3tBΓ + 2tΓ Γ + tΔ + 2x2 ≤ 0
j=1
− 3α4,4 −
3 j=1
−
3 j=1
jα4,j +
3
jα3,j ≤ 0
j=1
jα3,j +2tAA +3tAB +2tAΓ + 4tBB + 3tBΓ + 2tΓ Γ + tΔ + 2x2 + 3x3 ≤ 0
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms
−
4
jα4,j +
j=1
−T +
3
193
jα3,j + 4x4 ≤ 0
j=1 4
jα4,j + 5x5 ≤ 0
j=1
x1 − tAB − tBB − tBΓ − tΔ − d ≤ 0 6f f f 5f f 2f (1 − )T − tAA − f tAB − tAΓ − tBB − f tBΓ − tΓ Γ − tΔ 5 3 3 3 3 3 4 i 5 fj 2f − αi,j − (1 − f )xi − (1 − f )x1 − (1 − )x2 + d ≤ −1 i(i + 1) 3 i=3 j=1 i=3 αi,j ≥ 0, for i = 3, 4 and j = 1, ..., i xj ≥ 0, for j = 1, ..., 5 tAA , tAB , tAΓ , tBB , tBΓ , tΓ Γ , tΔ ≥ 0 T ≥0 The proof of the approximation bound is based on the following lemma. Lemma 5. For every f < 54/67, LPc (f ) has no feasible solution. Proof. Similarly to the proof of Lemma 2, we assume that LPc (f ) is a maximization linear program with objective 0. We show that its dual has a solution with strictly negative objective value when f < 54/67. This implies the lemma. To construct the dual of LPc (f ) we use the eleven variables β1 , β2 , β3 , β4 , γ3 , γ4 , δ3 , δ4 , η, μ and ζ corresponding to the constraints of LPc (f ). Variables βi correspond to the constraints in the first three lines of LPc (f ), variables γi correspond to the constraints in the fourth and fifth line, variables δi correspond to the constraints in the sixth and seventh line, and η, μ, and ζ correspond to the three last constraints of LPc (f ), respectively. So, the dual of LPc (f ) is depicted in Table 2. The solution β1 = 41/134, β2 = f /3 + 13/67, β3 = 0, β4 = 31f /108, γ3 = 0, γ4 = f /12, δ3 = δ4 = 1 − 67f /54, η = 1 − 6f /5, ζ = 1 and μ = 1 − f satisfies 1 all the constraints. Observe that β1 + β2 + β3 + β4 − ζ = 67f 108 − 2 , which implies that the objective value of the dual program is strictly negative for f < 54 67 . The lemma follows. The next statement follows by Lemmas 4 and 5. Theorem 2. The approximation ratio of GREEDYc is at least 54/67. 3.2
The Upper Bound
The instance which yields the tight upper bound for GREEDYc consists of 48 elements and 31 sets; see Figure 2. There, the sets selected by GREEDYc are shown, while the optimal solution consists of the 12 vertical disjoint sets of size 4
194
I. Caragiannis, C. Kaklamanis, and M. Kyropoulou Table 2. The dual of LPc (f ) in the proof of Lemma 5
min s.t.
β1 + β2 + β3 + β4 − ζ β2 + 2γ3 + 2δ3 − f3 ζ ≥ 0 β1 + 32 β2 + 3γ3 + 3δ3 − μ − f ζ ≥ 0 3 β + 2γ3 + 2δ3 − f3 ζ ≥ 0 2 2 2β1 + 2β2 + 4γ3 + 4δ3 − μ − 5f ζ≥0 3 β1 + 2β2 + 3γ3 + 3δ3 − μ − f ζ ≥ 0 2β2 + 2γ3 + 2δ3 − f3 ζ ≥ 0 β1 + β2 + γ3 + δ3 − μ − 2f ζ≥0 3 f β3 − γ3 + γ4 − δ3 + δ4 − 12 ζ≥0 β3 − 2γ3 + 2γ4 − 2δ3 + 2δ4 − f6 ζ ≥ 0 β3 − 2γ3 + 3γ4 − 3δ3 + 3δ4 − f4 ζ ≥ 0 βi ≥ 0, for i = 1, ..., 4 γi , δi ≥ 0, for i = 3, 4 ζ, μ, η ≥ 0
f β4 − γ4 − δ4 + η − 20 ζ≥0 f β4 − 2γ4 − 2δ4 + 2η − 10 ζ≥0 3f β4 − 3γ4 − 3δ4 + 3η − 20 ζ ≥ 0 β4 − 3γ4 − 4δ4 + 4η − f5 ζ ≥ 0 μ − (1 − f )ζ ≥ 0 β1 + β2 + 2γ3 + 2δ3 − (1 − 2f )ζ ≥ 0 3 β1 + β2 + 3δ3 − (1 − f )ζ ≥ 0 β1 + β2 + β3 + 4δ4 − (1 − f )ζ ≥ 0 β1 + β2 + β3 + β4 + 5η − (1 − f )ζ ≥ 0 −η + (1 − 6f /5)ζ ≥ 0 −μ + ζ ≥ 0
Fig. 2. The tight upper bound for GREEDYc
(note that only half of them are shown in the figure). Clearly, the profit obtained by GREEDYc is 48 + 6 = 54, while the profit of the optimal solution is at least 48 + 19 = 67, and the upper bound follows. We remark that the corrective phase does not remove any set.
4
Extensions
Our focus in the current paper has been on simple algorithms for frugal coverage. A possible improvement could be obtained by extending the corrective phase so that it considers removing sets included in phases of the greedy algorithm before phase 2. Another sophisticated technique that can probably lead to further improvements has been proposed by Duh and F¨ urer [4] for the set cover problem with sets of bounded size and is known as semi-local optimization. This technique has been proved to be useful in other problems such as color saving and spanning star forest [2,4]. In future work, we plan to extend our analysis to greedy-like algorithms that combine semi-local optimization and corrective phases.
Tight Approximation Bounds for Greedy Frugal Coverage Algorithms
195
References 1. Athanassopoulos, S., Caragiannis, I., Kaklamanis, C.: Analysis of approximation algorithms for k-set cover using factor-revealing linear programs. Theory of Computing Systems 45(3), 555–576 (2009) 2. Athanassopoulos, S., Caragiannis, I., Kaklamanis, C., Kyropoulou, M.: An improved approximation bound for spanning star forest and color saving. In: Kr´ aloviˇc, R., Niwi´ nski, D. (eds.) MFCS 2009. LNCS, vol. 5734, pp. 90–101. Springer, Heidelberg (2009) 3. Caragiannis, I.: Wavelength management in WDM rings to maximize the number of connections. SIAM Journal on Discrete Mathematics 23(2), 959–978 (2009) 4. Duh, R., F¨ urer, M.: Approximation of k-set cover by semi local optimization. In: Proceedings of the 29th Annual ACM Symposium on Theory of Computing (STOC), pp. 256–264 (1997) 5. Feige, U.: A threshold of ln n for approximating set cover. Journal of the ACM 45(4), 634–652 (1998) 6. Feige, U., Jozeph, S.: Oblivious algorithms for the maximum directed cut problem. arXiv: 1010.0406 (2010) 7. Huang, C.-C., Svitkina, Z.: Donation center location problem. In: Proceedings of the 29th IARCS Annual Conference on Foundations of Software Technology and Theoretical Computer Science (FSTTCS), pp. 227–238 (2009) 8. Jain, K., Mahdian, M., Markakis, E., Saberi, A., Vazirani, V.V.: Greedy facility location algorithms analyzed using dual fitting with factor-revealing LP. Journal of the ACM 50(6), 795–824 (2003) 9. Johnson, D.S.: Approximation algorithms for combinatorial problems. Journal of Computer and System Sciences 9, 256–278 (1974) 10. Levin, A.: Approximating the unweighted k-set cover problem: greedy meets local search. SIAM Journal on Discrete Mathematics 23(1), 251–264 (2008) 11. Levin, A., Yovel, U.: Uniform unweighted set cover: the power of non-oblivious local search. Theoretical Computer Science 412(12-14), 1033–1053 (2011) 12. Raz, R., Safra, S.: A sub-constant error-probability low-degree test, and subconstant error-probability PCP characterization of NP. In: Proceedings of the 29th Annual ACM Symposium on Theory of Computing (STOC), pp. 475–484 (1997)
Algorithms for Interval Structures with Applications Danny Z. Chen1,2, and Ewa Misiolek 1
2
Department of Computer Science and Engineering, University of Notre Dame, Notre Dame, IN 46556, USA
[email protected] Mathematics Department, Saint Mary’s College, Notre Dame, IN 46556, USA
[email protected]
Abstract. We present new algorithms for two problems on interval structures that arise in computer-aided manufacturing and in other areas. We give an O(Kn) time algorithm for the single-source K-link shortest path problem on an interval graph with n weighted vertices, and two O(n) time algorithms for a generalized version of the optimal colorspanning problem for n points on a real line, where each point is assigned one of m colors (m ≤ n). A standard approach for solving the K-link shortest path problem would take O(Kn2 ) time, and thus our result offers a linear time improvement. The previously best known algorithm for the optimal color-spanning problem in R1 takes O(n) time and space. We provide two algorithms for a generalized version of this problem in which each color must appear a specified minimum number of times. One of these two solutions is suitable for an online processing of the (streaming) input points; it uses O(m) working space for the ordinary 1-D optimal color-spanning problem.
1
Introduction
In this paper, we present new algorithms for two problems on interval structures that arise in computer-aided manufacturing. (1) We give an O(Kn) time and O(Kn) space algorithm for the single-source K-link shortest path problem on an interval graph with n weighted vertices. (2) We give two O(n) time algorithms for a generalized version of the optimal color-spanning problem with n points in R1 , where each point is assigned one of m colors (m ≤ n). We also present space saving methods for both problems. If only a single actual K-link shortest path is sought, we provide a scheme for reporting such an actual path in O(Kn) time and only O(n) space. For the generalized 1-D optimal color-spanning problem, we develop an O(n) time method that works in an online fashion for processing the (streaming) input points. This method uses O(m) working space for the ordinary 1-D optimal color-spanning problem (m may be much smaller than n
This author’s research was supported in part by the National Science Foundation under Grant CCF-0915203.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 196–207, 2011. c Springer-Verlag Berlin Heidelberg 2011
Algorithms for Interval Structures with Applications
197
in practice). Discussions of the applications of both these problems, as well as other omitted details, can be found in the full version of the paper. A graph G = (V, E) is an interval graph associated with a set I of n intervals on R1 if there exists a one-to-one correspondence between the vertices in V and the intervals in I such that two vertices are adjacent in G if and only if their corresponding intervals intersect. A “path” from Ii to Ij in I is a sequence of intervals in I, (Ii , . . . , Ij ), such that any two consecutive intervals in the sequence intersect. An interval structure arises in the problem of computing a set of feasible toolpaths for a 5-axis NC machine [5]. To find a solution, Chen and Misiolek [5] modeled the problem as a K-link shortest path in a special case of an interval graph with weighted vertices. In [5], the edges are defined only between intervals that overlap at their endpoints, and the single-source K-link shortest path problem on this special interval graph of n vertices is solved in O(Kn). In this paper, we develop an O(Kn) time and space algorithm for the single-source K-link shortest path problem on an arbitrary interval graph with weighted intervals. K-link Shortest Path Problem (K-SP). Given an integer K ≥ 0 and a set of intervals, I = {I1 , . . . , In }, on R1 , where each Ii ∈ I has a weight wi ≥ 0, find a path, denoted SP K (i), from I1 to every interval Ii in I containing at most K + 1 intervals such that SP K (i) has the smallest total weight among all I1 -to-Ii paths with at most K + 1 intervals. Our second problem is motivated by an application in layered manufacturing in which an efficient heuristic for planning a path of a machining tool is needed. In layered manufacturing, a 3-D object is built layer by layer by depositing (or cutting and gluing) the material corresponding to each “slice” (set of pairwisedisjoint contours) of the object. One step in the heuristic [21] searches for a minimum length segment I joining a sequence of contours intersected by a given line L such that I ⊂ L (an “interval” I on L). If all contours are convex, then the problem is obviously easy. However, in real applications, the contours need not be convex, and the intersection of L with a contour may consist of multiple disjoint “intervals”. If each contour is assigned a distinct color, then we obtain a set I of colored intervals on L, for which we want to find a connected interval I of the minimum length that intersects at least one interval in each color. By using only the endpoints of the intervals in I, this problem can be formulated as a color-spanning problem in R1 . We solve the following generalized version of the problem. Generalized Optimal Color-Spanning Problem (G-OCS). Let C = {c1 , . . ., cm } be a set of m distinct colors, G = {k1 , . . . , km } be a set of positive integers, and Q = {q1 , . . . , qn } be a sorted set of n points in R1 , where each point qi is assigned one of the colors in C. Find a shortest connected interval I ⊂ R1 containing at least ki points in Q with the color ci , for each i = 1, . . . , m. We present two different O(n) time algorithms for G-OCS. Both our algorithms are based on a left-to-right “sweeping” of Q. In the first algorithm, each
198
D.Z. Chen and E. Misiolek
point in Q is visited twice (a two-scan method) and is more suitable for an offline processing. In the second algorithm, each point in Q is visited only once (a one-scan method) and is designed for an online processing. In the offline G-OCS, the entire input set Q can be loaded into the main memory, which uses O(n) space. In an online setting, the set Q is not given ahead of time and the points arrive one-by-one in a streaming fashion. When our one-scan method is used for online processing, each arriving point is examined at once and may be discarded immediately (this is not the case in the two-scan solution). Since the one-scan algorithm keeps track of color-related information only, it uses O(m) working space for the ordinary 1-D optimal color-spanning problem (note that m ≤ n and m can be much smaller than n in practice). Both K-SP and G-OCS also appear in other applications and studies. In particular, our K-SP algorithms can be easily extended to circular-arc graphs whose arcs have nonnegative weights.(An interval graph is also a circular-arc graph, but not necessarily vice versa.) Both interval and circular-arc graphs have numerous applications in diverse fields, for example, in time-dependent applications (resource allocation, scheduling, traffic control) and applications in VLSI layout design, compiler design, genetics, archeology, and psychology [12,20]. It is important to note that in most interval graph algorithms (e.g., [2,13,17]), it is assumed that an interval model I is given and the intervals in I are sorted according to their endpoints. We also make this assumption in this paper. Atallah et al. [2] gave an O(n) time algorithm for finding a shortest path in a vertex-weighted interval graph. Ravi et al. [19] obtained an O(n2 ) time algorithm for computing all-pairs shortest paths in an unweighted interval graph. Chen et al. [4] developed an algorithm, which, after an O(n) time preprocessing, reports the shortest path length between any two query vertices in an unweighted interval graph in O(1) time and an actual shortest path in O(L) time, where L is the size of the output path. A standard method yields an O(K(n+e)) time algorithm for the single-source K-link shortest path problem on a general graph with n vertices and e edges. Since an interval graph can have O(n2 ) edges, such an algorithm takes O(Kn2 ) time in the worst case. To our best knowledge, we present the first O(Kn) time algorithm for the single-source K-link shortest path problem on a general interval graph and circular-arc graphs with weighted vertices. We use a dynamic programming approach which exploits some special properties of K-link shortest paths on such interval/circular-arc graphs. Our algorithm is very simple, and, unlike some previous shortest path solutions on interval graphs (e.g., [2,4]), avoids using any sophisticated data structures. Various color-spanning problems have been studied in computational geometry (e.g., see [9,10,14,15,18,16]) and find many applications, e.g., residence location for n facilities of m types, spatiotemporal databases, statistical clustering, pattern recognition and learning, geographical tagging, etc. Fleischer and Xu [11] gave polynomial time algorithms for finding a minimum diameter color-spanning set using the L1 or L∞ metric and proved that the problem is NP-hard for all Lp with 1 < p < ∞. They also provided an O(1)-approximation algorithm for
Algorithms for Interval Structures with Applications
199
the latter cases. Daescu et al. [6] proved the NP-completeness of a minimum color-spanning tree problem and the minimum diameter convex hull problem of n points with m colors. For the minimum diameter convex hull problem, they also gave an approximation solution. Abellanas et al. [1] and Das et al. [7,8] studied the problem of finding a smallest color-spanning corridor or a color-spanning polygon. In particular, Das et al. [8] provided an O(n) time algorithm for finding a narrowest vertical color-spanning corridor by projecting the n points in 2-D onto the x-axis, which is the 1-D version of the problem. In the manufacturing setting, the optimal color-spanning problem in R1 was studied by Tang and Pang [21], who gave an O(n2 ) time solution.
2
The Single-source K-link Shortest Path Problem on Interval Graphs
We are given a set of n intervals, I = {I1 , . . . , In }, on R1 , where each interval Ii = [ai , bi ] has a weight wi ≥ 0 and the intervals in I are ordered so that b1 < b2 < · · · < bn . We let I1 be the “source interval”. The case with a different source Ii can be handled easily by using two instances of the K-SP problem. Without loss of generality, we assume that the endpoints of the intervals are all distinct, and the union of the intervals in I covers the whole interval [a1 , bn ] (i.e., the graph is connected). We also assume that wi > 0 for each i = 1, . . . , n. This is only for simplicity of exposition; our algorithm can be modified for the case when some intervals have a weight 0 without affecting its asymptotic time bound. We focus on showing how to compute the weights of the K-link shortest paths instead of the actual paths. The actual paths can be easily obtained by a standard modification of our algorithm without increasing the asymptotic time bound. 2.1
Some Useful Structures of K-link Shortest Paths in I For any integer k, with 0 ≤ k ≤ K, let Wk (i) = j,Ij ∈SP k (i) wj denote the total weight of a k-link shortest I1 -to-Ii path SP k (i). We use a path weight of ∞ to indicate that a path does not exist. The following simple dynamic programming relation can be used to compute the weights (paths) of k-link shortest paths, for i = 1, . . . , n and k = 0, . . . , K. ⎧ ⎪ ⎨w1 Wk (i) = ∞ ⎪ ⎩ min{Wk−1 (j) : j = i, Ij ∩ Ii = ∅} + wi
if i = 1 and 0 ≤ k ≤ K, (1) if 2 ≤ i ≤ n and k = 0, if 2 ≤ i ≤ n and 1 ≤ k ≤ K.
Using (1), the weights can be computed iteratively, such that the k-link paths are computed from the (k − 1)-link paths. The sought K-SP solution is the set of weights WK (i) (paths SP K (i)), for all i = 1, . . . , n. A straightforward computation may take O(n) time to compute each Wk (i), since Ii can intersect
200
(a)
D.Z. Chen and E. Misiolek
(b)
(c)
Fig. 1. (a) A set of intervals I = {I1 , . . . , I6 } with weights as labeled. (b) After the first iteration: I1 = {I1 , I2 , I3 , I6 }, U1 = {I1 , I3 , I6 }, W1 = {1, 4, 3, ∞, ∞, 7}. (c) After the second iteration: I2 = {I1 , I2 , I3 , I4 , I5 , I6 }, U2 = {I1 , I3 , I4 , I6 }, W2 = {1, 4, 3, 5, 8, 7}.
O(n) other intervals. By exploiting some useful structures of k-link shortest paths in I, we will show how to compute each Wk (i) in O(1) time. Let Ik = {Ik1 , . . . , Ikt } ⊆ I be the subset of intervals in I such that there is a k-link shortest path in I to each interval of Ik . Assuming that Ik and the weights of the k-link shortest paths for the intervals in Ik are already computed, our goal is to efficiently find Ik+1 and the weights of the (k + 1)-link shortest paths for all intervals in Ik+1 . To efficiently compute Wk+1 (i) for Ii , a key is to quickly identify the intervals in Ik that intersect with Ii and, more importantly, select the interval Ip , the predecessor of Ii on SP k+1 (i), with the smallest weight Wk (p). We start with some very basic properties of k-link shortest paths in I. Lemma 1. Suppose Wk (i) < ∞ for some 0 ≤ k ≤ K. Then the following properties hold: 1. 2. 3. 4.
The union of the intervals on SP k (i) covers the interval [a1 , bi ]. Wk (i) ≥ Wk+1 (i) ≥ · · · ≥ WK (i). For any Ih ∈ SP k (i), h = i, Wk (h) < Wk (i). For k > 0, if SP k (i) = SP k−1 (p) ∪ Ii , then ap < ai < bp .
Suppose we maintain the sorted order of the intervals in Ik , based on their right endpoints. By Property 4 of Lemma 1, to compute Wk+1 (i), the search in Ik for a correct predecessor Ip of Ii on SP k+1 (i) can be limited to only those intervals that contain ai . For example, in Fig.1, I1 = {I1 , I2 , I3 , I6 } and to compute W2 (4), we identify I2 , I3 , and I6 in I1 as those that contain a4 . However, the desired predecessor (I3 ) is not readily identifiable without comparing the weights of the 1-link shortest paths for these three intervals. Clearly, this method is not sufficient for identifying the correct predecessor in O(1) time. To speed up the search, we remove from consideration the intervals that cannot contribute to any (k + 1)-link shortest path. Definition 1. An interval Ij ∈ Ik is (k + 1)-useless if for all Ii ∈ I such that Ii ∩ Ij = ∅, Wk+1 (i) < Wk (j) + wi . Otherwise, Ij is said to be (k + 1)-useful. In other words, an interval Ij ∈ Ik is (k + 1)-useless if it cannot be a predecessor of the last interval on any (k + 1)-link shortest path. For example, in Fig.1(a), the interval I2 is 2-useless since the weights of all 2-link paths with I2 as the penultimate interval are larger than the weights of the corresponding shortest 2-link paths. Some (not all) of the (k + 1)-useless intervals can be identified using the following rule.
Algorithms for Interval Structures with Applications
201
Lemma 2. For Ig , Ih ∈ Ik , bg < bh , if Wk (g) > Wk (h), then Ig is (k + 1)useless. We can remove easily from Ik the (k+1)-useless intervals identified using Lemma 2: we scan Ik from the last to the first interval and remove any interval whose path weight satisfies the condition Lemma 2. Let Uk = {Iu1 , . . . , Ius } ⊆ Ik , s ≤ t, be the set of (sorted) intervals left after removing from Ik the (k + 1)-useless intervals identified using Lemma 2. It is important to note, that the removal of the (k + 1)-useless intervals from Ik using Lemma 2 does not disconnect the interval [a1 , bkt ]. Lemma 3. The union of the intervals in Uk covers the interval [a1 , bkt ]. Finally, the following observation is the basis for our algorithm. Lemma 4. For any Ii = [ai , bi ] ∈ I, if there is Ij = [aj , bj ] ∈ Uk such that bj = min{bt : ai < bt , It ∩ Ii = ∅, It = [at , bt ] ∈ Uk },
(2)
then Wk+1 (i) = Wk (j) + wi . If for all [at , bt] ∈ Uk , bt < ai , then Ii does not have a (k + 1)-link shortest path in I. Given Uk , to find the predecessor Ip for Ii , we search in Uk for the interval with the smallest right endpoint that is larger than ai . For example, in Fig.1(b), to compute W2 (4) we use Lemma 4 to identify I3 ∈ U1 as the predecessor of I4 on SP 2 (4) since b3 satisfies (2) in Lemma 4. When the right endpoints of the intervals in Uk are in a sorted order, such a search can be efficient. 2.2
The O(Kn) Time K-SP Algorithm
The algorithm consists of K iterations. Based on the relations of (1), we initialize U0 = I0 = {I1 } and W0 (1) = {w1 }. Then in the (k + 1)-th iteration, for k = 0, . . . , K −1, given Uk and the weights of the k-link shortest paths to the intervals in Uk , we compute Uk+1 and the weights of the (k + 1)-link shortest paths to the intervals in Uk+1 . Let the array Ak store the right endpoints of the intervals of Uk in increasing order, and the array Wk store the weights of the k-link shortest paths to all intervals of I. In the (k + 1)-th iteration, we initialize Ak+1 to contain I1 only. Then, to compute new (k + 1)-link shortest paths, we apply Lemma 4 to each interval Ii , i = 2, . . . , n. Thus, we perform the following computation on each Ii . 1. Using the left endpoint ai of Ii , search in Ak to find the smallest bj such that ai < bj . 2. If no such bj is found, then Ii does not intersect with any interval in Uk and hence does not have a (k + 1)-link shortest path. 3. If bj is found, then let Wk+1 (i) = Wk (j) + wi , and put bi in Ak+1 and Wk+1 (i) in Wk+1 .
202
D.Z. Chen and E. Misiolek
After all intervals in I are processed, Ak+1 contains Ik+1 . We prune Ak+1 to retain only Uk+1 needed for the next iteration: We scan Ak+1 in the reverse order and remove from Ak+1 the entry for any interval not in Uk+1 . If k = K − 1, then Ak+1 = AK contains the solution for K-SP. Since Ak is a sorted array, each search for bj in Ak using ai takes O(log n) time, and O(n) such operations are performed in each iteration. Thus, it takes O(n log n) time to compute Ak+1 (and Ik+1 ). The removal of the (k + 1)-useless intervals from Ik+1 in Ak+1 to produce Uk+1 takes O(n) time. Hence each iteration takes O(n log n) time. However, we can compute bj for Ii , for all i = 2, . . . , n, in altogether O(n) time, as follows. The right endpoints in Ak are in sorted order. Since the intervals in I are given in sorted order, we extract their left endpoints and put them into an array B (in sorted order). We then merge Ak and B. From the merged sorted list it is easy to find, for each Ii , the desired bj . This process clearly takes O(n) time in each iteration. The algorithm has K iterations. Thus, the time bound of the algorithm is O(Kn). Since a K × n table is needed for reporting actual K-link shortest paths, the algorithm requires O(Kn) space. However, if a problem seeks only one actual K-link shortest path, then we can apply the space-saving techniques of Chen et al. [3] to reduce the space bound to O(n) still using O(Kn) time. The details are given in the full version of the paper.
3
The Generalized Optimal Color-Spanning Problem
A connected interval IC will be called a color-spanning interval (CSI) for Q if it that contains at least ki points in Q with the color ci , for each i = 1, . . . , m. A minimal color-spanning interval (MCSI) for Q, IM , is a color spanning interval for Q that contains no proper color-spanning interval for Q. 1 k Let M = {IM , . . . , IM } be the set of all minimal color-spanning intervals for Q. A solution to G-OCS, an optimal color-spanning interval, is a shortest interval among those in M. To solve G-OCS, we find all intervals in M and select the shortest one. To do so efficiently, we establish some useful properties of the set M and of individual minimal color-spanning intervals. Lemma 5. The minimal color-spanning intervals in M form a strictly mono1 k tonically increasing sequence (IM , . . . , IM ), such that a1M < a2M < · · · < akM
and
b1M < b2M < · · · < bkM .
(3)
In Fig.2(a), Q contains ten points in three colors. The intervals in M (marked by the solid segments) form a strictly monotonically increasing sequence. To prove useful properties of individual minimal color-spanning intervals, we introduce additional notation. Suppose P = {p1 , . . . , pk } is a subset of k points in Q. Let cpi denote the color of a point pi , and cj P denote the number of occurrences of the color cj in the set P. Using this notation, cpi P denotes the number of occurrences, in P, of the color assigned to the point pi . The following lemma gives some characteristics of each MCSI and, together with Lemma 5, forms a basis for our algorithm.
Algorithms for Interval Structures with Applications
(a)
(b)
203
(c)
Fig. 2. The different colors are indicated by different shapes. (a) The solid segments indicate the intervals in M (ki = 1, for all i). (b) The dashed segment marks the first CSI, the solid segment marks the first MCSI (ki = 1, for all i). (c) Dashed segments marks 2 rightmost occurrences of each color; the solid segment marks the MCSI (ki = 2, for all i).
Lemma 6. Let I = [a, b] ⊂ R1 be an interval and P = {p1 , . . . , pk }, k ≥ 0, be such that P = Q ∩ I. The interval I = [a, b] is a minimal color-spanning interval for Q if and only if all three of the following properties hold (referred to as Property 1, 2, and 3 of MCSI): 1. a = p1 and b = pk ; 2. cj P ≥ kj for all j = 1, . . . , m; 3. cp1 P = kp1 and cpk P = kpk . For example, observe that the MCSIs in Fig.2(a) are the only subintervals that satisfy all three properties. 3.1
The Two-Scan G-OCS Algorithm
The two-scan G-OCS algorithm performs a left-to-right “sweeping” of Q and uses Lemmas 5 and 6 to identify all intervals in M. The shortest of the intervals in M is a solution to G-OCS. During the sweeping, we maintain a working interval, I ∗ = [a∗ , b∗ ], whose each endpoint steps through the points in Q. Since both the endpoints of I ∗ scan Q, we call this method a two-scan method. The working interval I ∗ moves from left to right. We first advance the right endpoint b∗ , until I ∗ becomes a color-spanning interval (e.g., see the dashed segment in Fig.2(b)), and then we advance the left endpoint a∗ , until I ∗ becomes a minimal color-spanning interval (e.g., see the solid segment in Fig.2(b)). This process is repeated until all points of Q are visited. Lemma 5 justifies this sweeping process and the properties in Lemma 6 provide the criteria for identifying the MCSIs. Each time we find an MCSI, we compare its length with the length of the shortest MCSI discovered so far. To satisfy Property 1 of MCSI in Lemma 6, the endpoints of I ∗ always coincide with some points in Q. To verify whether I ∗ satisfies Properties 2 and 3 of MCSI, we use m counters f1 , . . . , fm to keep track of the cardinality of each of the m colors within I ∗ . More precisely, each fi specifies how many points in color ci need to be added to I ∗ to satisfy Property 2. If fi ≤ 0, then no more points in color ci are needed. Initially, when I ∗ = ∅, fi = ki for each i = 1, . . . , m. When we advance b∗ , say, to a point qi , its color cqi is “added” to I ∗ . We then decrement the counter for the color cqi by 1. Similarly, when we advance a∗ , say, from qi to qi+1 , its color cqi is “removed” from I ∗ . We then increment the counter for cqi by 1. Whenever a color counter reaches 0, the corresponding
204
D.Z. Chen and E. Misiolek
color is represented in I ∗ by the required number of points; if a color counter is negative, then the number of points with the corresponding color is larger than required. To ensure that all colors are properly represented in I ∗ , we use another counter, F0 . F0 keeps track of the number of colors that still need representations in I ∗ , and hence the value of F0 is the number of color counters with positive values. Initially, when I ∗ = ∅, F0 = m. During the algorithm, whenever one of the color counters drops to 0, the value of F0 is decreased by 1. When the value of F0 drops to 0, I ∗ contains at least ki points with the color ci for every i = 1, . . . , m. Whenever one of the color counters goes from 0 to 1, the value of F0 is increased by 1. Finally, to solve G-OCS, we repeatedly advance the right endpoint b∗ of I ∗ to the next point in Q, decrease the color counters for the colors added to I ∗ , and update F0 , until either a CSI is found or b∗ reaches the last point in Q. A CSI is found when F0 = 0. When a CCI is found, and if fca∗ < 0, then we repeatedly advance a∗ along the points in Q and increase the counters for the colors that leave I ∗ , until fca∗ = 0. When F0 = 0 and fca∗ = 0, we found an MCSI. For example, the first dashed segment in Fig.2(b) indicates the first CSI discovered by the algorithm, but since f = −1 < 0, it is not an MCSI. We then record the length, L, of this newly found MCSI and compare it with the best length L found so far. If not all points in Q have been visited by I ∗ , we then search for the next MCSI. By Lemma 5, the next MCSI in the sequence of MCSIs in M will have a larger left endpoint. Therefore, we advance a∗ to the next point in Q. Note that as soon as a∗ advances to the next point in Q, the counter for the color of the departed a∗ increases and becomes positive and F0 increases to 1, hence, I ∗ ceases to be a CSI for Q. For example, in Fig.2(b), when we advance from the left endpoint of the first MCSI (the first solid segment), the counter f• = 1. We repeat the above steps to search for the remaining MCSIs. The correctness of the above algorithm for G-OCS follows from Lemma 6 and the following result. Lemma 7. The algorithm correctly identifies all the minimal color-spanning intervals in M. Since the algorithm visits every point in Q exactly twice (by b∗ and a∗ ), performing O(1) computation on each visited point, it solves the G-OCS problem in O(n) time. If the input points of Q come in a streaming fashion, then O(n) working space is used by this algorithm to keep the points first visited by b∗ for the second visit by a∗ . Note that our algorithm for G-OCS can be easily modified to solve an even more general optimal color-spanning problem. In this more general version, for a specified integer K with 1 ≤ K ≤ m, it is sufficient to have any K of the m colors represented in a feasible (or optimal) interval I such that the frequencies of these K colors all satisfy the frequency requirements of G (i.e., if ci is among the K colors, then it must be represented in I by at least ki points). Only a small modification of our algorithm for G-OCS is needed to solve this more general version. In fact, the only change needed is to initialize the value of the counter F0
Algorithms for Interval Structures with Applications
205
to K instead of m (for the number of positive color counters). This generalized algorithm clearly takes O(n) time. 3.2
The One-Scan G-OCS Algorithm
We now present a refined, one-scan solution to the generalized color-spanning problem G-OCS. This method is especially designed for an online version of the problem, in which the set Q is not given ahead of time and instead the points of Q arrive one-by-one in a streaming fashion. The algorithm still takes O(n) time. It uses only O(m) (instead of O(n)) working space for the ordinary 1-D optimal color-spanning problem. Note that m can be much smaller than n in practice. Comparing with the two-scan algorithm, in this one-scan method, only the right endpoint b∗ of the working interval I ∗ scans the points. When a CSI is found, to identify the MSCI contained in this CSI, the position of the left endpoint a∗ of I ∗ for the sought MSCI is determined in O(1) time without the point-by-point scan by a∗ as in the two-scan version. The following observation is needed for this solution. Suppose an interval [a, b] is a CSI found using the G-OCS algorithm and [a , b] ⊆ [a, b] is an MCSI found next. Note that a = a if and only if fca < 0, i.e., the number of occurrences of the color ca in [a, b] exceeds the required minimum value kca (i.e., Property 3 of MCSI is not satisfied). To find a , using the twoscan G-OCS algorithm, the left endpoint of the interval [a, b] is advanced (and points are removed) until fca = 0 (then a = a). Observe that a is the first (or leftmost) point in [a, b] such that the cardinality of its color in [a , b] matches the minimum required. For example, Fig.2(c) shows a CSI for three colors (marked by different shapes) with k1 = k2 = k3 = 2 and the dashed segments indicate the ki = 2 rightmost occurrences of each color in the CSI. Then, the left endpoint of the sought MCSI (the solid segment) corresponds to the leftmost point in the union of the points covered by the dashed segments. Hence, to locate a in O(1) time, for each color ci , we need to maintain the locations of the ki rightmost occurrences of ci in [a, b] as well as the leftmost point in the union U of all those points. This can be done in the following way. The union U of the (at most) ki rightmost occurrences of each color ci in [a, b] is maintained using a linked list UL. As in the two-scan method, we scan one-by-one, from left-to-right, the points in Q (or examine the points one-by-one as they arrive in the online version of the problem), until a CSI is found. For each newly scanned point, we attach a new record to the end of the linked list UL. This corresponds to the advancement of the right endpoint b∗ of the working interval I ∗ in the two-scan method. If the newly added record corresponds to a color ci for which there are already ki points in I ∗ , then in O(1) time, we locate (as explained below) and remove from UL the current leftmost occurrence of ci in UL. This process guarantees that the order of the records in UL corresponds to the sorted order of the points in Q and that UL contains no more than ki rightmost occurrences of each color. Clearly, the head of the list UL always contains the leftmost point of the union U .
206
D.Z. Chen and E. Misiolek
To efficiently locate in UL a (leftmost) record for any color that needs to be removed, we maintain, for each color ci , a linked list CLi that contains pointers to all the (at most ki ) records for ci in UL. We maintain each CLi as follows. The head record of CLi holds a pointer to the leftmost record for ci in UL and the size of CLi never exceeds ki . We keep track of the size |CLi | of CLi . Every time we modify UL, one of the CLi ’s is modified as well. Recall that when a point with a color ci is scanned, its record is immediately attached to the end of UL. To maintain this location, a pointer to this new UL record is attached to the end of the list CLi for the color ci . To determine whether a record for ci must also be removed from UL, we check the size of CLi . If |CLi | ≤ ki , then no record needs to be removed from UL. If |CLi | > ki , then both UL and CLi are further modified. We first use the pointer stored in the head of CLi to locate the leftmost occurrence of ci in UL and remove this record from UL. Then, we remove the head record of CLi (to keep only the current ki rightmost occurrences of ci in CLi ). m When the number of records in UL becomes exactly equal to j=1 kj , a CSI is found. Then, to obtain the MCSI in that CSI, we simply shift the left endpoint of the current CSI to the point stored in the head of UL. This takes O(1) time and without the need to perform a second scan by the left endpoint a∗ of I ∗ . As before, we compare the length of the newly found MCSI with the smallest MCSI obtained so far (in the online version, a new smallest MCSI is output). To begin the search for the next CSI, we simply remove the head record of UL and the head record of the corresponding CLi . We proceed by scanning/adding points from Q until the next CSI is found or Q contains no more points. Our one-scan algorithm visits each point of Q once, performing O(1) computation on each visited point. Hence, mit solves the G-OCS problem in O(n) time. Since UL contains no more than j=1 kj records and the total sum of the sizes m of the CLi lists is no bigger than O( j=1 kj ), the working space used by the m one-scan algorithm is O( i ki ). Note that in general, m j=1 kj ≤ n (unless the problem instance is not feasible). For the ordinary 1-D optimal color-spanning problem (with ki = 1 for all i = 1, . . . , m), the one-scan solution uses only O(m) working space.
References 1. Abellanas, M., Hurtado, F., Icking, C., Klein, R., Langetepe, E., Ma, L., Palop, B., Sacristan, V.: Smallest color-spanning objects. In: Proceedings of the 9th Annual European Symposium, pp. 278–289 (2001) 2. Atallah, M.J., Chen, D.Z., Lee, D.T.: An optimal algorithm for shortest paths on weighted interval and circular-arc graphs, with applications. Algorithmica 14(5), 429–441 (1995) 3. Chen, D.Z., Daescu, O., Hu, X., Xu, J.: Finding an optimal path without growing the tree. Journal of Algorithms 49(1), 13–41 (2003) 4. Chen, D.Z., Lee, D.T., Sridhar, R., Sekharan, C.N.: Solving the all-pair shortest path query problem on interval and circular-arc graphs. Networks 31(4), 249–257 (1998)
Algorithms for Interval Structures with Applications
207
5. Chen, D.Z., Misiolek, E.: Computing feasible toolpaths for 5-axis machines. In: Proceedings of the 4th Annual International Conference on Combinatorial Optimization and Applications - Volume Part I, pp. 270–284 (2010) 6. Daescu, O., Ju, W., Luo, J.: NP-completeness of spreading colored points. In: Proceedings of the 4th Annual International Conference on Combinatorial Optimization and Applications, pp. 41–50 (2010) 7. Das, S., Goswami, P.P., Nandy, S.C.: Recognition of minimum width color-spanning corridor and minimum area color-spanning rectangle. In: Proceedings of the 11th International Conference on Computational Science and Its Applications, pp. 69–79 (2005) 8. Das, S., Goswami, P.P., Nandy, S.C.: Smallest color-spanning object revisited. International Journal of Computational Geometry and Applications 19(5), 457– 478 (2009) 9. de Berg, M., Gudmundsson, J., Katz, M.J., Levcopoulos, C., Overmars, M.H., van der Stappen, A.F.: TSP with neighborhoods of varying size. Journal of Algorithms 57, 22–36 (2005) 10. Elbassioni, K., Fishkin, A.V., Mustafa, N.H., Sitters, R.: Approximation algorithms for euclidean group TSP. In: Proceedings of the 32nd International Colloquium on Automata, Languages and Programming, pp. 1115–1126 (2005) 11. Fleischer, R., Xu, X.: Computing minimum diameter color-spanning sets. In: Proceedings of the 4th International Conference on Frontiers in Algorithmics, pp. 285–292 (2010) 12. Golumbic, M.C.: Algorithmic Graph Theory and Perfect Graphs. Annals of Discrete Mathematics, vol. 57. North-Holland Publishing Co., Amsterdam (2004) 13. Hsu, W.-L., Tsai, K.-H.: Linear time algorithms on circular-arc graphs. Information Processing Letters 40(3), 123–129 (1991) 14. Mitchell, J.S.B.: A PTAS for TSP with neighborhoods among fat regions in the plane. In: Proceedings of the 18th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 11–18 (2007) 15. Mount, D.M., Netanyahu, N.S., Silverman, R., Wu, A.Y.: Chromatic nearest neighbor searching: a query sensitive approach. Computational Geometry: Theory and Applications 17, 97–119 (2000) 16. Mukhopadhyay, A., Kumar, C., Greene, E., Bhattacharya, B.: On intersecting a set of parallel line segments with a convex polygon of minimum area. Information Processing Letters 105, 58–64 (2008) 17. Natarajan, S., Sprague, A.P.: Disjoint paths in circular arc graphs. Nordic Journal of Computing 3(3), 256–270 (1996) 18. Rappaport, D.: Minimum polygon transversals of line segments. International Journal of Computational Geometry and Applications 5(3), 243–256 (1995) 19. Ravi, R., Marathe, M.V., Rangan, C.P.: An optimal algorithm to solve the all-pair shortest path problem on interval graphs. Networks 22, 21–35 (1992) 20. Roberts, F.S.: Graph Theory and Its Applications to Problems of Society. Society for Industrial Mathematics (1978) 21. Tang, K., Pang, A.: Optimal connection of loops in laminated object manufacturing. Computer-Aided Design 35(11), 1011–1022 (2003)
Single Machine Scheduling with an Operator Non-availability Period to Minimize Total Completion Time Yong Chen, An Zhang, and Zhiyi Tan Department of Mathematics, State Key Lab of CAD & CG, Zhejiang University, Hangzhou 310027, P.R. China
[email protected]
Abstract. This paper considers the single machine scheduling problem with an operator non-availability period. The operator non-availability period is an open time interval in which a job may neither start nor complete. The objective is to minimize the total completion time. The problem is NP-hard. We present an algorithm with a tight worst-case ratio of 20/17.
1
Introduction
In this paper, we consider a single machine scheduling problem with an operator non-availability period. The operator non-availability period is an open time interval in which a job may neither start nor complete. However, a job can be started before the operator non-availability period, and be completed after the operator non-availability period. Such job is called a crossover job. The problem was recently proposed by Brauner et al. [2] and has applications in chemical experiments scheduling. An operator has to be present when an experiment starts and completes, and may be absent during the long time experiment. However, there may be time intervals when the operator is not available due to other activities and vacations. To conform with the standard scheduling terminology, we view experiments as jobs and these time intervals as operator non-availability periods. A strongly related problem is scheduling with machine non-availability periods. Machine non-availability periods arise from maintenance requirements, breakdowns, or other constraints occur that cause the machines not to be available. Machine non-availability periods differ from operator non-availability period in that no job can be processed during the machine non-availability periods. If a job cannot be finished before the machine non-availability period, it has to restart after the machine becomes available again [6]. In other words, no crossover job can exist. Operator non-availability periods can be viewed as a generalization of machine non-availability periods. When the processing times of jobs are
Corresponding author. Supported by Natural Science Foundation of China (10971191, 60021201) and Fundamental Research Funds for the Central Universities (2010QNA3040).
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 208–219, 2011. c Springer-Verlag Berlin Heidelberg 2011
Scheduling with an Operator Non-availability Period
209
all less than the length of the operator non-availability period, no job can be the crossover job. Thus the operator non-availability period has the same effect as the machine non-availability period. For the single machine scheduling problem with machine non-availability periods to minimize makespan, Lee [6] proved that the problem is NP-hard even if there is only one machine non-availability period, and LP T (Longest Processing Time first) has a tight worst-case ratio of 43 . If there are multiple machine nonavailability periods, no polynomial time approximation algorithm with constant worst-case ratio exists unless P = N P [3]. The study on the problem with objective to minimize the total completion time is much more harder. Similarly, we assume that there is only one machine non-availability period. The problem is NP-hard [1,7], and the worst-case ratio of algorithm SP T (Shortest Processing Time first) is 97 [7]. Later, Sadfi et al. [8] proposed an improved algorithm, which has a worst-case ratio of 20 17 . By using complicated techniques, Kellerer et al. [5] and Kacem et al. [4] independently obtained an FPTAS. Brauner et al. [2] considered the single machine scheduling problem with operator non-availability period to minimize makespan. If there is only one operator non-availability period, the problem is NP-hard and there exists an FPTAS. If there are K operator non-availability periods and the length of each operator non-availability period is no more than 1/λ times the total processing time of all jobs, they showed the greedy-like algorithm has a worst-case ratio of no more than 1 + 2K λ . They further designed an approximation algorithm with worst-case ratio arbitrary close to 2 + K−1 . Moreover, no polynomial time approximation λ algorithm with worst-case ratio smaller than 1 + K−1 exists unless P = N P . λ To the authors’ knowledge, no paper considered the problem with objective to minimize the total completion time. In this paper, we focus on the single machine scheduling problem with an operator non-availability period. The objective is to minimize the total completion time. We show that the worst-case ratio of SP T is at least 53 . Then we propose an improved algorithm with a tight worst-case ratio of 20 . 17 The paper is organized as follows. In Section 2, we give description of the problem and our algorithm. In Section 3, we present some preliminary results. The worst-case ratio of the algorithm is proved in Section 4.
2
Problem and Algorithm
Let J = {J1 , J2 , · · · , Jn } be the set of n independent jobs. Jobs are available at time 0, and no preemption is allowed. The processing time of job Jj is pj . W.l.o.g., we assume that the jobs are indexed according to the non-decreasing order of processing times, i.e., p1 ≤ p2 ≤ · · · ≤ pn . For J0 ⊆ J , let P (J0 ) be the total processing time of jobs in J0 . For nany schedule π, let Cj (π) be the completion time of Jj in π, and F (π) = j=1 Cj (π) be the total completion time of π. Let (b, a) be the operator non-availability period on the machine, nΔ = a − b be the length of operator non-availability period. We assume that j=1 pj > b. Otherwise, the operator non-availability period makes no sense.
210
Y. Chen, A. Zhang, and Z. Tan
Since scheduling problems with operator non-availability periods contain problems with machine non-availability periods as special case, the problem considered in this paper is clearly NP-hard. Therefore, we concentrate on the design and analysis of approximation algorithms. If pj < Δ for any j, no job can be the crossover job in any schedule. The algorithm given in [8] already has a worst-case ratio of 20 17 . Thus we assume pn = max1≤j≤n pj ≥ Δ in the following. SP T is the classical algorithm for scheduling problems with objective to minimize total completion time. Here SP T sequences jobs in the non-decreasing order of processing times. For the single machine scheduling problem with an machine non-availability period, the worst-case ratio of SP T is 97 [7]. However, the following instance show that the worst-case ratio of SP T for our problem is at least 53 . Instance 1: Let the operator non-availability period be (2, N + 2). The processing time of three jobs are 1, N −1 and N +1−, respectively, where is a sufficiently small positive number. In the schedule π0 produced by SP T , J1 , J2 and J3 are started at time 0, N +2 and 2N +1, respectively. Thus F (π0 ) = 5N +4+. In the optimal schedule π ∗ , J1 , J3 and J2 are started at time 0, 1 and N + 2 + , (π0 ) 5N +4+ 5 respectively. Thus F (π ∗ ) = 3N + 4 + 2. Hence, FF (π ∗ ) = 3N +4+2 → 3 (N → ∞). In the schedule π0 , no job can be processed during the operator non-availability period, although there may exist a job whose processing time is greater than Δ. It seems to be the main shortcoming of SP T . Therefore, we propose the following improved algorithm Modified SPT (M SP T for short), which tries to select a suitable job as the crossover job. The performance of the algorithm will be improved significantly. Algorithm. M SP T l 1 Let k = max{l| j=1 pj ≤ b}, B = {J1 , · · · , Jk } and A = {Jk+1 , · · · , Jn }. 2 Let π0 be the schedule where jobs in B are sequenced according to the nondecreasing order of processing times from time 0, and jobs in A are sequenced according to the non-decreasing order of processing times from time a. 3 Let I = {i|pk+i ≥ Δ, 1 ≤ i ≤ n − k}. For any i ∈ I, let πi be the schedule constructed as follows: 3.1 Jobs in B are sequenced according to the non-decreasing order of processing times from time 0, 3.2 Jk+i is started at time max{a − pk+i , P (B)} ≤ b, and is completed at time max{a, P (B) + pk+i } ≥ a. 3.3 Jobs in A \ {Jk+i } are sequenced according to the non-decreasing order of processing times from the time when Jk+i is completed. 4 Choose the best schedule among π0 and πi , i ∈ I, which is denoted π M , as output. Clearly, πi is a feasible schedule for any i ∈ I, and F (π M ) = min{F (π0 ), min F (πi )}. i∈I
Scheduling with an Operator Non-availability Period
211
The following instance shows that the worst-case ratio of M SP T for our problem is at least 20 17 . Instance 2: Let the operator non-availability period be (1, 2). The processing times of six jobs are p1 = < 1, pj = 1, 2 ≤ j ≤ 6. In the schedule π0 , J1 is started at time 0, Jj is started at time j, 2 ≤ j ≤ 6. Thus F (π0 ) = 25 + . In the schedule πi , 1 ≤ i ≤ 5. J1 is started at time 0, Ji+1 is the crossover job and is started at time 1. The remaining jobs are started at time 2 according to the order of their index and F (πi ) = 20 + . In the optimal schedule π ∗ , J2 and J3 are started at time 0 and 1, respectively. J1 is started at time 2, Jj is started at M
) F (πi ) 20+ time j − 2 + , 4 ≤ j ≤ 6. Thus F (π ∗ ) = 17 + 4 and FF(π (π ∗ ) = F (π ∗ ) = 17+4 → 20 ( → 0). 17 In fact, Instance 2 is one of the worst case instances of M SP T . The following theorem is the main result of this paper, which will be proved in the next two sections.
Theorem 1. The worst-case ratio of M SP T is
20 17 ,
and the bound is tight.
The analysis of algorithms for problems with operator non-availability periods is not as easy as those for problems with machine non-availability periods, since we must pay attention to the existence of the crossover job. The following instance shows that there may be no crossover job in the optimal schedule, and πi is not always better than π0 . Instance 3: Let the operator non-availability period be (1, 2+). The processing times of five jobs are p1 = , p2 = p3 = p4 = 1 and p5 = 4. In the schedule π0 , J1 is started at time 0, Jj is started at time j + , 2 ≤ j ≤ 5. Thus F (π0 ) = 21 + 5. Note that only J5 can be the crossover job. In the schedule π4 , J1 is started at time 0. J5 is the crossover job and is started at time . Jj is started at time j + 2 + , 2 ≤ j ≤ 4. Thus F (π4 ) = 22 + 5. It is also the best schedule among schedules which have a crossover job. In the optimal schedule π ∗ , J2 and J1 are started at time 0 and 2 + , respectively. Jj is started at time j − 1 + 2, 3 ≤ j ≤ 5. Thus F (π ∗ ) = 18 + 8 and However,
3
F (π4 ) F (π ∗ )
=
22+5 18+8
>
F (π M ) F (π ∗ )
=
F (π0 ) F (π ∗ )
=
21+5 18+8
→
7 6 (
→ 0).
20 17 .
Preliminary Results
Let δi be the idle time before the operator non-availability period in πi , i ∈ {0}∪I (Fig. 1). Clearly, δ0 = b − P (B) = a − Δ − P (B) ≥ 0 and δi = max{Δ + δ0 − pk+i , 0} ≤ δ0 , i ∈ I.
(1)
Moreover, pj > δ0 for any Jj ∈ A by the definition of k and p1 ≤ p2 ≤ · · · ≤ pn . It is not difficult to obtain the completion time of each job in πi , i ∈ {0} ∪ I. That is, j pl , 1 ≤ j ≤ k, Cj (π0 ) = l=1 (2) j l=1 pl + δ0 + Δ, k + 1 ≤ j ≤ n,
212
Y. Chen, A. Zhang, and Z. Tan
G0 J1
J2
…
J k 1
Jk
J k i
…
Jn
…
a b (a ) : S 0 (G 0 b P ( B ))
Gi J1
J2
…
J k i J k 1
Jk
a b (b) : S i ( ' d p k i d ' G 0 , G i
Jn
… ' G 0 pk i )
J k i J1
J2
…
J k 1
Jk
a b (c ) : S i ( p k i ! ' G 0 , G i
Jn
… 0)
Fig. 1. The schedules produced by M SP T
and ⎧ j ⎪ pl , 1 ≤ j ≤ k, ⎪ ⎪ ⎨ l=1 k p + p + δ , l k+i i j = k + i, Cj (πi ) = l=1 j ⎪ ⎪ l=1 pl + pk+i + δi , k + 1 ≤ j < k + i, ⎪ ⎩ j k + i < j ≤ n, l=1 pl + δi ,
i ∈ I.
(3)
Let π∗ be the optimal schedule, and [j] be the index of the job that occupies the jth position in π ∗ . Let B ∗ = {J[1] , J[2] , · · · , J[k∗ ] } be the set of jobs which are completed before the operator non-availability period in π ∗ , and A∗ = J \B ∗ = {J[k∗ +1] , · · · , J[n] }. Clearly, J[k∗ +1] is the crossover job of π ∗ if and only if p[k∗ +1] ≥ Δ. Let δ ∗ ≥ 0 be the idle time before the operator nonavailability period in π ∗ (Fig. 2). The completion time of each job in π∗ can be obtained similarly. If there is no crossover job in π ∗ , then C[j] (π∗ ) =
j p[l] , 1 ≤ j ≤ k∗ , l=1 j ∗ ∗ l=1 p[l] + δ + Δ, k + 1 ≤ j ≤ n.
(4)
If J[k∗ +1] is the crossover job, then C[j] (π∗ ) =
j p[l] , 1 ≤ j ≤ k∗ , l=1 j ∗ ∗ l=1 p[l] + δ , k + 1 ≤ j ≤ n.
(5)
Scheduling with an Operator Non-availability Period
213
G* J [1] J [ 2 ]
…
J [ k * 1]
J[k* ]
a
b *
( a) : S ( no crossover job, G *
G J [1] J [ 2 ]
…
(b) : S * ( J [ k * 1]
J [n ]
… b P( B * ) )
…
J [ k * 1]
*
J [k * 2]
J[k * ]
J [n ]
…
a b is the crossover job, p[ k * 1] d a P( B * ), G *
a P( B * ) p[ k * 1] )
J [ k * 1]
J [1] J [ 2 ]
… *
J [k * 2]
J[ k* ]
(c) : S ( J [ k * 1]
…
a b is the crossover job, p[ k * 1] ! a P ( B * ), G *
J [n ] 0)
Fig. 2. The optimal schedule π ∗
Since p1 ≤ p2 ≤ · · · ≤ pn , for any j ≥ 1 and J0 ⊆ J with |J0 | = j, j
pl ≤ P (J0 ).
(6)
l=1
By the definition of k and p1 ≤ p2 ≤ · · · ≤ pn , the total processing time of any k + 1 jobs of J is greater than b. Since P (B ∗ ) ≤ b, we have k∗ ≤ k.
(7)
The following lemma shows difference between the completion times of two jobs which occupies the jth position in π ∗ and πi , i ∈ {0} ∪ I, respectively. Recall that Jk+i occupies the (k + 1)th position in πi , i ∈ I. Lemma 1. (i) For any i ∈ {0} ∪ I and 1 ≤ j ≤ k − 1, Cj (πi ) ≤ C[j] (π∗ ). (ii) If there is no crossover job in π ∗ , then for any i ∈ {0} ∪ I, Ck (πi ) − C[k] (π∗ ) ≤ δ ∗ − δ0 . (iii) If i ∈ I and Δ ≤ pk+i ≤ Δ + δ0 , then Ck+i (πi ) ≤ C[k+1] (π∗ ). (iv) For any i ∈ I and k + i < j ≤ n, Cj (πi ) − C[j] (π ∗ ) ≤ δi − δ ∗ . Proof. (i) By (2), (3), (4), (5) and (6), for any i ∈ {0} ∪ I and 1 ≤ j ≤ k − 1, Cj (πi ) =
j l=1
pl ≤
j l=1
p[l] ≤ C[j] (π ∗ ).
214
Y. Chen, A. Zhang, and Z. Tan
(ii) By (2), (3), (4) and (7), for any i ∈ {0} ∪ I, ∗
∗
Ck (πi ) − C[k] (π ) ≤ Ck (πi ) − C[k∗ ] (π ) =
k l=1 ∗
∗
pl −
= (b − δ0 ) − (b − δ ∗ ) = δ − δ0 .
k
p[l]
l=1
(iii) By (3), (1) and pk+i ≤ Δ + δ0 , Ck+i (πi ) =
k
pl +pk+i +δi = (b−δ0 )+pk+i +max{Δ+δ0 −pk+i , 0} = b+Δ = a.
l=1
Since J[k∗ +1] ∈ / B ∗ , C[k∗ +1] (π ∗ ) ≥ a. Thus, by (7), Ck+i (πi ) − C[k+1] (π ∗ ) ≤ Ck+i (πi ) − C[k∗ +1] (π ∗ ) ≤ 0. (iv) By (3), (4) and (5), for any i ∈ I and k + i < j ≤ n, j
j
∗ ∗ Cj (πi ) − C[j] (π ) ≤ pl + δi − p[l] + δ ≤ δi − δ ∗ . l=1
l=1
The following three lemmas show difference between the total completion time of π ∗ and πi , i ∈ {0} ∪ I in different situations. Their proofs are omitted due to lack of space. Lemma 2. If there is no crossover job in π ∗ and n ≥ k+1, then F (π0 )−F (π ∗ ) ≤ (n − k − 1)(δ0 − δ ∗ ). Lemma 3. If there is no crossover job in π ∗ , n ≥ k + 2 and i ∈ I such that pk+i ≤ Δ + δ0 , then F (πi ) − F (π ∗ ) ≤ (n − k − 2)(δ0 − δ ∗ ). Lemma 4. Suppose that J[k∗ +1] is the crossover job of π ∗ and [k ∗ + 1] = k + i. (i) If p[k∗ +1] > Δ + δ0 , then F (πi ) ≤ F (π ∗ ). (ii) If n ≥ k + 2 and Δ ≤ p[k∗ +1] ≤ Δ + δ0 , then F (πi ) − F (π ∗ ) ≤ (n − k − 2)(δi − δ ∗ ).
4
Proof of the Worst-Case Ratio
In this section, we will prove that the worst-case ratio of M SP T is 20 . Clearly, 17 we only need to consider the instances that π M is not optimal. We first present some lemmas on the property of the optimal schedule π ∗ . The following lemma can be proved by the classical exchange scheme. Lemma 5. There exists an optimal schedule, such that the jobs which are completed before the operator non-availability period and started after the operate non-availability period are scheduled according to non-decreasing order of their processing times, respectively.
Scheduling with an Operator Non-availability Period
215
In the following only optimal schedules that satisfy Lemma 5 are considered further. Lemma 6. If there is no crossover job in π ∗ , or the crossover job of π ∗ belongs to B, then J[k∗ ] ∈ A. Proof. By assumption of the lemma, no job in A can be the crossover job of π∗ . If A ⊆ A∗ , then by Lemma 5, Cj (π0 ) ≤ Cj (π∗ ) for any Jj ∈ A. No matter whether a job in B is completed period in π∗ , we k before ∗the operator non-availability k ∗ have j=1 Cj (π0 ) ≤ j=1 Cj (π ). Thus F (π0 ) ≤ F (π ), which contradicts that π0 is not the optimal schedule. Hence, A ∩ B ∗ = ∅. Note that J[k∗ ] is the largest job of B ∗ by Lemma 5. Thus J[k∗ ] ∈ A.
Lemma 7. If there is a crossover job in π∗ , then there exists an optimal schedule π such that the crossover job of π belongs to A. Proof. Suppose that J[k∗ +1] is the crossover job of π ∗ . If J[k∗ +1] ∈ A, then π ∗ is the required schedule. Otherwise, J[k∗ +1] ∈ B. By Lemma 6, J[k∗ ] ∈ A. Since J[k∗ +1] ∈ B and J[k∗ ] ∈ A, we have p[k∗ ] ≥ p[k∗ +1] . Construct a new schedule π as follows: J[k∗ +1] is started at time C[k∗ ] (π∗ ) − p[k∗ ] and is completed at time C[k∗ ] (π∗ ) − p[k∗ ] + p[k∗ +1] ≤ C[k∗ +1] (π ∗ ) − p[k∗ ] , J[k∗ ] is started at time C[k∗ +1] (π ∗ ) − p[k∗ ] ≤ C[k∗ +1] (π∗ ) − p[k∗ +1] ≤ b and is completed at time C[k∗ +1] (π ∗ ) ≥ a. The start time of other jobs remains unchanged. Clearly, π is a feasible schedule, and F (π ) − F (π ∗ ) = (C[k∗ +1] (π ∗ ) + (C[k∗ ] (π∗ ) − p[k∗ ] + p[k∗ +1] )) −(C[k∗ ] (π ∗ ) + C[k∗ +1] (π∗ )) ≤ 0. Hence, π is the required optimal schedule and its crossover job belongs to A.
By Lemma 7, we assume that if there is a crossover job in π ∗ , then the crossover job belongs to A. Lemma 8. If there is no crossover job in π∗ , then δ0 < p[k∗ ] < Δ. Proof. By Lemma 6, J[k∗ ] ∈ A and thus p[k∗ ] > δ0 . Since J[k∗ +1] is not the crossover job in π ∗ , p[k∗ +1] < Δ. If p[k∗ ] ≥ Δ, then construct a new schedule π as follows: J[k∗ +1] is started at time C[k∗ ] (π∗ ) − p[k∗ ] and is completed at time C[k∗ ] (π∗ ) − p[k∗ ] + p[k∗ +1] ≤ C[k∗ ] (π∗ ) ≤ b, J[k∗ ] is started at time max{C[k∗ ] (π∗ ) − p[k∗ ] + p[k∗ +1] , a − p[k∗ ] } ≤ b and is completed at time max{C[k∗ ] (π ∗ )+p[k∗ +1] , a} ≥ a. The start time of other jobs remains unchanged. Clearly, π is a feasible schedule, and F (π ) − F (π ∗ ) = max{C[k∗ ] (π ∗ ) + p[k∗ +1] , a} + (C[k∗ ] (π∗ ) − p[k∗ ] + p[k∗ +1] ) −(C[k∗ ] (π ∗ ) + a + p[k∗ +1] ) < 0, which contradicts that π∗ is the optimal schedule.
216
Y. Chen, A. Zhang, and Z. Tan
n Since j=1 pj > b, we have n > k. The following lemma shows that M SP T outputs an optimal schedule if n = k + 1. Thus we only need to consider the case of n ≥ k + 2 in the following. Lemma 9. If n = k + 1, then F (π1 ) ≤ F (π ∗ ). Proof. Recall that pn ≥ Δ. By (3), (4) and (5), ⎛ ⎞ ⎛ ⎞ n n Cn (π1 ) − C[n] (π ∗ ) ≤ ⎝ pj + δ1 ⎠ − ⎝ p[j] + δ ∗ ⎠ = δ1 − δ ∗ . j=1
Next, we show that
(8)
j=1
Ck (π1 ) − C[k] (π ∗ ) ≤ δ ∗ − δ1 .
(9)
∗
In fact, if there is no crossover job in π , by Lemma 1(ii) and δ1 ≤ δ0 , Ck (π1 ) − C[k] (π ∗ ) ≤ δ ∗ − δ0 ≤ δ ∗ − δ1 . Otherwise, Jn must be the crossover job of π ∗ by Lemma 7. If pn ≥ Δ + δ0 , π1 is obviously the optimal schedule. If pn < Δ + δ0 , then by (3), (5) and (6), ∗
∗
Ck (π1 ) − C[k] (π ) ≤ Ck (π1 ) − C[k∗ ] (π ) =
k
∗
pl −
l=1
k
p[l]
l=1 ∗
≤ (a − pn − δ1 ) − (a − pn − δ ∗ ) = δ − δ1 . By Lemma 1(i) and (8), (9), we have F (π1 ) − F (π ∗ ) =
k−1
Cj (π1 ) − C[j] (π ∗ ) + (Ck (π1 ) − C[k] (π ∗ )) + (Cn (π1 ) − C[n] (π ∗ ))
j=1
≤ 0 + (δ ∗ − δ1 ) + (δ1 − δ ∗ ) = 0.
Next we give estimations on the objective value of π ∗ . Lemma 10. (i) If there is a crossover job in π ∗ , then F (π ∗ ) ≥
(n − k)(n − k + 1) + 2 δ0 + Δ, 2
(ii) If there is no crossover job in π ∗ , then F (π ∗ ) ≥
(n − k)(n − k + 1) + 2 δ0 + (n − k)Δ, 2
(iii) If there is no crossover job in π ∗ and pn ≥ 3δ0 , then F (π ∗ ) ≥
(n − k)(n − k + 1) + 6 δ0 + (n − k)Δ. 2
Scheduling with an Operator Non-availability Period
217
Proof. Suppose that B ⊆ B ∗ , then B = B ∗ by (7). If there is no crossover job in π ∗ , then by Lemma 5, π0 is identical with π ∗ . If J[k∗ +1] is the crossover job in π ∗ and [k ∗ + 1] = k + i, then πi is identical with π ∗ . Both contradict that π M is not the optimal schedule. Hence, there exists a job Jj0 ∈ B ∩ A∗ and thus Cj0 (π ∗ ) ≥ b + Δ = δ0 + Δ. Since pj > δ0 for any Jj ∈ A and |A| = n − k, the total completion time of all (n−k)(n−k+1) jobs in A is at least δ0 even if there is no operator non-availability 2 period exists. Thus (n − k)(n − k + 1) + 2 F (π ∗ ) ≥ Cj (π ∗ ) + Cj0 (π ∗ ) ≥ δ0 + Δ, 2 Jj ∈A
(i) is proved. When there is no crossover job in π ∗ , comparing the situation which no operator non-availability period exists, the completion time of any job in A∗ will increase by at least Δ. Since |A∗ \{Jj0 }| = n − k ∗ − 1 ≥ n − k − 1, (ii) is thus proved. If pn ≥ 3δ0 , then the total completion time of all jobs in A is at least (n−k)(n−k+1)+4 δ0 even if there is no operator non-availability period 2 exists. (iii) can be proved similarly.
Define f (m) =
2(m−2) m(m+1)+4 .
It can be verified by directly calculation that max f (m) = f (5) =
m∈Z +
3 . 17
Lemma 11. If there is a crossover job in π ∗ , then
(10)
F (π M )−F (π ∗ ) F (π ∗ )
≤ f (n − k).
Proof. Suppose that J[k∗ +1] is the crossover job of π ∗ and [k ∗ + 1] = k + i. If p[k∗ +1] > Δ + δ0 , then F (π M ) ≤ F (πi ) ≤ F (π ∗ ) by Lemma 4(i). Otherwise, Δ ≤ p[k∗ +1] ≤ Δ + δ0 . By Lemma 7, J[k∗ +1] ∈ A and thus p[k∗ +1] > δ0 . Hence, δi ≤ Δ and δi ≤ δ0 due to (1). By Lemmas 4(ii) and 10(i), F (π M ) − F (π ∗ ) F (πi ) − F (π ∗ ) (n − k − 2)(δi − δ ∗ ) ≤ ≤ (n−k)(n−k+1)+2 ∗ ∗ F (π ) F (π ) δ0 + Δ 2
≤
n−k−2 (n−k)(n−k+1)+2 2
= +1
2(n − k − 2) = f (n − k). (n − k)(n − k + 1) + 4
∗
Lemma 12. If there is no crossover job in π , then F (π M ) − F (π ∗ ) ≤ max{f (n − k), f (n − k + 1)}. F (π ∗ ) Proof. If there exists i, such that Δ ≤ pk+i ≤ Δ + δ0 , then by Lemmas 3, 10(ii) and 8, F (π M ) − F (π ∗ ) F (πi ) − F (π ∗ ) ≤ ≤ F (π ∗ ) F (π ∗ ) ≤
n−k−2 (n−k)(n−k+1)+2 2
(n − k − 2)(δ0 − δ ∗ ) (n−k)(n−k+1)+2 δ0 2
+ (n − k)Δ
2(n − k − 2) ≤ = f (n − k). (n − k)(n − k + 1) + 4 + (n − k)
218
Y. Chen, A. Zhang, and Z. Tan
Hence, we only need to consider the case that for any i, i ∈ I, pk+i > Δ + δ0 . Since pn ≥ Δ, then pn > Δ + δ0 . If pn > 3δ0 , by Lemmas 2, 10(iii) and 8, F (π M ) − F (π ∗ ) F (π0 ) − F (π ∗ ) ≤ ≤ F (π ∗ ) F (π ∗ )
(n − k − 1)(δ0 − δ ∗ ) (n−k)(n−k+1)+6 δ0 2
+ (n − k)Δ n−k−1 2(n − k − 1) ≤ (n−k)(n−k+1)+6 = (n − k + 1)(n − k + 2) + 4 + (n − k) 2 = f (n − k + 1).
Therefore, we are left to consider the case of pn ≤ 3δ0 . By Lemma 8, we have pn − p[k∗ ] − Δ − δ ∗ ≤ 3δ0 − δ0 − δ0 − δ ∗ = δ0 − δ ∗ .
(11)
Note that δn−k = 0. By (3), (4) and (11), ∗
Cn (πn−k ) − C[k+1] (π ) = =
k
pl + pn
l=1 k
pl −
−
k+1
l=1
k+1
∗
p[l] + δ + Δ
l=1
+ (pn − p[k∗ ] − δ ∗ − Δ)
p[l] − p[k∗ ]
l=1
≤ 0 + (δ0 − δ ∗ ) = δ0 − δ ∗ .
For k + 1 ≤ j < n − 2, ∗
Cj (πn−k ) − C[j+1] (π ) = =
j
pl + pn
l=1 j
pl −
−
j+1
l=1
j+1
∗
p[l] + δ + Δ
l=1
p[l] − p[k∗ ]
+ (pn − p[k∗ ] − δ ∗ − Δ)
l=1
≤ 0 + (δ0 − δ ∗ ) = δ0 − δ ∗ ,
and Cn−1 (πn−k ) =
n
pj ≤ C[n] (π ∗ ).
j=1
Combining them with Lemma 1(i)(ii), we have F (πn−k ) − F (π ∗ ) =
k−1
Cj (πn−k ) − C[j] (π ∗ ) + (Ck (πn−k ) − C[k] (π ∗ ))
j=1
+(Cn (πn−k ) − C[k+1] (π ∗ )) + + Cn−1 (πn−k ) − C[n] (π ∗ )
n−2
Cj (πn−k ) − C[j+1] (π ∗ )
j=k+1
≤ 0 + (δ ∗ − δ0 ) + (δ0 − δ ∗ ) + (n − k − 2)(δi − δ ∗ ) + 0 = (n − k − 2)(δ0 − δ ∗ ).
Scheduling with an Operator Non-availability Period
219
By Lemmas 10(ii) and 8, we have F (π M ) − F (π ∗ ) F (πn−k ) − F (π ∗ ) ≤ ≤ ∗ F (π ) F (π ∗ ) ≤
(n − k − 2)(δ0 − δ ∗ ) (n−k)(n−k+1)+2 δ0 2
n−k−2 (n−k)(n−k+1)+2 2
+ (n − k)
≤
+ (n − k)Δ
2(n − k − 2) = f (n − k). (n − k)(n − k + 1) + 4
By Lemmas 11, 12 and (10), the proof of Theorem 1 is thus finished.
References 1. Adiri, I., Bruno, J., Frostig, E., Rinnooy Kan, A.H.G.: Single machine flow-time scheduling with a single breakdown. Acta Inform. 26, 679–696 (1989) 2. Brauner, N., Finke, G., Lebacque, V., Rapine, C., Potts, C., Strusevich, V.: Operator non-availability periods. 4OR: Q. J. Oper. Res. 7, 239–253 (2009) 3. Breit, J., Schmidt, G., Strusevich, V.A.: Non-preemptive two-machine open shop scheduling with non-availability constraints. Math. Meth. Oper. Res. 34, 217–234 (2003) 4. Kacem, I., Mahjoub, A.R.: Fully polynomial time approximation scheme for the weighted flow-time minimization on a single machine with a fixed non-availability interval. Comput. Ind. Eng. 56, 1708–1712 (2009) 5. Kellerer, H., Strusevich, V.A.: Fully polynomial approximation schemes for a symmetric quadratic knapsack problem and its scheduling applications. Algorithmica 57, 769–795 (2010) 6. Lee, C.Y.: Machine scheduling with an availability constraint. J. Global. Optim. 9, 363–382 (1996) 7. Lee, C.Y., Liman, S.D.: Single machine flow-time scheduling with scheduled maintenance. Acta Inform. 29, 375–382 (1992) 8. Sadfi, C., Penz, B., Rapine, C., Blazewicz, J., Formanowicz, P.: An improved approximation algorithm for the single machine total completion time scheduling problem with availability constraints. Eur. J. Oper. Res. 161, 3–10 (2005)
PSAEC: An Improved Algorithm for Short Read Error Correction Using Partial Suffix Arrays Zhiheng Zhao, Jianping Yin, Yubin Zhan, Wei Xiong, Yong Li, and Fayao Liu School of Computer, National University of Defense Technology, 410073 Changsha, China
[email protected]
Abstract. Sequencing errors in high-throughput sequencing data constitute one of the major problems in analyzing such data. Error correction can reduce the error rate. However, it is a computation and data intensive process for large-scale data. This poses challenges for more efficient and scalable algorithms. In this paper, we propose PSAEC, an improved algorithm for short read error correction using partial suffix arrays in high-throughput sequencing data. Our algorithm optimizes the HiTEC program by replacing full suffix arrays with partial suffix arrays to index reads which is more time and space efficient. Moreover, PSAEC is a scalable parallel algorithm that can works well on multi-core computers using Pthread. Experiments show that our algorithm delivers good, scalable performance. Keywords: High-throughput sequencing, Error correction, Suffix array, Parallel.
1
Introduction
High-throughput sequencing technologies such as Illumina’s Genome Analyzer, ABI’s SOLiD, and Roche’s 454, e.g. [1] open up a range of new opportunities for genome research. Unlike the Sanger method, high-throughput sequencing technologies can produce large amount of short reads in a single run. For example, the Illumina Genome Analyzer IIx can currently generate an output of up to 640 million paired-end reads in a single run with a read length between 35 and 150. This leads to many novel applications such as genome resequencing, de novo genome assembly and metagenomics. However, high-throughput sequencing data is more error-prone than the Sanger sequencing method. With a significant impact on the accuracy of applications such as resequencing and de novo genome assembly, sequencing errors have become one of the major problems in analyzing high-throughput sequencing data. Many algorithms and software tools have been developed to address this problem. They try to reduce the error rate by using the high coverage of highthroughput sequencing technologies to identify and correct the erroneous bases in the reads. Each base is covered by many reads and the reads that contain M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 220–232, 2011. c Springer-Verlag Berlin Heidelberg 2011
PSAEC: An Improved Algorithm for Short Read Error Correction
221
correct value will prevail. If we can align each read correctly, we could correct the erroneous bases which are in the minority in each column. Therefore, the intuitive method is multiple read alignment, such as MisEd [2] for Sanger reads. However, multiple read alignment is extremely compute-intensive for large-scale reads and does not adapt well to short reads. Hence, a series of approaches have been proposed to optimize the alignment-based method. Chaisson et al. [3] proposed the spectral alignment problem (SAP) in which k -mers were divided into solid (correct) and insolid (erroneous) according to their multiplicity and reads containing insolid k -mers are corrected using a minimum number of edit operations so that they contain only solid k -mers post-correction. They implemented the SAP-based read correction algorithm [4] in assembly tool Euler-SR similarly with Butler et al. [5]. Recently, some tools which consider the quality value of per-base and optimize the k -mer counting [6, 7, 8] are also based on the SAP-based approach used in Euler-SR. However, the k -mer counting limits the performance of SAP-based error correction tools and therefore some works try to find more efficient structure to index reads. SHREC [9] uses a weighted suffix tree which is constructed from short-read data using both forward and reverse complementary strands. In a weighted suffix tree, each path from the root to a node corresponds to a substring of a read and the weight of nodes corresponds to the occurrence of the substring, so a node with lower weight than its sibling may be erroneous. Suffix trees enable us to query a P long string in O(P ) time. However, it requires huge memory and therefore it is difficult to be used for large-scale read data. Suffix arrays as a more memory efficient structure is used in HiTEC[10], a program on which our work is based. HiTEC builds a suffix array on the string of all reads and their reverse complements, and then uses a thorough statistical analysis of the suffix array to adjust the parameters. This makes HiTEC more accurate and efficient. However, for large amount of data, the process of constructing the suffix array in HiTEC remains the bottleneck of performance. Besides, unlike SHREC and other parallel programs [8], HiTEC is a serial program and therefore it cannot make full use of many modern compute resources such as multi-core architectures. In this paper, we propose PSAEC, an improved algorithm for short read error correction using partial suffix arrays in high-throughput sequencing data. PSAEC optimizes the HiTEC program by using the h-order partial suffix array [11], in which h is the length that we care about for error correction, to replace the full suffix array used in HiTEC. To achieve the same accuracy, PSAEC is more time and space efficient than HiTEC. Furthermore, PSAEC is a scalable parallel algorithm. Experiments show that PSAEC works well on multi-core platforms using Pthread. The rest of this paper is organized as follows. In section 2, we introduce the notations and the suffix array data structure as well as the HiTEC algorithm. We present PSAEC in section 3. In Section 4 we evaluate the performance of PSAEC. Finally, Section 5 concludes the paper.
222
2 2.1
Z. Zhao et al.
Background Notations and Suffix Array
This section briefly introduces the definitions of suffix array. We consider the alphabet Σ. | Σ | is the size of alphabet. A string is any finite sequence over Σ. Let T =c0 ,c1 ,. . . ,cn−1 be a string of length n. T [i,j ] is the substring ci , ci+1 ,. . . , cj , in which 0≤i≤j ≤n. We add a special character ”$” at the tail of the string T and denote the suffix of T at the position of i by Si =T [i,n]=ci ,ci+1 ,. . . ,cn−1 ,$. $ is smaller than any character in Σ. The suffix array of T on the alphabet Σ, which we denote as SA, is an array of length n containing the positions of string T such that SSA[i] gives the increasing lexicographical order, i.e., SSA[0] <SSA[1] < . . . <SSA[n−1]. Besides suffix array, the longest common prefix (LCP) array is often used to compute the length of the longest common prefix between suffixes. LCP[i] is the length of the longest common prefix of SSA[i] and SSA[i−1] . Figure 1 shows the suffix array and LCP array of string ACCTATACCGTA. The suffix array data structure has been proposed by Manber and Myers [15], and the suffix array construction algorithm can be seen from [16] for a survey. 2.2
The HiTEC Algorithm
Ilie et al. [10] proposed HiTEC, an algorithm based on a suffix array constructed from all reads and their reverse complements. The basic idea of HiTEC for correcting errors is intuitive. Suppose all reads are aligned as Figure 2, if the alignment is correct, we could identify an erroneous base that is the 25th base of read 4. However, many reads may be misaligned because of random occurrences or the aligned accuracy. HiTEC uses three concepts that are witness, support and cluster. Formally, suppose we have m reads that are r1 ,r2 ,. . . ,rm , the string of all reads and their reverse complements is denoted by R, R = r1 $r1 $r2 $r2 $ . . . $rm $rm $ A witness is any substring u of R that contains no occurrence of $. Let w(u) be the length of u. For a∈Σ, the support of u for a, supp(u, a) is the number of occurrences of the string ua in R. Furthermore, for a given witness u, HiTEC defines the cluster of u as the set of all positions in R where an occurrence of u is followed by a letter different from $. The cluster of u is cluster(u) = supp(u, a) a∈Σ
Fig. 1. The suffix array and LCP array of string ACCTATACCGTA
PSAEC: An Improved Algorithm for Short Read Error Correction
223
Fig. 2. An example of five aligned reads. The substring in the dashed rectangle is a witness u = GTACTCGGTGCAGATAAGA, w (u) =19, cluster (u) = 5,supp(u,T ) = 4, supp(u,G) =1.
Intuitively, for a witness u, the larger w (u) and cluster (u), the lower the probability that u is a random occurrence. Additionally, the larger the support of u for a, the more probably a is a correct value and vice versa. Hence, we can correct the errors to the base whose support is large enough. HiTEC is composed of two steps. The first step is a thorough statistical analysis to determine two thresholds (W and F ) - how long (W ) a witness is and how often (F ) the witness occurs so that the witness can identify a correct value or an erroneous value; the second step is using suffix arrays to compute the length of every witness and its cluster to correct errors. Our work is to optimize the second step which dominates the running time of HiTEC. Therefore, in the first step, we use the same formulas to compute the thresholds as those in [10] so that our algorithm can achieve the same accuracy as HiTEC while obtaining improved speed and scalability. The detailed HiTEC algorithm is presented in appendix A. HiTEC uses the libdivsufsort library of Yuta Mori [12] which is a fast and lightweight suffix array construction algorithm to compute the full suffix array of R, and then compute the LCP to get all witnesses whose length and cluster are larger than thresholds. The algorithm requires O(nlogn) time in which n is the length of R. if n< 232 , it requires 5n+O(1) bytes space for suffix array and n bytes space for computing LCP which is 6n+O(1) totally. HiTEC is efficient compared to previous algorithms. However, for large-scale read data, the time and space required by HiTEC remain intolerable.
3
PSAEC
This section presents our work, the PSAEC algorithm. We first describe our methods and then give the detailed algorithm as well as its parallel version. 3.1
Methods
As described in section 2, we use the same thresholds as those in HiTEC. Consequently, if the length of a witness is not equal to W or its cluster is less than F, we can ignore it. For a witness u, if W =w (u) and F cluster (u), we call u a valid witness. Hence, what we need are all the valid witnesses for error correction, not
224
Z. Zhao et al.
all the witnesses. This means that we only care about some special regions of the suffix array, not the full suffix array, and therefore we can reduce the requirement of space and the running time of building the full suffix array. We use the h-order suffix arrays which were proposed by Larsson et al. [11] to compute valid witnesses. Using the notations described in section 2, we can define an h-order suffix array as follows: For Si = T [i,n] and Sj = T [j,n], if T [i, min(i+h-1,n)] = T [j, min(j +h-1,n)] (h>0), we say that Si =h Sj ; if T [i, min(i+h-1,n)]
T [j, min(j +h-1,n)], we say that Si >h Sj ; The h-order suffix array of T on the alphabet Σ, which we denote as hSA, is an array of length n containing the positions of string T such that hSA satisfies the condition S hSA[0] ≤S hSA[1] ≤. . . ≤S hSA[n−1] .The suffix array of T is unique while the h-order suffix array is not necessarily unique, and the suffix array is any order suffix array. When h = n, the h-order suffix array is identical to the suffix array. We could get all the valid witnesses if we have constructed the W -order suffix array from all the suffixes of reads. For a W -order suffix array wSA, if wSA[i-1]<wSA[i]=wSA[i+1]=. . . =wSA[i+k -1]<wSA[i+k ] (1≤i, 1≤k, i+k
PSAEC: An Improved Algorithm for Short Read Error Correction
225
according to their P -long prefixes and then sort each subset using Multikey Quicksort. For a P -long prefix, there are 4P types of suffix subsets. For example, if P =1, we will classify all the suffixes into four types which start with A, C, G, T respectively. This strategy sorts all the suffixes of reads into P order by classification and therefore we only need to construct the (W -P )-order suffix array using Multikey Quicksort. when P increases, the time cost for Multikey Quicksort will decrease and it is the opposite for the classification phase. We will see that it is most efficient at P = 6 or 7 when PSAEC runs in serial mode. Note that this strategy also provides a good parallel approach for PSAEC. We will see that PSAEC has scalable performance based on the approach. 3.2
Algorithm
Figure 3 shows our algorithm briefly. We will explain each phase in detail. (1) Preprocessing: This phase reads the read data set into memory, and then stores them and their reverse complements in an array which requires n =2* m*(l +1) (m is the number of reads and l is the length of reads) space. We also compute the thresholds W and T using the formulas in HiTEC. (2) Classification: This phase corresponds to the third strategy. For the P -long prefix s k , s k+1 , . . . , s P−1+k of suffix k in read j, we first use function g to convert {A, C, T, G} to {0, 1, 2, 3} and then we can convert the string to an integer using function f k , p−1
fk =
g(sk+i ) ∗ 4P −1−i
i=0
Fig. 3. The process of our algorithm. There are five phases which are preprocessing, classification, Multikey Quicksort , error correction and iteration.
226
Z. Zhao et al.
Algorithm 1. ECSSORT (char ** hSA, int n, int d ) input: the suffixes array hSA of reads, the length n, the recursion depth d output: all the valid witness in the suffixes array hSA 1: if ( n ≤ T ) return; //ignore the invalid witnesses 2: if (d == W ) IdenityError(hSA,n); 3: choose a partitioning value v ; 4: partition hSA around value v on component d to form sequences hSA< , hSA= , hSA> of sizes n < , n = , n > ; 5: ECSSORT (hSA< , n < , d); 6: ECSSORT (hSA= , n = , d + 1); 7: ECSSORT (hSA> , n > , d);
And then put the pointer of suffix k into the array of hSAf . However, when P >6, k the running time of this phase will increase dramatically. We use the approach proposed by Futamura et al. [14] to optimize the function f k . Suppose the P -long prefix of suffix k +1 in the same reads is f k+1 , fk+1 = (fk − g(sk ) ∗ 4P −1 ) ∗ 4 + g(Sk+p ) (3) Multikey Quicksort: This phase is implemented in ECSSORT function which is an improved version of Multikey Quicksort as Algorithm 1. The IdenityError function does the similar work with the subroutine of the HiTEC algorithm from line 10 to line 25 in Appendix A, except that IdenityError function does not correct the erroneous bases directly. When IdenityError function identifies an erroneous base, it records the positions and correct values of the erroneous bases into an array L and then return. The length of L does not exceed 2*p*m*l (p is per-base error rate, m is the number of reads and l is the length of reads). (4) Error correction and iteration: Error correction phase corrects all the errors recorded in array L and computes the conditions to determine whether to terminate the program. We also iterate the process of phase 2, 3 and 4 as HiTEC does to improve the accuracy of error correction and update the parameter W at the beginning of each iteration. We use the same conditions as HiTEC to terminate the program in which the number of iterations does not exceed 9. Now we can analyze the space complexity and time complexity of our algorithm. In a 32-bit computer, for m reads whose length is l, let n = 2*m*(l +1). We need n bytes space to store the reads and 4n*(l -W )/l bytes to store the W -order suffix array. In addition, we need 8p*n to store the array L (p is perbase error rate, each element needs 8 bytes. Actually, we use a constant space to store L). Hence, the memory requirement of our algorithm is n + 4n*(l -W )/l + 8p*n + O(1) bytes which is 4n+O(1) approximately when W is nearly l /3. Our algorithm almost reduces 2/3 memory requirement compared to HiTEC which needs 6n + O(1).
PSAEC: An Improved Algorithm for Short Read Error Correction
227
In our algorithm, the classification phase and Multikey Quicksort phase consume the most of time which have O(n+P ) and O(n(lgn-lg4P ) + (W -P )n) time complexity respectively , for the original Multikey Quicksort algorithm has O(nlgn + kn) time complexity in which n is the number of strings and k is the length of strings. Hence, the parameter P plays an important role in the performance of our algorithm. We can obtain the best performance of PSAEC by tuning the value of P which outperforms HiTEC. 3.3
Parallelization
PSAEC can be parallelized on multi-core platforms using multithreading. Suppose the number of threads is M, in the classification phase, we use the parameter P to divide all the suffixes into 4P subsets and then the subsets can be assigned to the threads. If M is larger than or equals to 4P , the subsets can be assigned to 4P threads so that each thread corresponds to a unique prefix. If M is less than 4P , let k = 4P /M, then each thread corresponds to k or k +1 subsets. However, this approach only parallelizes the Multikey Quicksort phase. In section 4, we will see that the running time on classification is still considerable. Suppose the running time of the classification phase is T 1 , and the running time of the Multikey Quicksort phase is T 2 . If we do not consider the collisions between threads in the cache, the speedup S of parallelization is S=
T1 + T2 T1 + T2 /M
T1 has significant impact on the speedup. Hence, it is necessary for the classification phase to be parallelized. We use the divide-and-conquer strategy to parallelize the classification phase as follows: – Divide the reads into M groups. – Each thread classifies the suffixes of a group into suffix subsets according their P -long prefixes. – M suffix subsets with identical P -long prefixes from all the threads are merged into a single one. The third step will bring an additional cost that we define to be ε, then S=M∗
T1 + T2 T1 + T2 + M ∗ ε
Because the third step only has M *4P moves of array data, E is very small relative to T 1 and T 2 . Figure 4 shows the parallelization of PSAEC with 4 threads using multithreading during one iteration. We implement it using the Pthread Library.
228
Z. Zhao et al.
Fig. 4. Parallelization of PSAEC with 4 threads using multithreading during one iteration
4
Experiments
In this section, we evaluate the performance of PSAEC. We first evaluate the effects of parameter P on our algorithm and compare the time and space complexities of PSAEC with HiTEC. We also can compare PSAEC with SHREC [9] and Reptile [6] as they have been compared with HiTEC in [10]. We then evaluate the scalability of PSAEC on multi-core platforms and multiprocessor computers. Because PSAEC has the same output as HiTEC, we do not evaluate the accuracy of PSAEC. We use the simulation data sets which are created from several bacterial genomes as previous programs. These genomes can be downloaded from GenBank under the accession numbers. Table 1 shows the basic information of these genomes. We developed a tool to create read data sets from a genome with given length, coverage, and per-base error rate. Each data set can be considered as identical with the corresponding one in [8], [9] and [10], because they have been generated from the same genomes and have the same length, coverage and per-base error rate. The tests shown in Table 2, Table 3 and Figure 5 were performed on a desktop computer with Intel Xeon X7560 8-core processor at 2.26GHz, 8GB RAM, running RHEL 5 x86 64 server. Note that PSAEC runs in serial mode in Table 2 and Table 3. Table 1. The genomes from which the data sets were created Reference genome (ID) Saccharomyces Cerevisiae, Chr. 5 (S.cer5) Saccharomyces Cerevisiae, Chr. 7 (S.cer7) Haemophilus In?uenzae (H.inf) Escherichia coli str.K-12 substr.MG1655 (E.coli) Staphylococcus aureus (S.aureus)
Accession no. NC 001137 NC 001139 NC 007146 NC 000913 NC 003923
Len.(bp) 576,869 1,090,946 1,914,490 4,639,675 2,820,462
PSAEC: An Improved Algorithm for Short Read Error Correction
229
Table 2. The running time(s) of PSAEC with various parameter P. The read length is 70bp and coverage is 70 for all data sets with 1% per-base error rate. Data set S.cer5 S.cer7 H.inf S.aureus E.coli
0 108.4 230.3 464.1 774.1 1473.2
1 109.5 231.0 455.6 756.8 1374.4
2 105.9 223.4 442.1 727.4 1303.6
3 97.4 207.0 407.7 672.9 1188.6
4 87.4 186.4 371.3 619.0 1076.9
5 77.0 165.4 333.1 561.3 954.8
6 69.12 146.9 296.6 498.1 913.7
7 72.5 150.9 297.8 468.7 970.0
8 91.4 185.6 356.4 559.1 1046.8
Table 3. Time and space comparison between PSAEC and HiTEC. The read length is 70bp and coverage is 70 for all data sets. Data set Genome Err(%) S.cer5 1 S.cer5 2 S.cer5 3 S.cer7 1 S.cer7 2 S.cer7 3 H.inf 1 H.inf 2 H.inf 3 S.aureus 1 S.aureus 2 S.aureus 3 E.coli 1 E.coli 2 E.coli 3
Time(s) Space(MB) HiTEC PSAEC(P = 6) HiTEC PSAEC(P = 6) 123.5 69.1 746 542 154.3 86.3 746 542 277.8 155.4 746 542 257.6 146.9 1408 1028 386.4 220.3 1408 1028 579.6 330.5 1408 1028 478.9 296.6 2476 1896 714.3 444.9 2476 1896 1075.0 667.3 2476 1896 785.5 498.1 3652 2570 1174.8 747.1 3652 2570 1767.3 1120.7 3652 2570 1529.4 950.8 6014 4186 1911.7 1193.5 6014 4186 3441.1 2148.3 6014 4186
We first evaluate the parameter P which plays an important role in PSAEC. As analyzed in the section 3, when P increases, the time cost for classfication phase will increase and it is the opposite for the Multikey Quicksort phase. From Table 2 we can learn that when P = 6, PSAEC is most efficient, except for the read data sets created from S.aureus. Table 3 shows the time and space comparison between PSAEC and HiTEC at P = 6. Note that the test runs on a 64bit Linux, the memory used by HiTEC and PSAEC is almost two times as many as that running on 32bit operating systems. The test shows that Our algorithm is more time and space effcient than HiTEC. Combined with the data reproted by [10], our algorithm is also more efficient than SHREC and Reptile. Figure 5 shows the running time of PSAEC with various number of threads on an 8-core CPU which exhibits the scalability of PSAEC. However, the collisions between threads in the cache will degrade the speedup achieved from the parallelization on multi-core platforms. We will parallelize the PSAEC on distributed-memory parallel computers using MPI for more large-scale reads.
230
Z. Zhao et al.
Fig. 5. The running time of PSAEC with various number of threads on an 8-core CPU at P = 6. The read length is 70bp and coverage is 70 for all data sets with 3% per-base error rate.
5
Conclusion
In this paper, we provide an efficient and scalable algorithm which called PSAEC for error correction in high-throughput sequencing data. Our algorithm is more time and space efficient than previous algorithms and has good scalability on the multi-core platforms according to our analysis and the testing. We will further improve our algorithm on the accuracy of error correction combined with the quality values and parallelize our algorithm on the distributed-memory parallel computers using MPI for more large-scale reads.
References 1. Mardis, E.R.: The impact of next-generation sequencing technology on genetics. Trends Genet. 24, 133–141 (2008) 2. Tammi, M.T., Arner, E., Kindlund, E., Andersson, B.: Correcting errors in shotgun sequences. Nucleic Acids Res. 31, 4663–4672 (2003) 3. Chaisson, M.J., Pevzner, P.A., Tang, H.: Fragment assembly with short reads. Bioinformatics 20, 2067–2074 (2004) 4. Chaisson, M.J., Brinza, D., Pevzner, P.A.: De novo fragment assembly with short mate-paired reads: Does the read length matter? Genome Res. 19, 336–346 (2009) 5. Butler, J., MacCallum, I., Kleber, M., Shlyakhter, I.A., Belmonte, M.K., Lander, E.S., Nusbaum, C., Jaffe, D.B.: ALLPATHS: De novo assembly of whole-genome shotgun microreads. Genome Res. 18, 810–820 (2008) 6. Yang, X., Dorman, K.S., Aluru, S.: Reptile: representative tiling for short read error correction. Bioinformatics 26, 2526–2533 (2010) 7. Kelley, D., Schatz, M., Salzberg, S.: Quake: quality-aware detection and correction of sequencing errors. Genome Biology 11(11), R116 (2010)
PSAEC: An Improved Algorithm for Short Read Error Correction
231
8. Shi, H., Schmidt, B., Liu, W., Muller-Wittig, W.: A parallel algorithm for error correction in high-throughput short-read data on CUDA-enabled graphics hardware. J. Comput. Biol. 17, 603–615 (2009) 9. Schroder, J., Schroder, H., Puglisi, S.J., Sinha, R., Schmidt, B.: SHREC: a shortread error correction method. Bioinformatics 25, 2157–2163 (2009) 10. Ilie, L., Fazayeli, F., Ilie, S.: HiTEC: accurate error correction in high-throughput sequencing data. Bioinformatics 27(3), 295–302 (2011) 11. Larsson, N.J., Sadakane, K.: Faster suffix sorting. Technical Report LU-CS-TR: 99-214, LUNDFD6/(NFCS-3140)/1–20/(1999), Department of Computer Science, Lund University, Sweden (1999) 12. Mori, Y.: Short description of improved two-stage suffix sorting algorithm, http://homepage3.nifty.com/wpage/software/itssort.txt 13. Bentley, J.L., Sedgewick, R.: Fast algorithms for sorting and searching strings. In: 8th Annual ACM-SIAM Symposium on Discrete Algorithms, New York, pp. 360–369 (1997) 14. Futamura, N., Aluru, S., Kurtz, S.: Parallel suffix sorting. In: 9th International Conference on Advanced Computing and Communications, pp. 76–81. Tata McGraw-Hill (2001) 15. Manber, U., Myers, G.: Suffix arrays: a new method for on-line search. SIAM J. Comput. 22(5), 935–948 (1993) 16. Puglisi, S.J., Smyth, W.F., Turpin, A.: A taxonomy of suffix array construction algorithms. ACM Comput. Surv. 39(2), 1–31 (2007)
232
Z. Zhao et al.
Appendix A: The HiTEC Algorithm
Algorithm 2. HiTEC (r 1 ,. . . , r n ) given: n reads r 1 ,. . . , r n (of length l each); L and p output: n corrected reads 1: compute w M and w m 2: compute T 3: i ← 1 4: repeat 5: c←0 6: w ← w seq[i] 7: construct R and compute SA and LCP 8: compute the clusters in SA for all witnesses of length w 9: for each witness u with clust(u)≥ T + 1 do 10: Corr ← {a | supp(u,a) ≥ T } 11: Err ← {a | supp(u,a) ≤ T -1} 12: for each a ∈ Err do 13: if | Corr | == 1 then 14: correct a to b ∈ Corr 15: c←c+1 16: end if 17: if | Corr | ≥ 2 then 18: for each b ∈ Err do 19: if ua, ub followed by same two letters then 20: correct a to b ∈ Corr 21: c←c+1 22: end if 23: end for 24: end if 25: end for 26: end for 27: i ←i +1 28: until c < 0.0001 or i > 9 ln
Two Hardness Results on Feedback Vertex Sets Wei Jiang1 , Tian Liu1 , Tienan Ren1 , and Ke Xu2 1
Key Laboratory of High Confidence Software Technologies, Ministry of Education, Institute of Software, School of Electronic Engineering and Computer Science, Peking University, Beijing 100871, China [email protected] 2 National Lab of Software Development Environment, School of Computers, Beihang University, Beijing 100083, China [email protected]
Abstract. A feedback vertex set is a subset of vertices whose deletion makes the remaining graph a forest. We show that the minimum FVS (MFVS) in star convex bipartite graphs is N P-hard to find, and give a tighter lower bound on the size of MFVS in sparse random graphs, to provide further evidence on the hardness of random CSPs.
1
Introduction
A feedback vertex set (FVS), also called loop cutset, is a subset of vertices whose deletion makes the remaining graph a forest. Finding the minimum FVS (MFVS) is one of the twenty-one classical N P-complete problems in Karp’s list [28]. MFVS has applications in deadlock prevention and recovery in operating systems [37], information security [24], VLSI chip design [16], artificial intelligence [1,39], etc.. Many algorithms have been developed for MFVS, which are approximate [3,1,6,7,36,46], randomized [2], parameterized [10,11,8], exact [18], polynomial in restricted graphs [32,33,31,38,21,30], to enumerate and count the number of MFVS [17], and to estimate the size of MFVS [35]. In this paper, we show two hardness results about MFVS in two of the above categories. Namely, we show that MFVS is N P-hard in restricted bipartite graphs which are called star convex, and we give a tighter lower bound on the size of MFVS in sparse random graphs. These results in turn show the hardness of solving constraint satisfaction problems (CSPs) with respect to some specific algorithms based on MFVS. A bipartite graph G = (A, B, E) is called tree convex, if there is a tree T = (A, F ), such that for all vertex b in B, the subset N (b) = {a ∈ A|(a, b) ∈ E} (i.e. the neighborhood of b in A) is a connected subtree in T . When T is a star (i.e. a bipartite complete graph K1,|A|−1), G is called star convex. When T is a path, G is called path convex or just convex. The notions of tree convex bipartite graphs and star convex bipartite graphs are first time introduced here, which in turn are inspired by the concept of tree convex sets [45]. It was known that finding MFVS
To whom the correspondence should be addressed: Tian Liu ([email protected]) and Ke Xu ([email protected]).
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 233–243, 2011. c Springer-Verlag Berlin Heidelberg 2011
234
W. Jiang et al.
in bipartite graphs is also N P-hard [44], but tractable in convex bipartite graphs and cocomparable graphs [32], interval graphs [33], circle graphs [21], etc. In this paper, we show that finding MFVS in star convex bipartite graphs is already N P-hard, thus the tractable result in [32] on convex bipartite graphs is not extensible to all tree convex bipartite graphs. Constraint Satisfaction Problems (CSPs) cover many important problems in computer science and artificial intelligence. It was known that CSPs can be solved in O(||I||w ) time, where ||I|| is input size and w is the size of MFVS in constraint graphs [12]. This is achieved by first finding a MFVS, and then cycling through all assignments on the MFVS. For each of the assignment, the remaining subproblem is on a forest, and CSPs on trees are tractable [13]. A related more general notion is the so-called backdoor variables [39]. By definition, a proper partial assignment to the backdoor variables will make the remaining subproblem tractable. So MFVS is just a kind of backdoor variables for CSPs. Our research on MFVS was motivated by its role in solving CSPs as mentioned above. Our result on hardness of finding MFVS in tree convex bipartite graphs implies that there is no efficient way to find the optimal (i.e. the smallest) set of backdoor variables based on MFVS when the constraint graphs of CSPs are star convex (or general tree convex) bipartite graphs, unless P = N P. It was also know that random CSPs can have satisfiability thresholds and the hardest instances are around the thresholds [23]. Today it is a common practice to use random instances as benchmarks in algorithm competitions and research. For example, based on two random CSP models called Model RB and Model RD which have exact satisfiability thresholds [40], a whole family of benchmarks has been constructed (e.g. [41]), which cover many N P-hard optimization problems, such as Maximum Clique, Maximum Independent Set, Minimum Vertex Cover, Vertex Coloring, Set Covering, Set Packing, 0-1 Integer Programming, MAX-SAT, etc.. These benchmarks have been used in many international algorithm competitions, such as the annual CSP solver competitions and the annual Pseudo-Boolean (0-1 Integer Programming) solver competitions since the year 2005, the annual MAX-SAT solver competitions since the year 2008, and the annual SAT solver competition at the years 2004 and 2009, etc., and in many research papers on algorithms (e.g. [5], and references in [41]). However, a rigorous link between phase transition and the hardness is very hard to establish. By rigorous we mean that no polynomial time solver can exist at the satisfiability thresholds. Instead, we might show that some specific polynomial time solvers do not exist, e.g. no short resolution proof exists. In this paper, we will give a tighter lower bound on the size of MFVS in sparse random graphs, to provide further theoretical evidence on hardness of random CSP instances (especially of Model RB and Model RD), besides the known theoretical hardness results based on resolution complexity [42] and the experimental hardness results [43]. This paper is organized as follows. In Section 2, we give a reduction from Vertex Cover (VC) to MFVS in star convex bipartite graphs. In Section 3, we estimate the size of MFVS in sparse random graphs. Finally, we give some open problems.
Two Hardness Results on Feedback Vertex Sets
2
235
The Reduction
Theorem 1. MFVS is N P-hard on star convex bipartite graphs. Proof. We give a reduction from the Vertex Cover (VC) to MFVS in star convex bipartite graphs. Given a non-trivial (i.e. neither an independent set nor a clique) graph G = (V, E), we construct a star convex bipartite graph G = (A, B, E ), such that VC in graph G is equivalent to MFVS in graph G , as follows. Let |A∪B| = 3|V |+2|E|+1. The set A contains |V |+1 vertices a0 , a1 , . . . , a|V | . For 1 ≤ i ≤ |V |, the vertex ai is called an external vertex and corresponds exclusively to a vertex vi in V . The vertex a0 is called the central vertex. The set B contains 2|V | + 2|E| vertices b1 , b2 , . . . , b2|V |+2|E| . Let |E | = 4|V | + 6|E|. The graph G is composed by two types of gadgets. Gadgets of type I are complete bipartite graphs K2,2 , each with four edges and corresponding exclusively to a vertex in V . Gadgets of type II are complete bipartite graphs K3,2 , each with six edges and corresponding exclusively to an edge in E. See figure 1. For every vertex vi in V (1 ≤ i ≤ |V |), we build a gadget of type I in G , which is a K2,2 on four vertices ai , a0 , b2i−1 , b2i . For every edge ei = (vj , vk ) in E (1 ≤ i ≤ |E|, 1 ≤ j, k ≤ |V |), we build a gadget of type II in G , which is a K3,2 on five vertices aj , ak , a0 , b2|V |+2i−1 , b2|V |+2i . The construction of graph G is finished. An example of G = ({1, 2, 3, 4}, {(1, 2), (1, 3), (1, 4)}) and the construction of G is shown in Figure 2. Clearly, the construction is in polynomial time. The following three lemmas show its correctness. Lemma 1. The graph G is star convex bipartite. Proof. Both types of gadgets are complete bipartite graphs, with all edges between vertices in A and vertices in B. So G is a bipartite graph, with all edges between vertices in A and vertices in B. Both types of gadgets are complete bipartite graphs containing a0 . So every vertex b in B is connected to a0 . In fact, for 1 ≤ i ≤ |V |, the neighborhoods of b2i−1 and b2i are both {a0 , ai }. For 1 ≤ i ≤ |E|, the neighborhoods of b2|V |+2i−1 and b2|V |+2i are both {a0 , aj , ak }, where ei = (aj , ak ) is an edge in E. Let the tree T on A be a star with center a0 and leaves a1 , . . . , a|V | . Then for 1 ≤ i ≤ |V |, the neighborhoods of b2i−1 and b2i are both a star in T with center a0 and leaf ai . For 1 ≤ i ≤ |E|, the neighborhoods of b2|V |+2i−1 and b2|V |+2i are both a star in T with center a0 and leaves aj , ak . So G is also star convex.
Fig. 1. Gadgets of type I (left) and type II (right)
236
W. Jiang et al.
Fig. 2. An example of the construction
Lemma 2. Graph G has a VC of size no more than k, only if G has a FVS of size no more than k + 1. Proof. We show that given any VC S in graph G, let S be the corresponding vertices in A, then S ∪ {a0 } is a FVS in G . By definition of FVS, S ∪{a0 } is a FVS in G if and only if S ∪{a0 } covers all cycles in G . Clearly, each cycles in G either contains the vertex a0 or contains two vertices aj and ak such that (vj , vk ) is an edge in G, see Figure 1 and 2. To cover an edge (vj , vk ) in G, either vj or vk or both should be in S, thus either aj or ak or both should be in S . Thus S ∪ {a0 } covers all cycles in G . Lemma 3. Graph G has a VC of size no more than k, if G has a FVS of size no more than k + 1. Proof. Assume that S is a FVS in G . If a0 is not in S , then at least one other vertex of every gadget of type I will be in S , so |S | ≥ |V |. On the other hand, since G is not a clique, say (vj , vk ) is not an edge in E, then V \ {vj , vk } is a VC in G, so G has a VC of size no more than |V | − 2, the lemma trivially holds. So assume that a0 is in S . If S contains any vertex bi in B, then we can select any neighbor of bi other than a0 to replace bi . Still all the cycles in G are covered, thus the result is a FVS in G and its size is no more than that of S . So without lose of generality, we may assume that S is contained in A. Now let S be the corresponding vertices of S \ {a0 } in G. We show that S is a VC in G as follows. Otherwise, there is an edge ei = (vj , vk ) not covered by S. So both vj and vk are not in S, and accordingly both aj and ak are not in S . Then the corresponding gadget of type II of ei will contain a cycle aj → b2|V |+2i−1 → ak → b2|V |+2i → aj , which is not covered by S . This is a contradiction to the assumption that S is a FVS in G . This finishes the proof of Theorem 1.
Two Hardness Results on Feedback Vertex Sets
3
237
The Lower Bounds
Recall that deleting a FVS makes the remaining graph a forest. So the size of the maximum induced forest in a graph G (denoted by M IF (G)) is equal to the number of vertices in G (denoted by |V (G)| = n) minus the size of MFVS in G (denoted by M F V S(G)), i.e. M F V S(G) = n − M IF (G). A forest is a bipartite graph and at least half of its vertices is an independent set. So M IF (G) is lower bounded by the size of the maximum independent set in G (denoted by M IS(G)) and upper bounded by twice the size of the maximum independent set, i.e. M IS(G) ≤ M IF (G) ≤ 2 · M IS(G). Thus, n − 2 · M IS(G) ≤ n − M IF (G) = M F V S(G) ≤ M IS(G).
(1)
In this section, we will give an upper bound on M IF (G), and in turn a lower bound on M F V S(G) in some random graph G, which is tighter than that derived from the known upper bound on M IS(G). 3.1
In G(n, p)
The classical random graphs G(n, p) are defined on n vertices by selecting each pair of vertices independently at random with probability p as an edge [22]. They are also called the Erd˝ os-R´enyi random graphs and have been extensively investigated [4,26]. A beautiful result on the size of maximum independent sets √ in G(n, p) for p = o(1/ n) was proved by Frieze in 1990 with a profound combination of the second moment method and a large deviation inequality of martingale or Talagrand type [20,26]. For events Qn which may depend on n, we say that Qn holds with high probability, if limn→∞ Pr(Qn ) = 1, often written as Pr(Qn ) = o(1). Here, f (n) = o(g(n)) and f (n) g(n) both mean that (n) limn→∞ fg(n) = 0. Proposition 1. ([26], pp.183) For any constant > 0, define k± by 2 k± = (ln np − ln ln np + 1 − ln 2 ± ) . p There is a constant C such that for all C /n ≤ p ≤ ln−2 n, for G ∈ G(n, p), with high probability k− ≤ M IS(G) ≤ k+ . Corollary 1. Under the conditions in Proposition 1, for G ∈ G(n, p), with high probability n − 2k+ ≤ M F V S(G) ≤ n − k− . By Corollary 1, for G ∈ G(n, p = O( n1 )), there are constants 0 < c1 < c2 < 1, with high probability c1 n ≤ M F V S(G) ≤ c2 n. So for random graph G with O(n) edges, with high probability M F V S(G) is not as large as n − o(n). Only for G ∈ G(n, p) (p n1 ), with high probability M F V S(G) is as large as n−o(n). Theorem 2. For any > 0 and G ∈ G(n, p) (p n1 ), with high probability 2 p M F V S(G) ≥ n − ln np + + 2 − ln 2 + . p 2
238
W. Jiang et al.
Proof. In a forest, the number of edges is always smaller than the number of vertices. Let S(x) be the property that there is at least one induced subgraph with x vertices and less than x edges. Let Y be the number of edges in an induced subgraph with x vertices in G. Write Y = si=1 Yi , where s = x2 and 1 ith edge is selected in G(n, p), Yi = 0 ith edge is not selected in G(n, p). The expectation of Yi is EYi = Pr(Yi = 1) = p. As in the proofs of the Chernoff bound ([26], pp.25-26), for any t < 0, we have s EetYi EetY (pet + 1 − p)s (1 + p(et − 1))s Pr(Y < x) ≤ tx = i=1tx = = tx e e e etx t t (ep(e −1) )s ≤ = esp(e −1)−tx . tx e t
Let f (t) = esp(e
−1)−tx
x 2 t = ln sp = ln (x−1)p By the Union bound,
. Then f (t) = f (t)(spet − x). So f (t) is minimized at (x−1)p 2 and Pr(Y < x) ≤ f (ln 2 ) = e−x( 2 −ln (x−1)p −1) . (x−1)p
en x (x−1)p 2 n Pr(G ∈ S(x)) ≤ Pr(Y < x) ≤ e−x( 2 −ln (x−1)p −1) x x p np p 2 x −x( (x−1)p +ln −ln 2 np x−1 −2) = e−x(x 2 −ln 2 − 2 −2+o(1)) =e ≤e−x = o(1), for any > 0 and x > p2 ln(np) + p2 + 2 − ln 2 + , where np is unbounded. Thus M IF (G) ≤ 2p ln np + p2 + 2 − ln 2 + with high probability. Then the theorem follows from (1). If we directly use the Chernoff bound in its general form (e.g. as in [26,29]) to upper bound P r(Y < x) in proof of Theorem 2, then it is hard to find the expression of x in terms of n and p as we do. Instead, we customize the proof of the Chernoff Bound on our specific probability function. This trick may be useful in other places when sharp parameters are needed. The proof of Theorem 2 is much simpler than that of Proposition 1. Of course, Theorem 2 is only valid for p n1 , but gives a tighter lower bound than Corollary 1 does for such a p. 3.2
In GRB (n, r)
Two random CSP models called Model RB and Model RD are as follows [40]. – Given n variables each with domain {1, 2, ..., d}, where d = nα and α > 0 is a constant; – Select with repetition m = rn ln n random constraints, for each constraint select without repetition k of n variables, where k ≥ 2 is an integer constant;
Two Hardness Results on Feedback Vertex Sets
239
– Select uniformly at random without repetition (1 − p)dk compatible assignments for each constraint (for Model RB), or select each assignment for the k variables as compatible with probability 1 − p independently (for Model RD), where 0 < p < 1 is a constant. For simplicity, we only consider Model RB and Model RD for k = 2. Clearly, they have the same kinds of random constraint graphs. Let GRB (n, r) denote the probability space of these random graphs, where on n vertices we select with repetition rn ln n edges from all pairs of vertices independently at random. As in many other random graph models e.g. G(n, m) in [14,15], GRB (n, r) and G(n, p) are in fact asymptotically equivalent, which is shown by the Balls and Bins model [29]. Suppose that we put a balls independently at random into b bins. Then the joint distribution of the number of balls in each bin is referred to as in the exact case. In another case called Poisson case, the number of balls in each bin is independent and has Poisson distribution with mean a/b. Proposition 2. (Corollaries 5.9 and 5.11 at pages 102-103 in [29]) Any event √ occurring with probability p in Poisson case occurs with probability at most pe a in exact case. Moreover, any event, whose probability is either monotone increasing or monotone decreasing in the number of balls, with probability p in Poisson case occurs with probability at most 2p in exact case. Lemma 4.Let Qn be an arbitrary graph √ property, r > 0 and p = (rn ln n − r2 ln2 n)/ n2 . Then PrGRB (n,r) (Qn ) ≤ e rn ln n PrG(n,p) (Qn ). Moreover, if Qn is monotone, then PrGRB (n,r) (Qn ) ≤ 2 PrG(n,p) (Qn ). Proof. By Proposition 2. Treating edges as balls and all pairs of vertices as bins, then GRB (n, r) is no more than in the exact case where a = rn ln n and b = n2 . a a2 A bin is empty with probability (1 − 1b )a ≈ e− b ≈ 1 − ab + 2b 2 . So the expected a2 a2 number of nonempty bins is about b( ab − 2b ) = a − ≈ rn ln n − r2 ln2 n. This 2 2b RB is the expected number of edges in G (n, r). Then G(n, p) is equivalent to in Poisson case with p = (rn ln n − r2 ln2 n)/ n2 . Theorem 3. For any > 0 and constant r > 0, define C± by n (ln ln n + 2 + ln r + ) , r ln n n = n − (ln ln n − ln ln ln n + 1 + ln r − ) . r ln n
C− = n − C+
Then for G ∈ GRB (n, r), with high probability C− ≤ M F V S(G) ≤ C+ . Proof. Since the size of MFVS is a monotone property, by Lemma 4, for p = (rn ln n −r2 ln2 n)/ n2 , PrGRB (n,r) (G ∈ S(x)) ≤ 2 PrG(n,p) (G ∈ S(x)). So we can apply Lemma 4 to translate the proof in Theorem 2 and the resullt in Corollary 1 from G(n, p) to GRB (n, r) as follows.
240
W. Jiang et al.
The lower bound is proved as in Theorem 2 and we only give the changed part. For above p and G ∈ G(n, p),
en x (x−1)p 2 n Pr(G ∈ S(x)) ≤ Pr(Y < x) ≤ e−x( 2 −ln (x−1)p −1) x x en x x2 −x x−1 − (rn ln n−r 2 ln2 n)+x+x ln n2 −n (rn ln n−r 2 ln2 n) = e n2 −n x
−x x
<e
r ln n −ln ln n−ln r−2+o(1) n
= o(1),
n for any > 0 and x > r ln n (ln ln n + ln r + 2 + ). Then let C− = n − n − n (ln ln n + 2 + ln r + ) . r ln n The upper bound is translated from Corollary 1. Substituting above p into k± and omit some o(1) terms which are added to , a clean form of k± in r is n RB obtained, denoted by k± = r ln n (ln ln n − ln ln ln n + 1 + ln r ± ) . Then let RB C+ = k+ . This finishes the proof of Theorem 3.
The leading term in the relative gap between these theoretical upper and lower bounds on MFVS in GRB (n, r) is lnrlnlnlnn n , so the lower bound is asymptotically fairly tight. To observe the convergence speed of these bounds on small n, we do two groups of experiments for r = 5 and r = 10 respectively. In each group, we set n = 30 to 100 with step length 10. For each pair (n, r), we generate 10 random instances in GRB (n, r) and take average. The Results are shown in Figure 3. We can find the following facts. (1) Experimental results do agree with the theoretical bounds when n is larger than a small value (n > 90 for r = 5 and n > 50 for r = 10). (2) The larger r is, the earlier the results agree with the theoretical bounds. (3) The relative gap between the theoretical upper and lower bounds ( lnrlnlnlnn n ) is not too large (%8 for r = 5 and %4 for r = 10). By Corollary 1 or Theorem 3, the random instances of Model RB and Model α RD around the satisfiability thresholds rcr = − ln(1−p) [40] have asymptotically the largest possible MFVS, i.e. in size n − o(n). Theorem 3 gives an improved estimation on the o(n) term than Corollary 1 does. This provide further theoretical evidence on the hardness of Model RB and Model RD. Previously, the only theoretical hardness evidence is based on their high resolution complexity [42]. cutset size (r=5)
cutset size (r=10)
0.82
ratio of loop cutset
ratio of loop cutset
0.84 0.8 0.78 0.76 0.74
lower bound upper bound result
0.72 0.7 30
40
50
60
70
node number
80
90 100
0.91 0.9 0.89 0.88 0.87 0.86 0.85 0.84 0.83
lower bound upper bound result 30
40
50
60
70
80
90 100
node number
Fig. 3. Experimental Results on MFVS (also called loop cutset)
Two Hardness Results on Feedback Vertex Sets
4
241
Open Problems
A triad is three paths with a common end. Recently, we have shown that finding MFVS on triad convex bipartite graphs is tractable [27]. However, a complete classification of the complexity of finding MFVS on every kind of tree convex bipartite graphs is unknown. Also, showing other kind of theoretical hardness evidences for random CSPs is an important and interesting open problem.
Acknowledgments We thank Professor Kaile Su for his encouragement and support. We also thank the unknown reviewers whose comments are very helpful to improve our presentations. This research was partially supported by the National 973 Program of China (Grant No. 2010CB328103) and the National Natural Science Foundation of China (Grant Nos. 60725207 and 60973033), and was partially done while Tian Liu and Ke Xu were visiting KITPC at the Chinese Academy of Science.
References 1. Bar-Yehuda, R., Geiger, D., Naor, J., Roth, R.: Approximation algorithms for the feedback vertex set problem with applications to constraint satisfaction and Bayesian inference. SIAM J. Comput. 27, 942–959 (1998) 2. Becker, A., Bar-Yehuda, R., Geiger, D.: Randomized Algorithms for the Loop Cutset Problem. J. Artif. Intell. Res. 12, 219–234 (2000) 3. Becker, A., Geiger, D.: Optimization of Pearl method of conditioning and greedylike approximation algorithms for the vertex feedback set problem. Artificial Intelligence 83, 167–188 (1996) 4. Bollob´ as, B.: Random Graphs, 2nd edn. Cambridge University Press, Cambridge (2001) 5. Cai, S., Su, K., Chen, Q.: Ewls: A new local search for minimum vertex cover. In: Proc. of AAAI, pp. 45–50 (2010) 6. Cai, M., Deng, X., Zang, W.: An approximation algorithm for feedback vertex sets in tournaments. SIAM J. Comput. 30, 1993–2007 (2001) 7. Cai, M., Deng, X., Zang, W.: A min-max theorem on feedback vertex sets. Math. Oper. Res. 27(2), 361–371 (2002) 8. Cao, Y., Chen, J., Liu, Y.: On Feedback Vertex Set: New Measure and New Structures. In: Kaplan, H. (ed.) SWAT 2010. LNCS, vol. 6139, pp. 93–104. Springer, Heidelberg (2010) 9. Caragiannis, I., Kaklamanis, C., Kanellopoulos, P.: New bounds on the size of the feedback vertex set on meshes and butterflies. Inform. Process. Lett. 83(5), 275–280 (2002) 10. Chen, J., Fomin, F., Liu, Y., Lu, S., Villanger, T.: Improved algorithms for feedback vertex set problems. J. Comput. Syst. Sci. 74(7), 1188–1198 (2008) 11. Chen, J., Liu, Y., Lu, S., O’Sullivan, B., Razgon, I.: A fixed-parameter algorithm for the directed feedback vertex set problem. J. ACM 55(5) (2008) 12. Dechter, R.: Enhancement Schemes for Constraint Processing: Backjumping, Learning and Cutset Decomposition. Artif. Intell. 41(3), 273–312 (1990)
242
W. Jiang et al.
13. Dechter, R.: Tractable structures for constraint satisfaction problems. In: Handbook of Constraint Programming, pp. 209–244 (2006) 14. Erd˝ os, P., R´enyi, A.: On random graphs I. Publicationes Mathematicae 6, 290–297 (1959) 15. Erd˝ os, P., R´enyi, A.: On the evolution of random graphs. Publ. Math. Inst. Hungar. Acad. Sci 5, 17–61 (1960) 16. Festa, P., Pardalos, P.M., Resende, M.G.C.: Feedback set problems. In: Du, D.-Z., Pardalos, P.M. (eds.) Handbook of Combinatorial Optimization, vol. A(suppl.), pp. 209–259. Kluwer Academic Publishers, Dordrecht (2000) 17. Fomin, F.V., Gaspers, S., Pyatkin, A., Razgon, I.: On the Minimum Feedback Vertex Set Problem: Exact and Enumeration Algorithms. Algorithmica 52(2), 293–307 (2008) 18. Fomin, F.V., Villanger, Y.: Finding Induced Subgraphs via Minimal Triangulations. In: Proc. of STACS 2010, pp. 383–394 (2010) 19. Focardi, R., Luccio, F.L., Peleg, D.: Feedback vertex set in hypercubes. Inform. Process. Lett. 76(1-2), 1–5 (2000) 20. Frieze, A.M.: On the independence number of random graphs. Discrete Math. 81, 171–175 (1990) 21. Gavril, F.: Minimum weight feedback vertex sets in circle graphs. Information Processing Letters 107, 1–6 (2008) 22. Gilbert, E.N.: Random graphs. Annals of Mathematical Statistics 30, 1141–1144 (1959) 23. Gomes, C., Walsh, T.: Randomness and structures. In: Handbook of Constraint Programming, pp. 639–664 (2006) 24. Gusfield, D.: A graph theoretic approach to statistical data security. SIAM J. Comput. 17(3), 552–571 (1998) 25. Hsu, C.C., Lin, H.R., Chang, H.C., Lin, K.K.: Feedback Vertex Sets in Rotator Graphs. In: Gavrilova, M.L., Gervasi, O., Kumar, V., Tan, C.J.K., Taniar, D., Lagan´ a, A., Mun, Y., Choo, H. (eds.) ICCSA 2006. LNCS, vol. 3984, pp. 158–164. Springer, Heidelberg (2006) 26. Janson, S., Luczak, T., Rucinski, A.: Random Graphs. John Wiley and Sons, Chichester (2000) 27. Jiang, W., Liu, T., Xu, K.: Feedback Vertex Sets in Bipartite Graphs (submitted, 2011) 28. Karp, R.: Reducibility among combinatorial problems. In: Complexity of Computer Computations, pp. 85–103. Plenum Press, New York (1972) 29. Mitzenmacher, M., Upfal, E.: Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge University Press, Cambridge (2005) 30. Kuo, C., Hsu, C., Lin, H., Lin, K.: An efficient algorithm for minimum feedback vertex sets in rotator graphs. Information Processing Letters 109, 450–453 (2009) 31. Kralovic, R., Ruzicka, P.: Minimum feedback vertex sets in shufflebased interconnection networks. Inform. Process. Lett. 86(4), 191–196 (2003) 32. Liang, Y.D., Chang, M.S.: Minimum feedback vertex sets in cocomparability graphs and convex bipartite graphs. Acta Informatica 34, 337–346 (1997) 33. Lu, C., Tang, C.: A linear-time algorithm for the weighted feedback vertex problem on interval graphs. Information Processing Letters 61, 107–111 (1997) 34. Luccio, F.L.: Exact minimum feedback vertex set in meshes and butterflies. Inform. Process. Lett. 66(2), 59–64 (1998) 35. Madelaine, F.R., Stewart, I.A.: Improved upper and lower bounds on the feedback vertex numbers of grids and butterflies. Discrete Math. 308, 4144–4164 (2008)
Two Hardness Results on Feedback Vertex Sets
243
36. Sasatte, P.: Improved approximation algorithm for the feedback set problem in a bipartite tournament. Operations Research Letters 36, 602–604 (2008) 37. Silberschatz, A., Galvin, P.B., Gagne, G.: Operating Systems Concepts, 6th edn. John Wiley and Sons, Inc., New York (2003) 38. Wang, F.H., Wang, Y.L., Chang, J.M.: Feedback vertex sets in star graphs. Inform. Process. Lett. 89(4), 203–208 (2004) 39. Williams, R., Gomes, C.P., Selman, B.: Backdoors To Typical Case Complexity. In: Proc. of IJCAI 2003, pp. 1173–1178 (2003) 40. Xu, K., Li, W.: Exact phase transitions in random constraint satisfaction problems. J. Artif. Intell. Res. 12, 93–103 (2000) 41. Xu, K.: BHOSLIB: Benchmarks with Hidden Optimum Solutions for Graph Problems, http://www.nlsde.buaa.edu.cn/~ kexu/benchmarks/graph-benchmarks.htm 42. Xu, K., Li, W.: Many hard examples in exact phase transitions. Theor. Comput. Sci. 355, 291–302 (2006) 43. Xu, K., Boussemart, F., Hemery, F., Lecoutre, C.: Random Constraint Satisfaction: Easy Generation of Hard (satisfiable) Instances. Artif. Intell. 171, 514–534 (2007) 44. Yannakakis, M.: Node-deletion problem on bipartite graphs. SIAM J. Comput. 10, 310–327 (1981) 45. Zhang, Y., Yap, R.: Set Intersection and Consistency in Constraint Networks. J. Artif. Intell. Res. 27, 441–464 (2006) 46. van Zuylen, A.: Linear programming based approximation algorithms for feedback set problems in bipartite tournaments. Theor. Comput. Sci. (in press)
Approximation Algorithms for Unrelated Machine Scheduling with an Energy Budget Lin Chen1 , Wenchang Luo2 , and Guochuan Zhang1 1
College of Computer Science, Zhejiang University, Hangzhou, 310027, China [email protected], [email protected] 2 Faculty of Science, Ningbo University, Ningbo, 315211, China
Abstract. We consider the problem of unrelated parallel machine scheduling when the DVS (dynamic voltage scaling) method is used to conserve energy consumption. Given an energy budget, we present (2+)approximation algorithms for the makespan minimization problem under two different settings, the continuous model in which speeds are allowed to be any real number in [smin , smax ] and the discrete model in which only d distinct speeds are available. We also show how to derive a 2approximation algorithm if the energy budget is allowed to be slightly exceeded. Keywords: Approximation algorithm; Unrelated machine scheduling; Rounding.
1
Introduction
With the fast development of IT technology, CPU is becoming more and more powerful. However, increasing CPU clock speeds also causes higher energy consumption, and thus power saving becomes a very important issue. One of the efficient ways to this end is dynamic voltage scaling (DVS), which allows CPU to run at different speeds. Along this way a lot of work has been done on a single processor, while not much is known for multiprocessor scheduling. As nowadays multicore chips are much more widely used, and many of them (e.g., chips designed by AMD and Intel) are capable of running at a variety of speeds, it is crucial to devise a strategy of speed choosing for multiprocessor scheduling so that both service and energy consumption are taken into consideration. In this paper we study unrelated parallel machine scheduling with the total energy consumption constraint. We are given a set of jobs J = {J1 , J2 , · · · , Jn } and a set of machines M = {M1 , M2 , · · · , Mm }. Each job must be processed on one of the machines. The workload (size) of job Ji on machine Mj is wij , and its actual processing time depends on the speed of machine Mj . Moreover, the release time of job Ji with respect to Mj is rij , which can be regarded as the travel time of job Ji to reach machine Mj . Depending on the availability of machine speeds we consider two models, namely, a discrete model and a continuous model. In the discrete model, each M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 244–254, 2011. c Springer-Verlag Berlin Heidelberg 2011
Approximation Algorithms for Unrelated Machine Scheduling
245
machine is able to run at d distinct speeds, s1 , s2 , · · · , sd , where sk ≥ 1 is an integer. The processing time of Ji on Mj is defined as wij /sk if Mj processes Ji at speed sk . Moreover, we allow the machine to run at different speeds in processing sk for tijk a single job. For example, in order to process Ji , M j might use speed time units, then the total processing time of Ji is k tijk , and k sk tijk = wij follows. Note that we only allow machines to choose multiple speeds to process jobs, but no preemption is allowed. The continuous model is quite similar. The only difference is that machines are allowed to choose any speed in the interval [smin , smax ], where both smin and smax are positive integers. The processing time of a job can be defined analogously. In fact we can also handle the more general case when the interval of available speeds is [0, +∞), which will be discussed later. For both models, we allow machines to be idle when there are no jobs running on them. It can be viewed as that the machines work at speed 0. Therefore we also take 0 as a feasible speed. When a machine is running it consumes energy. A higher speed definitely needs more power. We take the commonly used assumption as follows. If a machine runs at a certain speed s, its power consumption is characterized by the function P (s) = sα with α ≥ 2, and it does not consume energy when it is idle. Given an energy budget E, we aim to find a schedule with the least makespan. It is easy to check if the given budget suffices to maintain a feasible schedule by assigning each job the least possible power. Throughout this paper we always assume that a feasible solution exists. If there is no energy consumption constraint or the budget is sufficiently large, the problem is equivalent to the classical unrelated machine scheduling problem since all machines would choose to run at the top speed. Unrelated machine scheduling is a classical and important model with many interesting applications in manufacturing, such as distributed computing or printed wiring board [11]. For unrelated machine scheduling Lenstra et al. [5] proposed an elegant 2-approximation algorithm. Recently, a slightly better algorithm that achieves (2 − 1/m)-approximation was presented by Shchepin and Vakhania [8]. However, the asymptotic upper bound of two remains the best known. Phillips et al. [6] considered the unrelated scheduling problem on network, where each job is located at some node in the network, and it takes some time for them to move to machines to get processed. This problem is actually equivalent to the scheduling problem in which there is a machine dependent release time rij for each job. A 2-approximation algorithm was given. Related work. The study of DVS was initiated by the seminal paper of Yao et al. [9], in which each job with its own release time and deadline are to be scheduled on a single machine capable of running at any speed in [0, +∞), and a greedy algorithm achieving the minimum energy consumption is given. Later Yao and Li [10] gave an optimal algorithm for the same problem when there are only discrete speeds available.
246
L. Chen, W. Luo, and G. Zhang
In the case of multiprocessor scheduling aiming to minimize the energy consumption, Albers et al. [1] considered scheduling unit-size jobs with arbitrarily release times and deadlines, and scheduling arbitrary size jobs with agreeable deadlines. They provided constant ratio approximation algorithms for both problems if α is a constant. Pruhs et al. [7] dealt with the problem of scheduling jobs with precedence constraints on identical machines. They also showed that if there are no precedence constraints, the energy minimization problem (when speed can be any real number in [0, +∞)) is actually equivalent to the minimization of lα norm of the load which admits a PTAS [2]. Our contribution. We consider the continuous model and the discrete model to minimize the makespan under a given energy budget on unrelated machines where each job has its machine dependent release times. Our main result is to show both models admit a (2 + )-approximation algorithm, for any given > 0. Our method for the continuous model involves scaling the available speed between smin and smax into a number of discrete ones which are “dense”enough to approximate the speeds used in an optimum solution, and then formulating to an integer program. The basic idea also works for the discrete model as we transform a discrete model into a continuous one by modifying its power function. Rounding techniques proposed by Grigoriev et al. [3] for unrelated machine scheduling are applied. Finally we also show how to derive a 2-approximation algorithm by using slightly more energy, i.e., (1 + )E.
2
The Continuous Model
Before presenting our algorithm, we make the following simple observation. This could also be seen as a corollary from Theorem 1 of Yao et al. [9]. Lemma 1. There exists an optimal schedule for the continuous model, in which each job is processed with exactly one speed. Proof. The proof is straightforward. If speeds s1 and s2 are used for t1 and t2 time units, respectively, in processing a job. We can simply use the average speed (s1 t1 + s2 t2 )/(t1 + t2 ) for t1 + t2 time units instead, maintaining the same job length. The energy consumption can only be less since P is a convex function. Let c = log1+ ssmax , and S = {smin , smin (1 + ), · · · , smin (1 + )c−1 , smax } min be the set of scaled speeds, where > 0 is any fixed number. For each continuous model, we can define a corresponding discrete model in which only those scaled speeds are available. Suppose the makespan of an optimal schedule for the continuous model is T . By substituting the speeds in this optimal schedule with the scaled speed that right below it we get a solution for the corresponding discrete model with makespan no more than T (1 + ) (Note that P (s)/s = sα−1 is non-decreasing, thus by using a smaller speed we only consume less energy). Now we can concentrate on the corresponding discrete model with scaled speeds, and let sk = smin (1 + )k−1 , 1 ≤ k ≤ c and sc+1 = smax for simplicity.
Approximation Algorithms for Unrelated Machine Scheduling
247
Let xijk be an 0-1 variable which is equal to one if the job Ji is processed on machine Mj at speed sk , and zero otherwise. The optimum value of the following integer program (IP) is obviously no more than T (1 + ): min t xijk = 1, ∀i
(1) (2)
j,k
wij xijk /sk ≤ t, ∀j
(3)
wij xijk P (sk )/sk ≤ E
(4)
(rij + wij /sk )xijk ≤ t, ∀i, j, k
(5)
xijk ∈ {0, 1}
(6)
i,k
i,j,k
By removing the objective and replacing the equations (5) and (6) with (7) and (8) in the following, respectively, we get an LP-relaxation. xijk = 0, if rij + wij /sk > t, ∀i, j, k 0 ≤ xijk ≤ 1
(7) (8)
It can be easily seen that the minimum t (denoted by t∗ ) such that the above LP admits a feasible solution is no more than T (1 + ). We can apply a binary search to find numbers ξ and η such that ξ < t∗ ≤ η, and η ≤ (1 + )ξ. Thus a fractional solution with makespan T ≤ T (1 + )2 ≤ T (1 + 3) can be achieved. Inspired by the work of Grigoriev et al. [3], we have the following lemma. Lemma 2. Let E and T be any constants. If the following linear program has a feasible solution, m c+1
xijk = 1, ∀1 ≤ i ≤ n
j=1 k=1 n c+1
xijk wijk i=1 k=1 m c+1 n
≤ T , ∀1 ≤ j ≤ m
xijk cijk ≤ E
i=1 j=1 k=1
xijk = 0, if rij + wijk > T 0 ≤ xijk ≤ 1 and (T , xLP ) is the corresponding feasible solution, then we can find a feasible solution x∗ = (x∗ijk ) for the following integer program in polynomial time.
248
L. Chen, W. Luo, and G. Zhang m c+1
xijk = 1, ∀1 ≤ i ≤ n
j=1 k=1 c+1 n
xijk wijk ≤ T + wmax , ∀1 ≤ j ≤ m
i=1 k=1 m c+1 n
xijk cijk ≤ E
i=1 j=1 k=1
xijk ∈ {0, 1} where wmax = max{wijk |xijk > 0}. The proof is omitted, since it is essentially the same as that of Grigoriev et al. [3]. Now by choosing wijk = wij /sk , cijk = wij P (sk )/sk , an integer solution with energy consumption no more than E and makespan no more than 2T , i.e. bounded from above by 2(1 + 3)T , can be derived, if release times are not considered. In order to handle release times, we notice that similar to the extreme point solution for linear programming, the rounding procedure of Grigoriev et al. [3] actually ensures that in the integer solution constructed in this lemma, except for at most one job on each machine (called an extra job if exists), the total processing time of all the other jobs is not greater than T . Following the idea of Phillips et al. [6], we order jobs on each machine such that the extra job of each machine, if it exists, is processed first, and all the other jobs wait until time T to start. If there is no extra job on some machine, then simply start processing jobs at time T . In this way the release time of every job is respected. The complexity of our algorithm depends mainly on solving of the linear program, which is O((mnc)3 log(E+nwmax ) log(nwmax )), and thus is polynomial in mn, log smax and log E. Therefore we conclude Theorem 1. For any fixed > 0, there admits a (2+)-approximation algorithm for the continue model. Remarks 1. Our approach is still of (2 + )-approximation for a more general power function P (s) as long as it is convex and satisfies that P (s)/s is nondecreasing, since only these two properties of the function sα are used in our proof. Moreover, even if machines have different power functions, say, for all j, the power function of machine j is Pj , then by setting cijk = wij Pj (sk )/sk our algorithm still returns a (2 + )-approximation solution as long as each Pj is convex and Pj (s)/s is nondecreasing. 2. If the available speeds are in [0, +∞), we can still apply our algorithm for the power function P (s) = sα since the energy budget E along with the goal of minimizing makespan actually bounds the speed. We first determine the highest speed. There exists an optimum schedule such that each job is
Approximation Algorithms for Unrelated Machine Scheduling
processed with only one speed, thus sα max · smax ≤ E
1 α−1
1 smax
249
≤ E, which implies that
.
Next we estimate the makespan. For each job Ji , let ui = minj {rij + wij |j = 1, · · · , m} < +∞, and u = i ui . We always put job Ji on the machine Mj corresponding to ui and take the release time of a job as part of its load. 1 α−1 ≤ 1, using energy s This gives an upper bound for T since if sˆ = ( E ˆ u) to process all jobs can always produce a feasible schedule with makespan α 1 no more than Tˆ ≤ u α−1 /E α−1 . Otherwise sˆ > 1, then we just use speed 1 to process all jobs, which yields a feasible schedule with makespan no more than u. Now we bound the speed from below. At least 1 unit of work should be done during time length of max{Tˆ , u}. According to Lemma 1, we can simply 1 α assume that only one speed is used, thus smin ≥ min{E α−1 /u α−1 , 1/u}. Thus we can transfer the problem into one with available speeds (except 0) in [smin , smax ], where both smin and smax are some integers at least 1. Notice that our algorithm runs polynomially in log E and log smax , thus it is still efficient for the transferred problem.
3
The Discrete Model
In this section, we consider the problem in which the available speeds fall in S = {s1 , s2 , · · · , sd }. Suppose 1 ≤ s1 < s2 · · · < sd . We call speeds si and si+1 adjacent, for i = 1, 2, . . . , d − 1. Similar to Lemma 1, we have the following fact, whose proof is similar to Lemma 1. Lemma 3. There exists an optimal schedule for the discrete model, in which each job is processed with one speed or two adjacent speeds. Suppose again the makespan of an optimum schedule is T . Similar to the continuous model, the following IP with minimum object value no more than T could be derived: min t xijk = 1, ∀i j,k
wij xijk /sk ≤ t, ∀j
i,k
wij xijk P (sk )/sk ≤ E
i,j,k
xijk ∈ {0, 1} The difficult issue is that we can no longer assume xijk = 0 if rij + wij /sk > t since in an optimum schedule, some job might be processed with two speeds, and its load divided by the lower speed is possibly larger than T .
250
L. Chen, W. Luo, and G. Zhang
To solve this problem, we first convert the discrete model into a continuous model. We observe that in the optimum schedule, only d distinct speeds are used. Thus the energy consumption only depends on P (s1 ), P (s2 ), · · · , P (sd ) (P (0) = 0) and is irrelevant of its values on other points. Inspired by the work of Kwon et al. [4], we define a new power function P (s) as follows. P (s) if s = s1 , · · · , sd P (s) = P (s −P (sk )) P (sk ) + (s − sk ) sk+1 if sk < s < sk+1 , k = 1, · · · , d − 1 k+1 −sk We deal with the continuous model with this modified power function P and available speeds in [s1 , sd ], we show that the optimum objective value of this continuous model is not greater than the discrete model. Consider an optimum schedule of the discrete model satisfying Lemma 3. If we use only one speed sk to process some job Ji , then in the constructed continuous model we just process this job on the same machine at the same speed. Otherwise we use two adjacent speeds sk and sk+1 for Ji . Let tk and tk+1 be the time units using the two speeds, respectively. Then in the constructed continuous model we use the speed (sk tk + sk+1 tk+1 )/(tk + tk+1 ) to process this job on the same machine. It can be easily verified that by using the new power function P , this job is processed with the same time duration and consumes the same energy. By changing the speed of each job in this way we transform the schedule of the discrete model into a feasible solution of the continuous model with the new power function. Therefore the optimum objective value of this continuous model does not exceed that of the discrete model. Moreover, it can be easily verified that the new power function P (s) is convex and P (s)/s is nondecreasing as P (s) is convex and P (s)/s is nondecreasing. We can thus apply our approach in the previous section to this continuous model. For any fixed > 0, again let c = log1+ ssd1 , S = {s1 , s1 (1 + ), · · · , s1 (1 + )c−1 , sd }. For simplicity let s¯k = s1 (1 + )k−1 , for k = 1, 2 · · · , c and s¯c+1 = sd . We get the following LP. m c+1
xijk = 1, ∀1 ≤ i ≤ n
j=1 k=1 n c+1
xijk wij /¯ sk ≤ t, ∀1 ≤ j ≤ m
i=1 k=1 n m c+1
xijk wij P (¯ sk )/¯ sk ≤ E
i=1 j=1 k=1
xijk = 0, if rij + wij /¯ sk > t 0 ≤ xijk ≤ 1
Approximation Algorithms for Unrelated Machine Scheduling
251
With the above analysis, the minimum t satisfying this LP is not greater than T (1 + ). Via a similar binary search as for the continuous model, a fractional solution with makespan T ≤ T (1 + )2 could be found. Now applying Lemma 2, we can get an integer solution with makespan at most 2T . Suppose that in processing job Ji , the speed s¯k is used for tk time units. If s¯k = sl for some 1 ≤ l ≤ d, we substitute it with sl . Otherwise sl < s¯k < sl+1 −¯ sk for some 1 ≤ l ≤ d − 1, and we substitute it with ssl+1 tk time units of l+1 −sl ¯k −sl sl and ssl+1 t time units of s . Simple calculation shows that both the l+1 −sl k processing time and energy consumption remain unchanged. Now order jobs on each machine in the same way as we do in the continuous model so that release times are met. We get a (2 + 6)-approximation integer solution for the discrete model. The following theorem holds. Theorem 2. There exists a (2 + )-approximation algorithm for the discrete model.
4
A 2-Approximation Algorithm with Energy Augmentation
Recall that unrelated scheduling is a special case of our problem if no energy consumption is considered. It implies that even we allow an arbitrarily large energy budget, we cannot have a better approximation than the classical unrelated scheduling problem, for which the best known upper bound is two. In this section, we show that an integer solution with makespan no more than 2T could be derived if we are allowed to use a slightly more energy than the optimum solution. For simplicity, we assume that = 1/λ for some integer λ. First consider the continuous model. We have the following lemma. Lemma 4. There exists an optimum solution such that each job is processed with one speed, and for each job Ji processed on some machine Mj , if it starts later than its release time rij , then Mj processes Ji at the same speed as that for the job right before Ji . Proof. We start with an optimum schedule satisfying Lemma 1, and this schedule consumes the least energy. Without loss of generality we can further assume that on each machine jobs are processed in increasing order of their release times (on this machine). Let ri be the time point at which we start processing job Ji on machine Mj . Suppose ri > rij . If machine Mj is idle in some interval between ri and rij , then we could always start processing job Ji earlier. Thus we can assume there is another job Ji running during [rij , ri ]. Let si and si be the speeds to process Ji and Ji , respectively. We show that if si = si and ri > rij , then we can construct another optimal schedule, satisfying lemma 1, which consumes less energy. It thus incurs a contradiction. w +w If si > si , we simply process the two jobs at one speed w /si j +wijij /si . Since i j i this speed is in between si and si , the processing time of Ji becomes longer
252
L. Chen, W. Luo, and G. Zhang
and thus Ji will start later, satisfying the release time constraints. Moreover, the total processing time of the two jobs remains unchanged. The convexity of the power function P (s) implies that the energy consumption is less, which is a contradiction. w +w If si < si , again we can try the average speed w /si j +wijij /si . In this case if i j i the completion time of Ji is not less than rij , we argue as the previous case. Otherwise, the starting time ri of job Ji must be smaller than rij . We process wi j wij Ji at speed rij −r during [ri , rij ], and Ji at speed ri −rij +w during [rij , ri + ij /si i wij /si ]. The total processing time of the two jobs remains unchanged. Now we look at the two new speeds for the two jobs. Recall that with the avw +w wi j erage speed w /si j +wijij /si job Ji would be completed before rij . Then rij −r < wi j +wij wi j /si +wij /si
i j
i
≤ si . Since rij < ri , we have w
wi j rij −ri
i
> si . Moreover, we can
ij see that si < ri −rij +w < si . The convexity of P implies that the energy ij /si consumption is strictly reduced. Again we arrive at a contradiction.
Now we show how to achieve a 2-approximation algorithm with energy augmentation. Consider an optimum solution satisfying Lemma 4. Let T be its objective value. Now we round up the speed in processing each job to the nearest speed in S , and start them as early as possible (note that we do not change the processing order of jobs on each machine). Let Tˆ ≤ T be the new makespan. It is impossible to determine Tˆ directly since we are not aware of any optimal schedule. However, we observe the following key point. Although rounding up the speed of each job will incur more energy consumption, but the total energy is no more than (1 + )α−1 E. Thus the minimum t satisfying the following LP is not greater than Tˆ , since the above schedule with makespan Tˆ is just a feasible solution of the LP. xijk = 1, ∀i j,k
wij xijk /sk ≤ t, ∀j
i,k
wik xijk P (sk )/sk ≤ E(1 + )α−1
i,j,k
xijk = 0, if rij + wij /sk > t 0 ≤ xijk ≤ 1 In other words we can get a lower bound for Tˆ (and thus a lower bound for T ) by solving this LP optimally (minimizing t). Unfortunately we may not able to find the best t by a binary search since the optimal value can be a real number. To tackle this issue we reconsider some property of Tˆ and try to find a feasible solution for the LP in polynomial time which is not worse than Tˆ. The main idea is to do an exact binary search. To this end we have to assure that the desired value must be an integer. The following lemma shows an important property of Tˆ . Recall that λ, smin and smax are all integers.
Approximation Algorithms for Unrelated Machine Scheduling
253
Lemma 5. Either Tˆ · smin (1 + λ)k−1 is an integer for some 1 ≤ k ≤ c, or Tˆ · smax is an integer. Proof. We show that for each machine, if its speed changes at time tˆ when we start processing some job, then tˆ must be the release time of this job, by Lemma 4. Thus the completion time of each machine could always be written as r+W/sk for some sk ∈ S , where r is either 0 or the release time of some job, and W is the total load of jobs that are processed after time r. Hence r and W are both integers and Lemma 5 follows naturally. Now we can do a binary search for a minimum t so that smax smin (1 + λ)c−1 t is an integer and the above LP is satisfied. Such a t will not exceed Tˆ, and thus is not greater than T . Again we can apply Lemma 2, and an integer solution with makespan no more than 2T and energy consumption no more than E(1+)α−1 ≤ E(1+2α) can be constructed. Note that our algorithm runs polynomially in 1/, thus by substituting with /(2α) we can get an integer solution with makespan no greater than 2T and energy consumption no more than E(1 + ). Notice that when solving the discrete model we transform it to a continuous one with a modified power function. A 2-approximation algorithm with energy augmentation for the discrete model could be derived in a similar way.
5
Concluding Remarks
We consider the unrelated scheduling problem with energy constraint in the DVS model, where a machine can run in different speeds by consuming different amount of energy, while the total energy is bounded by a given budget. Two (2 + )-approximation algorithms are derived, respectively, for the continues and the discrete models. With a slightly more energy, the upper bound can be improved to two. A natural question is how to design a better approximation algorithm with the bound of two, satisfying the energy constraint.
References 1. Albers, S., Muller, F., Schmelzer, S.: Speed scaling on parallel processors. In: Proceedings of the 19th Annual ACM Symposium on Parallelism in Algorithms and Architectures (SPAA), pp. 289–298 (2007) 2. Alon, N., Azar, Y., Woeginger, G.J., Yadid, T.: Approximation schemes for scheduling on parallel machines. Journal of Scheduling 1, 55–66 (1998) 3. Grigoriev, A., Sviridenko, M., Uetz, M.: Machine scheduling with resource dependent processing times. Mathematical Programming 110(1), 209–228 (2007) 4. Kwon, W.C., Kim, T.: Optimal voltage allocation techniques for dynamically variable voltage processors. ACM Transactions on Embedded Computing Systems 4(1), 211–230 (2005) 5. Lenstra, J.K., Shmoys, D.B., Tardos, E.: Approximation algorithms for scheduling unrelated parallel machines. Mathematical Programming 46, 259–271 (1990)
254
L. Chen, W. Luo, and G. Zhang
6. Phillips, C., Stein, C., Wein, J.: Task scheduling in networks. In: Schmidt, E.M., Skyum, S. (eds.) SWAT 1994. LNCS, vol. 824, pp. 290–301. Springer, Heidelberg (1994) 7. Pruhs, K., van Stee, R., Uthaisombut, P.: Speed scaling of tasks with precedence constraints. Theory of Computing Systems 43(1), 67–80 (2008) 8. Shchepin, E.V., Vakhania, N.: An optimal rounding gives a better approximation for scheduling unrelated machines. Operations Research Letters 33(2), 127–133 (2005) 9. Yao, F., Demers, A., Shenker, S.: A scheduling model for reduced CPU energy. In: Proceedings of the 36th Annual Symposium on Foundations of Computer Science (FOCS), pp. 374–382 (1995) 10. Yao, F., Li, M.: An efficient algorithm for computing optimal discrete voltage schedules. SIAM Journal on Computing 35(3), 658–671 (2006) 11. Yu, L., Shih, H., Pfund, M.E., Carlyle, W.M., Fowler, J.W.: Scheduling of unrelated parallel-machines: An application to PWB manufacturing. IIE Transactions on Scheduling and Logistics 34, 921–931 (2002)
Plane-Filling Properties of Directed Figures Wlodzimierz Moczurad Institute of Computer Science, Jagiellonian University L ojasiewicza 6, 30-348 Krak´ ow, Poland [email protected]
Abstract. The process where simple entities form more complex structures acting autonomously is called self-assembly; it lies at the centre of many physical, chemical and biological phenomena. Massively parallel formation of nanostructures or DNA computation are just two examples of possible applications of self-assembly once it is technologically harnessed. Various mathematical models have been proposed for selfassembly, including the well-known Winfree’s Tile Assembly Model based on Wang tiles on a two-dimensional plane. In the present paper we propose a model based on directed figures with partial catenation. Directed figures are defined as labelled polyominoes with designated start and end points, and catenation is defined for non-overlapping figures. This is one of possible extensions generalizing words and variable-length codes to planar structures, and a flexible model, allowing for a natural expression of self-assembling entities as well as e.g. image representation or “pictorial barcoding.” We prove several undecidability results related to filling the plane with a given set of figures and formation of infinite and semiinfinite zippers, demonstrating a unifying approach that could be useful for the study of self-assembly.
1
Introduction
Self-assembly is a process where simple autonomous components form more complex structures without specific external control. It is a common phenomenon of the physical world that can be observed at different scales, ranging from molecular to cellular (biological) to macroscopic. The interest in self-assembly is driven by perspective technological applications in e.g. materials science, medicine, robotics or DNA computation. It is worth pointing out that the interactions between components are local; this is a defining characteristic of self-assembly. Mathematical study of self-assembly was initiated by Adleman and Winfree already in 1990s [1,9] and it has attracted enormous attention over the past decade. See e.g. [2] for an extensive bibliography of self-assembly research. Various mathematical models have been proposed for self-assembly, including the well-known Winfree’s Tile Assembly Model based on Wang tiles on a two-dimensional plane. In the present paper we propose a model based on directed figures with partial catenation. Directed figures are defined as labelled polyominoes with designated start and end points, and catenation is defined for non-overlapping figures. This is one of possible extensions generalizing words and M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 255–263, 2011. c Springer-Verlag Berlin Heidelberg 2011
256
W. Moczurad
variable-length codes to planar structures, introduced in [7] and [6], admitting a natural definition of catenation. The attribute “directed” is used to emphasize the way figures are catenated; this should not be confused with the meaning of “directed” in e.g. directed polyominoes. A similar setting, known as symbolic pixel pictures, has been described by Costagliola et al. in [5]. The model we propose is flexible, allowing for a natural expression of selfassembling entities as well as e.g. image representation or “pictorial barcoding;” cf. [8]. We prove several undecidability results related to filling the plane with a given set of figures and formation of infinite and semi-infinite zippers. Whilst not entirely new from the Wang-tiles perspective, they demonstrate a unifying approach that could prove useful for the study of self-assembly. The paper is structured as follows. Section 2 introduces the definitions of directed figures, their catenation and zippers. Section 3 contains the main result of the paper. Based on a result of Adleman et al. [2], we prove that the existence of infinite or semi-infinite zippers assembled from a given set of figures is undecidable. In Section 4 we consider plane-filling properties of sets of figures and show their undecidability.
2
Preliminaries
Let Σ be a finite, non-empty alphabet. A translation by vector u = (ux , uy ) ∈ Z2 is denoted by tru : tru : Z2 (x, y) → (x + ux , y + uy ) ∈ Z2 . By extension, for a set U ⊆ Z2 and an arbitrary function f : V → Σ define tru : P(Z2 ) V → {tru (v) | v ∈ V } ∈ P(Z2 ) tru : Σ U f → f ◦ tr−u ∈ Σ tru (U) . An integer interval {k ∈ Z | i ≤ k ≤ j} is denoted by [i, . . . , j]. Definition 1 (Directed figure). Let D ⊆ Z2 be finite, b, e ∈ Z2 and l : D → Σ. A quadruple f = (D, b, e, l) is a directed figure (or simply figure) over Σ with domain dom(f ) = D, start point begin(f ) = b, end point end(f ) = e, labelling function label(f ) = l. Translation vector of f is defined as tran(f ) = end(f ) − begin(f ). Additionally, the empty directed figure ε is defined as (∅, (0, 0), (0, 0), {}), where {} denotes a function with an empty domain. The set of all figures over Σ is denoted by Σ . Note that for a figure we make no additional assumptions about connectivity of its domain and relative position of its domain, start and end points.
Plane-Filling Properties of Directed Figures
257
Example 1. A figure and its graphical representation. Each point of the domain, (x, y), is represented by a unit square in R2 with bottom left corner in (x, y). A circle marks the start point and a diamond marks the end point of the figure. For the sake of clarity we do not mark the coordinates. ({(0, 0), (1, 0), (1, 1)}, (0, 0), (2, 1), {(0, 0) → a, (1, 0) → b, (1, 1) → c}) c aib
For figures we define the following operation: Definition 2 (Catenation). Let x = (Dx , bx , ex , lx ) and y = (Dy , by , ey , ly ) be directed figures. If Dx ∩ trex −by (Dy ) = ∅,
(1)
then the catenation of x and y is defined as x ◦ y = (Dx ∪ trex −by (Dy ), bx , trex −by (ey ), l),
where l(z) =
lx (z) for z ∈ Dx , trex −by (ly )(z) for z ∈ trex −by (Dy ).
If Dx ∩ trex −by (Dy ) = ∅, then x ◦ y is not defined. Example 2.
aib Example 3.
ai b c
◦
c
aib
a b c aib
=
di e f
◦
is not defined, since the figures violate condition (1): point labelled with c overlaps with the point labelled with e. Proposition 1. (Σ , ◦) is a partial monoid. Proof. Obvious. Proposition 2. (Σ , ◦) is never free. Proof. The basis contains the figures
E = ai , N = ai, W =
ai, S = ai,
where a ∈ Σ. This contradicts the freeness, since the figure below can be decomposed as NNESSENNE and EENWWNEEE. a a a a a a aia a
Note that properties presented in Sections 3 and 4 do not use labellings, hence Σ = {a} may be assumed.
258
3
W. Moczurad
Infinite and Semi-infinite Zippers
Informally, a sequence of figures (fi )i∈Z is called an infinite zipper, if an infinite catenation · · · f−1 ◦ f0 ◦ f1 · · · exists, i.e. there are no domain conflicts. Formally: Definition 3 (Infinite zipper). Let F ⊆ Σ . A sequence of figures (fi )i∈Z , where fi ∈ F , is called an infinite zipper (over F ), if for every i, j ∈ Z, i < j, dom(fi ) ∩ trΔ (dom(fj )) = ∅, where
(2)
k=j−1
Δ = end(fi ) +
tran(fk ) − begin(fj ).
k=i+1
The image of an infinite zipper (fi )i∈Z is defined as zip((fi )i∈Z ) = (D, L), where tr−end(fi )− k=−1 tran(fk )+begin(f0 ) (dom(fi )) D= k=i+1
i=...,−2,−1
∪ dom(f0 ) trend(f0 )+ k=i−1 tran(fk )−begin(fi ) (dom(fi )), ∪ k=1
i=1,2,...
L=
i=...,−2,−1
tr−end(fi )− k=−1
k=i+1
tran(fk )+begin(f0 ) (label(fi ))
∪ label(f0 ) trend(f0 )+ k=i−1 tran(fk )−begin(fi ) (label(fi )). ∪ k=1
i=1,2,...
Condition (2) ensures that all catenations can be defined. Observe that the image of an infinite zipper has neither starting point nor end point. In a similar way we define a semi-infinite zipper (fi )i∈N : Definition 4 (Semi-infinite zipper). Let F ⊆ Σ . A sequence of figures (fi )i∈N , where fi ∈ F , is called a semi-infinite zipper (over F ), if for every i, j ∈ N, i < j, dom(fi ) ∩ trΔ (dom(fj )) = ∅, where Δ = end(fi ) +
k=j−1
tran(fk ) − begin(fj ).
k=i+1
The image of a semi-infinite zipper (fi )i∈N is defined as zip((fi )i∈N ) = (D, L, b), where D = dom(f0 ) ∪ trend(f0 )+ k=i−1 tran(fk )−begin(fi ) (dom(fi )), i=1,2,...
L = label(f0 ) ∪
i=1,2,...
b = begin(f0 ).
k=1
trend(f0 )+ k=i−1 tran(fk )−begin(fi ) (label(fi )), k=1
Plane-Filling Properties of Directed Figures
259
Finally, we define finite zippers: Definition 5 (Finite zipper). Let F ⊆ Σ . A sequence of figures (fl )l∈[i,...,j] , where fl ∈ F , is called a finite zipper (over F ), if f = fi ◦ · · · ◦ fj is defined. The image of a finite zipper (fl )l∈[i,...,j] centered at k-th element, where k ∈ [i, . . . , j], is defined as zipk ((fl )l∈[i,...,j] ) = (trΔ (dom(f )), trΔ (label(f )), trΔ (begin(f )), trΔ (end(f ))), where Δ = −begin(fi ) −
l=k−1
tran(fl ) + begin(fk ).
l=i
The length of a finite zipper is the number of elements in the sequence, j − i + 1. The image centered at k-th element retains the original position of fk , as opposed to a typical catenation that retains the position of the first figure. Observe that for an infinite and semi-infinite zippers, respectively: zip((fi )i∈Z ) = (
∞
i=0 ∞
zip((fi )i∈N ) = (
i=0
dom(zip0 ((fj )j∈[−i,...,i] )), dom(zip0 ((fj )j∈[0,...,i] )),
∞
label(zip0 ((fj )j∈[−i,...,i] ))),
i=0 ∞
label(zip0 ((fj )j∈[0,...,i] )),
i=0
begin(f0 )) Now we show that it is undecidable whether there exists an infinite zipper over a given set of figures F ⊆ Σ . To this end, we encode the directed tile system (T, d) of [2] using directed figures. In Theorem 4.1 of that paper the existence of an infinite (T, d)-directed zipper has been proved undecidable. Let A = {1, . . . , n} be a finite, non-empty alphabet of glues. A Wang tile is a quadruple (tN , tE , tS , tW ) ∈ A4 , interpretted geometrically as a unit square whose edges are “coloured” with tN , tE , tS and tW glues (north, east, south and west edge, respectively). A directed tile system is a pair (T, d), where T is a set of Wang tiles and d : T → {N, E, S, W } is a function assigning directions to tiles. An infinite (T, d)-directed zipper is, informally, a sequence of tiles (ti )i∈Z (ti ∈ T ), mapped to Z2 , such that d(ti ) determines the position of ti+1 and all tiles at neighbouring positions have matching glues on their common edge. For the formal definition, see [2]. Neighbouring positions are defined as either [(x, y) and (x + 1, y)] or [(x, y) and (x, y + 1)], for x, y ∈ Z. Theorem 1. Let F be a finite set of figures. It is undecidable whether there exists an infinite zipper over F . Proof. We reduce the existence of an infinite (T, d)-directed zipper to our problem. Let (T, d) be a directed tile system. For each tile t = (tN , tE , tS , tW ) ∈ T define three figures ti = (D, l, bi , e) over Σ = {a}, for i = 1, 2, 3:
260
W. Moczurad
D = {(x, y) | x, y ∈ [−n − 1, . . . , n + 1]} ∪ {(−tN , n + 2), (n + 2, tE ), (tS , −n − 2), (−n − 2, −tW )} \ {(tN , n + 1), (n + 1, −tE ), (−tS , −n − 1), (−n − 1, tW )} l≡a ⎧ (0, n + 2) if ⎪ ⎪ ⎨ (n + 2, 0) if e = (ex , ey ) = (0, −n − 2) if ⎪ ⎪ ⎩ (−n − 2, 0) if
d(t) = N d(t) = E d(t) = S d(t) = W
b1 = (ey , −ex ) b2 = (−ex , −ey ) b3 = (−ey , ex ). The idea is to emulate the glues with “bumps and dents” such that the figures can be placed side by side only if the original tiles have matching glues. Position of the end point is determined by d(t) and all three remaining edges are candidates for the start point, hence we define three variants ti for i = 1, 2, 3. Figure 1 shows an example of a figure derived from a tile.
a a a a a a a a a a a a a a a a a a a a a a
a a a a a a a a a a
a a a a a a a a a a a
a a a a a a a a a a a a
a a a a a a a a a a a
a a a a a a a a a a
a a a a a a a a a a a
a a a a a a a a a a a a
a a a a a a a a a a a
a a a a a a ai a a a a
Fig. 1. Directed figure t1 derived from a tile t = (1, 2, 3, 4) ∈ {1, 2, 3, 4}4 with d(t) = N
Now define a set of figures F = t∈T {t1 , t2 , t3 }. It is clear that the existence of an infinite zipper over F is equivalent to the existence of an infinite (T, d)directed zipper. Hence the existence of an infinite zipper over F is undecidable. The above result can easily be extended to semi-infinite zippers. First, observe the following equivalences: Theorem 2. For a given F ⊆ Σ the following conditions are equivalent: 1. There exists an infinite zipper over F . 2. There exists a semi-infinite zipper over F . 3. For every n ∈ N there exists a finite zipper over F of length n.
Plane-Filling Properties of Directed Figures
261
Proof. Implications (1 ⇒ 2) and (2 ⇒ 3) are obvious, as every infinite zipper contains a semi-infinite zipper and every semi-infinite zipper contains a finite zipper of arbitrary length. We now prove (3 ⇒ 1) using an argument similar to the K˝ onig’s infinity lemma. By (3), there exists an infinite sequence of finite zippers over F , (Zn )n∈N , such that Zn = (Zn i )i∈[−n,...,n] is a zipper of length 2n + 1. Consider the figures occurring as zipper elements with index 0, i.e. Zn0 for all n ∈ N. Since F is finite, some figure f0 must occur infinitely many times. Reject all zippers that have a different figure at index 0, i.e. replace (Zn ) with the appropriate subsequence. Now consider figures occuring as zipper elements with index 1 and choose a figure f1 that occurs infinitely many times as Zn 1 . Continuing with index −1, 2, −2, . . . , we obtain an infinite zipper (fi )i∈Z . Corollary 1. Let F be a finite set of figures. It is undecidable whether there exists a semi-infinite zipper over F .
4
Filling the Plane with Figures
In this section we analyze plane-filling properties of directed figures, showing their undecidability. The proof is a reduction from the tiling problem for Wang tiles. For a given set of Wang tiles T we construct a set of figures FT such that T tiles the plane if and only if FT tiles the plane. The exact meaning of tileability in both settings is clarified below. We say that a finite set of Wang tiles T tiles the plane if there exists a mapping τ : Z2 → T such that tiles at neighbouring positions have the same glue on their common edge. The following is a well-known theorem due to Berger [3]. Theorem 3. Let T be a finite set of Wang tiles. It is undecidable whether T tiles the plane. Now let F ⊆ Σ be a finite set of figures. We say that F tiles the plane if there exists a mapping τ : N → F such that: – (τ (i))i∈N is a semi-infinite zipper, – the domain of zip((τ (i))i∈N ) is Z2 . Notice that the question whether F tiles the plane is a restriction of the problem of Section 3, and its undecidability does not follow directly. Theorem 4. Let F be a finite set of figures. It is undecidable whether F tiles the plane. Proof. We construct a reduction from the Wang tiling problem. The main idea is to replace the tiles with figures in such a way that the figures (i) can be placed side by side only if the original tiles have matching glues and (ii) can be placed along a spiral that fills the plane. This is achieved by (i) using “bumps and dents” as in Theorem 1 to encode glues and (ii) replacing each tile with a figure having its start and end points located at different edges so that a spiral can be formed. The construction resembles the snaked tile system of Chen and Goel [4].
262
W. Moczurad
For instance, the figure depicted in Fig. 1 is one of the figures that replaces a tile (1, 2, 3, 4). Note that its translation vector can be conveniently presented as: 6
Thus, for each tile we define nine figures with the same domain D that emulates glues with “bumps and dents” (as in the proof of Theorem 1) but with different start and end points, giving different translation vectors. When replacing a tile, one of the nine figures is used depending on the vector required. Vectors of the nine figures, and hence their start and end points, can be depicted as: 6
-
-
?
6
6
?
It is clear that if the original set T tiles the plane, then so does FT . Given the original tiling τ : Z2 → T , construct a tiling τ : N → FT by defining τ (0) as e.g. τ (0, 0) replaced with the 6-variant of the corresponding figure. Then follow clockwise along a spiral, replacing the tiles with appropriately-oriented figures. Conversely, if FT tiles the plane, then by disregarding translation vectors and replacing the figures back with tiles, we obtain a T -tiling of the plane. Note that a similar reduction can be constructed for an infinite zipper, i.e. when tileability is defined in terms of a mapping τ : Z → F . More variants with different translation vectors have to be used then, to allow the figures to form a double spiral, with two parallel strands.
5
Final Remarks
Given the undecidability of zipper-related properties of figures, it is interesting what restictions would guarantee decidability. Our previous research on directed figures suggests that e.g. the angle spanned by translation vectors may be important (codicity testing becomes decidable when the angle is less than π, see [6]).
References 1. Adleman, L.: Molecular computation of solutions to combinatorial problems. Science 266(5187), 1021–1024 (1994) 2. Adleman, L., Kari, J., Kari, L., Reishus, D., Sosik, P.: The undecidability of the infinite ribbon problem: Implications for computing by self-assembly. SIAM Journal on Computing 38(6), 2356–2381 (2009) 3. Berger, R.: The undecidability of the domino problem. Memoirs of the American Mathematical Society 66, 1–72 (1966) 4. Chen, H.L., Goel, A.: Error free self-assembly using error prone tiles. In: Ferretti, C., Mauri, G., Zandron, C. (eds.) DNA 2004. LNCS, vol. 3384, pp. 62–75. Springer, Heidelberg (2005)
Plane-Filling Properties of Directed Figures
263
5. Costagliola, G., Ferrucci, F., Gravino, C.: Adding symbolic information to picture models: definitions and properties. Theoretical Computer Science 337, 51–104 (2005) 6. Kolarz, M.: The code problem for directed figures. Theoretical Informatics and Applications RAIRO 44(4), 489–506 (2010) 7. Kolarz, M., Moczurad, W.: Directed figure codes are decidable. Discrete Mathematics and Theoretical Computer Science 11(2), 1–14 (2009) 8. Moczurad, W.: Directed figure codes with weak equality. In: Fyfe, C., Tino, P., Charles, D., Garcia-Osorio, C., Yin, H. (eds.) IDEAL 2010. LNCS, vol. 6283, pp. 242–250. Springer, Heidelberg (2010) 9. Winfree, E.: Algorithmic Self-Assembly of DNA. Ph.D. thesis, California Institute of Technology (1998)
An Iterative Method for Generating Loop Invariants Shikun Chen1, , Zhoujun Li2 , Xiaoyu Song3 , and Mengjun Li1 1
3
School of Computer Science, National University of Defense Technology, Changsha, China, 410073 2 School of Computer, BeiHang University, Beijing, China, 100083 Dept. of Electrical and Computer Engineering, Portland State University, Portland, OR 97207
Abstract. Automatic derivation of invariants is one of the critical conundrums in the framework of the inductive program verification methodologies. This paper presents a novel and simple approach to generating polynomial equations as loop invariants. Finite difference of expressions and linear equation solving are harnessed. Unlike related work, the generated constraints are linear equalities, which can be solved efficiently. Furthermore, invariants of higher degree can be constructed in terms of those of lower degree. The case studies demonstrate the effectiveness of the approach. Keywords: program correctness; loop invariant; finite difference.
1
Introduction
A program invariant at a location is a statement of the conditions that should be true for any program execution reaching the location. Automatic derivation of invariants is one of the critical conundrums in the framework of the traditional inductive assertion methodologies [3]. There have been some extensive investigations for invariant generation. Abstract interpretation based techniques are used for generating invariants [9,3,12,5]. These techniques usually require a fixed point calculation. Some sophisticated widening and abstraction refinement techniques are employed to capture an approximation of fixed points. These methods can efficiently discover linear inequality invariants, such as ±x ≤ c (Intervals), x − y ≤ c (DBMs), ax + by ≤ c (where a,b ∈ {−1, 0, 1}, and c is an integer) [9], and a1 x1 + · · · + an xn ≤ c (where a1 , · · · , an and c are integers) [3]. Using Gr¨ obner bases, polynomial equality invariants can be constructed as well [12,5]. Some existing methods rely on parameterized templates to solve nonlinear constraints. A method for generating linear invariants is proposed [8]. With an
Supported by the National Natural Science Foundation of China under Grant No.90718017, No.60703075 and the Research Fund for the Doctoral Program of Higher Education under Grant No. 20070006055.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 264–274, 2011. c Springer-Verlag Berlin Heidelberg 2011
An Iterative Method for Generating Loop Invariants
265
invariant template with undetermined coefficients, they obtain a set of non-linear constraints by the Farkas Lemma. The solutions to the system of constraints yield an invariant. In [6], linear invariant templates (possibly disjunctive) and a set of second-order constraints are harnessed. The second-order constraints are converted to conjunctive normal form and reduced to first-order constraints by the Farkas Lemma. A satisfiability solver is employed for the first-order nonlinear constraints to yield invariants. In [13], polynomial equality templates are used. By imposing that the template is invariant, they obtain a system of nonlinear constraints by means of the Gr¨ obner basis computation algorithm, thus solving the constraints to yield invariants. In [2], polynomials with inequations and inequalities are used and invariants are obtained by solving semi-algebraic systems. For programs with affine assignments, an interprocedural method for computing polynomial equalities of bounded degree as invariants has been proposed [10]. They also propose a technique for discovering all the polynomial invariants of bounded degree in programs with polynomial assignments and disequality tests [11]. As polynomial invariants constitute an ideal, the problem of finding all polynomial invariants reduces to computing a finite basis of the associated polynomial invariant ideal. In [4], a fixed point procedure is designed to approximate the invariant ideal. The fixed point procedure is shown to terminate when the list of conditional assignments in the loop constitutes a solvable mapping. For P-solvable loops, a method for generating polynomial equality invariants is proposed and proven to be complete for some special cases [7]. In the approach, recurrence relations expressing the value of each program variable at the end of any iteration are formulated and solved exactly to yield the closed form for each loop variable. The closed form expressions can involve exponentials of algebraic numbers. Polynomial relations among the exponentials are derived by algebraic and combinatorial methods. Thus, every program variable can be expressed as a polynomial of the initial values of variables, the loop counter and some new variables. There are algebraic dependencies among the new variables. Loop counters are eliminated by Gr¨ obner bases methods to yield invariants. Finite differences of expressions over assignment transition are used in the termination analysis for imperative loops with multiple paths, polynomial guards, and polynomial assignments [1]. The finite difference of an expression over the assignment transition expresses the change of the value of expression before and after the transition. The value of an expression is guaranteed to remain 0 on every iteration of the loop if and only if the finite differences of the expression over the corresponding assignment transitions is 0. In this paper, we present a novel method to generate polynomial equality invariants using finite difference of expressions. We harness the constraints over coefficients in the template by using finite differences of expressions. This method is effective because it has no resort to Gr¨ obner bases computing, recurrence relation solving and fixed point computation. In addition, the constraints generated in the invariant constructing process are linear equalities, thus they can be solved
266
S. Chen et al.
effectively. It differs from the related work where non-linear equality constraints are generated. The approach can use polynomial equality invariants of lower degree to construct invariants of higher degree incrementally.
2
Preliminaries
Definition 1 (Loop Invariant). A loop invariant is an assertion that is true at the entry of a loop and remains true on each iteration of the loop. Let x ¯ = (x1 , · · · , xn ) be the program variables, which are assumed to take rational values. Let E(¯ x) be an expression over program variables x1 , · · · , xn , In this paper, when we say that E(¯ x) is a loop invariant for a loop, it means that E(¯ x) = 0 is an equality invariant for the loop. Definition 2 (Algebraic Assertions). An algebraic assertion is an assertion of the form p1 = 0 ∧ · · · ∧ pn = 0, where p1 , · · · , pn are polynomials. Definition 3 (Assignment Transition). An assignment transition is a simultaneous assignment of the form x¯ := (f1 (¯ x), · · · , fn (¯ x)), where x ¯ are program variables and f1 , · · · , fn are n functions of variables x1 , . . . , xn . Intuitively, an assignment transition x ¯ := (f1 (¯ x), · · · , fn (¯ x)) can be rewritten to an assertion x1 = f1 (¯ x) ∧ · · · ∧ xn = fn (¯ x), where xi and xi (1 ≤ i ≤ n) are the pre- and post- variables of the transition, respectively. For example, (x, y, z) := (x + 1, y + 2, z + y + 2) can be rewritten as x = x + 1 ∧ y = y + 2 ∧ z = z + y + 2. Definition 4 (Finite Difference). The finite difference of E(¯ x) over assignment transition τ is the expression E(¯ x ) − E(¯ x), denoted by Δτ E(¯ x), where τ gives the value of x¯ in terms of x ¯. Let τ1 , · · · , τn are n assignment transitions, for convenience, we denote a chain of finite differences Δτn , . . . , Δτ1 E(¯ x) by Δτ1 , . . . , τn E(¯ x) (note the reversal of the list). If τ1 = . . . = τn , the chain is denoted by Δnτ1 E(¯ x). Let @pre be the precondition for a loop. Example 1. An assignment transition τ is formed by the simultaneous assignment in the following simple loop. int x,y,z,n; @pre[x = 0 ∧ y = 1 ∧ z = 1 ∧ n ≥ 0] l0 : while z ≤ n do τ : (x, y, z) := (x+1, y+2, z+y+2); done. We have: Δτ (z − (x + 1)2 ) = z − (x + 1)2 − (z − (x + 1)2 ) = z + y + 2 − (x + 1 + 1)2 − z + (x + 1)2 = y − 2x − 1; 2 Δτ (z − (x + 1)2 ) = Δτ (y − 2x − 1) = y + 2 − 2(x + 1) − 1 − y + 2x + 1 = 0.
An Iterative Method for Generating Loop Invariants
267
Example 2. The following loop has two assignment transitions, denoted by τ1 and τ2 , respectively. Each branch corresponds to an assignment transition. int a,b,x,y,u,v; @pre[ a > 0 ∧ b > 0 ∧ x = a ∧ y = b ∧ u = b ∧ v = a] l0 : while (x != y) do if (x > y) τ1 : (x, v) := (x - y, v + u) else τ2 : (y, u) := (y - x, u + v) endif done We have: Δτ1 (xu + yv − 2ab) = (x − y)u + y(v + u) − 2ab − xu − yv + 2ab = 0, Δτ2 (xu + yv − 2ab) = x(u + v) + (y − x)v − 2ab − xu − yv + 2ab = 0. Definition 5 (Transition System). A transition system is a tuple V, L, T, l0 , Θ, where V is a set of variables, L is a set of locations, l0 ∈ L is the initial location, Θ is a first-order assertion over V denoting the initial condition. T is a set of transitions. Each transition τ ∈ T is a tuple l, l , ρ, where l and l are the pre- and post- locations of the transition. The transition relation ρ is a first-order assertion over V ∪ V , where V denotes the set of the current state variables and V denotes the set of the next state variables. If Θ is an algebraic assertion, and, for each transition l, l , ρ ∈ T , ρ is an algebraic assertion, then the transition system is an algebraic transition system. A non-nested loop can be regarded as a special transition system where L contains only one location l0 (the initial location), the pre- and post-locations of every transition are l0 . Due to undecidability of the computation with conditions [4], many invariant generating techniques ignore, or approximate tests. In this paper, we focus on non-nested loops without tests. We assume that a loop can be described by an algebraic transition system. As such, each transition relation can be regarded as an assignment transition. Example 3. Without considering tests, the loop in Example 1 can be represented by a transition system V, L, T, l0 , Θ, where V = {x, y, z, n}, L = {l0 }, Θ = (x = 0 ∧ y = 1 ∧ z = 1), T = {l0 , l0 , τ }, τ = (x = x + 1 ∧ y = y + 2 ∧ z = z + y + 2 ∧ n = n) Clearly, τ is an assignment transition. Note, we ignore non-algebraic assertion n ≥ 0. Example 4. Without considering tests, the loop in Example 2 can be represented by a transition system V, L, T, l0 , Θ, where V = {a, b, x, y, u, v}, L = {l0 }, Θ = (x = a ∧ y = b ∧ u = b ∧ v = a), T = {l0 , l0 , τ1 , l0 , l0 , τ2 }, where,
268
S. Chen et al.
τ1 = (x = x − y ∧ y = y ∧ u = u ∧ v = v + u ∧ a = a ∧ b = b) τ2 = (x = x ∧ y = y − x ∧ u = u + v ∧ v = v ∧ a = a ∧ b = b) Clearly, τ1 and τ2 are assignment transitions. Note, we ignore non-algebraic assertion a > 0 ∧ b > 0.
3
Invariant Generation
In what follows, we assume that E(¯ x) = 0 is true under the initial condition Θ. Theorem 1. E(¯ x) is an invariant of loop V, {l0 }, T, l0 , Θ if and only if, for each transition l0 , l0 , τ ∈ T , Δτ E(¯ x) is an invariant of the loop. Proof. We prove the necessary part by contradiction. Assume that E(¯ x) is an invariant of loop V, {l0 }, T, l0 , Θ, and there exists a transition l0 , l0 , τ ∈ T such that Δτ E(x) is not an invariant of the loop. From the definition of loop invariant, there exists an iteration of the loop such that Δτ E(¯ x) = 0 after this iteration. If E(¯ x) = 0, E(¯ x) is not an invariant of loop (contradicts to the assumption). If E(¯ x) = 0, then E(¯ x ) = E(¯ x)+Δτ E(¯ x) = 0, namely, E(¯ x) = 0 is false after the next iteration, so, E(¯ x) is not an invariant of loop. This contradicts to the assumption. x) is an invariant of loop Assume that, for every transition l0 , l0 , τ ∈ T , Δτ E(¯ V, {l0 }, T, l0 , Θ. We prove that E(¯ x) is an invariant of the loop by inducion on the number of iterations. Let n be the number of iterations in the loop. E(¯ x) = 0 is true under the initial condition Θ, namely, n=0. Assume that E(¯ x) = 0 is true when n = k. When the loop iterates k + 1 times, the value of E(¯ x) is E(¯ x ) such that E(¯ x ) = E(¯ x) + Δτ E(¯ x) and l0 , l0 , τ ∈ T is a transition. Since, for every transition l0 , l0 , τ ∈ T , Δτ E(¯ x) is an invariant, namely, Δτ E(¯ x) = 0. Hence, when the loop has iterated k + 1 times, the assertion E(¯ x) = 0 is true. If E(¯ x) is a polynomial expression, due to the property that polynomial invariants form an ideal, the proof of Theorem 1 could be done much shorter, by using ideal theoretic operations. For example, necessity: assuming that E(x) is an invariant, then E(x ) is also an invariant. Since invariants form a poly ideal, E(x) − E(x ) is also an invariant. Expression 0 is an invariant of an arbitrary loop because of the tautology of 0 = 0. For a given expression E(¯ x), if E(¯ x) = 0 is true under the initial condition Θ, and, for every transition l0 , l0 , τ ∈ T , Δτ E(¯ x) equals 0, then E(¯ x) is an invariant of loop V, {l0 }, T, l0 , Θ according to Theorem 1. Therefore, we have the following lemma. x) = 0 holds, then E(¯ x) Lemma 1. For every transition l0 , l0 , τ ∈ T , if Δτ E(¯ is an invariant of loop V, {l0 }, T, l0 , Θ. A constraint-solving based invariant generation approach usually has three steps: Step 1. Assuming a template over a set of abstract coefficient variables A for the loop.
An Iterative Method for Generating Loop Invariants
269
Step 2. Generating constraints on all the template variables A, guaranteeing that any solution to these constraints corresponds to an invariant of the loop. Step 3. Solving the constraints. In this paper, we focus on generating polynomial equations as loop invariants. All the known methods of constraint-based invariant generation harness the constraints over coefficients in the template using inductive assertion methods. For equality invariants, using Theorem 1, we can obtain a simple and sound algorithm to find the constraints over coefficients. The Algorithm is described as follows. Algorithm 1 input: Loop V, {l0 }, T, l0 , Θ and a polynomial Q such that Q = 0 is an invariant of the given loop output: A new polynomial equality invariant 1. Assume a polynomial P (with a degree d higher than the degree of Q) whose coefficients are unknown parameters as invariant template for the loop 2. For each l0 , l0 , τ ∈ T , set each coefficient expression of Δτ (P ) − aQ to zero to obtain constraints φτ , where a is a new non-zero coefficient. 3. The initial condition Θ gives the initial values of the variables. Substitute these initial values on P to obtain P0 . Set each coefficient expression of P0 to zero to obtain constraints φΘ . 4. The overall constraints φ are given by φ ≡ φΘ ∧ τ ∈T φτ . Solve φ to obtain a solution α. Let α(P ) denote the specialization of P by the solution α. Return α(P ). In Algorithm 1, the second and the third steps correspond to the constraint generation. In the the third step, in case that Θ is an algebraic assertion that gives a constraint on the initial values of the variables, we have to calculate the symbolic expression for each variable by means of solving equations. Theorem 2 (Soundness). In Algorithm 1, α(P ) is an invariant for the given loop. Proof. It is clear that polynomial P (x1 , · · · , xn ) is zero for all the possible values of x1 , · · · , xn if and only if all its coefficients are identically zero. Since the solution α satisfies φ, it must satisfy each individual φτ along with φΘ . Since α satisfies φΘ , P0 is identically zero. Thus, α(P ) is zero under the initial condition Θ. For each l0 , l0 , τ ∈ T , α satisfies φτ , so Δτ (α(P )) − aQ is identically zero, namely, Δτ (α(P )) = aQ. Since Q is an invariant of the loop, for an arbitrary a, aQ is also an invariant of the loop. By Theorem 1, α(P ) is an invariant of the given loop. Example 5. Consider the loop in Example 1. The loop computes the square root √ n for a given non-negative integer n. The corresponding transition system is shown in Example 3. Using invariant 0 = 0, we can generate some new polynomial equality invariants:
270
S. Chen et al.
1, Assuming template: let P be an invariant of the form a0 x + a1 y + a2 z + a3 , where a0 , · · · , a3 are coefficients that we want to discover. 2, Δτ (P ) = Δτ (a0 x + a1 y + a2 z + a3 ) = a0 (x + 1) + a1 (y + 2) + a2 (z + y + 2) + a3 − (a0 x + a1 y + a2 z + a3 ) = a0 + 2a1 + 2a2 + a2 y Setting each coefficient expression of Δτ (P ) to zero, we obtain φτ : a0 + 2a1 + 2a2 = 0, a2 = 0 3, Under the initial condition x = 0 ∧ y = 1 ∧ z = 1, P0 = a1 + a2 + a3 . Setting each coefficient expression of P0 to zero, we obtain φΘ : a1 + a2 + a3 = 0 4, Solving φ, we obtain a0 = −2, a1 = 1, a2 = 0, a3 = −1, which correspond to the invariant: y − 2x − 1. The method of solving the constraints is given in the next section. For many loops, the finite difference of a higher degree polynomial is a polynomial of lower degree. Theorem 1 inspire us to generate invariants using an iterative approach: first, generate some lower degree polynomials as invariants. If these invariants can’t establish the target property, we generate polynomial invariants of higher degree using the previously generated invariants, ..., until we obtain the key invariant for proving the target property or we decide to give up because the number of iterations is too large. Example 6. Using Algorithm 1, we can harness the invariant of degree one obtained in Example 5 to construct an invariant of degree two. 1, Assuming template: let P be an invariant of the form a0 x2 + a1 x + a2 xy + a3 xz + a4 y 2 + a5 y + a6 yz + a7 z 2 + a8 z + a9 , where a0 , · · · , a9 are coefficients that we want to find. 2, Δτ (P ) = a0 +a1 +2a2 +2a3 +4a4 +2a5 +4a6 +4a7 +2a8 +(2a0 +2a2 +2a3 )x+ (a2 +a3 +4a4 +4a6 +4a7 +a8 )y +a3 xy+(a6 +a7 )y 2 +(a3 +2a6 +4a7 )z +2a7 yz Setting each coefficient expression of Δτ (P )−a(y −2x−1) to zero, we obtain φτ : a0 + a1 + 2a2 + 2a3 + 4a4 + 2a5 + 4a6 + 4a7 + 2a8 = −a, 2a0 + 2a2 + 2a3 = −2a, a2 + a3 + 4a4 + 4a6 + 4a7 + a8 = a, a3 = 0, a6 + a7 = 0, a3 + 2a6 + 4a7 = 0, 2a7 = 0 3, Under the initial condition x = 0∧y = 1∧z = 1, P0 = a4 +a5 +a6 +a7 +a8 +a9 . Setting each coefficient expression of P0 to zero, we obtain φΘ : a4 + a5 + a6 + a7 + a8 + a9 = 0 4, Solving φ, we get: a0 = −1, a1 = −2, a8 = 1, a9 = −1, a = 1, a2 = a3 = a4 = a5 = a6 = a7 = 0, which correspond to the invariant: −x2 − 2x − 1 + z. This invariant is critical to the correctness proof of the program.
An Iterative Method for Generating Loop Invariants
4
271
Solving Constraints
We show how to solve the constraints generated by the method described in Section 3 Since the constraint generation process involves only addition and subtraction of polynomials, the generated constraints are linear equalities which can be solved easily by means of solving linear equations. We use M athematica to solve the constraints. Example 7. The three linear equalities generated in Example 5 constitute a set of linear equations, which can be solved by the following M athematica instruction: Solve[{a0 + 2a1 + 2a2 == 0, a2 == 0, a1 + a2 + a3 == 0, }, {a0 , a1 , a2 , a3 }] Get: a0 = 2a3 , a1 = −a3 , a2 = 0. Let a3 = −1, we obtain the solution: a0 = −2, a1 = 1, a2 = 0, a3 = −1. When choosing concrete values to parameters, we choose the parameter values such that resulting solution set is formed by minimal integer values. In example 7, we choose a3 = −1 or a3 = 1 (and get a0 , a1 , a2 accordingly), but we will not choose a3 = 10. Example 8. Solving the constraints generated in Example 6 in mathematica, we obtain: a0 = −2a − 4a5 − 3a8 − 4a9 , a1 = −a − 2a5 − a8 , a2 = a + 4a5 + 3a8 + 4a9 , a3 = 0, a4 = −a5 − a8 − a9 , a6 = 0, a7 = 0 Let a = 1, a5 = 0, a8 = 1, a9 = −1, we obtain the solution: a0 = −1, a1 = −2, a8 = 1, a9 = −1, a = 1, a2 = a3 = a4 = a5 = a6 = a7 = 0.
5
Case Studies
We use two representative benchmarks to illustrate the effectiveness of our approach. Example 9. The program in Example 2 implements the Dijkstra algorithm which calculates the least common multiple (lcm) and the greatest common divisor (gcd) of integers a and b. Its transition system is shown in Example 4. Some polynomial equality invariants are generated as follows. 1, Assuming template: Let P = a0 x2 +a1 x+a2 xy +a3 xu+a4 xv +a5 xa+a6 xb+ a7 y 2 + a8 y + a9 yu + a10 yv + a11 ya + a12 yb + a13 u2 + a14 u + a15 uv + a16 ua + a17 ub + a18v2 + a19 v + a20 va+ a21 vb + a22 a2 + a23 a+ a24 ab + a25b2 + a26 b + a27 2, Δr1 (P ) = a19 u + a20 au + a21 bu + (a15 + a18 )u2 + 2a18 uv + a4 ux − a1 y − a5 ay − a6 by + (a10 − a3 )uy − a4 uy − a4 vy − 2a0 xy + (a0 − a2 )y 2 ; Δr2 (P ) = a14 v + a16 av + a17 bv + 2a13 uv + (a13 + a15 )v 2 − a11 ax − a8 x − a12 bx − a9 ux − (a10 − a3 + a9 )vx − (a2 − a7 )x2 + a9 vy − 2a7 xy Let Δr1 (P ) = Δr2 (P ) = 0, we obtain φr1 :
272
S. Chen et al.
a19 = a20 = a21 = a18 = a4 = a1 = a5 = a6 = a0 = 0, a15 + a18 = 0, a10 − a3 = 0, a0 − a2 = 0 φr2 : a14 = a16 = a17 = a13 = a11 = a8 = a12 = a9 = a7 = 0, a13 + a15 = 0, a10 − a3 + a9 = 0, a2 − a7 = 0 3, Under the initial condition x = a ∧ y = b ∧ u = b ∧ v = a, P0 = a27 + (a0 + a18 + a20 + a22 + a4 + a5 )a2 + (a1 + a19 + a23 )a + (a10 + a11 + a15 + a16 + a2 + a21 + a24 + a3 + a6 )ab + (a14 + a26 + a8 )b + (a12 + a13 + a17 + a25 + a7 + a9 )b2 Setting each coefficient expression of P0 to zero, we obtain φΘ : a27 = 0, a0 + a18 + a20 + a22 + a4 + a5 = 0, a1 + a19 + a23 = 0, a10 + a11 + a15 + a16 + a2 + a21 + a24 + a3 + a6 = 0, a14 + a26 + a8 = 0, a12 + a13 + a17 + a25 + a7 + a9 = 0 4, Solving φ, we get: a3 = 1, a10 = 1, a24 = −2, while all the other coefficients are zero. This corresponds to the invariant: xu + yv − 2ab. Example 10. The following program implements an algorithm for computing the cubic root τ for a given integer a. @pre[x = a ∧ r = 1 ∧ s = 13/4] while (x > s) do τ: (x,s,r):=(x-s, s+6*r+3, r+1) done. 1, Assuming template: let P = a0 x2 + a1 x + a2 xs + a3 xr + a4 xa + a5 s2 + a6 s + a7 sr + a8 sa + a9 r2 + a10 r + a11 ra + a12 a2 + a13 a + a14 . 2, Δτ (P ) = a10 + 9a5 + 3a6 + 3a7 + a9 + (36a5 + 6a6 + 9a7 + 2a9 )r + (36a5 + 6a7 )r2 − (a1 + 3a2 + a3 − 6a5 − a7 )s − (6a2 + a3 − 12a5 )rs + (a0 − a2 )s2 + (a11 + 3a8 )a + 6a8 ar − a4 as + (3a2 + a3 )x + 6a2 rx − 2a0 sx Let Δτ (P ) = 0, we obtain φr : a10 + 9a5 + 3a6 + 3a7 + a9 = 0, 36a5 + 6a6 + 9a7 + 2a9 = 0, 36a5 + 6a7 = 0, a1 + 3a2 + a3 − 6a5 − a7 = 0, 6a2 + a3 − 12a5 = 0, a0 − a2 = 0, a11 + 3a8 = 0, 6a8 = 0, a4 = 0, 3a2 + a3 = 0, 6a2 = 0, 2a0 = 0
An Iterative Method for Generating Loop Invariants
273
3, Under the initial condition x = a ∧ r = 1 ∧ s = 13/4, P0 = (a0 + a4 + a12 )a2 + (a1 +(13/4)a2 +a3 +(13/4)a8 +a11 +a13 )a+(169/16)a5 +(13/4)a6 +(13/4)a7 + a9 + a10 + a14 Let P0 = 0, we obtain φΘ : a0 + a4 + a12 = 0, a1 + (13/4)a2 + a3 + (13/4)a8 + a11 + a13 = 0, (169/16)a5 + (13/4)a6 + (13/4)a7 + a9 + a10 + a14 = 0 4, Solving the constraints, we get: a0 = a1 = a2 = a3 = a4 = a5 = a7 = a8 = a10 = a11 = a12 = a13 = 0, a9 = −12, a6 = 4, a14 = −1, corresponding to invariant: −1 − 12r2 + 4s. In addition, using invariant −1 − 12r2 + 4s, we can attain a more useful invariant which has a degree of three: We use a simple template P = a0 x3 + a1 x2 + a2 x + a3 s3 + a4 s2 + a5 s + a6 r3 + a7 r2 + a8 r + a9 a3 + a10 a2 + a11 a + a12 . Thus, Δτ (P ) = 216a3r3 + (3a6 + 324a3 + 36a4 )r2 + 108a3 r2 s + (6a5 + 3a6 + 2a7 + 162a3 + 36a4 )r + 18a3 rs2 + (12a4 + 108a3 )rs − a0s3 + (a1 + 9a3 )s2 + 3a0 s2 x + (27a3 − a2 + 6a4 )s − 3a0 sx2 − 2a1 sx + 3a5 + a6 + a7 + a8 + 9a4 + 27a3 . Setting each coefficient expression of Δτ (P ) − a(−1 − 12r2 + 4s) to zero, we obtain φr : 216a3 = 0, 3a6 + 324a3 + 36a4 = −12a, 108a3 = 0, 6a5 + 3a6 + 2a7 + 162a3 + 36a4 = 0, 18a3 = 0, 12a4 + 108a3 = 0, a0 = 0, a1 + 9a3 = 0, 3a0 = 0, 27a3 − a2 + 6a4 = 4a, 3a0 = 0, 2a1 = 0, 3a5 + a6 + a7 + a8 + 9a4 + 27a3 = −a Under the initial condition x = a ∧ r = 1 ∧ s = 13/4, P0 = (a0 + a9 )a3 + (a1 + a10 )a2 + (a2 + a11 )a + (2197/64)a3 + (169/16)a4 + (13/4)a5 + a6 + a7 + a8 + a12 Setting each coefficient expression of P0 to zero, we obtain φΘ : a0 + a9 = 0, a1 + a10 = 0, a2 + a11 = 0, (2197/64)a3 + (169/16)a4 + (13/4)a5 + a6 + a7 + a8 + a12 = 0 Solving φ, we get: a = −1, a2 = 4, a6 = 4, a7 = −6, a8 = 3, a11 = −4, a12 = −1, a0 = a1 = a3 = a4 = a5 = a9 = a10 = 0, which corresponds to the invariant: −1 − 4a + 3r − 6r2 + 4r3 + 4x.
6
Conclusion
We presented a method for generating polynomial equations as loop invariants using finite difference of expressions and linear equation solving. The generated constraints are linear equalities, which can be solved easily, hence, we are
274
S. Chen et al.
confident that the technique will scale to larger examples. The generation process can construct invariants of higher degree in terms of those of lower degree. Our further research is directed to generalizing the technique to construct nonpolynomial (such as, exponential, logarithmic) equations as invariants.
References 1. Bradley, A.R., Manna, Z., Sipma, H.B.: Termination of polynomial programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 113–129. Springer, Heidelberg (2005) 2. Chen, Y., Xia, B., Yang, L., Zhan, N.: Generating polynomial invariants with Discoverer and Qepcad. In: Jones, C.B., Liu, Z., Woodcock, J. (eds.) Formal Methods and Hybrid Real-Time Systems. LNCS, vol. 4700, pp. 67–82. Springer, Heidelberg (2007) 3. Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: Proc. POPL 1978, pp. 84–96 (1978) 4. Rodriguez-Carbonell, D.K.E.: Generating all polynomial invariants in simple loops. Journal of Symbolic Computation, 443–476 (2007) 5. Giacobazzi, R. (ed.): SAS 2004. LNCS, vol. 3148. Springer, Heidelberg (2004) 6. Gulwani, S., Srivastava, S., Venkatesan, R.: Program analysis as constraint solving. In: Proc. PLDI 2008, pp. 281–292 (2008) 7. Kov´ acs, L.: Reasoning algebraically about p-solvable loops. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 249–264. Springer, Heidelberg (2008) 8. Michael, H.S., Colon, A., Sankaranarayanan, S.: Linear Invariant Generation Using Non-linear Constraint Solving. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 420–433. Springer, Heidelberg (2003) 9. Min´e, A.: The octagon abstract domain. Higher-Order and Symbolic Computation 19(1), 31–100 (2006) 10. M¨ uller-Olm, M., Seidl, H.: Precise interprocedural analysis through linear algebra. In: POPL, pp. 330–341 (2004a) 11. M¨ uller-Olm, M., Seidl, H.: Computing polynomial program invariants. Inf. Process. Lett. 91(5), 233–244 (2004b) 12. Rodr´ıguez-Carbonell, E., Kapur, D.: Automatic generation of polynomial invariants of bounded degree using abstract interpretation. Sci. Comput. Program. 64(1), 54–75 (2007) 13. Sankaranarayanan, S., Sipma, H., Manna, Z.: Non-linear loop invariant generation using gr¨ obner bases. In: POPL, pp. 318–329 (2004)
Algorithms for Computing Bidirectional Best Hit r-Window Gene Clusters Trong Dao Le, Melvin Zhang, and Hon Wai Leong Department of Computer Science, National University of Singapore Computing 1, 13 Computing Drive, Singapore 117417, Republic of Singapore {daole,melvin,leonghw}@comp.nus.edu.sg
Abstract. Genome rearrangements are large-scale mutations that result in a shuffling of the genes on a genome. Despite these rearrangements, whole genome analysis of modern species has revealed sets of genes that are found close to one another in multiple species. These conserved gene clusters provide useful information on gene function and genome evolution. In this paper, we consider a novel gene cluster model called bidirectional best hit r-window (BBHRW) in which the idea is to (a) capture the “frequency of common genes” in an r-window (interval of at most r consecutive genes) of each genome and (b) to further strengthen it by the bidirectional best hit criteria. We define two variants of BBHRW using two different similarity measures to define the “frequency of common genes” in two r-windows. Then the algorithmic problem is as follows: Give two genomes of length n and m, and an integer r, compute all the BBHRW clusters. A straight-forward algorithm for solving this problem is an O(nm) algorithm that compares all pairs of r-windows. In this paper, we present faster algorithms (SWBST and SWOT) for solving these two BBHRW variants. Algorithm SWBST is a simpler algorithm that solves the first variant of the BBHRW, while algorithm SWOT solves both variants of the BBHRW. Both algorithms have running time O((n+m)r lg r). The algorithmic speed-up is achieved via a sliding window approach and with the use of efficient data structures. We implemented the algorithms and compare their running times for finding BBHRW clusters conserved in E. coli K-12 (2339 genes) and B. subtilis (2332 genes) with r from 1 to 30 to illustrate the speed-up achieved. We also compare the two similarity measures for these genomes to show that the choice of similarity measure is an important factor for this cluster model.
1
Introduction
In the course of evolution, the genome of a species undergoes large-scale, rare mutation events known as rearrangements [7]. Despite the shuffling of genes due to rearrangements, comparison of modern species reveals that certain sets of genes always occur near one another in several genomes. These gene sets are commonly known as conserved gene clusters. We model a chromosome as a string where each character represents a gene family. Genomes with multiple chromosomes are handled by concatenating the M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 275–286, 2011. c Springer-Verlag Berlin Heidelberg 2011
276
T.D. Le, M. Zhang, and H.W. Leong
different chromosomes together in an arbitrary order. An important feature of many gene cluster models is that the order of occurrence of the elements in a cluster does not matter. Hence, when looking for instances of a given cluster in a string, we are only interested in the set of characters. This is known as the character set of a string [3]. One of the simplest gene cluster model is the common interval model [9]. A common interval is a set of characters and it occurs in a string S if it is the character set of some substring of S. The common interval model only considers character sets of substrings. Thus it assumes that a elements of a cluster are contiguous. When the strings are permutations of n characters, there is an O(kn + C) time algorithm [9,5] for finding all C common intervals that occur in k strings. The best known algorithm for finding common intervals in general strings is an O(N 2 ) time algorithm [3], where N is the total length of all the strings. The common interval model assumes that a gene cluster is contiguous. However, gene clusters evolve over time and may gain/loss elements in different genomes. Therefore, one possible generalization is to allow clusters to form subsequences instead of substrings. Since clusters are relatively compact structures, the gene team model considers character sets of gapped subsequences with gaps of at most δ characters. There is an O(kn lg n) time algorithm of the case of k permutations [1] and an O(nk ) time algorithm for k sequences [4]. The preceding models (common intervals and gene teams) look for character sets that occur in a set of strings. An alternative solution to define clusters that are not contiguous is to look for substrings with similar characters sets. Motivated by the popular bidirectional best hit criteria [6] for finding corresponding genes in several species, we propose a novel gene cluster model based on finding bidirectional best hit substrings of at most r characters. The underlying assumption is that substrings in two different strings are instances of the same cluster if their character sets are bidirectional best hits. We consider two variants of this model, based on two similarity measures for strings: count(wG , wH ) is the number of characters in wG that occur in wH , and msint(wG , wH ) is the size of the multiset intersection of wG and wH . A na¨ıve algorithm that computes all clusters by comparing all pairs of substrings requires at least quadratic time. Exploiting the structure of the similarity measures, we designed two O((n + m)r lg r) time algorithms, where n and m are the lengths of the two input strings.
2
Problem Formulation
We model the sequence of genes on a genome as a string over the alphabet Σ of gene families. Given a string S, S[i, j] denotes a substring of S that starts at position i, ends at position j, and includes both S[i] and S[j]. Gene clusters are compact structures, hence we only consider substrings of length at most r, where r is a user defined parameter. Definition 1 (r-window). An r-window of a string G is a substring of G with at most r characters.
Computing Bidirectional Best Hit r-Window Gene Clusters
277
For a given r-window wG of a string G and a specific similarity measure, we want to find r-windows of another string H that is the most similar to wG . We call these the best hits of wG . Definition 2 (Best hits of a r-window). Given an r-window wG on a string G, a string H, and a similarity measure sim, the best hits of wG are the rwindows wH of H that satisfies sim(wG , wH ) > sim(wG , wH ) for all wH which does not contain wH
Depending on the definition of the similarity measure, it is possible for a given rwindow wG there are two or more r-windows of H that have the same similarity to wG . In the case where one of these r-window contains the other, we prefer the minimal one. That is why in the above definition, we require that wH does not contain wH . Naturally, we want to find a pair of r-windows that are the unique best hit of each other. Hence, we define bidirectional best hits as follows: Definition 3 (BBH r-window cluster). Given two strings G and H, a window size r, and a similarity measure sim, a pair of r-windows (wG , wH ) is a bidirectional best hit r-window cluster if and only if wG is the only best hit of wH with respect to sim and wH is the only best hit of wG with respect to sim. The computational problem we are solving is to find all occurrences of BBH r-window cluster. Formally, given two strings, G and H, a similarity measure between a pair of windows, sim, and a maximum window length, r, we want to compute the set of all BBH r-window clusters. A na¨ıve algorithm for the above problem is compare all r-windows of string G against all r-windows of string H. This is a general algorithm since it does not depend on the form of the similarity measure, but it requires at least quadratic time. In the following, we consider two specific similarity measures and exploit the specific properties of the similarity measures to design more efficient algorithms for computing all BBHRW clusters.
3
BBHRW Using Similarity Measure count
3.1
Similarity Measure count
The first similarity measure we will consider is count1 . count(wG , wH ) is the number of characters in wH that are also in wG . Formally, count(wG , wH ) = |{p | wH [p] ∈ CS(wG )}| where CS(wG ) is the character set of wG . This is an asymmetric function since we consider all the characters in wH but treat characters in wG as a set. For example, count(abc, aab) is 3 due to one character a and one character b in aab. In contrast, count(aab, abc) is 2 since c is not in aab. 1
Applications and comparison of BBHRW (count) with the gene teams model was discussed in [10].
278
3.2
T.D. Le, M. Zhang, and H.W. Leong
Algorithm SWBST
Our algorithms for computing BBHRW clusters for two strings G and H consists of three main steps: 1. computing best hits of r-windows in G 2. computing best hits of r-windows in H 3. keeping only the bidirectional best hits The most time-consuming step is computing the best hits. We then store the best hit for H in a hash table and iterate over the best hits for G, keeping only the bidirectional best hits. In the following, we will focus on how we compute the best hits of r-windows in G. Key ideas. We observe that for a given r-window wG in G, most of the rwindows in H do not have any characters in common with wG since only some of the characters in H are also in wG . Our approach is to represent the characters in H that are also in wG in a data structure that allows us to query for the best hit efficiently. There are O(nr) r-windows in G so building this data structure for every r-window is time-consuming. The key is to enumerate the r-windows in G in a specific order. For every position in G, we consider the r-windows that starts at that position in increasing length. This is because the r-window of length l that starts at position i is just the r-window of length l − 1 starting at position i with an addition character. Suppose we have computed the data structure for the characters in H in the current r-window and found the best hit, the next r-window is the previous one with an additional character. This means that we can update our data structure by inserting the additional characters instead of computing it from scratch. Finding best hits. The specific data structure we are using is an augmented binary search tree which supports range query. Each node in the tree is a character in H that is also in the current r-window. We order the nodes according to their position in H. We augment each node u, with s = count(wG , H[p, p + r − 1]), where p is the position of u, and maxs , the maximum value of s in the subtree rooted at u. This gives us a simple algorithm to find the best hit by starting from the root and following the node with the largest maxs . If we find more than one node with the largest maxs than we can stop, since the best hit is not unique. Inserting additional characters. The main difficulty is in updating our binary search tree when we want to add an additional character. Since our data structure only considers characters in H that are also in wG , count(wG , H[p, p+ r − 1]) is also the number of nodes in the tree whose position is in [p, p + r − 1]]. In order to add a new node at position p, we first compute the value of s for the new node by counting the number of nodes in the tree whose position is in [p, p + r − 1]. Secondly, we increase the value of s by 1 for those nodes in the tree whose position is in [p − r + 1, p]. In both cases, we need to deal with
Computing Bidirectional Best Hit r-Window Gene Clusters
279
nodes in a certain range. Hence, we further augment each node with the range of positions of the characters in its subtree (minp and maxp ) and a value (Δ) that indicates the increase to the value of s in all nodes in this subtree. These allows us to execute range queries and updates efficiently. The details are given in the next section. In summary, the algorithm for insertion consist of the following three steps: 1. compute the similarity measure s of the new node using a range query to count the number of nodes in a given interval 2. update the nodes affected by the new node using a range update 3. insert the new node into the binary search tree Range query and update algorithm. An interval of a node u is the interval [minp , maxp ].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Data: a node u in the tree, an interval [s, e] to query/update Result: update the subtree rooted at u and return the answer to the query if the interval of u lies inside [s, e] then ProcessSubtree: Query/update the attributes in this node end else if the position of u is in [s, e] then ProcessNode: Query/update the attributes in this node end if the interval of the left child of u intersects with [s, e] then Recursive call to the left child end if the interval of the right child of u intersects with [s, e] then Recursive call to the right child end CombineSubtree: Combine the result of the recursive calls and/or update the node to maintain consistency end Algorithm 1. Algorithm to query/update nodes in a given interval
We make use of the range query algorithm (Algorithm 1) to compute the result of a query or to update the similarity measure in an interval. Figure 1 shows a possible tree and the nodes visited during a range query operation. Let ProcessSubtree be the procedure to query/update the subtree rooted at u in line 2, ProcessNode be the procedure to query/update the node u in line 6, and CombineSubtree be the procedure in line 14. We use this algorithm to compute the similarity measure s for the new node and to update the data structure.
280
T.D. Le, M. Zhang, and H.W. Leong
Fig. 1. The nodes with bold outline are visited by Algorithm 1 during a range query on the interval [1, 5]
Our structure is based on the interval decomposition idea [2], hence, the worst case time complexity of the range query/update is O(lg |T |) where |T | is the size of the tree. Compute the similarity measure of the new node. Computing the similarity measure of the new node makes use of Algorithm 1 and the corresponding procedures are as follows: ProcessSubtree: return the number of nodes in the subtree. ProcessNode: add 1 to the result for this node. CombineSubtree: return the result plus the sum of the recursive calls. Update the similarity measure of affected nodes. Insertion of the new node increased the similarity measure for nodes in the interval [p − r + 1, p] by 1, where p is the new node’s position. Updating the similarity measure for affected nodes requires a range update. ProcessSubtree: increase Δ by 1 to indicate that the value of s in the subtree has increased by 1 without actually changing s in each node. ProcessNode: increase s by 1. CombineSubtree: update the maxs according to the value of maxs and Δ in the left and right subtrees. Insert the new node into the tree. Insertion a node follows the same procedure as a standard binary search tree. In case where rotations might be needed to keep the tree balanced, the augmented attributes of a node are updated using the attributes of its subtrees. 3.3
Time Complexity Analysis of Algorithm SWBST
For simplicity, we assume that the number of occurrences of a character in a string is bounded by a constant. In the worst case, the size of our binary search tree is O(r). Hence, all operations on the tree have a worst case time complexity of O(lg r) where r is the maximum window length.
Computing Bidirectional Best Hit r-Window Gene Clusters
281
Using the above data structure, the worst case time complexity to compute best hits for all r-windows with the same starting position in G is O(r lg r). We have to compute best hits twice: once from G to H which takes O(nr lg r) time and once from H to G which takes O(mr lg r). Hence, the worst case time complexity of the entire algorithm is O((n + m)r lg r) where n and m are the length of G and H.
4
BBHRW Using Similarity Measure msint
4.1
Similarity Measure msint
The earlier similarity measure count is an asymmetric function. In this section, we consider a symmetric similarity measure that takes into account the multiplicity of the characters. We make use of the multiplicity by using the character multiset instead of character set and let the similarity measure be the size of the multiset intersection. Let CMS(S) denote the character multiset of the string S. Then, the similarity measure msint is as follows: msint(wG , wH ) = |CMS(wG ) ∩ CMS(wH )| The following illustrates the difference between count and msint – count(abacf, bfcba) = 5 and msint(abacf, bfcba) = 4 – count(abacf, fcbaa) = 5 and msint(abacf, fcbaa) = 5 Observe that for the same pair of strings, the value of count is at least as large as msint. In the above example, bfcba and fcbaa give the same value under count, and fcbaa has a higher value compared to bfcba under msint. Intuitively, fcbaa is a more similar to abacf as both of them have two copies of the character a, whereas bfcba has two copies of character b but only a single copy of character a. This illustrates that we can better distinguish between two strings when we make use of the multiplicity of the characters. 4.2
Algorithm SWOT
The general approach for this algorithm is the same as in algorithm SWBST. The difference is in how we compute best hits. The method for computing best hits used in algorithm SWBST cannot be extended for msint because the range query used for counting the number of characters in an substring of H does not take into account the multiplicity of the characters. Hence, we need a new approach to handle the similarity measure msint. The key insight is that instead of storing the similarity measure in the data structure, we store the intervals to be updated. These intervals depend on the order of insertion, so we have to insert characters from left to right. We call these intervals the update interval of a character. Definition 4. An update interval of a character g is the interval where the similarity measure of every substring starting in the interval is increased by the addition of g.
282
T.D. Le, M. Zhang, and H.W. Leong
The key is to recast the problem of finding best hits to the problem of finding the position where the most number of update intervals overlap. This position is the start of the best hit r-window. We keep track of the update intervals using the segment tree data structure. Similar to the algorithm SWBST, we build the data structure incrementally for different r-windows by inserting new update intervals as the current r-window is extended by an additional character. Adding a single character to the current r-window may require inserting several update intervals since there may be multiple occurrences of the character in the string H. The algorithm for inserting a new character and computing best hits consist of three steps: 1. computing the update interval of a new character 2. inserting the update interval and updating the segment tree 3. determining the best hit Computing the update interval of a new character. As discussed earlier, inserting a new character increases the similarity measure of the r-windows containing the character. In the case of msint, the similarity measure increases by 1. The following gives the formula to compute the update interval for similarity measure msint. Definition 5 (Update interval for similarity measure msint). Let Hc denote a list of occurrence of character c in H in increasing order. Consider a character c at position p which has index k in Hc , its update interval is [max(1, p − r + 1, p + 1), p] where l is the number of character c in wG and H[p ] = c has index k − l in Hc . If k − l is less than 1, let p be 0. Observe that every r-window whose start position is the interval [max(1, p−r), p] is affected by H[p] except those r-windows that already have enough character c. Position p is the last position that has as many occurrences of character c as r-window wG , therefore any position at or before p is not affected by the insertion of a character at position p. Figure 2 illustrates the update intervals for each character of the string H for a given r-window wG . Note that this formulation of the problem is also able to handle similarity measure count presented earlier. In the case of count, the update interval for a new character at position p is simply [max(1, p − r + 1), p]. From the above definition, we can compute the update interval of a character in constant time. Inserting the update interval and updating the segment tree. Insertion of the update interval follows from standard segment tree insertion. In order to compute the best hit efficiently, we augment each node to keep track of the maximum number of overlapping intervals in its subtree. This augmented value is updated during insertion.
Computing Bidirectional Best Hit r-Window Gene Clusters
283
Fig. 2. The update intervals corresponding to each characters of H = ababbc with the red line representing maximum overlapped points with respect to wG = abb and r = 5. There is no update interval for character c since it does not occur in wG .
Determining the best hit. Computing the region covered by the most number of update intervals incrementally is the dynamic version of the standard stabbing query problem [2]. In our case, since we know the maximum number of overlapping interval in the subtree of each node, we can simply start from the root of the segment tree and follow the child that has the larger maximum number of overlapping interval. The leaf node that we reach at the end of this process is the interval with the most overlap and equivalently the highest similarity measure according to msint. 4.3
Time Complexity Analysis of Algorithm SWOT
For simplicity, we assume that the number of occurrences of a character in a string is bounded by a constant. Consider two strings of length n and m respectively, pre-computing the lists of occurrences of a character in H for all characters in H takes O(m) time. Computing the update interval for each character takes O(1). The worst case time complexity of updating the segment tree and traversing the tree to find the start position of the best hit r-window is O(lg r) [2] as there are at most O(r) intervals in the tree. Therefore, the worst case time complexity for computing best hits in H for every r-window of G is O(m+nr lg r), which is the same as the method for computing best hits used in algorithm SWBST. Hence, the worst case time complexity of the entire algorithm is O((n + m)r lg r) (same as algorithm SWBST).
5
Results and Discussion
In this section, we are interested in the improvement in the running time of our algorithms compared to the na¨ıve algorithm and the difference between the two similarity measures. We have previously shown that the BBHRW (count) clusters have a greater correspondence to known biological structures than gene teams [10].
284
T.D. Le, M. Zhang, and H.W. Leong
In practice, we want to include domain specific knowledge about the clusters we are modelling. In the case of gene clusters, where clusters represents descendants of a common ancestor, overlapping clusters are not meaningful. Therefore, we introduce a post processing step to merge clusters when both windows overlap. 5.1
Experimental Setup
Our dataset consist of two prokaryotic genomes, namely E. coli K-12 (GenBank accession number NC000913) and B. subtilis (NC000964) downloaded from the NCBI Microbial Genomes Resource. We convert each genome into a string by representing each gene by its COG [8] label. There are 4289 genes in E. coli K-12 and 4100 genes in B. subtilis. After removing the genes that are unique to each genome, we obtain two strings of 2339 characters (E. coli K-12) and 2332 characters (B. subtilis) from an alphabet of size 1137 (COG labels). We computed the BBHRW gene clusters between the two genomes using both similarity measures for r ranging from 1 to 30 (on an Intel Core 2 Duo T7300 2Ghz with 2GB of RAM running Ubuntu 10.10). 5.2
Comparison of the Running Time
As shown in Figure 3, the running time of SWBST and SWOT are almost the same when we fix the two strings and increase r from 1 to 30. This is expected from their complexities. In contrast, running time of the na¨ıve algorithm is roughly quadratic with respect to r. From this result, we conclude that our algorithms are much more scalable than the na¨ıve algorithm. 5.3
Characteristics of BBHRW Clusters for count and msint
Figure 4 shows the number of clusters produced by our algorithm for the two similarity measures for r from 1 to 30. The two curves shows completely different Running time versus window size for similarity measure COUNT
Running time (seconds)
100
Running time versus window size for similarity measure MSINT 180
Naive algorithm SWBST SWOT
160 Running time (seconds)
120
80 60 40
Naive algorithm SWOT
140 120 100 80 60 40
20 20 0
0 5
10
15 20 Window size, r
25
30
5
10
15 20 Window size, r
25
30
Fig. 3. Comparison of the running time between the na¨ıve algorithm, algorithm SWBST and algorithm SWOT for the two similarity measures, count (left) and msint (right). Note that algorithm SWBST cannot be used for similarity measure msint.
Computing Bidirectional Best Hit r-Window Gene Clusters
285
Number of BBHRW clusters reported for each similarity measure 500
Number of BBHRW clusters
450
MSINT COUNT
400 350 300 250 200 150 100 5
10
15
20
25
30
Window size, r
Fig. 4. Number of reported BBHRW clusters for r varying from 1 to 30
trends. The number of results for similarity measure count peak at r equal to 13 and decreases slightly as r increases to 30. In contrast, for similarity measure msint the number of results increases with the parameter r. This phenomenon is due to the fact that msint is symmetric while count is not. When the similarity measure is symmetric, it is always possible to find a bidirectional best hit when starting from any pair of r-windows. Suppose (wG , wH ) is not a bidirectional best hit and without loss of generality assume that wG is not the best hit of wH . Then, there exist another r-window wG which is the best hit of wH and msint(wG , wH ) is greater than msint(wG , wH ). If (wG , wH ) is not a bidirectional best hit, we simply repeat the previous argument. Each time we do this the similarity measure strictly increases. Since the similarity cannot increase indefinitely, we eventually reach a maxima and find a bidirectional best hit. The same argument cannot be applied to an asymmetric similarity measure because , wH ) is greater than count(wG , wH ), count(wH , wG ) may be while count(wG smaller then count(wG , wH ). Therefore, it is easier to find bidirectional best hits when the similarity measure is symmetric and this is reflected by the greater number of BBHRW clusters found using the similarity measure msint. In practice, we found that using r = 6 (for count) and r = 8 (for msint) results in the greatest number of BBHRW clusters that corresponds to known biological structures such as operons (data not shown).
6
Conclusion
We proposed the BBHRW gene cluster model and two variants based on different similarity measures. Similarity measure msint is symmetric and takes into consideration the number of copies of each gene, whereas count is asymmetric. We designed an efficient algorithm for each variant by making use of fast data structures that support incremental updates. In our experiments on real biological data, we discovered that using a symmetric similarity measure results in many more cluster being reported as compared to an asymmetric similarity
286
T.D. Le, M. Zhang, and H.W. Leong
measure. An interesting direction for future work is to investigate imposing other constraints or post-processing steps to filter or refine the clusters generated.
Acknowledgements We would like to thank the reviewers for their efforts in reviewing our paper and pointing out issues that need to be addressed. This work was supported in part by the National University of Singapore under Grant R252-000-361-112.
References 1. B´eal, M.P., Bergeron, A., Corteel, S., Raffinot, M.: An algorithmic view of gene teams. Theoretical Computer Science 320(2-3), 395–418 (2004) 2. Bentley, J.: Solutions to Klee’s rectangle problems. Unpublished manuscript, Dept. of Comp. Sci., Carnegie-Mellon University, Pittsburgh (1977) 3. Didier, G., Schmidt, T., Stoye, J., Tsur, D.: Character sets of strings. Journal of Discrete Algorithms 5(2), 330–340 (2007) 4. He, X., Goldwasser, M.H.: Identifying conserved gene clusters in the presence of homology families. Journal of Computational Biology 12(6), 638–656 (2005) 5. Heber, S., Stoye, J.: Finding all common intervals of k permutations. In: Amir, A., Landau, G.M. (eds.) CPM 2001. LNCS, vol. 2089, pp. 207–218. Springer, Heidelberg (2001) 6. Moreno-Hagelsieb, G., Latimer, K.: Choosing BLAST options for better detection of orthologs as reciprocal best hits. Bioinformatics 24(3), 319 (2008) 7. Sankoff, D.: Rearrangements and chromosomal evolution. Current Opinion in Genetics & Development 13(6), 583–587 (2003) 8. Tatusov, R.L., Natale, D.A., Garkavtsev, I.V., Tatusova, T.A., Shankavaram, U.T., Rao, B.S., Kiryutin, B., Galperin, M.Y., Fedorova, N.D., Koonin, E.V.: The COG database: new developments in phylogenetic classification of proteins from complete genomes. Nucleic Acids Research 29(1), 22–28 (2001) 9. Uno, T., Yagiura, M.: Fast algorithms to enumerate all common intervals of two permutations. Algorithmica 26(2), 290–309 (2000) 10. Zhang, M., Leong, H.W.: Bidirectional best hit r-window gene clusters. BMC Bioinformatics 11(suppl. 1), S63 (2010)
Contracted Webgraphs: Structure Mining and Scale-Freeness Yushi Uno1 and Fumiya Oguri2
1
Graduate School of Science, Osaka Prefecture University, 1-1 Gakuen-cho, Naka-ku, Sakai 599-8531, Japan 2 Nihon Software Corporation, Ltd., 7-20-1 Fukushima, Fukushima-ku, Osaka 553-0003, Japan
Abstract. The link structure of the Web is generally viewed as the webgraph. One of the main objectives of web structure mining is to find hidden communities on the Web based on the webgraph, and one of its approaches tries to enumerate substructures each of which corresponds to a set of web pages of a community or its core. Through those research, it has been turned out that certain substructures can find sets of pages that are inherently irrelevant to communities. In this paper, we propose a model, which we call contracted webgraphs, where such substructures are contracted into single nodes to hide useless information. We then try structure mining iteratively on those contracted webgraphs since we can expect to find further hidden information once irrelevant information is eliminated. We also explore structural properties of contracted webgraphs from the viewpoint of scale-freeness, and we observe that they exhibit novel and extreme self-similarities.
1 Introduction The link structure of the Web is generally viewed as the webgraph, i.e., a (directed) graph whose nodes and arcs are (web) pages and (hyper)links among pages, respectively [12,13]. It is widely accepted as a significant model since not only fundamental web algorithms such as search engines or page rankings work on it [9] but they have a lot of its advanced applications. Since the Web is still evolving rapidly in its scale, it is important not only to retrieve its contents but to acquire hidden information by regarding the Web as a huge database. Web structure mining is one of such advanced utilization of the webgraph, and it mainly aims to find communities that share common interests in specific topics on the Web [2,5,6,11,14] or to cluster the Web [7,8], and their outcome is expected to make web algorithms eÆcient, to illuminate social phenomena, and so on. On the webgraph, a set of web pages of a community or its core is often supposed to constitute a dense subgraph or a frequent inherent substructure, and structure mining is actually realized by extracting them from the webgraph. Along this line, Kleinberg’s hub-authority biclique model [11,13] is well-known and attractive. Some experimental Partially supported by the Scientific Grant-in-Aid from Ministry of Education, Science, Sports and Culture of Japan (Grant #19500016). M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 287–299, 2011. c Springer-Verlag Berlin Heidelberg 2011
288
Y. Uno and F. Oguri
research tried to extract them from the real Web [12,14], however, it has become quite hard to carry out exhaustive enumeration and to have eective outcome from the recent Web [21]. Another approach is by a max-flow (or a min-cut) that finds small cuts separating a specific set of seed pages [6], however, this also has a drawback in that it requires specified seed pages in advance. In the enumeration approach, substructures called isolated clique [10] and isolated star [22] were proposed to model community structures on the Web. They are convenient from the algorithmic point of view since they can be enumerated eÆciently mainly due to their disjointness. It is reported [21,22] that isolated cliques and isolated stars can find some community candidates, while most of them exist in single domains and are irrelevant to communities (we call spams in this paper). These observations suggest that we can eliminate those structures in single domains without losing any intrinsic information necessary for structure mining. As for the structural aspects of the webgraph, there are enormous research directions and results (e.g., [1,4,23]). One of the most important aspects is its scale-freeness, which is considered that the (in-)degree distribution shows the power-law. (Here, the powerlaw distribution is the one in which the probability that an stochastic variable X (degree of nodes, in this case) equals k is denoted by Pr(X k) 1 k ( 1), and the index is called its (scaling) exponent.) Many of the real-world networks are observed to have this property, and they are called scale-free networks in general [16,17]. The webgraph is regarded as one of typical examples of scale-free networks. In the light of these surveys, the objectives and contributions of this paper are summarizes as follows: (1) We propose contracted webgraphs, where specified substructures useless for finding communities are contracted into a single node in the webgraph (Sec. 2). (2) We explore structural properties of contracted webgraphs from the viewpoint of scale-freeness, which exposes new types of self-similarities (Sec. 3). (3) We perform experiments of structure mining on contracted webgraphs since we can expect to find new information once the webgraph is contracted. We adopt isolated cliques and isolated stars as target substructures, and then iterate structure mining on contracted webgraphs by enumerating and contracting them. This finally verifies the validity of the proposed new scheme, i.e., structure mining on contracted webgraphs (Sec. 4).
2 Contracted Webgraphs In this section, we present the notion of contracted webgraphs. We also mention about isolated cliques and isolated stars which we focus on as spam substructures to be contracted as well as community substructures in the webgraph. We then explain the outline of our experiments using the scheme of contracted webgraphs. 2.1 Undirected Webgraphs In the subsequent part of this paper, we denote directed graphs and undirected graphs by
G and G, respectively. A simplification of a directed graph G (V E) is to remove loops and to identify multiple arcs as a single arc. For a simple directed graph G (V E), we call a pair of arcs (vi v j ) E and (v j vi ) E bidirectional, and an arc (vi v j ) E
Contracted Webgraphs: Structure Mining and Scale-Freeness
289
such that (v j vi ) E unidirectional. Substructures used in this paper are essentially defined on undirected graphs. On the other hand, since the webgraph is directed, we need to regard it as undirected to find them. From a viewpoint that mutual links can have significant information on the Web [2,21], in this paper, we prepare a webgraph that consists only of mutual links (a pair of bidirectional arcs) as single undirected edges by discarding all the unidirectional arcs, only when we find specified substructures. Then an undirectization of a simple directed graph G (V E) is to make an undirected graph ¼ ¼ G (V E ) whose edge set E vi v j vi v j (vi v j ) E and (v j vi ) E . Hereafter, we sometimes denote the undirectization of a simple directed graph G by an opera tor u(G), and we refer simplified webgraph to a (directed) webgraph and undirectized webgraph to an undirected webgraph. 2.2 Intra-»Inter-domain Substructures and Contractions
Given a vertex subset W ( V) of a directed graph G (V E), a contraction of W in G is to make a new graph G W (V ¼ E ¼ ), where V ¼ (V W) u (u V) E ¼ (E E(G[W]) E(W V W) E(V W W))
(u v) v V W E(W v) (v u) v V W E(v W) By definition, G W becomes simple. In our approach, we enumerate substructures in undirected webgraphs, however, we propose that they should be contracted in the (directed) webgraphs immediately before their undirectization. This is because we may lose unidirectional arcs in (directed) webgraphs if contractions are done in resulting undirected webgraphs. Otherwise, we can preserve unidirectional arcs, which may produce new bidirectional arcs after contractions and could have new information in the resulting webgraph. For a (community or spam) substructure on the Web (a vertex subset in the webgraph), we call it intra-domain if all the corresponding nodes belong to a single domain, and inter-domain, otherwise. In this paper, we regard that only inter-domain substructures whose sizes are greater than two can be community candidates, while the other substructures (intra-domain ones) are regarded not to contribute for structure mining and thus to be contracted (except for the ones whose size is two since they are not spams but simply mutual links) [21,22]. Furthermore, we assume that the substructures we contract should be disjoint. This guarantees that the resulting graph after contracting them in any order become unique, which allows to contract them simultaneously. 2.3 Contracted Webgraphs Let a specified substructure of a graph be X. (X is supposed to represent spams on the Web.) We define webgraphs that are obtained by repeatedly enumerating X in undi rected webgraph G (V E) and contracting X in its original (directed) webgraph G. Suppose that all the substructures X appearing in G are disjoint, and let be a family of substructures X enumerated in G, i.e., Xi Xi V (i 1 2 k), Xi is X, Xi , Xi X j (i j). Then for a directed graph G and a family of disjoint ver tex sets , a contraction of a vertex sets family in G is to make a graph G ¼k , where
290
Y. Uno and F. Oguri
G G X (and G G X ). We denote this contraction by G or by an operator i 1 i i 1 1 x(), that is, x(G) G . Then by this operator, we can define a webgraph after i times successive iterations of contractions of substructure X in G by xi (G) x(xi 1 (G)) (where x0 (G) G). We refer this webgraph xi (G) to i-th (substructure) X contracted (directed) webgraph and its undirected webgraph u(xi (G)) to i-th (substructure) X con tracted undirected webgraph, and denote them G i and Gi , respectively. We call them ¼
¼
¼
X
X
contracted webgraphs in general. 2.4 Isolated Cliques and Isolated Stars as Communities and Spams In reality, it is often the case that a single substructure can represent both communities and spams. In this paper, we focus on isolated clique [10] and isolated star [22] as target substructures1, since it has been observed [21,22] that they have two aspects in the webgraph; isolated cliques and isolated stars can be communities if they are interdomain, while they are menu or index structures (spams) if in single domains. For a directed graph G (V E) and two subsets V1 and V2 of V (V1 V2 V1 V2 ), we define an arc set E(V1 V2 ) by (v1 v2 ) (v1 v2 ) E v1 V1 v2 V2 . For an undirected graph, we consider E(V1 V2 ) E(V2 V1 ). Now, if a vertex set C V (C ) is a clique and satisfies E(C V C) C , C is called an isolated clique (i-clique) [10]. On the other hand, for a vertex subset S ( V) and its partition into F and A (F A S F A A 1), if G[S ] is a star graph, S is called a star and denoted by S (F A). A unique node a A is called a center node, and a node v F is called a satellite node. A star S (F A) is called proper if deg(v) 1 in G for any v F, and a proper star S is called maximal if there is no proper star S ¼ such that S S ¼ . A star S (F A) is called an isolated star (i-star) if S is maximal proper star and satisfies E(A V S ) F [22]. In defining contracted webgraphs, we assumed that spam substructures X to be contracted are disjoint. For i-cliques and i-stars, it is known that they become disjoint except for very restricted cases. We strictly define the disjointness of these substructures, and guarantees the uniqueness of the resulting graph after their simultaneous contractions. Thus X will be i-clique (IC), i-stars (IS) or i-clique and i-stars simultaneously (ICIS), and what we contract is a family of intra-domain i-cliques andor i-stars of sizes greater than two (menu or index structures) in contracted webgraphs. By definition, it holds that G 0IC G 0IS G 0ICIS G G 0IC G 0IS G0ICIS u(G). We define G : u(G) for simplicity. 2.5 Outline of Experiments on Contracted Webgraphs For our experiments, we prepare a webgraph from the real web data collected by The Stanford WebBase Project [20]. We acquire web data from repository WB1:7008, and we first construct the original webgraph G raw . However, since G raw is not necessarily 1
It would be controversial if i-cliques and or i-stars are valid substructures for communities or spams (e.g., see [15]). We avoid this kind of arguments since the main purpose of this paper is the scheme “contracted webgraphs” itself. You can choose any substructure you like.
Contracted Webgraphs: Structure Mining and Scale-Freeness
291
simple, we prepare its simplified webgraph G. It has 59,565 domains, 95,821,917 pages (nodes) and 1,737,732,518 links (arcs). All of our experiments are done on a single PC of Intel 3.0GHz Xeon processor with 6GB memory. For this webgraph, we observe #nodes, #arcs (#edges), degrees and their distributions; enumerate specified substructures and observe their numbers and distributions; and examine if those substructures can correspond to communities. We repeat these examinations also on contracted webgraphs until no more community candidates can be found. Hereafter, we restrict substructures that correspond to community candidates to be the ones that lie over more than two domains, since the ones lie over exactly two domains are too many and most of them cannot be regarded as communities. We present this scheme as the procedure in the following, where inter (G) implies a family of substructures X lying over more than two domains. Procedure (Substructure)X Contracted Webgraph 1. Construct a webgraph G raw from a real web data. 2. Simplify G raw to construct a directed webgraph G. 3. Let a specified target substructure be X. Initialize the number of iteration i : 0, and let GXi : G. 4. Examine #nodes, #arcs and in-out-degree distributions of GXi . i 5. Construct an undirected webgraph GX . Examine #nodes, #edges and degree distribution of GXi . 6. Enumerate substructures X in GXi . Examine the size distribution of the substructure X (GXi ). If inter (GXi ) inter (GXi 1 ), then stop. 7. Examine the corresponding pages of X inter (GXi ) if they stand for communities. 8. Construct a contracted webgraph GXi intra (GXi ) of intra (GXi ) for a webgraph GXi . 9. Let GXi1 : GXi intra (GXi ) and i : i 1, and goto 4. In the following two sections, we show a series of experimental results and observations from the viewpoints of scale-freeness and structure mining by letting X IC (i-cliques), IS (i-stars) and ICIS (i-cliques and i-stars, simultaneously) in Procedure X Contracted Webgraph.
3 Scale-Freeness of Contracted Webgraphs 3.1 Properties of Isolated Clique Contracted Webgraphs Procedure IC Contracted Webgraph stopped after 2 iterations. Tables 1 and 2 show the statistics of contracted webgraphs and contracted undirected webgraphs in each iter 2 ) and #arcs ation, respectively. After contracting a set of i-cliques twice, #nodes V(GIC G 2 ) of G 2 become approximately 94.44% and 81.77% of V( G 0 ) and E( G 0 ), reE( IC IC IC IC 2 2 2 spectively. Similarly, #nodes V(GIC ) and #edges E(GIC ) of GIC become approximately 0 0 87.66% and 45.67% of V(GIC ) and E(GIC ), respectively. Most of the decrement of 1 nodes, arcs and edges occur in the first iteration, and especially E(GIC ) becomes less 1 is 0 than half of E(GIC ). In Table 1, we can observe that the maximum degree of GIC
292
Y. Uno and F. Oguri
i i i 0 Table 1. The number of nodes V( GIC ) and arcs E(GIC ) , the ratio of #nodes V(GIC ) V( GIC ) i 0 and #arcs E( GIC ) E(GIC ) and maximum in- out-degrees of i-clique contracted (directed) webgraphs
→ −0 GIC → −1 GIC → −2 GIC
#nodes #arcs #node ratio #arc ratio max in-deg max out-deg 94,340,605 1,737,732,518 100.00% 100.00% 632,716 10,000 89,182,661 1,423,757,416 94.53% 81.93% 582,313 10,783 89,099,138 1,420,934,272 94.44% 81.77% 582,100 10,783
i i i 0 Table 2. The number of nodes V(GIC ) and edges E(GIC ) , the ratio of #nodes V(GIC ) V(GIC ) i 0 and #edges E(GIC ) E(GIC ) , and maximum degrees of i-clique contracted undirected webgraphs
0 GIC 1 GIC 2 GIC
#nodes #edges #node ratio #edge ratio max deg 42,708,162 172,849,929 100.00% 100.00% 9,667 37,525,258 79,513,007 87.86% 46.00% 9,737 37,438,408 78,948,474 87.66% 45.67% 9,737
0 greater than that of GIC , and this is because arcs whose starting nodes are in an i-clique become sharing their starting nodes after contracting the i-clique. (Similar observations 1 are seen in GIC .) We next observe degree distribui tions of contracted webgraphs GIC . 0 2 Fig. 1 shows those of GIC and GIC , and we can see that both show the powerlaw with almost the same exponents. We can also find a straight line of gradient 1 that stretches from around de0 gree 200 in GIC , but we cannot see 2 it in GIC . This confirms a conjecture that they were due to large cliques caused by making the webgraph undirected [21]. Fig. 1. Degree distributions of i-clique contracted Then we examine the number of undirected webgraphs (estimated exponent 0 2 and GIC , respectively) i-cliques enumerated in each 254 and 259 in GIC iteration (Table 3). The number of intra-domain i-cliques decreases by it- Table 3. The number of i-cliques in i-clique coneration, but that of inter-domain ones tracted webgraphs; #intra- inter-domain i-cliques of is non-decreasing since we do not con- sizes 3, 2 and its maximum size tract them by regarding them as comintra-domain inter-domain size ≥ 3 size = 2 max size ≥ 3 size = 2 max munity candidates. We also find an 0 GIC 868,192 2,281,293 5,940 71 3,350 27 0 1 i-clique of size 5,940 in GIC , and it was GIC 23,285 2,393,168 366 75 3,550 27 2 GIC 1,861 2,400,828 37 75 3,555 27 in fact a huge menu structure in a single domain . Furthremore, we examined i-clique size distributions in each iteration, which again show power-law. Their exponents seem to be almost the same or to become larger in their absolute values by iteration. 10
8
10
7
degree of GC0 degree of GC2
number of nodes
106
10
5
10
4
10
3
10
2
10
1
10
0
10
0
10
1
2
10 degree
3
10
4
10
Contracted Webgraphs: Structure Mining and Scale-Freeness
293
3.2 Properties of Isolated Star Contracted Webgraphs Procedure IS Contracted Webgraph stopped after 4 iterations. Tables 4 and 5 show the statistics of contracted webgraphs and contracted undirected webgraphs, respec 4 ) and #arcs E( G 4 ) of tively. After contracting a set of i-stars four times, #nodes V(GIS IS G 4 become approximately 82.90% and 82.91% of V( G 0 ) and E( G 0 ), respectively. IS IS IS 4 4 4 Similarly, #nodes V(GIS ) and #edges E(GIS ) of GIS become approximately 72.10% 0 0 and 94.74% of V(GIS ) and E(GIS ), respectively. In the first iteration, the decrement ratio is extremely large, however, it gets rapidly small in the later iterations. In Table 4, we can observe that maximum in-degree is decreasing by iteration, and this is because incoming arcs to a center node of an i-star disappeared due to contractions of i-stars. The 1 is greater than that of G 0 , and this is because out-going maximum out-degree of GIS IS arcs from an i-star are concentrated on its center node by contractions.
i i 0 Table 4. The number of nodes V(GIS ) and arcs E( GISi ) , the ratio of #nodes V( GIS ) V(GIS ) i 0 and #arcs E(GIS ) E(GIS ) , and maximum in- out-degrees of i-star contracted (directed) webgraphs
→ −0 GIS → −1 GIS → −2 GIS → −3 GIS → −4 GIS
#nodes 94,340,605 82,386,813 79,448.674 78,466,440 78,206,046
#arcs #node ratio #arc ratio max in-deg max out-deg 1,737,732,518 100.00% 100.00% 632,716 10,000 1,513,579,077 87.33% 87.10% 573,147 16,714 1,459,876,321 84.21% 84.01% 560,105 12,929 1,444,961,271 83.17% 83.15% 557,137 10,000 1,440,687,003 82.90% 82.91% 556,595 10,000
i i i 0 Table 5. The number of nodes V(GIS ) and edges E(GIS ) the ratio V(GIS ) V(GIS ) and i 0 E(GIS ) E(GIS ) , and maximum degrees of i-star contracted undirected webgraphs
0 GIS 1 GIS 2 GIS 3 GIS 4 GIS
#nodes 42,708,162 33,547,032 31,631,837 30,925,377 30,791,005
#edges #node ratio #edge ratio max deg 172,849,929 100.00% 100.00% 9,667 166,184,922 78.55% 96.14% 16,687 164,538,447 74.07% 95.19% 12,926 163,873,640 72.41% 94.81% 9,748 163,749,432 72.10% 94.74% 9,748
i We next observe degree distributions of contracted webgraphs GIS . We can see that 0 4 both GIS and GIS show the power-law with almost the same exponents. We can still find 4 a straight line of gradient 1 in GIS , and this again confirms that it is due to large cliques. Then we examine the number of istars enumerated in each iteration (Ta- Table 6. The number of i-stars in i-star contracted ble 6). The number of intra-domain webgraphs i-stars decreases by iteration, and the intra-domain inter-domain number of inter-domain ones is nonsize ≥ 3 size = 2 max size ≥ 3 size = 2 max 0 decreasing. We also find an i-star of GIS 1,034,855 1,108,921 9,664 1,344 1,471 340 1 0 GIS 105,226 1,026,414 16,655 1,499 1,510 3,675 size 9,664 in GIS , and it was in fact 2 GIS 19,112 1,011,812 12,926 1,563 1,497 3,675 a huge index structure in a single do3 GIS 5,012 1,008,385 8,686 1,588 1,495 3,675 4 main . Furthremore, GIS 1,849 1,006,864 8,867 1,595 1,495 3,675 we examined i-star size distributions in each iteration, which again show power-law with almost the same exponent.
294
Y. Uno and F. Oguri
3.3 Properties of Isolated Clique and Isolated Star Contracted Webgraphs Procedure IC·IS Contracted Webgraph stopped after 6 iterations. Notice that the number of iterations is more than the case of X IC or IS alone. After contracting a 6 ) and #arcs E( G 6 ) of G 6 set of i-cliques and i-stars six times, #nodes V(GIC IS ICIS IC IS 0 0 become approximately 75.56% and 63.00% of V(GIS ) and E(GIS ), respectively. Sim6 6 6 ilarly, #nodes V(GIC IS ) and #edges E(GICIS ) of GIS become approximately 57.64% 0 0 and 39.31% of V(GICIS ) and E(GICIS ), respectively. We confirmed that #nodes and i 1 to G i #edges decreased from GIC IS ICIS is almost close to the sum of those decreased i 1 i i 1 i from GIC to GIC and GIS to GIS , respectively, and this is due to the disjointness of i-cliques and i-stars. Furthermore, we examined degree distributions of contracted wei i bgraphs GIC IS , and we have almost the similar properties that we observed in GIC i and GIS . Next, we examine the number of i-cliques and i-stars enumerated in each iteration (Table 7). Again, we have almost similar observations that we had in Subsec. 3.1 and 0 6 3.2. We then examine distributions of i-clique and i-star sizes found in GIC IS to GICIS . They are shown in Fig. 2 and 3, respectively. We see that they repeatedly show powerlaw with almost the same or slightly increasing exponent in their absolute values. Table 7. The number of i-cliques and i-stars in i-clique and i-star contracted webgraphs
0 GIC+IS 1 GIC+IS 2 GIC+IS 3 GIC+IS 4 GIC+IS 5 GIC+IS 6 GIC+IS
i-clique i-star intra-domain inter-domain intra-domain inter-domain size ≥ 3 size = 2 max. size ≥ 3 size = 2 max. size ≥ 3 size = 2 max. size ≥ 3 size = 2 max. 868,192 2,281,293 5,940 71 3,350 27 1,034,855 1,108,921 9,664 1,344 1,471 340 62,317 2,032,147 366 78 3,438 27 177,457 1,055,773 16,655 1,702 1,534 3,675 9,449 1,969,850 100 78 3,535 27 39,436 1,043,589 12,926 1,878 1,540 3,675 1,701 1,950,728 49 83 3,565 27 10,512 1,039,862 9,686 1,945 1,545 5,946 497 1,944,867 12 83 3,571 27 3,521 1,037,825 8,867 1,965 1,547 5,946 151 1,942,866 11 84 3,581 27 1,451 1,036,970 7,131 1,975 1,547 5,946 52 1,942,134 11 85 3,583 27 714 1,036,513 6,055 1,976 1,545 5,946
1e+007
1e+007
GC+S0 GC+S1 GC+S2 GC+S3 GC+S4 GC+S5 GC+S6
1e+006
100000
100000
number of i-star
number of i-clique
GC+S0 GC+S1 GC+S2 GC+S3 GC+S4 GC+S5 GC+S6
1e+006
10000
1000
10000
1000
100
100
10
10
1
1 1
10
100 size of i-clique
1000
10000
0 6 Fig. 2. IC size distributions in GIC IS –GICIS
1
10
100
1000
10000
100000
size of i-star
0 6 Fig. 3. IS size distributions in GIC IS –GICIS
Contracted Webgraphs: Structure Mining and Scale-Freeness
295
3.4 Scale-Freeness and Self-similarities in Contracted Webgraphs We discuss about the properties of distributions on contracted webgraphs. As we i i i observed, degree distributions of contracted webgraphs GIC , GIS and GIC IS showed power-law repeatedly with almost the same exponent, respectively. (This property can i , G i and G i .) In addition, sizes also be seen in contracted (directed) webgraphs GIC IS ICIS i i of i-cliques enumerated in contracted undirected webgraphs GIC , GIC IS also showed power-law distributions (e.g., as shown in Fig. 2), and sizes of i-stars enumerated in i i contracted undirected webgraphs GIS and GIC IS showed power-law distributions as well (e.g., as shown in Fig. 3). To summarize, we observed new scale-free properties in the following two sense: (i) not only degrees but other indices (such as the size of a specific substructure; i-cliques and i-stars in this paper) can also show the power-law distributions, and (ii) such powerlaw distributions can be observed repeatedly in contracted webgraphs as well as in the original webgraph. We can also say that a webgraph has a remarkably recursive and selfsimilar structure, that is, ‘cliques-within-cliques’ and ‘stars-hanging-o-stars’. Indeed, these observations look similar to those in [19], however, our approach is essentially dierent from it and we observed another kind of self-similar phenomena.
4 Structure Mining on Contracted Webgraphs Remind, in this paper, that i-cliques and i-stars are substructures not only for spams but for community candidates. Also remind that we only regard inter-domain ones over more than two domains as community candidates. 4.1 Structure Mining on Isolated Clique Contracted Webgraphs We show in Table 8 the number Table 8. The number of inter-domain i-cliques over more of inter-domain i-cliques over than two domains in i-clique contracted webgraphs; ‘total’: i i 1 i not in GIC but newly more than two domains in GIC . #i-cliques in GIC , ‘inc.’: #i-cliques i 1 i appeared ‘dec.’: #i-cliques in G but disappeared in GIC , IC By definition, in each iteration i and ‘change’: #i-cliques in GIC with the same pivot as in i i, the value ‘total’ in GIC is i 1 GIC but not with the same size, ‘max.’: the maximum size i 1 equal to the ‘total’ in GIC plus i ‘inc.’ minus ‘dec.’ in GIC , and total inc. dec. change max. 0 7 GIC 26 ‘inc.’ tells the number of newly 1 GIC 29 4 1 0 7 enumerated i-cliques in each 2 GIC 29 0 0 0 7 iteration. The number of those i-cliques is non-decreasing. Moreover, we Table 9. An inter-domain i-clique of size 3 over more than 1 can find four such i-cliques in two domains in GIC (related to ‘fishing’ community) 1 0 GIC that were not found in GIC . This implies that we could find new community candidates only by constructing contracted web1 2 graphs. We did not observe any change from GIC to GIC . We checked if those icliques represent communities in reality, and as a result, we regard some of them as
296
Y. Uno and F. Oguri
communities. Table 9 is a set of pages whose corresponding nodes constitute an inter1 domain i-clique over more that two domains in GIC . 4.2 Structure Mining on Isolated Star Contracted Webgraphs We show in Table 10 the Table 10. The number of inter-domain i-stars over more than two number of inter-domain domains in i-star contracted webgraphs i-cliques over more than total inc. dec. change max. i 0 two domains in GIS (see GIS 115 184 1 GIS 126 20 9 8 409 the annotations in Table 8 2 GIS 132 7 1 2 2312 for avvreviations). 3 GIS 136 4 0 0 2312 4 GIS 136 0 0 0 2312 The number of those i-stars is non-decreasing. Moreover, we obTable 11. An inter-domain i-star of size 5 over more than two served an i-star that bedomains in G3 (related to ‘finite element method’ community); came not over more than (a) is a page IScorresponding to a center node and (b) is a set of two domains by contrac- pages corresponding to satellite nodes of the i-star tions. We did not observe 3 any change from GIC to (a) 4 GIC . We checked if those (b) i-stars represent commu nities in reality, and as a result, we regard some of them as communities. Table 11 is a set of pages whose corresponding nodes constitute 3 an inter-domain i-star over more than two domains in GIS . This set of pages was not 1 found as an i-star in GIS , that is, it was found only by multiple times of contractions. 4.3 Structure Mining on Isolated Clique and Isolated Star Contracted Webgraphs We show the number of inter-domain i-cliques and i-stars over more than two domains i in GIC IS in Table 12. Notice again that the number of iterations is more than the cases of i-cliques or i-stars alone. We checked if those i-cliques Table 12. The number of inter-domain i-cliques and irepresent communities in reality, stars over more than two domains in i-clique and i-star and we confirmed that some of them contracted webgraphs can be considered to be communii-clique i-star ties. Table 13 is a set of pages found total inc. dec. change total inc. dec. change 5 0 in GICIS , and it was not found as 115 GIC+IS 26 1 1 GIC+IS 27 4 3 0 144 40 11 8 an i-clique in GIC . Furthermore, IS 2 GIC+IS 26 1 2 0 154 13 3 4 i this was not found even in GIC (con3 GIC+IS 27 1 0 0 162 10 2 1 4 tract i-cliques alone), which implies GIC+IS 27 0 0 0 165 3 0 0 5 GIC+IS 28 1 0 0 165 1 1 0 that it was found by contracting 6 GIC+IS 28 0 0 0 165 0 0 0 intra-domain i-cliques and i-stars
Contracted Webgraphs: Structure Mining and Scale-Freeness
297
simultaneously and multiple times. We also checked if those i-stars represent communities, and we regard some of them as communities. Table 14 is a set of pages found in 4 4 1 GIC IS , and it was found as an i-star neither in GIS nor GICIS . Table 13. An inter-domain 5 i-clique of size 3 in GIC IS (related to ‘web site design company’ community)
4 Table 14. An inter-domain i-star of size 4 in GIC IS (related to ‘geology’ community)
(b) ! (a)
4.4 Validity of Contracted Webgraphs for Structure Mining Through a series of structure mining experiments according to the proposed procedure X Contracted Webgraphs, we verified that we could find substructures in contracted webgraphs that could not be found in the original webgraph in any case of X IC, IS or ICIS, and we obtained community candidates among them. Especially, in i-clique and i-star contracted webgraphs, we could find an i-clique or i-star not only the same set of nodes that were found in i-clique or i-star contracted webgraphs, but completely new set of nodes that could only be found by simultaneous contractions of i-cliques and i-stars. We consider that contracted webgraphs provide quite promising scheme for structure mining. The condition that Procedure X Contracted Webgraphs terminates was inter (GXi ) inter (GXi 1 ), however, we tried to continue it some more times after satisfying this condition. Then it is observed that a few more new community candidates were found in further iterations. This suggests that we can set another condition to stop the procedure in order to better utilize contracted webgraphs for structure mining.
5 Concluding Remarks We adopted i-cliques and i-stars as spam substructures for contractions in webgraphs, however, it is quite important to find other useful substructures for this purpose (see [15]). It is also important to apply our scheme to dierent web data to confirm its effectiveness not depending on specific types of data. The self-similar structure of the webgraph observed by i-cliques and i-stars will help to model the layer structure of the Web pointed out, for example, in [3,9]. Since intra-domain i-cliques and i-stars do not contribute to structure mining, it suggests that contracting them can compress web data without losing any important imformation. We consider that this idea will helpful for improving the existing method or for developing new framework of web data compression (e.g., [18]).
298
Y. Uno and F. Oguri
References 1. Albert, R., Jeong, H., Barab´asi, A.-L.: Diameter of the World Wide Web. Nature 401, 130–131 (1999) 2. Asano, Y., Imai, H., Toyoda, M., Kitsuregawa, M.: Finding neighbor communities in the Web ˇ ep´ankov´a, O., Retschitzegger, W. (eds.) DEXA 2003. using inter-site graph. In: Maˇr´ık, V., Stˇ LNCS, vol. 2736, pp. 558–568. Springer, Heidelberg (2003) 3. Bharat, K., Chang, B.-W., Henzinger, M., Ruhl, M.: Who links to whom: Mining linkage between web sites. In: Proc. 1st IEEE International Conference on Data Mining, pp. 51–58 (2001) 4. Broder, A.Z., Kumar, S.R., Maghoul, F., Raghavan, P., Rajagopalan, S., Stata, R., Tomkins, A., Wiener, J.L.: Graph structure in the web. Computer Networks 33, 309–320 (2000) 5. Dourisboure, Y., Geraci, F., Pellegrini, M.: Extraction and classification of dense communities in the Web. In: Proc. 16th International WWW Conference, pp. 461–470 (2007) 6. Flake, G.W., Lawrence, S., Giles, C.L.: EÆcient identification of web communities. In: Proc. 6th ACM International Conference on Knowledge Discovery and Data Mining, pp. 150–160 (2000) 7. Flake, G.W., Tarjan, R.E., Tsioutsiouliklis, K.: Graph clustering and minimum cut trees. Internet Mathematics 1, 385–408 (2004) 8. G¨orke, R., Hartmann, T., Wagner, D.: Dynamic graph clustering using minimum-cut trees. In: Dehne, F., Gavrilova, M., Sack, J.-R., T´oth, C.D. (eds.) WADS 2009. LNCS, vol. 5664, pp. 339–350. Springer, Heidelberg (2009) 9. Henzinger, M.R.: Algorithmic challenges in web search engines. Internet Mathematics 1, 115–126 (2003) 10. Ito, H., Iwama, K., Osumi, T.: Linear-time enumeration of isolated cliques. In: Brodal, G.S., Leonardi, S. (eds.) ESA 2005. LNCS, vol. 3669, pp. 119–130. Springer, Heidelberg (2005) 11. Kleinberg, J.: Authoritative sources in a hyperlinked environment. J. ACM 46, 604–632 (1999) 12. Kleinberg, J.M., Kumar, R., Raghavan, P., Rajagopalan, S., Tomkins, A.S.: The Web as a Graph: Measurements, Models, and Methods. In: Asano, T., Imai, H., Lee, D.T., Nakano, S.-i., Tokuyama, T. (eds.) COCOON 1999. LNCS, vol. 1627, pp. 1–17. Springer, Heidelberg (1999) 13. Kleinberg, J., Lawrence, S.: The structure of the Web. Science 294, 1894–1895 (2001) 14. Kumar, R., Raghavan, P., Rajagopalan, S., Tomkins, A.: Trawling the Web for emerging cyber-communities. Computer Networks 31, 1481–1493 (1999) 15. Leskovec, J., Lang, K.J., Dasgupta, A., Mahoney, M.W.: Statistical properties of community structure in large social and information networks. In: Proc. 17th International WWW Conference, pp. 695–704 (2008) 16. Mitzenmacher, M.: Editorial: The future of power law research. Internet Mathematics 2, 525–534 (2006) 17. Newman, M.E.J.: The structure and function of complex networks. SIAM Review 45, 167– 256 (2003) 18. Raghavan, S., Garcia-Molina, H.: Representing web graphs. In: Proc. 19th International Conference on Data Engineering, pp. 405–416 (2003) 19. Song, C., Havlin, S., Makse, H.A.: Self-similarity of complex networks. Nature 433, 392– 395 (2005) 20. The Stanford WebBase Project,
Contracted Webgraphs: Structure Mining and Scale-Freeness
299
21. Uno, Y., Ota, Y., Uemichi, A.: Web structure mining by isolated cliques. IEICE Transactions on Information and Systems E90-D, 1998–2006 (2007) 22. Uno, Y., Ota, Y., Uemichi, A.: Web structure mining by isolated stars. In: Aiello, W., Broder, A., Janssen, J., Milios, E.E. (eds.) WAW 2006. LNCS, vol. 4936, pp. 149–156. Springer, Heidelberg (2008) 23. Watts, D., Strogatz, S.: Collective dynamics of ‘small-world’ networks. Nature 393, 440–442 (1998)
Hardness of Finding Two Edge-Disjoint Min-Min Paths in Digraphs Longkun Guo1 and Hong Shen1,2 1
School of Computer Science, Univ. of Science and Technology of China 2 School of Computer Science, University of Adelaide, Australia
Abstract. The Min-Min problem of finding a disjoint path pair with the length of the shorter path minimized is known to be NP-complete and no K-approximation exists for any K ≥ 1 [1]. In this paper, we give a simpler proof of this result in general digraphs. We show that this proof can be extended to the problem in planar digraphs whose complexity was unknown previously. As a by-product, we show this problem remains NPcomplete even when all edge costs are equal (i.e. strongly NP-complete). Keyword: Min-Min problem, planar digraph, NP-completeness, disjoint path, inapproximability.
1
Introduction
The Min-Min problem of computing an edge (vertex) disjoint path pair with the length of the shorter path minimized is attracting considerable attention in the research community because of its wide applications in networks [1,2]. Formally this problem is as below: Definition 1. (Min-Min Problem) Given an undirected (directed) graph G = (V, E), distinct vertices s, t ∈ V , and a length function f : E → R+ , find a vertex (edge) disjoint st-path pair AP and BP with f (AP ) minimized, where AP is the active path, BP is the backup path, and f (AP ) ≤ f (BP ). It is known that this problem is NP-complete [1,3,4]. The complexity of the problems closely related to the Min-Min problem has been well studied. The MinSum problem of finding two paths with the total length minimized is polynomial solvable and for which polynomial-time algorithms have been developed in [5,6], whereas the Min-Max problem of finding two disjoint paths with the length of the longer path minimized is NP-complete [7]. The length bounded disjoint path problem, to find two disjoint paths with the length of each path bounded by a given bound, is a deviant of the Min-Max problem and also known to be NP-complete [7]. Applying the algorithm for the Min-Sum problem in [5,6] will result in a 2-approximation solution for the Min-Max problem and the length
This project was partially supported by the “100 Talents” Project of Chinese Academy of China and NSFC grant #622307. The corresponding author is Hong Shen.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 300–307, 2011. c Springer-Verlag Berlin Heidelberg 2011
Hardness of Finding Two Edge-Disjoint Min-Min Paths in Digraphs
301
bounded disjoint path problem, achieving the best approximation ratio for these two problems in directed graphs [7]. For a given graph G = (V, E) and four vertices s1 , s2 , t1 , t2 ∈ V , the 2-disjoint path (2DP) problem is to compute two disjoint paths, one from s1 to t1 and another from s2 to t2 . As a well-known result, the 2DP problem is polynomial solvable in undirected graphs [8,9] whereas it is NP-complete in directed graphs [10]. This problem is closely related to the Min-Max problem and the Min-Min problem, because we can obtain the inapproximability of the Min-Max problem in directed graph based on the NP-completeness of the directed 2DP problem, i.e. the directed Min-Max problem admits no ρ-approximation solution for any ρ < 2 [7]. Following the same lines as the inapproximability proof in [7], clearly the directed Min-Min problem admits no K-approximation for any K > 1. Because most practical applications arise in a network that can be mapped into a planar graph, the problems above have been considered in planar graphs. Holst et al showed the NP-completeness of the length bounded disjoint problem in planar graphs by giving a reduction from the Partition problem [11]. The vertex-disjoint version of the well-known 2DP problem is polynomial solvable in planar digraphs [12,13] whereas the complexity of its edge-disjoint version remains a long standing open problem [13]. Fitting the complexity of the 2DP problem, the vertex-disjoint Min-Min problem is polynomial solvable in planar digraph [14], while its edge-disjoint version is NP-complete in planar digraphs as shown in this paper. This paper shows the NP-completeness of the edge-disjoint Min-Min problem in digraphs and extends the proof to show the complexity and the inapproximability of this problem in planar digraphs. We note that the NP-completeness of the edge-disjoint Min-Min problem in general digraphs was proved in [1,3]. However, our proof is simpler, and can be extended to show the complexity and the inapproximability of the edge-disjoint Min-Min problem in planar digraphs. To our knowledge, it is the first NP-completeness proof on this problem in planar digraphs and may be the first step to answer the long standing question whether the (edge-disjoint) 2DP problem is NP-complete in planar digraphs.
2
A Simpler NP-Completeness Proof for the Edge-Disjoint Min-Min Problem in General Digraphs
In this section, we shall show the NP-completeness of the Min-Min problem in general digraphs. We would like to give some notations first. Assume that P is a path from v0 to vh following the vertex order v0 , v1 , . . . , vh , we write u P w for u, w ∈ V (P ) if and only if u = vi , w = vj and i ≤ j. By u ≺P w, we denote u P w and u = w. We denote by e(w, u) the edge from w to u and say e(w, u) ∈ / P is a backward edge iff u ≺P w. By reducing the well-known NP-complete 3SAT problem, we shall prove the theorem below: Theorem 1. The edge-disjoint Min-Min problem is NP-complete in digraphs.
302
L. Guo and H. Shen
ci
ui,1
vi,1
ui,2
vi,2
ui,3
vi,3
edge with cost 0
ci+1
edge with cost 1
Fig. 1. Lobe for Ci
Proof. Clearly, the directed edge-disjoint Min-Min problem is in NP. We prove this Lemma by reducing 3SAT to the decision form of our problem: Does a digraph with non-negative edge cost contain two edge-disjoint s-t paths AP and BP with f (AP ) ≤ 0? An instance of 3SAT is a CNF of m clauses C1 ∧ · · · ∧ Cm , where Ci = ai,1 ∨ ai,2 ∨ ai,3 and ai,j is an occurrence of a variable in X = {x1 , . . . , xn } or its negation. For a given instance of 3SAT, we construct an auxiliary graph such that the instance of 3SAT is satisfiable iff there exist two disjoint paths. The construction is as below. Firstly, for a clause Ci we add a vertex ci and construct a lobe Gi (as illustrated in Figure 1), which are three paths from ci to ci+1 with three cost-0 middle edges e(ui,j , vi,j ) (j = 1, 2, 3) respectively. Note that s = c1 . Secondly, for a variable xj , we add two vertices yj and zj together with dotted edges (cost-0 edges) s → y1 , zj → yj+1 (j = 1, . . . , n−1) and zn → t. We connect those vertices representing variables via dotted edges as follows: Assume that literals aj1 ,l1 , . . . , ajh ,lh with j1 < j2 < · · · < jh are occurrences of xj incrementally, then add backward edges yj → ujh ,lh , . . . , vji ,li → uji−1 ,li−1 , . . . , vj1 ,l1 → zj (the case for xj is similar). For example, graph G constructed for instance x1 ∨ x2 ∨ x4 , x1 ∨ x2 ∨ x3 , x2 ∨ x3 ∨ x4 is as illustrated in Figure 2. Apparently, the construction of G can be finished in polynomial time. So Lemma 1 below completes the proof of this theorem. Lemma 1. There exists a true assignment satisfying the instance of 3SAT iff there exist two edge-disjoint Min-Min paths in G with f (AP ) ≤ 0. Proof. We show that the satisfiability of the instance results in the existence of a solution of the problem and vice versa. Suppose there is a true assignment satisfying the instance of 3SAT. The MinMin paths pair AP and BP can be constructed as below. For AP , initially s → y1 and zn → t are added. Assume Pj1 and Pj2 are two paths from yj to zj
Hardness of Finding Two Edge-Disjoint Min-Min Paths in Digraphs
303
y1 y2 y3 y4
c2
c1
c3
t
z1 z2 z3 z4
Fig. 2. Reduction of 3SAT instance x1 ∨ x2 ∨ x4 , x1 ∨ x2 ∨ x3 , x2 ∨ x3 ∨ x4 in digraphs. Note that the instance contains no x3 , so only one path from y3 to z3 exists.
corresponding to xj and xj respectively. Then for each i ∈ {1, . . . , n} add Pi1 to AP if τ (xi ) = f alse and add Pi2 to AP otherwise. Apparently, AP is a cost-0 path from s to t. Because each clause Ci contains at least one satisfied literal, every lobe must contain at least one path that shares no common edge with AP . Then, there are n paths of the n lobes collectively compose a path BP from s to t disjoint with AP . Conversely, assume AP and BP are two Min-Min paths in G and f (AP ) = 0. The true assignment for each xj is: For ai,l appearing on BP , set τ (xj ) = true if aj,l is an occurrence of xj , and τ (xj ) = f alse otherwise. To show this true assignment satisfies the 3SAT instance, we need to show first that for any xj either Pj1 or Pj2 shares no common edge with BP , and second that for each lobe BP contains at least one of its three paths. For the first, we show AP contains at least one path of {Pj1 , Pj2 }. Since f (AP ) ≤ 0 and every solid edge is with cost 1, AP cannot contain any solid edge. Hence, AP must contain every edge that can separate s and t in G after removing the solid edges. Therefore, AP must contain s → y1 , . . . , zj → yj+1 , . . . , → yn , zn → t. Because the dotted edges do not compose any loop, AP will go through yj and zj incrementally on j. Since there exist only two cost 0 paths Pj1 and Pj2 from yj to zj , AP must go through either Pj1 or Pj2 . From the fact that AP and BP are edge-disjoint, BP cannot go through any edge appearing on AP . So either Pj1 or Pj2 shares no common edge with BP . For the second, BP must go through all ci for i = 1, . . . , m, since every ci separates s and t in G \ E(AP ). Because BP is a path, BP cannot contain any loop. Since each backward edge on BP indicates a loop, BP contains no backward edges. Therefore, BP must go through one of the three paths in every lobe. These complete the proof.
304
L. Guo and H. Shen
ci
ci
bi,j,2n
bi,j,2n−1
...
bi,j,2l−1
ai,2 = xl ui,2
vi,j
ci+1
vi,2
ai,j = xl ui,j
edge with cost 0
bi,j,2l−1
...
bi,j,2n−1
vi,j
bi,j,2n
ci+1
edge with cost 1
Fig. 3. The auxiliary vertices added to the path with ei,j in Figure 1, where ei,j corresponds to ai,j an occurrence of xl (The case for ai,j an occurrence of xl is similar)
From the proof of Lemma 1, the edge-disjoint Min-Min problem admits no K-approximation for any K ≥ 1. That is because any K-approximation for the problem can determine whether there exist of a pair of edge-disjoint paths {AP, BP } with f (AP ) ≤ 0 in G, resulting a polynomial solution for the 3SAT problem, which is impossible unless P=NP. Hence, we have the follow theorem: Theorem 2. The edge-disjoint Min-Min Problem is NP-complete and admits no K-approximation for any K ≥ 1 in digraphs unless P = N P . The correctness of the following corollary can be obtained from the proof of Lemma 1 by replacing each solid edge by m ∗ (n + 1) dotted edges and setting each dotted edge in H with cost 1, where m and n are the number of clauses and variables of the 3SAT instance respectively: Corollary 1. The edge-disjoint Min-Min Problem is strongly NP-complete in digraphs. Our NP-completeness proof for the edge-disjoint Min-Min problem in general digraph is simpler than Xu et al’s proof in [1], and can be extended to the problem in planar digraph.
3
Extension of the Proof to Planar Digraphs
In this section, we shall show that our proof can be extended to planar digraphs. Graph G constructed in Section II may not be a planar graph, since G may contain a subdivision of K3,3 or K5 . The key idea of our extension is that, adding to G some appropriate dummy vertices and breaking an edge to several edges can transform G to an auxiliary digraph H containing no K3,3 or K5 (i.e. planar graph), and contains a Min-Min path pair AP and BP with f (AP ) ≤ 0 iff the 3SAT instance is satisfiable. The construction of H is roughly as below:
Hardness of Finding Two Edge-Disjoint Min-Min Paths in Digraphs
305
y1 y2 y3 y4
c1 s
c2
c3
t
z1 z2 z3 z4
Fig. 4. Reduction of 3SAT instance (x1 ∨ x2 ∨ x4 ) ∧ (x1 ∨ x2 ∨ x3 ) ∧ (x2 ∨ x3 ∨ x4 ) in a planar digraph
– Add dummy vertices to the path of lobe containing ai,j which appears on path Pgl by the following order (as shown in Figure 3): bi,j,2n , . . . , bi,j,2g+l−2 , vi,j , ui,j , vi,j , bi,j,2g+l−2 , . . . , bi,j,2n ;
– For path Pgl = yg → uig ,jg · · · → vih ,jh → uih−1 ,jh−1 → · · · → vi1 ,j1 → zg , replace edge vih ,jh → uih−1 ,jh−1 to path vih ,jh → vih ,jh → bih ,jh ,2g+l−2 → · · · → bih−1 ,jh−1 −1,2g+l−2 → uih−1 ,jh−1 . For example, graph H constructed for instance x1 ∨ x2 ∨ x4 , x1 ∨ x2 ∨ x3 , x2 ∨ x3 ∨ x4 is as illustrated in Figure 4. Similar to Theorem 1, we immediately have the following lemma: Lemma 2. The auxiliary graph H resulted from the construction above contains a pair of Min-Min paths AP and BP with f (AP ) ≤ 0 iff the instance of 3SAT is satisfiable. It remains to show the following lemma: Lemma 3. Graph H is planar. Proof. We prove the planarity of H by showing first that the dotted edges of H compose a planar graph; and second that the solid edges of H can be embedded without breaking the planarity of the dotted edges. For the first, the dotted paths compose a subgraph analogous to a path from s to t, and hence compose a planar graph. For the second, let P2i+l−2 = Pil (yi , zi ), and Ei,i+1 be the solid edges of H with endpoints in {Pi , Pi+1 }. W.l.o.g. assume that Ei,i+1 is embedded to the plane
306
L. Guo and H. Shen
incrementally on i. We show by induction that Ei,i+1 can be embedded in the plane with all vertices of V (Pj ) ∪ V (Pj+1 ) for any j > i in a face. By induction V (Pi ) ∪ V (Pi+1 ) are in a face before embedding Ei,i+1 . From the construction of H, the solid edges of Ei,i+1 satisfy the following two conditions: – For any two edges e1 (u1 , v1 ) and e2 (u2 , v2 ) with u1 , u2 ∈ P and v1 , v2 ∈ Q, u1 ≺P u2 holds iff v1 ≺Q v2 ; – For any edge e1 (u1 , v1 ) with u1 , v1 ∈ P , H contains no e2 (u2 , v2 ) with u1 ≺ x ≺ v1 for x ∈ {u2 , v2 }. So the edges of Ei,i+1 can be embedded into the plane. Apparently, the faces produced by adding the solid edges of Ei,i+1 bound no vertex of Pj for any j > i. Therefore, the vertices of Pj and Pj+1 with j > i remains in a same face. This completes the proof. Similar to Theorem 2 and Corollary 1 for the general digraph case, we have the following theorem: Theorem 3. The edge-disjoint Min-Min Problem is strongly NP-complete and admits no K-approximation for any K ≥ 1 in planar digraphs unless P = N P .
4
Conclusion
In this paper, we proved the NP-completeness of the edge-disjoint Min-Min problem in general digraphs, and extended the proof to show the NP-Completeness of this problem in planar digraphs. We achieved the latter by constructing a planar digraph H for any given instance of 3SAT, such that the 3SAT instance is satisfiable iff there is an edge-disjoint Min-Min path pair AP and BP in H with f (AP ) ≤ 0. We note that our proof can not be immediately applied to show the complexity of the edge-disjoint Min-Min problem in undirected planar graphs, so the complexity of the edge-disjoint Min-Min problem in undirected graphs remains open.
References 1. Xu, D., Chen, Y., Xiong, Y., Qiao, C., He, X.: On the complexity of and algorithms for finding the shortest path with a disjoint counterpart. IEEE/ACM Transactions on Networking 14(1), 147–158 (2006) 2. Zheng, S., Yang, B., Yang, M., Wang, J.: Finding Minimum-Cost Paths with Minimum Sharability. In: 26th IEEE International Conference on Computer Communications IEEE INFOCOM 2007, pp. 1532–1540 (2007) 3. Li, C., Thomas McCormick, S., Simchi-Levi, D.: Finding disjoint paths with different path-costs: Complexity and algorithms. Networks 22(7) (1992) 4. Bhatia, R., Kodialam, M., Lakshman, T.: Finding disjoint paths with related path costs. Journal of Combinatorial Optimization 12(1), 83–96 (2006) 5. Suurballe, J.: Disjoint paths in a network. Networks 4(2) (1974)
Hardness of Finding Two Edge-Disjoint Min-Min Paths in Digraphs
307
6. Suurballe, J., Tarjan, R.: A quick method for finding shortest pairs of disjoint paths. Networks 14(2) (1984) 7. Li, C., McCormick, T., Simich-Levi, D.: The complexity of finding two disjoint paths with min-max objective function. Discrete Applied Mathematics 26(1), 105–115 (1989) 8. Seymour, P.: Disjoint paths in graphs. Discrete Mathematics 306(10-11), 979–991 (2006) 9. Shiloach, Y.: A polynomial solution to the undirected two paths problem. Journal of the ACM (JACM) 27(3), 445–456 (1980) 10. Fortune, S., Hopcroft, J., Wyllie, J.: The directed subgraph homeomorphism problem* 1. Theoretical Computer Science 10(2), 111–121 (1980) 11. van der Holst, H., de Pina, J.: Length-bounded disjoint paths in planar graphs. Discrete Applied Mathematics 120(1-3), 251–261 (2002) 12. Ding, G., Schrijver, A., Seymour, P.: Disjoint Paths in a Planar Graph . SIAM J. Discrete Math. 5(1), 112–116 (1992) 13. Schrijver, A.: Finding k disjoint paths in a directed planar graph . SIAM J. Computing 23(4), 780–788 (1994) 14. Guo, L., Shen, H.: On Finding Min-Min disjoint paths (manuscript)
Online Algorithm for 1-Space Bounded Multi-dimensional Bin Packing Yong Zhang1,2, , Francis Y.L. Chin2, , Hing-Fung Ting2, , Xin Han3,† , and Zhuo Chang1 1
2
College of Mathematics and Computer Science, Hebei University, China [email protected] Department of Computer Science, The University of Hong Kong, Hong Kong {yzhang,chin,hfting}@cs.hku.hk 3 School of Software, Dalian University of Technology, China [email protected]
Abstract. In this paper, we study 1-space bounded multi-dimensional bin packing. A sequence of items arrive over time, each item is a ddimensional hyperbox and the length of each side is no more than 1. These items must be packed without overlapping into d-dimensional hypercubes with unit length on each side. In d-dimensional space, any two dimensions i and j define a space Pij . When an item arrives, we must pack it into an active bin immediately without any knowledge of the future items, and 90◦ -rotation on any plane Pij is allowed. The objective is to minimize the total number of bins used for packing all these items in the sequence. In the 1-space bounded variant, there is only one active bin for packing the current item. If the active bin does not have enough space to pack the item, it must be closed and a new active bin is opened. For this problem, we give an online algorithm with competitive ratio 4d , which is the first study on 1-space bounded d-dimensional bin packing.
1
Introduction
Bin packing is a very fundamental problem in computer science, and has been well studied for more than thirty years. Given a sequence of items, we pack them into unit-size bins without overlapping. The objective is to minimize the number of bins for all items in the sequence. We focus on the online version of bin packing, where the items arrive over time, when packing the current item, we have no information of the future items. †
Supported by Shanghai Key Laboratory of Intelligent Information Processing, China. Grant No. IIPL-2010-010. Research supported by HK RGC grant HKU-7113/07E and the William M.W. Mong Engineering Research Fund. Research supported by HK RGC grant HKU-7171/08E. Partially supported by “the Fundamental Research Funds for the Central Universities”.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 308–318, 2011. c Springer-Verlag Berlin Heidelberg 2011
Online Algorithms for 1-Space Bounded Multi-dimensional Bin Packing
309
The positions of the packed items in the bin are fixed and cannot be repacked. To measure the performance of online bin packing, we study a general used method called asymptotic competitive ratio. Consider an online algorithm A and an optimal offline algorithm OP T . For any sequence S of items, let A(S) be the cost (number of bins used) incurred by algorithm A and OP T (S) be the corresponding optimal cost incurred by algorithm OP T . The asymptotic competitive ratio for algorithm A is: ∞ RA = lim sup{ k→∞ S
A(S) |OP T (S) = k}. OP T (S)
In the online bin packing, there are two models: bounded space model and unbounded space model. If we do not impose a limit on the number of bins available for packing the items (called active bins), we call it unbounded space. Otherwise, if the number of active bins is bounded by a constant, and each item can only be packed into one of the active bins, we call it bounded space, which is more realistic in many applications. If none of the active bins has enough space to pack the arrival item, one of the active bins must be closed and a new active bin will be opened to pack that item. In this paper, we consider 1-space bounded multi-dimensional bin packing. In the 1-space bounded variant, the number of active bins is only one. If an item cannot be packed into the active bin, we have to close it and open a new bin to pack this item. In the 1-space bounded d-dimensional bin packing problem (d ≥ 2), each item is a d-dimensional hyperbox such that the length on each side is no more than 1. The items must be packed into d-dimensional hypercubes with side length 1. Any two dimensions i and j define a plane Pij . 90◦ -rotation of the item in any plane Pij is allowed, otherwise, the competitive ratio is unbounded [12]. To understand this problem clearly, we give an example for the 1-space bounded 2-dimensional bin packing. In Fig. 1(a), there are four items to be packed into unit square bins, and the arrival order is A, B, C and D. After the packing position of A is fixed, we have two choices to pack B: rotation and
A
B
C
D
(a) four items arrive in order A, B, C, and D D
C A
A
B C
D B
(b) non-optimal packing into two bins
(c) optimal packing into one bin
Fig. 1. Example of optimal packing and non-optimal packing
310
Y. Zhang et al.
without rotation. If we pack B without rotation in the same bin with A as shown in Fig. 1(b), when item C arrives, we have to open a new bin since the current active bin does not have enough space for packing C. In the optimal solution, these four items can be packed into one bin (Fig. 1(c)), since item B, C and D can be rotated and the free space in the bin can accommodate all of them in their order of arrival. Related works Both the offline and online version of the bin packing problem have been well studied. The offline bin packing is NP-Hard [13]. For one-dimensional bin packing, Simchi-Levi gave a 1.5-approximation algorithm [22]. Johnson and Gary [16] gave an asymptotic 71/60-approximation algorithm. An AFPTAS was given by Karmarkar and Karp [19]. For two-dimensional bin packing. Chung et. al. [5] presented an approximation algorithm with an asymptotic performance ratio of 2.125. Caprara [4] improved the upper bound to 1.69103. Bansal et al. [2] devised a randomized algorithm with an asymptotic performance ratio of at most 1.525. As for the offline lower bound of the approximation ratio, Bansal et al. [1] showed that the two-dimensional bin packing problem does not admit any asymptotic polynomial time approximation scheme. The online bin packing has been studied for more than thirty years. For onedimensional online bin packing, Johnson et al. [17] showed that the First Fit algorithm (FF) has an asymptotic competitive ratio of 1.7. Yao [25] improved the algorithm to obtain a better upper bound of 5/3. Lee et al. [18] introduced the class of Harmonic algorithms, and showed that an asymptotic competitive ratio of 1.63597 is achievable. Ramanan et al. [20] further improved the upper bound to 1.61217. The best known upper bound is 1.58889, which was given by Seiden [21]. As for the lower bound of the competitive ratio of one dimensional bin packing, Yao [25] showed that no online algorithm can have an asymptotic competitive ratio less than 1.5. The best known lower bound is 1.54014 [24]. For two-dimensional online bin packing, Coppersmith and Raghan [6] gave the first online algorithm with asymptotic competitive ratio 3.25. Csirik et al. [7] improved the upper bound to 3.0625. Based on the techniques of the Improved Harmonic, Han et.al [14] improved the upper bound to 2.7834. Seiden and van Stee [23] showed an upper bound of 2.66013 by implementing the Super Harmonic Algorithm. The best known upper bound of the competitive ratio for two dimensional bin packing is 2.5545, which was given by Han et. al [15]. The best known lower bound is 1.907 [3]. For bounded space online bin packing, Harmonic algorithm by Lee et al. [18] can be applied for one dimensional case, the competitive ratio is 1.69103 when the number of active bins goes to infinity. Csirik and Johnson [8] presented an 1.7-competitive algorithm (K-Bounded Best Fit algorithms (BBFK )) for one dimensional bin packing using K active bins, where K ≥ 2. For multidimensional case, Epstein et al. [11] gave a 1.69103d-competitive algorithm using
Online Algorithms for 1-Space Bounded Multi-dimensional Bin Packing
311
(2M − 1)d active bins, where M ≥ 10 is an integer such that M ≥ 1/(1 − (1 − ε)1/(d+2) ) − 1, ε > 0 and d is the dimension of the bin packing problem. For the 1-space bounded variant, Fujita [12] first gave an O((log log m)2 )-competitive algorithm, where m is the width of the square bin and the size of each item is a×b (a, b are integers and a, b ≤ m). Chin et al. proposed an 8.84-competitive packing strategy [9], then they further improved the upper bound to 5.155 [10], they also gave the lower bound 3 for 1-space bounded two dimensional bin packing. The remaining part of this paper is organized as follows. In Section 2, we give some preliminary knowledge for solving the 1-space multi-dimensional bin packing. In Section 3, we propose an online algorithm for this problem, which is the first result on this variant. The analysis and proof of the performance ratio is in Section 4.
2
Preliminary
Let d be the highest dimension of the item and hypercube, each item a is associated with a vector (a1 , a2 , ..., ad ), where ai (1 ≤ i ≤ d) is the length in the i-th dimension of item a. In 1-space bounded multi-dimensional bin packing problem, rotation 90◦ in any plane Pij is allowed. Otherwise, the performance ratio is unbounded. Consider an example of a sequence with 2n items: {A, B, A, B, ...}, where A = (1/n, 1, 1, ..., 1) and B = (1, 1/n, 1, 1, ..., 1). If rotation is not allowed, any two adjacent items cannot be packed into the same bin by any online algorithm, thus, the number of used bins is 2n. In the optimal packing, all A items can be packed into one bin, all B items can be packed into another bin, only two bins is enough to pack all these items. In this way, the performance ratio is n. If rotation is allowed, the first half part of items in the sequence can be packed into one bin by rotate B items 90◦ in the plane P12 . Similarly, the second half of items can be packed into another bin. Since rotation 90◦ in any plane Pij is allowed, we may assume that the lengths in dimensions of any item a is non-increasing, i.e., ai ≥ aj (i < j) for each item. d Denote the size of an item a = (a1 , a2 , ..., ad ) to be i=1 ai . We say a (k + 1)dimensional hyperbox b = (b1 , b2 , ..., bk+1 ) is a (k + 1, h)-hyperbox if b1 = ... = bk−1 = 1, bk = 1/2 and bk+1 = h.
3
Packing Strategy
Roughly speaking, items are recursively packed by the strategy from higher dimension to lower dimension according to their sizes. Let oi and ri (2 ≤ i < d) be the average occupancy ratio in the worst case and competitive ratio for packing i-dimensional items by our algorithm, respectively. Our target is to design an algorithm with competitive ratio as smaller as possible. Since any algorithm
312
Y. Zhang et al.
cannot pack items with total sizes more than 1 into one bin, we set ri = 1/oi . The target can be done by designing algorithm with the average occupancy ratio as larger as possible. From our algorithm, we can recursively compute oi (ri ), until i od (rd ). We say an item is large w.r.t. its (i + 1)-th dimension if j=1 xi ≥ oi , and small w.r.t. its (i + 1)-th dimension otherwise. For a small item a w.r.t. its (k + 1)-th dimension, we have ak+1 ≤ ak ≤ 1/k −1/k ok = rk . From Table 1 and Lemma 1 in the later part of this paper, we 1/k have rk > 2, thus, ak+1 ≤ ak < 1/2. A small items a w.r.t. its (k + 1)-th dimension can be packed into a (k + 1, h)-hyperbox such that h/2 < ak+1 ≤ h 1/k and h = 2−j · ok (for some j = 0, 1, 2, ...). Note that in our algorithm, small items can be only packed into a (k + 1, h)-hyperbox with h < 2ak+1 . Let ok+1 be the average occupancy ratio for packing small items into (k + 1, h)-hyper-box, we have the following fact. Fact 1. ok+1 = ok /2. Proof. Since the length of the k-th dimension is no more than 1/2, any small item a can be packed into the corresponding (k + 1, h)-hyperbox such that, h/2 < ak+1 ≤ h. Packing small items can be regarded as packing general items into k-dimensional bin by doubling the length in the k-th dimension of the small item. Thus, the average occupancy ratio is preserved in the first k dimensions. In the (k + 1)-th dimension, the length is at least h/2. Thus, ok+1 = ok /2. Now we give our algorithm for packing d-dimensional items with d ≥ 3. In case of d = 2, we use our previous 5.15-competitive algorithm. Algorithm for Packing d-dimensional item a: 1: if a is large w.r.t. the d-th dimension. then 2: Pack it by a top-down order such that ad alongs the d-th dimension. 3: if overlap happens then 4: Close this bin then open a new bin for packing this item. 5: end if 6: else if a is small w.r.t. the d-th dimension. then 7: if there exists (d, h)-hyperbox with enough space for the item then 8: Pack it into the (d, h)-hyperbox. 9: else 10: Open a new (d, h)-hyperbox for this item. 11: Pack the (d, h)-hyperbox by a bottom-up order in the d-th dimension, 12: such that the heights of the “left” part and the “right” part are balanced. 13: if overlap happens then 14: Close this bin then open a new bin for packing this (d, h)-hyperbox. 15: end if 16: end if 17: end if
Online Algorithms for 1-Space Bounded Multi-dimensional Bin Packing
313
k-th dimension
central axle
y1
y2 “left” part
“right” part
(k − 1)-th dimension large item
(k, h)-hyperbox for small items
Fig. 2. Packing k-dimensional items into k-dimensional hypercube
In the above algorithm, large items w.r.t. the k-th dimension are packed in the upper part of the k-th dimension; small items w.r.t. the k-th dimension are packed into the lower part of the k-th dimension. The lower part is partitioned into the “left” part and the “right” part: the “left” part is the area such that the (k − 1)-th dimension is in the range [0, 1/2], while the “right” part is in the range [1/2, 1]. Packing items into (k, h)-hyperbox can be regarded as packing (k − 1)-dimensional items into (k − 1)-dimensional hypercubes, thus, we can use the same algorithm described above, since the k-th dimension is fixed. To understand the algorithm clearly, we give an example to show how to pack an incoming item. In the current packing shown in Figure 2, there are some large items packed in the upper part of the k-th dimension, some small items packed in the (k, h)-hyperboxes which located in the lower part of the k-th dimension such that the “left” and “right” part are balanced. When a large item comes, if it cannot be packed between the upper and lower part without overlapping, we will open a new bin. When a small item comes, we will first try to pack it into some existed (k, h)-hyperbox, if no such (k, h)-hyperbox, we open a new (k, h)-hyperbox then pack it into the right part. The above algorithm recursively packing items from higher dimension to lower dimension, until dimension 3. We implement the algorithm in [10] for packing 2-dimensional items because that the performance ratio r2 = 5.15 is better than implementing the above algorithm in dimension 2.
314
4
Y. Zhang et al.
Analysis of the Strategy
When packing items which are small w.r.t. the k-dimension into (k, h)hyperbox, we say the (k, h)-hyperboxes with the same height h are of the same type. From Fact 1, the average occupancy ratio ok = ok−1 /2. Thus, for each kind of (k, h)-hyperbox, except the last one, the average occupancy ratio is at least ok−1 /2. Fact 2. The total lengths in dimension k of the last hyperboxes of each type is 1/(k−1) at most 2 · ok−1 . Proof. From previous definition hj = 2−j · ok−1 (j = 0, 1, 2, ...), the length in dimension k of each type of (k, hj )-hyperbox is fixed. Thus, the total length is 1/(k−1) at most j hj ≤ 2 · ok−1 . 1/(k−1)
Consider a packing configuration shown in Figure 2, suppose the length in kdimension of the upper part is y, the lengths in k-dimension of the “left” and “right” parts are y1 and y2 respectively. W.l.o.g., y1 ≥ y2 . The current occupancy in this bin is at least 1/(k−1)
y · ok−1 +
(y1 + y2 − 2 · ok−1 2
) · ok
The first term is the occupancy of large items, the second term is the occupancy of small items. Since in the lower part, the length in (k − 1)-dimension of each hyperbox is 1/2, we divide 2 in the second term. By Fact 1, we know the occupancy in this bin is at least 1/(k−1)
y · ok−1 +
(y1 + y2 − 2 · ok−1 4
) · ok−1
If we only count the occupancy in one bin, the performance ratio is unbounded. For example, a bin contains a very small item, the next item is very large and cannot be packed together with the small one. We have to open a new bin for the later item. In this case, the occupancy in the previous bin is very small. This example gives us an heuristic to amortize the occupancies of adjacent two bins: if we have to open a new bin due to an item, this items has contribution to two bins, one is the bin it packed and the other is the previous bin it cannot be packed. To amortize the occupancy of adjacent two bins, item from the upper part compensate half occupancy to the previous bin; item from the lower part compensate the part which is larger than the ratio ok−1 /4 to the previous bin. Now we study two cases of opening a new bin. – a large item with length y in dimension k cannot be packed into this bin.
Online Algorithms for 1-Space Bounded Multi-dimensional Bin Packing
315
By amortized analysis, the occupancy in this bin is at least 1/(k−1)
= > = ≥ =
(y1 + y2 − 2 · ok−1 ) · ok−1 y · ok−1 y · ok−1 + + 2 4 2 1/(k−1) (y1 + y2 − 2 · ok−1 ) · ok−1 (y + y ) · ok−1 + 2 4 1/(k−1) (y1 + y2 − 2 · ok−1 ) · ok−1 (1 − y1 ) · ok−1 + 2 4 k/(k−1) o ok−1 (y2 − y1 ) · ok−1 − k−1 + 2 2 4 k/(k−1) k/(k−1) ok−1 ok−1 ok−1 − − 2 2 4 k/(k−1) 3 · o ok−1 k−1 − 2 4
– a small item with length y in dimension k cannot be packed into this bin.
• if (y )k ≤ y ·o4k−1 , this small item has no contribution to the previous bin. In this case, y ≤ (ok−1 /4)1/(k−1) . The amortized occupancy is at least
≥ = > = ≥ y ·o
y · ok−1 (y1 + y2 − 2(ok−1 )1/(k−1) ) · ok−1 + 2 4 y · ok−1 (y2 − (ok−1 )1/(k−1) ) · ok−1 + 2 2 (y + y2 ) · ok−1 (ok−1 )k/(k−1) − 2 2 k/(k−1) (1 − y ) · ok−1 (ok−1 ) − 2 2 ok−1 (ok−1 )k/(k−1) y · ok−1 − − 2 2 2 ok−1 (ok−1 )k/(k−1) (ok−1 /4)1/(k−1) · ok−1 − − 2 2 2 y ·o
k−1 • if (y )k > , this small item has contribution (y )k − 4k−1 to the 4 previous bin. In this case, y > (ok−1 /4)1/(k−1) . The amortized occupancy is at least
y · ok−1 (y1 + y2 − 2(ok−1 )1/(k−1) ) · ok−1 y · ok−1 + + (y )k − 2 4 4 y · ok−1 (y2 − (ok−1 )1/(k−1) ) · ok−1 y · o k−1 ≥ + + (y )k − 2 2 4
316
Y. Zhang et al.
(y + y2 ) · ok−1 (ok−1 )k/(k−1) y · ok−1 − + (y )k − 2 2 4 (1 − y ) · ok−1 (ok−1 )k/(k−1) y · o k−1 ≥ − + (y )k − 2 2 4 ok−1 (ok−1 )k/(k−1) 3 · y · ok−1 = − + (y )k − 2 2 4 ok−1 (ok−1 )k/(k−1) (ok−1 /4)1/(k−1) · ok−1 ≥ − − 2 2 2 =
the last inequality holds since k ≥ 3 and (ok−1 /4)1/(k−1) < y ≤ ok−1 1/2.
1/(k−1)
<
When k = 3, the above three formula are equivalent, when k > 3, the last two formulas are less. In this paper, the dimension we focused is at least 3, thus, we can say that the amortized occupancy ratio for packing k-dimensional items is at least ok =
ok−1 (ok−1 )k/(k−1) (ok−1 /4)1/(k−1) · ok−1 − − 2 2 2
(1)
Since rk = 1/ok , we have 1 1 1 1 = − − k/(k−1) rk 2 · rk−1 2 · r · (4 · rk−1 )1/(k−1) k−1 2 · rk−1
(2)
In Table 1, we give the performance ratio rk for some lower dimensions (k = 2 1/k to 6). We also compute rk , which will help us to give the upper bound for the performance ratio. Table 1. the performance ratio for k = 2 to 6 k 2 3 4 5 6 rk 5.15 30.86 127.969 518.156 2086.38 1/k rk 2.269 3.13 3.36 3.49 3.57 1/k
We can see that the performance ratio is increased very fast, but rk increased slowly. 1/k
Lemma 1. 3.5 < rk
1/(k−1)
< 4 if k > 6 and 3.5 < rk−1
is
< 4.
1/k
Proof. Let xk = rk , from Equation (2), we have 1 1 1 1 1 1 = k−1 − k − k ≥ k−1 − k xkk 2xk−1 2xk−1 41/(k−1) xk−1 2xk−1 2xk−1
(3)
Online Algorithms for 1-Space Bounded Multi-dimensional Bin Packing
317
When xk−1 ≥ 3.5, the above formula is larger than 1/4k . Thus, we can say that xk < 4 if xk−1 ≥ 3.5. 1 1 1 1 = k−1 − k − k k xk 2xk−1 2xk−1 41/(k−1) 2xk−1 1 1 1 1 = k−1 ( − − ) 2xk−1 41/(k−1) xk−1 2 2xk−1 1 1 1 1 ( − − ) 3.5k−1 2 2xk−1 2xk−1 41/(k−1) 1 < 3.5k <
The last inequality holds if xk−1 < 4. Thus, we can say that xk > 3.5 if xk−1 < 4. Combine the above two statements and x6 = 3.57, this lemma can be proved by induction. From Lemma 1, we conclude that xk is in the range (3.5, 4) when k ≥ 6. Therefore, Theorem 2. The competitive ratio of the algorithm for 1-space bounded d-dimensional bin packing is 4d .
References 1. Bansal, N., Correa, J.R., Kenyon, C., Sviridenko, M.: Bin Packing in Multiple Dimensions: In-approximability Results and Approximation Schemes. Mathematics of Operations Research 31(1), 31–49 (2006) 2. Bansal, N., Caprara, A., Sviridenko, M.: Improved approximation algorithm for multidimensional bin packing problems. In: FOCS 2006, pp. 697–708 (2006) 3. Blitz, D., van Vliet, A., Woeginger, G.J.: Lower bounds on the asymptotic worstcase ratio of on-line bin packing algorithms (1996) (unpublished manuscript) 4. Caprara, A.: Packing 2-dimensional bins in harmony. In: FOCS 2002, pp. 490–499 (2002) 5. Chung, F.R.K., Garey, M.R., Johnson, D.S.: On packing two-dimensional bins. SIAM J. Algebraic Discrete Methods 3(1), 66–76 (1982) 6. Coppersmith, D., Raghavan, P.: Multidimensional on-line bin packing: Algorithms and worst case analysis. Oper. Res. Lett. 8, 17–20 (1989) 7. Csirik, J., Frenk, J., Labbe, M.: Two-dimensional rectangle packing: on-line methods and results. Discrete Applied Mathematics 45(3), 197–204 (1993) 8. Csirik, J., Johnson, D.S.: Bounded Space On-Line Bin Packing: Best is Better than First. Algorithmica 31, 115–138 (2001) 9. Chin, F.Y.L., Ting, H.-F., Zhang, Y.: 1-Space Bounded Algorithms for 2Dimensional Bin Packing. To appear in International Journal of Foundation of Computer Science 10. Zhang, Y., Chen, J., Chin, F.Y.L., Han, X., Ting, H.-F., Tsin, Y.H.: Improved Online Algorithms for 1-Space Bounded 2-Dimensional Bin Packing. In: Cheong, O., Chwa, K.-Y., Park, K. (eds.) ISAAC 2010, Part II. LNCS, vol. 6507, pp. 242–253. Springer, Heidelberg (2010)
318
Y. Zhang et al.
11. Epstein, L., van Stee, R.: Optimal Online Algorithms for Multidimensional Packing Problems. SIAM Jouranl on Computing 35(2), 431–448 (2005) 12. Fujita, S.: On-Line Grid-Packing with a Single Active Grid. Information Processing Letters 85, 199–204 (2003) 13. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide for the Theory of NP-Completeness. Freeman, San Francisco (1979) 14. Han, X., Fujita, S., Guo, H.: Dimensional Harmonic Algorithm with Performance Ratio 2.7834. IPSJ SIG. Notes (93), 43–50 (2001) 15. Han, X., Chin, F., Ting, H.-F., Zhang, G., Zhang, Y.: A New Upper Bound on 2D Online Bin Packing (manuscript) 16. Johnson, D.S., Garey, M.R.: A 71/60 theorem for bin-packing. J. Complexity 1, 65–106 (1985) 17. Johnson, D.S., Demers, A.J., Ullman, J.D., Garey, M.R., Graham, R.L.: WorstCase performance bounds for simple one-dimensional packing algorithms. SIAM Journal on Computing 3(4), 299–325 (1974) 18. Lee, C.C., Lee, D.T.: A simple on-line bin packing algorithm. J. Assoc. Comput. Mach. 32, 562–572 (1985) 19. Karmarkar, N., Karp, R.M.: An efficient approximation scheme for the one-dimensional bin packing problem. In: Proc. 23rd Ann. IEEE Symp. on Foundations of Comput. Sci., pp. 312–320. IEEE Computer Society, Los Alamitos (1982) 20. Ramanan, P.V., Brown, D.J., Lee, C.C., Lee, D.T.: On-line bin packing in linear time. Journal of Algorithms 10, 305–326 (1989) 21. Seiden, S.S.: On the online bin packing problem. J. ACM 49, 640–671 (2002) 22. Simchi-Levi, D.: New worst-case results for the bin-packing problem. Naval Res. Logistics 41, 579–585 (1994) 23. Seiden, S., van Stee, R.: New bounds for multi-dimensional packing. Algorithmica 36, 261–293 (2003) 24. van Vliet, A.: An improved lower bound for on-line bin packing algorithms. Information Processing Letters 43, 277–284 (1992) 25. Yao, A.C.-C.: New Algorithms for Bin Packing. Journal of the ACM 27, 207–227 (1980)
Online Algorithms for Maximizing Weighted Throughput of Unit Jobs with Temperature Constraints Martin Birks1 , Daniel Cole2 , Stanley P.Y. Fung1 , and Huichao Xue2 1
2
Department of Computer Science, University of Leicester, Leicester LE1 7RH, United Kingdom {mb259,pyfung}@mcs.le.ac.uk Department of Computer Science, University of Pittsburgh, Pittsburgh, USA {dcc20,hux10}@cs.pitt.edu Abstract. We consider a temperature-aware online deadline scheduling model. The objective is to schedule a number of unit jobs, with release dates, deadlines, weights and heat contributions, to maximize the weighted throughput subject to a temperature threshold. We give an optimal randomized algorithm and another resource-augmented constantcompetitive randomized algorithm for the problem. We also give almost tight upper and lower bounds for the multiple processor case. Keywords: Online algorithms, scheduling, competitive analysis, temperature, resource augmentation.
1
Introduction
Background on Temperature. There has been a tremendous increase in processing power and packing density in microprocessors in recent years; thermal management in processors has therefore become an important issue in microarchitecture. High temperature affects reliability, incurs higher cooling costs, accelerates failure mechanisms such as electromigration and dielectric breakdown which can lead to permanent device failures, and worsens leakage which leads to increased power consumption [9]. Commonly, there is a critical temperature threshold that cannot be exceeded. Modern processors are usually ‘multicore’ where multiple processing units are put together on a single chip. One of the reasons for this architecture is that it allows a lower operating frequency (and hence temperature) when delivering the same computational power. There has been quite a lot of recent work on a related problem of minimizing energy consumption in an online scheduling context (see e.g. [13,3] among many others). However, optimizing for energy/power and for temperature require different techniques [3]. Arguably, thermal management is even more important than energy management in at least the following sense: as Bansal et al. [3] put it, “if the processor in a mobile device exceeds its energy bound, then the battery is exhausted. If a processor exceeds its thermal threshold, it is destroyed.” However, algorithmic work on temperature issues is comparatively limited so far. M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 319–329, 2011. c Springer-Verlag Berlin Heidelberg 2011
320
M. Birks et al.
The temperature of a processor is related to its power usage and the cooling mechanism. Since the power usage is a convex function of processor speed [3], one possible way of managing temperature is to slow down the processor when the temperature is too high. This can be supported in the hardware level by dynamic voltage scaling (DVS). Online and offline thermal management algorithms using DVS have been designed and analysed in [3]. However, these algorithms are concerned with minimizing the maximum temperature, i.e., the peak temperature of the online algorithm is at most a constant factor higher than that of the offline optimal algorithm. Arguably, it is more useful to impose a fixed temperature threshold, and subject to this threshold, maximize some measure such as throughput; after all, the processor may die even if the threshold is exceeded by just a little. We consider a different model, described below. Our model. Instead of slowing down the processor, we allow the algorithms to use heat characteristics information of the jobs to make scheduling decisions. This can be done at the operating systems level. Different types of jobs tend to have different patterns of heat contributions (e.g. a CPU-intensive job vs. a memoryintensive one). Recent empirical work [11] suggests that using this information can help produce better schedules with minimal performance degradation while maintaining a good thermal profile. As a simplified scenario, we consider a set of unit-length jobs, where each job j has a release time r(j), a deadline d(j), a weight w(j) and a heat contribution h(j). All release times and deadlines are integers. At each integral time step, some jobs arrive, and the algorithm selects (at most) one job to schedule. The temperature of the processor will be increased due to the job execution, but there is also a cooling factor R > 1, so that the temperature is reduced by a factor of R after every time step. Thus, if the temperature at time t is τ , and the job scheduled at time [t, t + 1) has heat contribution h, then the temperature at time t + 1 is (τ + h)/R. We assume, without loss of generality, that the initial temperature is 0, and the temperature threshold of the processor is 1. The algorithm is online meaning that it makes decisions without knowledge of future job arrivals. The objective is to maximize the weighted throughput, i.e. total weight of jobs completed before their deadlines, while not exceeding the temperature threshold. In a single processor environment, this can be denoted, using standard notation, by 1|online-ri , hi , pi = 1| wi Ui . Such a model was first studied in [8] where the unit jobs represent unit slices in an OS scheduler. In the multiple processor case, m denotes the number of processors. All processors have the same temperature threshold of 1 and the same cooling factor. The temperature of each processor is updated independently, i.e., the temperature of a processor at time t + 1 is calculated based on the its temperature at time t, the heat contribution of the job it schedules at t and the cooling factor, in the same way as in the single processor case. The performance of online algorithms is analysed using competitive analysis. An online algorithm A is c-competitive, if the value obtained by A on any instance is at least 1/c that of the offline optimal algorithm. For randomized algorithms, we consider the expected value of A, against an oblivious adversary who has to
Maximizing Weighted Throughput of Unit Jobs
321
specify the input sequence without knowing the outcome of the random choices made by A. See e.g. [5] for further details on competitive analysis and adversaries. A job j with h(j) > R can never be scheduled by any algorithm, because the temperature threshold will be immediately exceeded; hence we can assume that all jobs have h(j) ≤ R. A job j with h(j) = R is said to have the maximum permissible heat, or simply full heat. We will see that if the heat contribution is bounded away from full heat, more interesting and more useful results can be obtained. Moreover, full heat is not reasonable because it effectively means that once any job (of any positive heat contribution) has been scheduled, then no full heat job can be scheduled, no matter how long afterwards. In practice, after some finite amount of idle time, the processor is effectively at the ambient temperature and can run other jobs. Also, a full heat job will almost ‘burn’ the processor (starting from the ambient temperature) in just one ‘quantum’ of time, which is perhaps not really that reasonable. Previous results. Without temperature constraints, the problem is known as unit job scheduling in the literature and received a lot of attention in recent years. Currently, the best deterministic upper and lower bounds on the competitive ratio are 1.828 [10] and 1.618 [7,1], and the best randomized upper and lower bounds are 1.582 [6] and 1.25 [7]. The paper [8] introduced temperature issues into such a model. They considered the unweighted case, i.e., all jobs have the same weight so that the objective becomes maximizing the number of completed jobs, and that the cooling factor R = 2. They showed that computing the offline optimal schedule is NP-hard, and that all ‘reasonable’ algorithms are 2-competitive and this ratio is the best possible for deterministic algorithms. In [4] this result is extended to all values of R, giving an optimal competitive ratio that increases as R decreases (but is a constant for any fixed R). Our results. In this paper we consider the case where jobs have different weights, to represent their different importance. We show that this weighted version does not admit constant competitive algorithms for the deterministic case. Then we consider two ways of improving the competitiveness: using randomization and using multiple processors. All of our results work for any R > 1. For the randomized case, we give optimal Θ(log W ) bounds on the competitive ratio where W is the ratio of maximum to minimum job weights. Furthermore we give a constant competitive randomized algorithm when the heat contribution of all jobs are a constant factor 1 − away from the maximum permissible heat contribution. For any > 0, the algorithm is O(log 1/)-competitive, and this competitive ratio is optimal up to a constant factor. This allows a tradeoff between the maximum permissible heat and the competitive ratio. The result can be interpreted in a resource augmentation setting where the online algorithm has a slightly higher temperature threshold than the offline optimal algorithm. For the multiple processor case, we give an upper bound of O(mW 1/m ) and a lower bound of Ω((mW )1/m ) on the competitive ratio of deterministic algorithms. Thus for constant m this gives a tight bound of Θ(W 1/m ).
322
M. Birks et al.
In the following, OP T denotes the optimal offline algorithm, A denotes an online algorithm and |A| denotes the value (weighted throughput) of the schedule produced by algorithm A.
2
Deterministic Case
We first make the simple observation that deterministic algorithms give poor results on a single processor. It is easy to see that no deterministic algorithms can have competitive ratio better than W , if jobs can have full heat. Consider two jobs J1 and J2 , with r(J1 ) = 0, d(J1 ) = 1, w(J1 ) = 1, h(J1 ) = R, and r(J2 ) = 1, d(J2 ) = 2, w(J2 ) = W, h(J2 ) = R. When J1 arrives, A must schedule it or else J2 will not arrive and it will have an infinite competitive ratio. Once J1 is started, A cannot schedule J2 . OP T schedules only J2 . Thus the competitive ratio is W . It is also easy to give an O(W )-competitive algorithm: just ignore all the job weights and use any reasonable algorithms for the unweighted case given in [8,4]. An algorithm is reasonable if, at any time step, (i) it never idles when there is at least one job that can be executed without violating the deadline and temperature constraints, and (ii) it executes a job that is not strictly dominated by another pending job, where a job i strictly dominates another job j if h(i) ≤ h(j) and d(i) ≤ d(j) and at least one of these two inequalities are strict. Examples of reasonable algorithms include the earliest deadline first, and the coolest first algorithms. It was shown in [4] that, for any constant R > 1, all reasonable algorithms are O(1)-competitive (with the constant depending on the value of R) with respect to the number of completed jobs. Since we lose a factor of at most W for the weight of each job, the competitiveness of O(W ) follows.
3
Randomized Case: Full Heat
For the randomized case, we show that the competitive ratio is also unbounded in the case with full heat. We follow Yao’s principle [12] and specify a probabilistic construction of the adversary and bound the competitive ratio against deterministic algorithms with inputs over this distribution. Theorem 1. Any randomized algorithm for the problem 1|online-ri , hi , pi = 1| wi Ui has competitive ratio Ω(log W ). Proof. Choose a large enough positive integer n, and let Ji (1 ≤ i ≤ n) be a job with r(Ji ) = i − 1, d(Ji ) = i, w(Ji ) = 2i−1 and h(Ji ) = R. At t = 0, job J1 arrives. Then at each time step i (1 ≤ i < n), with conditional probability 1/2 the sequence stops, and with conditional probability 1/2 the adversary continues to release job Ji+1 . The probability is conditional on the fact that the time step i is actually reached, i.e. the adversary is not stopped before. If Jn is released, then the sequence stops. Thus, we have a total of n different input sequences, appearing with probability 1/2, 1/4, . . . , 1/2n−1 , 1/2n−1 . (See Figure 1.)
Maximizing Weighted Throughput of Unit Jobs
323
Fig. 1. Input distribution for the randomized lower bound
Since all jobs have full heat, any algorithm can schedule at most one of those jobs. Hence, without loss of generality, we can restrict our attention to deterministic algorithms Aj of the following form: do not start the first j − 1 jobs in the sequence and start the j-th, for some 1 ≤ j ≤ n. Then Aj gets the value of job Jj if the adversary releases Jj , i.e. the adversary has not stopped after releasing the previous j − 1 jobs. This happens with marginal probability 1/2j−1 . Otherwise, if the adversary stopped before releasing Jj , no value is obtained. Thus E[|Aj |] = (1/2j−1 )(2j−1 ) = 1. Note that this is independent of j. Thus the expected profit of any online algorithm is 1. For OP T , it always schedules the last job released by the adversary; thus E[|OP T |] =
n−1 i=1
1 2i
(2
i−1
)+
1 2n−1
(2n−1 ) =
n−1 n+1 +1= . 2 2
Therefore the competitive ratio is at least (n + 1)/2. Since W = 2n−1 , we have proven a lower bound of Ω(log W ) on the competitive ratio. This competitive ratio can be attained by a randomized algorithm using the classify-and-random-select technique [2]. We assume the minimum weight is 1 and the maximum weight is W , and that this value of W is known in advance. We partition the weight range [1, W ] into ln W classes, with ranges [1, e), [e, e2 ), . . . , [eln W −1 , eln W ), [eln W , W ]. In each class, the job weights differ by a factor of at most e. We randomly choose one of the classes and ignore all jobs not in this class. Then we run the O(1)-competitive algorithm for unweighted instances [4] for jobs in this class, ignoring the job weights. Let Ai be the schedule of the online algorithm for the i-th class, and OP Ti be the optimal schedule for jobs in the i-th class. Let cR be the competitive ratio of the algorithm for the unweighted version of the problem. Then |OP Ti | ≤ cR e|Ai | since the algorithm is cR -competitive for the number of jobs and at most a factor of e is lost on job weights. So
324
M. Birks et al.
|Ai | E[|A|] = ≥ ln W
|OP Ti |/cR e |OP T | ≥ ln W cR eln W
Thus the algorithm is (cR eln W )-competitive. Theorem 2. There is a randomized O(log W )-competitive algorithm for the problem 1|online-ri , hi , pi = 1| wi Ui .
4
Randomized Case: Non-full Heat
Assuming that jobs do not have the maximum permissible heat, we can give better algorithms. For example, if all jobs have heat at most R−1, then it is easy to verify that the temperature never exceeds the threshold. We can generalise this idea to the case where all jobs have heat at most H, where H < R with an arbitrarily small difference between H and R. We show how to give constant competitive randomized algorithms in such cases. In fact we give a tradeoff between the competitiveness and the maximum permissible heat. We first make this observation. Lemma 1. Suppose an algorithm runs jobs of heat at most h every k ≥ 1 time slots, and keeps idle at other slots. If h ≤ R(1 − 1/Rk ), then the temperature does not exceed 1 at any point. Proof. We claim that the temperature immediately after executing a job of heat at most h is at most 1. For the first such job, the temperature is at most R(1 − 1/Rk )/R = 1 − 1/Rk , so this clearly holds. By induction assume this is true after n jobs. Then the temperature before executing the (n + 1)-th job is at most 1/Rk−1 , since there are k − 1 idle slots. Hence the temperature after executing it is at most (1/Rk−1 + h)/R ≤ 1. Suppose all jobs have heat at most H = R(1 − 1/Rk ), for some k ≥ 1. Our algorithm first uses an existing online algorithm for scheduling unit jobs without heat consideration. We can use any such existing algorithms, deterministic or randomized ([10,6] among others), to produce such a schedule S. We then virtually create k schedules S1 , S2 , . . . , Sk : S1 schedules the same job as S during slots t = 0, k, 2k, . . ., and stays idle at all other slots. Similarly S2 schedules the same job as S during slots t = 1, k + 1, 2k + 1, . . ., and stays idle at all other slots. In general, Si follows S during slots of the form t = (i− 1)+ qk for q = 0, 1, 2, . . .. Each Si schedules a job only every k slots, and each slot in S is “covered” by exactly one of the Si ’s. By Lemma 1, each of the Si ’s will never exceed the temperature threshold. The online algorithm chooses one of S1 , S2 , . . . , Sk in the beginning, each with probability 1/k. Clearly this process can be done online. Let c < 2 be the competitive ratio of the underlying unit job scheduling algorithm without heat consideration. The expected weighted throughput E[|A|] of our algorithm is equal to 1/k of the total weighted throughput of S1 , . . . , Sk , k i.e., E[|A|] = k1 i=1 |Si |. Let OP T denote the optimal offline schedule for the same input instance but without heat considerations. Then we have:
Maximizing Weighted Throughput of Unit Jobs
325
|OP T | ≤ |OP T |, |S| =
k
|Si |, and
i=1
|OP T | ≤ c|S|. The first inequality is true because putting in temperature consideration clearly cannot result in a schedule with a larger value; the second is from the definition of the algorithm; and the last one comes from the competitiveness of the underlying unit job scheduling algorithm. Combining all these together, we have |OP T | ≤ ckE[|A|], and therefore the competitive ratio of our algorithm is k · c. Note that the maximum permissible heat R(1−1/Rk ) can be made arbitrarily close to R (the maximum permissible heat) for sufficiently large k. For heat limits not of the form R(1 − 1/Rk ), just take next higher limit of that form and the bound is only affected by a constant factor. We can therefore rephrase the result as follows: let = 1/Rk . Then k = logR (1/) = O(log(1/)) and therefore we have: Theorem 3. For any 0 < ≤ 1/R, the above algorithm schedules jobs with H = R(1 − ) with competitive ratio O(log(1/)). We can prove an almost matching lower bound: Theorem 4. For jobs with maximum heat H = R(1 − ) = R(1 − 1/Rk ), and for large enough k, no randomized algorithm can have competitive ratio better than k. Proof. Let n ≥ 1 be the largest integer such that H/Rn +H/R > 1. (It is required that H ≥ R/2, i.e. Rk ≥ 2 for such an n to exist.) Let p be a real number in (0,1), to be determined later. The proof is very similar to that of Theorem 1. Let Ji (1 ≤ i ≤ n) be a job with r(Ji ) = i − 1, d(Ji ) = i, w(Ji ) = 1/pi−1 and h(Ji ) = H. At t = 0, job J1 arrives. Then at each time step i (1 ≤ i < n), with conditional probability 1−p the sequence stops, and with conditional probability p the adversary continues to release job Ji+1 . The probability is conditional on the fact that the adversary is not stopped before time step i. If Jn is released, then the sequence stops. Since H/Rn +H/R > 1, any algorithm can schedule at most one of those jobs. Hence, similar to Theorem 1, we only need to consider deterministic algorithms Aj that do not start the first j−1 jobs in the sequence and start the j-th, for each 1 ≤ j ≤ n. Then Aj gets the value of job Jj if the adversary releases Jj , which happens with marginal probability pj−1 . Thus E[Aj ] = (pj−1 )(1/pj−1 ) = 1. For OP T , if the adversary stops at job Jj , it only schedules job Jj ; thus E[OP T ] =
n−1
i−1
(p
i=1
(1 − p))
1 pi−1
n−1
+ (p
)
1 pn−1
= (n − 1)(1 − p) + 1.
326
M. Birks et al.
Therefore, the competitive ratio is at least (n − 1)(1 − p) + 1. Choose p to be arbitrarily close to 0, then the ratio can be made arbitrarily close to n. The condition on H/Rn + H/R > 1 is equivalent to n < logR (RH/(R − H)). It follows that the lower bound is logR (RH/(R − H)) − 1. Since H = R(1 − ) = R(1 − 1/Rk ), we have that the lower bound is equal to logR (R2 (1 − 1/Rk )/(1/Rk−1 )) − 1 = logR (Rk+1 − R) − 1. This lower bound is equal to k for any R > 1 and sufficiently small , and thus the upper bound is optimal up to a constant factor of c. Resource Augmentation. Alternatively, we can use the above idea to give constant competitive algorithms even for jobs with full heat, but against a slightly weaker adversary; this follows the idea of resource augmentation. In our case, we compare an online algorithm with temperature threshold 1 + against an offline optimal algorithm with threshold 1. Observe that if the heat contribution of all jobs in a certain schedule are multiplied by a factor λ, then the temperature at any point in the schedule is also multiplied by λ. Hence, when an online algorithm with temperature threshold 1 + is given an instance I with maximum heat H ≤ R, it scales the heat contribution of all jobs by a factor of 1/(1 + ), and applies the algorithm in Theorem 3 on this new instance. Since the algorithm in Theorem 3 produces a schedule not exceeding temperature 1, the schedule will not exceed temperature 1 + on the original instance. This transformed instance I has maximum heat contribution R/(1 + ) = R(1 − 1+ ). Let A(I) and A(I ) be the schedule returned by the online algorithm on I and I (with temperature threshold 1 + and 1 respectively). Similarly let OP T (I) and OP T (I ) be the schedule produced by OP T on I and I (with a temperature threshold of 1 in both cases). We have |OP T (I)| ≤ |OP T (I )| as the jobs in I are hotter than those in I ; |A(I)| = |A(I )| as they are the same schedule; and |OP T (I )| ≤ O(log(1/ 1+ ))|A(I )| as this is the competitive ratio given in Theorem 3. Putting these together it therefore follows that |OP T (I)| ≤ O(log(1/
))|A(I)| = O(log(1 + 1/))|A(I)|. 1+
This represents a tradeoff between competitiveness and extra resource (on temperature threshold).
5
Multiple Processors
We have seen that in the single processor case, no deterministic algorithms can have a bounded competitive ratio. In this section we consider the multiprocessor (and deterministic) case, and show that the bounds can be improved, where the bounds depend on the number of processors m. We first prove a lower bound: Theorem 5. No deterministic algorithm can be better than (mW )1/m competitive for P |online-ri , hi , pi = 1| wi Ui , when W ≥ mm−1 .
Maximizing Weighted Throughput of Unit Jobs
327
Proof. Fix a deterministic algorithm A. Consider a sequence of jobs Ji for 1 ≤ i ≤ m, where r(Ji ) = i − 1, d(Ji ) = i and h(Ji ) = R. The weights of the jobs are given by w(J1 ) = 1, and w(Ji ) = (c − 1) i−1 j=1 w(Jj ) for i > 1 where c > 1 is some value to be chosen later. Each Ji is released successively. Note that the job Ji cannot be scheduled on any processor that has already scheduled another job Jj for j < i as all of the jobs have full heat contribution. If A chooses not to schedule some job Jk on any processor then the subsequent jobs will not be released. In thiscase A have scheduled the first k − 1 jobs and so has a weighted k−1 throughput of i=1 w(Ji ). OP T will schedule all k jobs and so have a weighted k−1 throughput of i=1 w(Ji ) + w(Jk ). As w(Jk ) = (c − 1) k−1 i=1 w(Ji ), this gives k−1 OP T a weighted throughput of c i=1 w(Ji ) giving a competitive ratio of c in this case. Otherwise A does not miss any of the Ji jobs, 1 ≤ i ≤ m. This means that A have scheduled exactly one job on each of its processors. At time m we then release m jobs X1 , . . . , Xm have heat contributions of R, tight deadlines of that m m + 1 and weights of (c i=1 w(Ji ))/m. A will be too hot to schedule any of them, while OP T can skip all the Ji and schedule all X1 , X2 , . . . , Xm one on m each processor. This gives OP T a weighted throughput of c i=1 w(Ji ) while A m has a weighted throughput of i=1 w(Ji ) which again gives a competitive ratio of c. i−1 Each job Ji for i > 1 has weight (c − 1) j=1 w(Jj ) and w(J1 ) = 1. Solving the recursion we get w(Ji ) = ci−1 − ci−2 . Thus m i−1 i−2 w(Xi ) = c (c − c ) + 1 /m = cm /m. i=2
The minimum job weight is 1 and the maximum job weight is either w(Jm ) or w(Xm ). The ratio of maximum to minimum job weights is therefore W = max{cm−1 − cm−2 ,
cm } m
We have that cm−1 −cm−2 ≤ cm /m as long as cm ≤ c2 +m, which means in this case W = cm /m. Setting c = (mW )1/m therefore gives the desired competitive ratio. With this value of c, the condition cm ≤ c2 + m is satisfied if, for example, W ≥ mm−1 . We can prove a deterministic upper bound of O(mW 1/m ). The idea is similar to the randomized algorithm in Section 3. Split the job weights into m classes [1..W 1/m ), [W 1/m ..W 2/m ), ..., [W (m−1)/m ..W ]. Each processor deals only with jobs in one class. The processor then ignore the weights and use the O(1)competitive 1-processor algorithm in [4] to schedule the jobs. 1/m Theorem 6. The above ) for algorithm has a competitive ratio of O(mW P |online-ri , hi , pi = 1| wi Ui .
Proof. Let Ai be the online schedule produced by processor i (job weight class i). Let OP Ti,j be the OP T schedule of processor j filtered to include jobs in
328
M. Birks et al.
class i only. For each such schedule j, the O(1)-competitiveness of the algorithm in [4] implies that the number of jobs completed by Ai is at least 1/cR that in OP Ti,j , for some constant cR . Thus the value of Ai is at least 1/(cR W 1/m ) that of OP Ti,j , since the job weights in each class differ at most by a factor of W 1/m . Summing over all i and j we have that |A| ≥ 1/(cR mW 1/m )|OP T |. Hence the competitive ratio is O(mW 1/m ).
6
Conclusion
In this paper we give almost optimal bounds for the online unit job scheduling problem for weighted throughput with temperature constraints. Further work will include closing these bounds and also investigating the use of randomized algorithms or resource augmentation in the multiprocessor case. Acknowledgement. We thank Kirk Pruhs for useful discussions.
References 1. Andelman, N., Mansour, Y., Zhu, A.: Competitive queueing policies for QoS switches. In: Proceedings of 14th ACM-SIAM Symposium on Discrete Algorithms, pp. 761–770 (2003) 2. Awerbuch, B., Bartal, Y., Fiat, A., Rosen, A.: Competitive non-preemptive call control. In: Proceedings of 5th ACM-SIAM Symposium on Discrete Algorithms, pp. 312–320 (1994) 3. Bansal, N., Kimbrel, T., Pruhs, K.: Dynamic speed scaling to manage energy and temperature. Journal of the ACM 54(1) (2007) 4. Birks, M., Fung, S.P.Y.: Temperature aware online scheduling with a low cooling factor. In: Kratochv´ıl, J., Li, A., Fiala, J., Kolman, P. (eds.) TAMC 2010. LNCS, vol. 6108, pp. 105–116. Springer, Heidelberg (2010) 5. Borodin, A., El-Yaniv, R.: Online Computation and Competitive Analysis. Cambridge University Press, New York (1998) 6. Chin, F.Y.L., Chrobak, M., Fung, S.P.Y., Jawor, W., Sgall, J., Tich´ y, T.: Online competitive algorithms for maximizing weighted throughput of unit jobs. Journal of Discrete Algorithms 4(2), 255–276 (2006) 7. Chin, F.Y.L., Fung, S.P.Y.: Online scheduling with partial job values: Does timesharing or randomization help? Algorithmica 37(3), 149–164 (2003) 8. Chrobak, M., D¨ urr, C., Hurand, M., Robert, J.: Algorithms for temperature-aware task scheduling in microprocessor systems. In: Proceedings of 4th International Conference on Algorithmic Aspects in Information and Management, pp. 120–130 (2008) 9. Coskun, A., Rosing, T., Whisnant, K.: Temperature aware task scheduling in MPSoCs. In: Proc. Conference on Design, Automation and Test in Europe, pp. 1659– 1664 (2007) 10. Englert, M., Westermann, M.: Considering suppressed packets improves buffer management in QoS switches. In: Proceedings of 18th ACM-SIAM Symposium on Discrete Algorithms, pp. 209–218 (2007)
Maximizing Weighted Throughput of Unit Jobs
329
11. Yang, J., Zhou, X., Chrobak, M., Zhang, Y., Jin, L.: Dynamic thermal management through task scheduling. In: IEEE International Symposium on Performance Analysis of Systems and Software, pp. 191–201 (2008) 12. Yao, A.C.-C.: Probabilistic computations: Toward a unified measure of complexity. In: Proceedings of 18th IEEE Symposium on Foundations of Computer Science, pp. 222–227 (1977) 13. Yao, F.F., Demers, A.J., Shenker, S.: A scheduling model for reduced CPU energy. In: Proceedings of 36th IEEE Symposium on Foundations of Computer Science, pp. 374–382 (1995)
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs Martin Birks and Stanley P.Y. Fung Department of Computer Science, University of Leicester, Leicester LE1 7RH, United Kingdom {mb259,pyfung}@mcs.le.ac.uk Abstract. We study the online scheduling problem of maximising job completion subject to temperature constraints. In our setting, jobs are of equal length and have deadlines and heat contributions. The algorithm tries to complete as many jobs as possible before their deadlines while keeping the temperature of the system within an acceptable limit. We give an optimal algorithm for the case where preemption is not allowed. Then we consider the case of preemption and prove a number of lower bounds, showing that for many combination of system parameters, preemption (with restart) is not helpful in improving the competitiveness.
1
Introduction
Background. Thermal management have become a very important problem in the architectural design of microprocessors and other small devices. As devices become smaller and yet more powerful, an increasing amount of heat needs to be dissipated within an even smaller space. High temperatures are problematic as they affect reliability, incur higher cooling costs or even lead to permanent device failures; see e.g. [6]. Many devices have a temperature threshold that cannot be exceeded, and often this becomes the bottleneck in obtaining better performance. One way of controlling the temperature is to vary the processor speed according to the load, or forcibly reduce the speed when the temperature gets too high. Often these techniques are used at the hardware level. While such techniques have been extensively studied by the microprocessor architecture community, algorithmic techniques can also be used to manage temperature; see e.g. the survey in [9]. This works more closely at, for example, the operating system level where the OS decides how jobs are scheduled. The model. We consider a model with online jobs of equal length. Time is divided into discrete unit-sized steps. Every job j has a release time rj and a deadline dj . All jobs have the same length p > 1 which is the number of time steps that each job requires to complete. A job j has a tight deadline if rj + p = dj ; they are also called tight jobs. All rj , dj and p are nonnegative integers. Each job also has a heat contribution hj which is the heat contribution at every time step when j is executing. The temperature of a system can never exceed the thermal threshold T which can be set at 1 with an initial temperature of 0 without loss of generality. The M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 330–342, 2011. c Springer-Verlag Berlin Heidelberg 2011
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs
331
system has a cooling factor R such that if the temperature at time t is τt and a job j is executing for a time step at time [t, t + 1) then the temperature at time t + 1 is given by τt+1 = (τt + hj )/R. This is a discrete approximation of Fourier’s Law of cooling, which states that the rate of cooling of a system is proportional to the difference in temperature between itself and its environment. The algorithm takes a decision at each time step deciding whether to schedule a job, and which job to schedule. The objective of the algorithm is to maximise the throughput of jobs without violating the temperature threshold. As jobs have longer than unit length, the scheduling may involve preemption as an urgent job may arrive while another job is running. This paper considers both nonpreemptive and preemptive scheduling models. With preemption a job may be preempted and value is only gained for a job that is completed. There are several different models for preemption. In the preemptive restart model, when a job is preempted all current progress of that job is lost and the job must be restarted from the beginning if it is to be completed in the future. In the preemptive resume model, a preempted job can be later resumed at the last point of execution. See e.g. [8]. For simplicity, the total heatcontribution of a job j over all p time steps is p−1 denoted by h∗j , defined as h∗j = i=0 hj /Ri . This takes into account the cooling at each step. With this definition the temperature after executing j for its entire duration (without preemption) is given simply by τt+p = τt /Rp + h∗j /R. A job j is pending at time t if j is released but not expired, rj ≤ t < dj , and has not been scheduled before t. A job is admissible at time t if it is pending at t and is not too hot to be executed. As jobs take p steps to complete, the temperature at any point during these p steps must not exceed the threshold. It is easy to show that as long as the temperature at the end of the p steps is within the threshold, then that must also be the case for any intermediate time steps. So for nonpreemptive or the preemptive restart model, a job j is admissible at time t if τt /Rp + h∗j /R ≤ 1. Thus no jobs with h∗j > R can be admissible. We assume the same for the resume model (this will be discussed in Section 4). As the jobs arrive online, an online algorithm would not have any knowledge that the job exists, or any of its properties, until the job is released. We analyse online algorithms using the standard competitive analysis: an algorithm A is c-competitive if, for any input instance, the value returned by A is at least 1/c times that of an offline optimal algorithm OP T that knows the entire input sequence in advance and therefore computes the best solution. Previous results. Algorithmic work on thermal management in online scheduling is relatively limited. The first major algorithmic result concerning temperature aware online scheduling is possibly the one by Bansal et al [1]. A different model was considered there, where all jobs must be finished, processor speeds are unlimited and the objective is to minimise the maximum temperature. Constant competitive algorithms were given for such a model. However, an algorithm with a peak temperature a constant factor higher than the threshold has, after all, exceeded the threshold and thus may be undesirable.
332
M. Birks and S.P.Y. Fung
There has been some work done for the problem of maximising throughput subject to temperature constraints, although only involving unit-length jobs, where the length of each job is equal to the length of a time step. The motivation is that each job represents a slice of a process given to the OS scheduler. This problem is shown to be NP-complete in the offline case [4]. For the online case a lower bound and matching upper bound are given that show that a class of algorithms called reasonable algorithms are all optimal when R = 2. The optimality of reasonable algorithms has also been proven for all R > 1 [3]. As mentioned in [4], one way of generalising this unit-length model is to allow longer jobs. Considering longer jobs is useful for several reasons: first, if jobs (for example, CPU processes) are already partitioned into unit length slices as in the unit length model, credit will be given to each completed slice even though the job itself may not be completed. Thus to correctly account for the value gained, the scheduler needs to be aware of the longer, unpartitioned jobs. Second, depending on the application domain, it may not be possible (or it may be costly) to have preemption, and it would be useful to analyse the power of preemption which is not possible in the unit-length model. We are not aware of any prior work in this model, although there has been a significant amount of work on scheduling equal length jobs without temperature considerations. For the case with a single machine without preemption, there is a 2-competitive greedy algorithm [2] which has been shown to be optimal for the deterministic case [7]. For the deterministic case with restarts an optimal 3/2-competitive algorithm has been shown [5]. Our results. In this paper we show several upper and lower bound results for the case of equal length jobs. We first consider the nonpreemptive case, and show a lower bound for all deterministic algorithms. We then show that a coolest first algorithm gives a matching upper bound. We also give a slightly weaker upper bound for the more general class of reasonable algorithms. Next we consider preemption and show several lower bound results. We give lower bounds for the preemptive restart or resume models that are slightly lower than those of the
Fig. 1. Bounds for the different models when (left) p = 2, (right) p = 3
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs
333
nonpreemptive case. This shows that preemption is not going to help a lot in reducing the competitiveness. Moreover, we give a lower bound that shows that preemption with restarts do not have any advantage at all over the nonpreemptive case when Rp > R + 1. The exact bounds depend on the values of R and p, and will be stated in the theorems, but the charts in Figure 1 show how the bounds for the different models change depending on the values of R and p. Before we move on we introduce some notations. We use OP T to denote the offline optimal algorithm, and A to denote the online algorithm being studied. Without ambiguity they also denote the schedules of the respective algorithms. We use τt to denote the temperature of the online algorithm at time t, and τt to denote the temperature of OP T at time t. We refer to a job as an OP T -only job if it is started by OP T at some time t when A is idle, and at time t the job is pending at A but is too hot to be scheduled. Due to space constraints, some of the proofs are either omitted, or only a sketch is given.
2
The Nonpreemptive Model
The competitive ratios for the nonpreemptive case are given in terms of a value N (defined in terms of p and R) that is the largest integer n > 0 such that (n + R)Rp > Rnp+1 + n holds. The following table shows the values of N for different values of R and p. N 1 2 3 4 5 2.1
p=2 p=3 p=4 √ √ √ 3 4 R > 2 ≈ 1.260 R > 2 ≈ 1.189 R > 5 2 ≈ 1.149 1.260 R 1.105 1.189 R 1.075 1.149 R 1.059 1.105 R 1.058 1.075 R 1.041 1.059 R 1.032 1.058 R 1.037 1.041 R 1.026 1.032 R 1.020 1.037 R 1.026 1.026 R 1.018 1.020 R 1.014
Lower Bound
Theorem 1. No deterministic nonpreemptive algorithm can be better than (N + 2)-competitive. Proof. Fix any deterministic algorithm A. At time 0 release a job j with a deadline of 2D + (N + 3)p + 1 and a total heat contribution h∗j = R(1 − ) for a sufficiently small > 0, where D = logR (1/) is the time for an idle machine’s temperature to reduce from 1 to . If A does not schedule j at all then OP T schedules it at time 0, and the competitive ratio of A is infinite, so we can assume A schedules j at some time u. If u ≤ D + p, then OP T remains idle at u and at time u + 1 we release a job k that has a tight deadline and a heat contribution hk = 0. OP T schedules this job, while A must continue with j as it is nonpreemptive, reaching a temperature of 1 − at time u + p. At time t = u + ip + 1 for i = 1, 2, ..., the temperature
334
M. Birks and S.P.Y. Fung
1 of A is given by (ignoring the small ) τu+ip+1 = R(i−1)p+1 . At each such t, as long as τu+ip+1 > τu+ip+1 , the adversary releases a tight job ji with the smallest τ possible heat contribution such that h∗ji > R − u+ip+1 . A will be (just) too hot Rp−1 to schedule the jobs (i.e. they are OP T -only jobs), while OP T will schedule each of them. The temperature of OP T at time u + ip + 1 for every i ≥ 1 is given by: τu+p+1 = 0,
τu+ip+1 =
τu+(i−1)p+1
Rp
+
h∗ji−1 R
for i ≥ 2
This can be solved to give: τu+ip+1 =
Rp − Rp−(i−1)p i−1 − (i−1)p+1 Rp − 1 R
The maximum number of OP T -only jobs is the largest integer i > 0 such that τu+ip+1 > τu+ip+1 holds, which is satisfied if 1 R(i−1)p+1
>
Rp − Rp−(i−1)p i−1 − (i−1)p+1 p R −1 R
which can be simplified to (i + R)Rp > Rip+1 + i, the formula that defines N . After completing jN at time (u + N p + 1) + p, OP T will then remain idle for D steps so that it is cool enough to schedule j at which point this will be done. Since u ≤ D + p, it can still meet its deadline. If u > D + p then OP T schedules j at time 0. Since u > D + p, at time u + 1 OP T ’s temperature will be less than , i.e. almost 0. We then continue as in the previous case, with all N jobs and k being scheduled by OP T while A cannot schedule any more jobs. This concludes the proof as j is the only job that A is able to schedule while OP T is able to schedule N other jobs as well as j and k, making A no better than (N +2)-competitive. 2.2
Upper Bound: Coolest First
In this section the algorithm CoolestFirst will be shown to have an optimal competitive ratio. CoolestFirst schedules a job whenever one is admissible, and if several are admissible will always schedule the job with the smallest heat contribution. Whenever several jobs have the same smallest heat contribution it will always schedule a job in this set that has the smallest or equal smallest deadline. Before proving the competitive ratio, we need two lemmas to bound the number of OP T -only jobs during an idle period of A. The two lemmas are similar, but in the second one, OP T starts them one time step later. Lemma 1. If A completes a job at time u then OP T can start at most M OP T -only jobs on or after time u but before A starts the next job, where M is the largest integer m ≥ 0 such that (m + 1)Rp > Rmp + m holds.
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs
335
Proof. For A we must have τu ≤ 1. We assume OP T runs these OP T -only jobs consecutively starting from u without idle time or other jobs in-between; it can be shown that they cannot increase the number of OP T -only jobs. As A remains idle while OP T starts jobs, the temperature of A after i jobs have been run by OP T is given by τu+ip ≤ R1ip . For each OP T -only job ji it must be too hot to τ be admissible in A, i.e. h∗ji > R − u+(i−1)p . The temperature of OP T after it Rp−1 has run i jobs is given by τu ≥ 0,
τu+ip =
τu+(i−1)p
Rp
+
h∗ji R
This can be solved to: τu+ip ≥
Rp − Rp−ip i − ip Rp − 1 R
As long as τu+(i−1)p > τu+(i−1)p it is always possible for OP T to schedule the i-th OP T -only job ji at time u + (i − 1)p. The maximum number of OP T -only jobs is thus the largest i > 0 such that τu+(i−1)p > τu+(i−1)p , which is satisfied if
1 R(i−1)p
>
Rp − Rp−(i−1)p i−1 − (i−1)p p R −1 R
which is equivalent to (i + 1)Rp > Rip + i, the same formula that defines M . Lemma 2. If A completes a job at time u and OP T does not start a job at [u, u + 1), then OP T can start at most N OP T -only jobs on or after time u + 1 but before A starts the next job. We omit the proof as it is very similar to that of Lemma 1. It turns out that M are never much larger than N : Lemma 3. If M and N are defined from the same p and R, N ≤ M ≤ N + 1. Theorem 2. CoolestFirst is (N + 2)-competitive for the nonpreemptive model. Proof. The algorithm will be analysed by dividing the schedules into regions, and then associating with each region certain credits for jobs scheduled by OP T and A. Each region is a time interval [u, v), where u is the time when A starts a job, and v is the earliest time on or after u + p when A starts another job. If A does not start another job after u, set v = ∞. Clearly, for every two consecutive regions [u, v) and [u , v ) it must be that v = u , i.e. the regions form a nonoverlapping partition of the schedules. The first region starts when A first schedules a job. OP T cannot schedule any job before this time as A schedules a job as soon as one is released. Thus it is not possible for OP T to start a job before the start of the first region. Each job completed by A or OP T will be given credits towards some region. T A We use ΦOP [u,v) and Φ[u,v) to denote the credits associated to region [u, v) of
336
M. Birks and S.P.Y. Fung
T OP T and A respectively, and ΦOP and ΦA ∞ ∞ to represent the total credits of OP T and A respectively after jobs have stopped being released and all jobs have expired or completed. We prove that for every region [u, v) it must be that T A OP T ≤ (N +2)· ΦA ΦOP ∞. [u,v) ≤ (N +2)·Φ[u,v) . Summing over all regions this gives Φ∞ This shows that A is (N + 2)-competitive. Fix a region, and let j be the job that A schedules in this region. The starting time of j is u. We give A credit for the job it schedules in each region, so OP T ΦA [u,v) = 1 for every region. We also give 1 credit to Φ[u,v) in every region, to account for the fact that at some point in the future OP T may schedule the job j. We consider the following cases of OP T ’s action when j is started by A at time u:
Case 1: OP T starts a job k at u, and k has either been completed by A on or before u, or is the same job j. In either case we do not need to give any more credit to OP T for scheduling job k as it has already been accounted for. Any other job started by OP T in this region must be started at a time t while A is idle. Consider one such job x. If x has already been scheduled in A before u, then a credit have already been given to it in a previous region. Otherwise, x is still pending in A at time t, and it must be too hot to be executed by A at time t because otherwise A would have started it and therefore started a new region. So x is an OP T -only job, and from Lemma 1 we know that OP T can start at most M OP T -only jobs before A starts another job. This means we can T increase ΦOP [u,v) by up to another M credits in this case. In addition to the credit T already given for potentially scheduling j in the future, this means ΦOP [u,v) has at most M + 1 credits. Case 2: OP T does not start a job at u. In this case OP T can either start a job in the interval [u + 1, u + p) or not. If OP T does not start a job in this interval T then again we can use Lemma 1 to show that ΦOP [u,v) will be given at most M more credits as in Case 1. If OP T does start a job k in this interval then we give T ΦOP [u,v) another credit for k. By the same argument as in Case 1, any other jobs started by OP T have either been scheduled by A before and have therefore been accounted for, or are OP T -only. These jobs (excluding k) can only be started on or after time u + p + 1, one time step after A completes j. From Lemma 2 it follows that there are at most N such OP T -only jobs, meaning the total credits T in ΦOP [u,v) is at most N + 2. Case 3: OP T starts a job k = j at u, but k has not been completed by A on or before u. It must be the case that hk ≥ hj , since otherwise A would have started the cooler job k instead of j. We consider two subcases. If τu ≥ τu , then it must also be the case that τu+p ≥ τu+p as k is hotter than or equal to j. Thus it is not possible to have any OP T -only jobs in this region. So ΦA [u,v) increases T increases by 2 (one from k and one from j). The other subcase by 1 while ΦOP [u,v) is τu < τu . Here there must be a previous region before this one, as in the first region both OP T and A has the same starting temperature of 0. We claim that
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs
337
the previous region has at most M − 1 or N − 1 (depending on which case it belongs to) OP T -only jobs. This is because, if there are M (or N ) OP T -only jobs in the previous region, then following the arguments in Lemmas 1 and 2, by the end of the previous region (which is the beginning of this region, i.e. time u) OP T must be hotter than A, otherwise there could be more OP T -only jobs, contradicting the maximality of M (or N ). Therefore, we can count the job k to the previous region instead of this one. As in Case 1 there can be at most M T OP T -only jobs in this region, so ΦOP [u,v] is at most M + 1. T A From the three cases, it can be seen that ΦOP [u,v) ≤ max(M + 1, N + 2) · Φ[u,v) . Lemma 3 shows that M ≤ N + 1. This completes the proof. 2.3
Upper Bound: Any Reasonable Algorithm
CoolestFirst in fact belongs to the larger class of algorithms called reasonable algorithms. To define them, we first define a dominance relation on jobs: a job j dominates a job k if dj ≤ dk and hj ≤ hk . If at least one of the inequalities is strict then we say that j strictly dominates k. An online algorithm is called reasonable if at each time step the algorithm schedules a job whenever there is one admissible, and if there are several admissible jobs, then any of these jobs that is not strictly dominated. If no jobs are admissible then the machine is left idle for a time step. Using a region analysis similar to Theorem 2 it can be shown that reasonable algorithms have a competitive ratio that is no worse than 1 greater than that of CoolestFirst. We omit the proof. Theorem 3. Any reasonable algorithm is (N + 3)-competitive for the nonpreemptive model.
3
The Preemptive Restart Model
In the preemptive restart and resume models many of the competitive ratios are given in terms of N , defined as the largest integer n ≥ 0 such that nR(Rp −1) > R + R(n+1)p − 2Rp holds. The following table shows the value of N for some combinations of R and p. N 0 1 2 3 4
p=2 p=3 p=4 √ √ √ R > 2 ≈ 1.414 R > 3 2 ≈ 1.260 R > 4 2 ≈ 1.189 1.414 R 1.109 1.260 R 1.081 1.189 R 1.062 1.109 R 1.050 1.081 R 1.039 1.062 R 1.031 1.050 R 1.030 1.039 R 1.023 1.031 R 1.019 1.030 R 1.019 1.023 R 1.015 1.019 R 1.012
Two lower bounds will be proven in this subsection, which in a way complement each other. The first one applies to all values of R, but is relatively weak √ (gives a bound of 2) when R > p 2. The second one only applies to the case
338
M. Birks and S.P.Y. Fung
where Rp > R + 1, but gives a stronger bound of 3. The root of Rp = R + 1 is, √ p for large p, just a bit larger than 2, so the two theorems together show a lower bound of at least 3 for almost all values of R. √ Moreover, as the nonpreemptive upper bound (Theorem 2) is 3 when R > p+1 2, this means that preemption with restart does not help for Rp > R + 1, which is quite a wide range for large p (for example when p = 2 it is equivalent to R > 1.618 but when p = 10 it becomes R > 1.076.) Theorem 4. No deterministic algorithm for the preemptive restart model can be better than (N + 2)-competitive. Proof. Release a job j at time 0 with a large deadline 2D + (N + 4)p and a total heat contribution h∗j = R − , for a very small > 0, where D is the time it takes for the temperature to drop from 1 to . If A never starts the job then the competitive ratio is infinite. So A will start thejob at some time u. p p−1 h At time u + p − 1, A’s temperature is given by τu+p−1 = i=1 Rji = RRp−R −1 . At time u + p − 1, release a tight job k with a heat contribution that means that 2−p τu+p−1 it is just too hot to be scheduled by A, i.e. h∗k > R − R = R − R−R p−1 Rp −1 . As k is too hot to be executed anyway, A will not preempt j and will continue to finish it. Meanwhile OP T does not start j and starts k. Assume OP T has temperature 0 before it starts k. After k has been completed by OP T we have 1−p h∗ 1 τu+2p−1 = Rp−1 , τu+2p−1 = Rk > 1 − 1−R Rp −1 . At time u + (i + 1)p − 1 for each i = 1, 2, ..., as long as τu+(i+1)p−1 > τu+(i+1)p−1 we release an OP T -only job ji . For i ≥ 1, the temperatures τu+(i+1)p−1 and τu+(i+1)p−1 and the heat contributions of jobs ji are given by τu+(i+1)p−1 =
1 , Rip−1
τu+(i+2)p−1 =
h∗ji > R − τu+(i+1)p−1
Rp
τu+(i+1)p−1 Rp−1
+
h∗ji R
This recursion can be solved to give τu+(i+1)p−1 >
R1−ip + Rp − 2R(1−i)p i−1 − ip−1 Rp − 1 R
To find the maximum number of OP T -only jobs we now need to find the largest possible i such that τu+(i+1)p−1 > τu+(i+1)p−1 , which is satisfied when p (i+1)p p iR(R − 1) > R + R − 2R , i.e. the same formula that defines N . OP T can schedule all the OP T -only jobs plus k and j: if u < D + p, then OP T will finish all j1 , ..., jN by time u + (N + 1)p − 1 + p < D + (N + 3)p − 1, and can still meet the deadline of j after taking D time steps of cooling time. If u ≥ D + p, OP T will schedule j at time 0 and will become cooler than (i.e. temperature almost 0) at time u, and thus can schedule all OP T -only jobs as above. A can only complete j. This gives a lower bound of N + 2.
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs
339
Theorem 5. Every deterministic algorithm for the preemptive restart model is at least 3-competitive when Rp > R + 1. Proof. (Sketch) Set a deterministic algorithm A. The lower bound construction works in phases. We first describe Phase 1. Let 0 be the temperature of OP T at the beginning of the phase (which is 0 for Phase 1 but will be some small positive value for later phases.) At time 0 release a job j1 with a total heat contribution of h∗j1 = R − 1 for some small 1 > 0, and a deadline D1 + 4p where D1 is the time it takes to cool down from a temperature of 1 to 1 . We choose a small enough 1 so that D1 is much larger than p. If j1 is not scheduled by A then OP T will schedule it and the competitive ratio of A is infinite, so we assume that A starts j1 at some time u1 . In the following we assume A will not preempt a currently running job unless it is to start another job (i.e. it will not preempt a job only to stay idle). If such a situation does happen, OP T will then act as if the preempted job has never been started - it can only be disadvantageous to A for raising its temperature without completing the job. Case 1: u1 ≥ p. At time u1 + p − 1 we release a job k1 with a heat contribution of 0 and a tight deadline. Regardless of whether A preempts j1 with k1 or not, A’s temperature at time u1 + 2p − 1 can be shown to be at least (because it executes at least p − 1 steps of j1 )
h∗ j1 . (R+1)Rp
OP T will start j1 at time 0 and h∗
0 also runs k1 , so by time u1 + 2p − 1 its temperature is at most Rj2p1 + R3p−1 . As p R > R + 1, OP T is cooler for small 0 , and we then release a job x1 at time u1 + 2p − 1 with a tight deadline and a heat contribution so that it is just too hot for A to schedule but OP T can schedule it. So OP T schedules 3 jobs and A schedules only one. If A has not preempted j1 , then we are done. If A has preempted j1 , it may restart the job later. This will be dealt with in Phase 2.
Case 2: u1 ≤ p − 1. At time u1 + 1 the adversary releases a job k1 with a tight h∗ deadline and a heat contribution h∗k1 that is just smaller than Rj1 − R0p . Suppose A does not preempt j1 . Then it cannot schedule k1 . OP T will then schedule k1 , h∗ h∗ 0 0 so at time u1 + p + 1 its temperature is just below Ru1+p+1 + Rj21 − Rp+1 ≤ Rj21 , and is therefore cooler than A, and so the adversary can release a job x1 at time u1 + p + 1 with a tight deadline and a heat contribution so that it is just too hot for A to schedule but OP T can schedule it. OP T waits D1 steps after completing x1 so that it is cool enough to schedule j1 . Since (u1 +p+1)+p+D1 +p ≤ D1 +4p, OP T can complete j1 before its deadline. OP T will have scheduled 3 jobs and A will have scheduled 1 and the lower bound is complete. Otherwise A must have preempted j1 with k1 . In this case the adversary releases a job l1 at time u1 + p with a tight deadline. Its heat contribution will be specified later. If A does not preempt k1 then it cannot schedule l1 . In this case OP T will schedule j1 at time u1 and l1 at u1 + p. We choose hl1 to be cool enough so that OP T will be cooler than A (which executed j1 for one time step and completed k1 ) at u1 + 2p. The adversary then releases a tight job x1 with a
340
M. Birks and S.P.Y. Fung
heat contribution h∗x1 so that it is just too hot for A to schedule but OP T can schedule it. OP T will have scheduled 3 jobs (j1 , l1 and x1 ), and immediately after x1 has completed in OP T , A will have completed 1 job. A may still be able to complete j1 in the future, which will be dealt with in Phase 2. Otherwise it must be that A preempted k1 with l1 . In this case the adversary releases a job m1 at time u1 + p + 1 with a heat contribution of 0 and a tight deadline of u1 + 3p + 1. If A does not preempt l1 then it cannot schedule m1 . In this case OP T will schedule k1 at u1 + 1 and m1 at u1 + p + 1. l1 has to be hot enough so that OP T is cooler than A (which has executed j1 for one time step, then k1 for p − 1 time steps, then l1 ) at time u1 + 2p + 1. We can show that such an hl1 that is simultaneously not too hot nor too cold does exist. The adversary then releases a tight job x1 at time u1 + 2p + 1 with a heat contribution h∗x1 so that it is just too hot for A to schedule but OP T can schedule it. In this case OP T have scheduled 3 jobs and A have completed 1 job, and still be able to complete j1 in the future, which will be dealt with in Phase 2. Otherwise it must be that A preempted l1 with m1 . In this case the adversary releases a job y1 at time u1 + 2p with a heat contribution of 0 and a tight deadline. A can either preempt m1 or not but either way only one of m1 or y1 can be completed by A. OP T will complete j1 , l1 and y1 . In this case OP T have scheduled 3 jobs and A have only completed 1 job, and may still be able to complete j1 in the future. Again we will deal with this in Phase 2. In all the above cases where A does not preempt j1 then we have already achieved a ratio of 3 and so we stop here. Otherwise A will still have j1 pending, and we begin Phase 2. Let s be the earliest time when A becomes cool enough to schedule j1 again (i.e. temperature at most 1 ). Define a time t = s − (2p + 2) and let 2 = τt . If s > dj1 − p then A cannot schedule j1 and we have achieved a ratio of 3 and we stop here. Otherwise we release a job j2 at time t = s −(2p+ 2), with deadline t + D2 + 4p and a heat contribution of h∗j2 = R − 2 , where D2 is the time it takes to cool down from a temperature of 1 to 2 . We can show that A cannot schedule both j1 and j2 : roughly speaking it is because there is not enough time to cool down between scheduling these two hot jobs. It can therefore be assumed without loss of generality that A will not schedule j1 , as j2 is cooler and has a later deadline. A must schedule j2 at some time u2 ; then we proceed as in Phase 1, releasing k2 , l2 , m2 , x2 and y2 as necessary. In this phase OP T can complete 3 jobs while A can complete at most one, and possibly have j2 still pending at the end of the phase. This process continues until either A does not have some ji pending that will become admissible before dji − p, or Phase n is reached for a large enough n 3n in which case we stop. In the latter case the competitive ratio is n+1 as OP T schedules 3 jobs in every phase whereas A schedules one job is every phase except Phase n where it schedules 2. We can show that all the i ’s can be kept small enough for the construction to work for any number of phases n. (There are technical details that we have skipped over here.) This concludes the proof as the ratio can be made arbitrarily close to 3 for large n.
Temperature Aware Online Algorithms for Scheduling Equal Length Jobs
4
341
The Preemptive Resume Model
Potentially, the preemptive resume model can allow for a much hotter job to be executed than the nonpreemptive or restart models: even if the heat contribution per step (hj ) of a job is almost R, it can stil be scheduled by taking a long enough idle time in-between any two scheduled steps of the job. However, it can be shown that such a model leads to bad results: Theorem 6. When the maximum heat contribution of a job per time step is R − for some sufficiently small , no deterministic algorithm for the preemptive resume model is better than pM -competitive, where M is as defined in Lemma 1. Therefore, in the following we assume the maximum permissible heat contribution of a job is the same as the nonpreemptive/restart case, i.e. h∗j = R. This also allows a fairer comparison between different models of preemption. We prove a lower bound that is precisely one smaller than the corresponding lower bound for the restart model. The proof is very similar to that of Theorem 4 and is therefore omitted. Theorem 7. No deterministic algorithm for the preemptive resume model can have a competitive ratio better than N + 1. √ Note that for R > p 2, the above theorem gives a trivial lower bound of 1. We can give a different lower bound (that works for any R > 1): Theorem 8. No deterministic algorithm for the preemptive resume model can have a competitive ratio better than 2.
References 1. Bansal, N., Kimbrel, T., Pruhs, K.: Dynamic speed scaling to manage energy and temperature. In: Proc. 45th Annual IEEE Symposium on Foundations of Computer Science, pp. 520–529 (2004) 2. Baruah, S.K., Haritsa, J.R., Sharma, N.: On-line scheduling to maximize task completions. In: Proc. 15th IEEE Real-Time Systems Symposium, pp. 228–236 (1994) 3. Birks, M., Fung, S.P.Y.: Temperature aware online scheduling with a low cooling factor. In: Proc. 7th Int. Conference on Theory and Applications of Models of Computation, pp. 105–116 (2010) 4. Chrobak, M., D¨ urr, C., Hurand, M., Robert, J.: Algorithms for temperature-aware task scheduling in microprocessor systems. In: Proc. 4th Int. Conference on Algorithmic Aspects in Information and Management, pp. 120–130 (2008) 5. Chrobak, M., Jawor, W., Sgall, J., Tich´ y, T.: Online scheduling of equal-length jobs: Randomization and restarts help. SIAM J. Comput. 36(6), 1709–1728 (2007) 6. Coskun, A.K., Rosing, T.S., Whisnant, K.: Temperature aware task scheduling in MPSoCs. In: Proc. of 2007 Design, Automation and Test in Europe Conference, pp. 1659–1664 (2007)
342
M. Birks and S.P.Y. Fung
7. Goldman, S.A., Parwatikar, J., Suri, S.: Online scheduling with hard deadlines. J. Algorithms 34(2), 370–389 (2000) 8. Hoogeveen, H., Potts, C.N., Woeginger, G.J.: On-line scheduling on a single machine: Maximizing the number of early jobs. Operations Research Letters 27(5), 193–197 (2000) 9. Irani, S., Pruhs, K.: Algorithmic problems in power management. SIGACT News 36(2), 63–76 (2005)
Visibility Testing and Counting Sharareh Alipour and Alireza Zarei Department of Mathematical Sciences Sharif University of Technology Tehran, Iran Abstract. For a set of n disjoint line segments S in R2 , the visibility counting problem (VCP) is to preprocess S such that the number of visible segments in S from a query point p can be computed quickly. For this configuration, the visibility testing problem (VTP) is to test whether p sees a fixed segment s. These problems can be solved in logarithmic query time by using O(n4 ) preprocessing time and space. In this paper, we approximately solve this problem using quadratic preprocessing time and space. Our methods are superior to current approximation algorithms in terms of both approximation factor and preprocessing cost. In this paper, we propose a 2-approximation algorithm for the VCP using at most quadratic preprocessing time and space. The query time √ of this method is Oε (n2 / k) where k is the preprocessing time and Oε (f (n)) = O(f (n)nε ). We also solve the VTP in expected logarithmic query time using quadratic time and space. Keywords: Computational geometry, visibility, approximation algorithm.
1
Introduction
Problem Statement. Assume that S is a set of n disjoint(except at their endpoints) line segments in the plane. For simplicity, we assume that there is a bounding box that contains all segments. Two points p, q ∈ R2 see each other with respect to (wrt) S if the line segment pq does not intersect a segment of S. A segment st ∈ S is visible (wrt S) from a point p if there exists a point q ∈ st such that p and q are visible from each other. Visibility computation is a basic problem in graphics and visualization applications and therefore, it has been considered thoroughly in computer graphics and computational geometry literatures [2,4,11,13]. In this paper, we consider the visibility testing problem (VTP) and the visibility counting problem (VCP) to be defined as follows. In VTP, for any query point p and a given fixed segment s we need to test if p and s are visible. In VCP, for any query point p we need to find the number of segments of S which are visible from p. Basic Definitions. The visibility region or the visibility polygon of a given point p ∈ R2 (wrt S) is defined as VS (p) = {q ∈ R2 : p and q are visible (wrt S)}. Similarly, the visibility polygon of a given segment st is defined as M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 343–351, 2011. c Springer-Verlag Berlin Heidelberg 2011
344
S. Alipour and A. Zarei
Fig. 1. (a) The visibility polygon for a point p and (b) The visibility polygon of a line segment s [9]
Fig. 2. (a) The visibility graph and (b) The extended visibility graph [9]
VS (st) =
q∈st
VS (q) ={p ∈ R2 : st and p are visible (wrt S)}.
Fig 1 shows the visibility polygons of a point p and a segment s inside a given scene. If we consider the 2n endpoints of the segments of S as vertices of a graph and add an edge between each pair of nodes whenever they see each other, the resulting graph is called the visibility graph of S and is denoted by V G(S) (See Fig 2.(a)). The visibility graph has useful visibility information from which the visibility polygon of each segment endpoint can be obtained. If we extend the edges of V G(S) in both directions until intersecting the first segment in S, some new edges and vertices produced. Adding these new edges and vertices to V G(S) results a new graph called extended visibility graph or EV G(S) (See Fig 2.(b)). The extended visibility graph reflects all visibility information from which the visibility polygon of a segment st ∈ S can be computed. For any given query point p there are four types of visible segments (See Fig 3), 1. Lp : The segments that their left endpoints are visible from p and their right endpoints are not visible, 2. Rp : The segments that only their right endpoints are visible from p and their left endpoints are not visible, 3. LRp : The segments that their both endpoints are visible from p,
Visibility Testing and Counting
345
Mid R
LR
L
p
Fig. 3. Types of visible segments from the point p
4. M idp : The segments that are visible from p but none of their endpoints are visible. Here, the left and right endpoints of a segment s are defined according to the order of sweeping these endpoints by a radial sweep line around p, and are respectively denoted by sl and sr . For a query point p, we say that a visible segment is endpoint visible if it belongs to Rp , Lp or LRp . Otherwise, the visible segment is called midpoint visible. Related Work. The visibility polygon of a point p (wrt S) can be computed in optimal O(n log n) time using O(n) storage [3,12]. This can be done by sorting the endpoints of segments of S radially around p and processing them in this order using a binary search tree in which the segments intersected by the sweep ray emanating from p are maintained according to their intersections on this ray. There is an optimal O(n log n + m) time algorithm to compute the visibility graph of a set of n disjoint line segments where m = O(n2 ) is the number of the edges of V G(S) [7]. This algorithm can also be used to compute the extended visibility graph in O(n log n + m) time [7]. The VTP and VCP can be solved using the extended visibility graph. Considering the planar arrangement of the edges of EV G(S) as a planar graph, all points of a face of this arrangement have the same number of visible segments. Therefore, we can compute these numbers for each face in a preprocessing step and then, for each query point it is enough to locate the face containing this point. There are O(n4 ) faces in the planar arrangement of EV G(S). Then, a point location structure of size O(n4 ) can answer each query in O(log n) time. Trivially, O(n4 ) preprocessing time and space is too high to be used in practice. On the other hand, without any preprocess, the query can be answered in O(n log n) time. This query time is also high enough to be used in practice. There are several other results with a tradeoff between the preprocessing cost and the query time [2,4,11,13] (see the visibility book by Kumar Ghosh for a complete survey on visibility results [8]). Therefore, the main concern in the VTP and VCP is to obtain approximation algorithms of lower preprocessing cost (compare to O(n4 )) in expense of higher than logarithmic query time. Moreover, the preference is to obtain close estimation to the exact value of the answer for these problems. Suri and O’Rourke introduced the first 3-approximation algorithm for the VCP based on representing a region by the union of a set of convex (triangular) regions [12]. Gudmundsson and Morin improved this method to a 2approximation algorithm using an improved covering scheme [9]. Their method
346
S. Alipour and A. Zarei
builds a data structure of size Oε (n2(1+α) ) in preprocessing time of Oε (n2(1+α) ) and performs a query in Oε (n(1−α) ) time where 0 < α ≤ 1 and Oε (f (n)) = O(f (n)nε ). The computed value in this method is a 2-approximation of the correct answer. Precisely, when a query point p sees mp segments of S, the method returns a value mp such that mp ≤ mp ≤ 2mp . They also introduced a method for the VTP by maintaining the visibility polygon of the given segment s in a partition√tree. This method uses a data structure of size O(k) and answers in Oε (ms / k) time if a query point p is contained in VS (s) (for any k with ms ≤ k ≤ m2s ) where ms is the number of edges in EV G(S) which are incident to s. There are two other approximation algorithms for the VCP by Fischer et. al. [5,6]. One of these algorithms uses a data structure of size O((m/r)2 ) to build a (r/m)-cutting for the EV G(S) by which the queries are answered in O(log n) time with an absolute error of r compare to the exact answer. The other algorithm uses a random sampling method to build a data structure of size O((m2 log O(1) n)/l) to answer a query in O(l logO(1) n) time. In the latter method, the answer of the VCP is approximated up to an absolute value of δn for any constant δ > 0 (The constant δ affects the constant factor of both data structure size and query time of this method). They also introduced an algorithm for the VTP with O(m2s /l) space that answers a query in O(l log n) time where l ≥ 1 is the space/query time tradeoff parameter of the algorithm. Our Results. We introduce a new method for the VTP which uses a data structure of size O(n2 ). The average query time in our method is O(log n) which is better compare to the previous results. We also introduce a new method for estimating the answer of the VCP. Similar to the previous method, our method is also a 2-approximation solution. The main difference between our method and Gudmundsson and Morin’s method is that they considered visibility polygons of all segments while we only considered some parts of these visibility polygons. In section 2, we present the new method for the VTP and in Section 3 the new method for the VCP is presented.
2
The Visibility Testing Problem
In this section, we propose an algorithm to solve the VTP. For a given segment s ∈ S and a query point p, if s is invisible from p there must be a subset S ⊂ S−s such that the projection of segments in S from p totally covers s. Therefore, we can answer the VTP by checking whether any point q ∈ s is the projection of a point q ∈ s for some s ∈ S . This can be done by starting from one endpoint of s and moving to the other endpoint (without loss of generality, we start from the left endpoint), if ls is visible from p then it cannot be the projection of some point of a segment in S − s and it means that s and p are visible. Otherwise, assume that sl is the projection of a point q ∈ s such that s ∈ S − s and q is the closest point to sl . Then, the projection of s on s covers a subsegment sl t of s which means that we should only check the parts of s that lie on the right of t.
Visibility Testing and Counting
s
sr s’r
q’
s
sr
l
s’
s’r
p (a)
sr
s’r
s’
s
t s”
q’
p
(c)
s
t
t’
s
l
s’
sr l
s
347
s’
p (b)
s t q’ s”
s
l
s’r
p (d)
Fig. 4. The algorithm for the VTP begin from the left endpoint to right endpoint. (a) the case where s completely covers s. (b) s is the first segment that projection of sr is on it and s and p are visible. (c) and (d) the case where s is the last segment intersected by the ray psr before intersecting s.
If sl t completely covers s then s is not visible from p (See Fig 4(a)). Otherwise, we must continue on tsr . This is done by checking whether sr and p are visible. If sr and p are visible from each other and s is the first segment of S that is →r beyond the point s , we can say that p is visible form intersected by the ray − ps r a point t ∈ tsr with an arbitrarily small distance to t. If so, p and s are visible (See Fig 4(b)). Otherwise, assume that s is the last segment intersected by the −→ ray psr beyond sr before intersecting s. Now we can continue on s in the same way as what is done for s (See Fig 4(c) and (d)). This algorithm is shown formally in Algorithm 1. This algorithm returns true if and only if there is a point on s that is not covered by the projection of segments S − s from p on s. This is equivalent to the answer of the VTP which implies the correctness of this algorithm. For a fixed segment s,the running time of this algorithm depends on the number of steps in which the algorithm processes the set of segments S each of which covers at least one point q on s and s is the closest segment to s among all segments intersected by pq. This set is denoted by cs (p)(See Fig 5). Other than cs (p), the running time of this algorithm depends on the way we find the segment s in lines 11 and 20 of the algorithm. In these lines we find the last segment(before s) intersected by psr . Assume that for each endpoint sr we can answer this query in O(log n) time. Then, the total time complexity of this algorithm is O(|cs (p)| log n) where |.| is the size of the corresponding set. Now we explain the required data structures to answer this query in logarithmic time. For any point q we can maintain a radial decomposition RD(q) around q to be defined as follows. We connect q to each endpoint r and sort these segments radially around q. The answer of the last intersected segment for a point p depends on the region of RD(q) through which the → ray − pq passes. Therefore, we can compute these answers for all ranges of RD(q) in preprocessing step. Then, for any point p we can answer the last intersected segment query in O(log n) time. We must build the RD data structures for all endpoints of the segments. The size of each RD is O(n) and it can be constructed in O(n log n) time. The algorithm is the same as the O(n log n) algorithm which
348
S. Alipour and A. Zarei
Algorithm 1. The Visibility Testing Algorithm 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:
Input: S: a set of segments s ∈ S: a given segment p: a query point Output: true: if s is visible from p false: otherwise if p and sl are visible from each other then return true else →l before intersecting s let s be the last segment intersected by − ps while true do let qr be the projection of s from p on s if sr ∈ qr then return false else −→ if s is the only segment intersected by psr before intersecting s then return true else −→ let s be the last segment intersected by psr before intersecting s (except s itself) end if end if end while end if
computes the visibility polygon of a point [3,12]. Therefore, the total preprocessing time is O(n2 log n) and the required space is O(n2 ). Then we can answer the VTP in O(|cs (p)| log n) time. Lemma 1. The expected size of cs (p) is O(1) Proof. For each segment s, cs (p) contains two types of segments: the projection of an endpoint p of s ∈ cs (p) directly covers a point of s, or none of the endpoints of a segment s ∈ cs (p) directly covers a point of s. In the first case, there is no segment between the endpoint and its projection on s. These segment types are respectively denoted by e(cs (p)) for endpoint cover and m(cs (p)) for midpoint cover (See Fig 5). Trivially, e(cs (p)) and m(cs (p)) are disjoint and cs (p) = e(cs (p)) m(cs (p)). Now we prove that |m(cs (p))| ≤ |e(cs (p))| + 1 which completes the proof of Lemma 1. Assume that t1 and t2 are two segments in m(Cs (p)). It is trivial to see that there is one segment t ∈ e(cs (p)) which covers a partition of s between the partitions covered by s1 and s2 . Therefore, if we sort the segments in m(cs (p)) according to the partitions of s covered by these segments, there is at least one segment in e(cs (p)) which covers a partition of s lieing between the partitions covered by two consequence segments in m(cs (p)). This means that |m(cs (p))| ≤ |e(cs (p))| + 1.
Visibility Testing and Counting
349
s 2
3
4
1
p
Fig. 5. The segments that cover s are the set {1, 2, 3, 4, } from which {2} = m(cs (p)) and {1, 3, 4} = e(cs (p))
It is simple to see that each of e(Cs (p)) for at segment t can be a member most two segments s. Then, |c (p)| = |e(c (p))|+ s s s∈S s∈S s∈S |m(cs (p))| ≤ 2 s∈S |e(cs (p))| + 1 = O(n). Therefore, the expected size of cs (p) of a randomly chosen segment s is O(n)/n = O(1). Combining the result of Lemma 1 and above discussions, we have the following Corollary: Corollary 1. The VTP can be answered in O(log n) expected query time using O(n2 log n) preprocessing time and O(n2 ) space.
3
The Visibility Counting Problem
In this section we prove a theorem from which we can obtain a simple algorithm for the VCP. Theorem 1. |Lp | + 2|LRp| + |Rp | is a 2-approximation for the VCP of a query point p. Proof. This theorem means that mp ≤ |Lp | + 2|LRp | + |Rp | ≤ 2mp where mp is the answer of the VTP for a point p. For each segment of type M idp or Lp there should be at least a segment in Lp or LRp which covers the right endpoint of this segment. Therefore, we can assign for each segment s of type M idp or Lp the nearest segment to s that causes the right endpoint of s to be invisible. It is apparent that this latter segments must be in LRp or Lp and each of these segments are assigned to at most one segment. So, we have |M idp | + |Lp | ≤ |LRp | + |Lp | which results |M idp | ≤ |LRp |. By using this inequality, we have mp = |M idp | + |LRp | + |Rp | + |Lp | ≤ |Lp | + 2|LRp | + |Rp | ≤ mp + |LRp | ≤ 2mp. Based on Theorem 1, we propose a 2-approximation algorithm for the VCP which is simpler than the method proposed by Gudmundsson and Morin [9].
350
S. Alipour and A. Zarei
We can answer the VCP by obtaining the visibility polygon of all segments endpoints in a preprocesses phase. Then, for each query point p we check these O(n) visibility polygons and obtain the number of visibility polygons that contain p. This can be done in O(n log n) and returns a 2-approximation for the VCP. The preprocessing time and space of this method is O(|V GS |). This query time is too high and we can spend O(n log n) to answer the correct value of VCP. But, we can spend more preprocessing cost to obtain better query time. This is done by using the partition tree technique [1,10] in the same way as used by Gudmundsson [9].The following is the theorem used by Gudmundsson. Theorem 2. ([1,10]) Let T be a set of n triangles. For any k with n ≤ k ≤ n2 , there exists a data structure of size O (k) that can be constructed in time O (k) by which √ the number of triangles containing a query point p can be counted in O (n/ k) time. The visibility polygons are composed of at most O(n2 ) triangles. According to Theorem 2, we can put these triangles in a partition tree of size O (k) in O (k) time. Then, √ the number of triangles containing any query point q is obtained in O (n2 / k) time where n2 ≤ k ≤ n4 . This number is equal to |Lp |+2|LRp |+|Rp | which according to Theorem 1 is a 2-approximation for the VCP.
4
Conclusion
In this paper we proposed methods for the VTP and VCP problems which are both superior to the current methods. Our method for the VCP is a 2approximation and our method for the VTP is an optimal query time algorithm in average case. We used the partition tree data structure in our methods which is a general data structure for representing a set of polygons in the plane. Building a special version of partition tree which is appropriate for the visibility problems with possibly smaller size and construction time is an open direction for farther researches.
References 1. Agarwal, P.K., Erickson, J.: Geometric range searching and its relatives. In: Chazelle, B., Goodman, J.E., Pollack, R. (eds.) Advances in Discrete and Computational Geometry, Contemporary Mathematics, vol. 223, pp. 1–56. American Mathematical Society Press, Providence (1999) 2. Aronov, B., Guibas, L.J., Teichmann, M., Zhang, L.: Visibility queries and maintenance in simple polygons. Discrete and Computational Geometry 27, 461–483 (2002) 3. Asano, T.: An efficient algorithm for finding the visibility polygon for a polygonal region with holes. IEICE Transactions, 557–589 (1985) 4. Bose, P., Lubiw, A., Munro, J.I.: Eficient visibility queries in simple polygons. Computational Geometry Theory and Applications 23(7), 313–335 (2002)
Visibility Testing and Counting
351
5. Fischer, M., Hilbig, M., Jahn, C., auf der Heide, F.M., Ziegler, M.: Planar visibility counting. CoRR, abs/0810.0052 (2008) 6. Fischer, M., Hilbig, M., Jahn, C., auf der Heide, F.M, and Ziegler, M.: Planar visibility counting. In: Proceedings of the 25th European Workshop on Computational Geometry(EuroCG 2009), pp. 203–206 (2009) 7. Ghosh, S.K., Mount, D.: An output sensitive algorithm for computing visibility graphs. SIAM Journal on Computing 20, 888–910 (1991) 8. Ghosh, S.K.: Visibility algorithms in the plane. Cambridge University Press, Cambridge (2007) 9. Gudmundsson, J., Morin, P.: Planar visibility: testing and counting. In: Annual Symposium on Computational Geometry, pp. 77–86 (2010) 10. Matoutsek, J.: Effcient partition trees. Discrete and Computational Geometry 8, 315–334 (1992) 11. Pocchiola, M., Vegter, G.: The visibility complex. International Journal of Computational Geometry and Applications 6(3), 279–308 (1996) 12. Suri, S., O’Rourke, J.: Worst-case optimal algorithms for constructing visibility polygons with holes. In: Proceedings of the Second Annual Symposium on Computational Geometry (SCG 1984), pp. 14–23 (1984) 13. Zarei, A., Ghodsi, M.: Efficient computation of query point visibility in polygons with holes. In: Proceedings of the 21st Annual ACM Symposium on Computational Geometry (SCG 2005) (2005)
The Nearest Neighbor Spearman Footrule Distance for Bucket, Interval, and Partial Orders Franz J. Brandenburg, Andreas Gleißner, and Andreas Hofmeier University of Passau 94030 Passau, Germany {brandenb,gleissner,hofmeier}@fim.uni-passau.de
Abstract. Comparing and ranking information is an important topic in social and information sciences, and in particular on the web. Its objective is to measure the difference of the preferences of voters on a set of candidates and to compute a consensus ranking. Commonly, each voter provides a total order of all candidates. Recently, this approach has been generalized to bucket orders, which allow ties. In this work we further generalize and consider total, bucket, interval and partial orders. The disagreement between two orders is measured by the nearest neighbor Spearman footrule distance, which has not been studied so far. We show that the nearest neighbor Spearman footrule distance of two bucket orders and of a total and an interval order can be computed in linear time, whereas the computation is NP-complete and 6-approximable for a total and a partial order. Moreover, we establish the NP-completeness and the 4-approximability of the rank aggregation problem for bucket orders. This sharply contrasts the well-known efficient solution of this problem for total orders.
1
Introduction
The rank aggregation problem consists in finding a consensus ranking on a set of candidates, based on the preferences of individual voters. The problem has many applications including meta search, biological databases, similarity search, and classification [2,7,11,15,18,19,20,24]. It has been mathematically investigated by Borda [6] and Condorcet [8] (18th century) and even by Lullus [16,17] (13th century) in the context of voting theory. The formal treatment of the rank aggregation problem is determined by the strictness of the preferences. It is often assumed that each voter makes clear and unambiguous decisions on all candidates, i. e., the preferences are given by total orders. However, the rankings encountered in practice often have deficits against the complete information provided by a total order, as voters often come up with unrelated candidates, which they consider as tied (“I consider x and y coequal.”) or incomparable (“I cannot compare x (apples) and y (oranges).”). Voters considering all unrelated pairs of candidates as tied are represented by bucket orders, such that ties define an equivalence relation on candidates within a bucket. They are also known as partial rankings or weak orders [1,12]. As incomparable pairs of candidates come into play, more general orders are needed: M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 352–363, 2011. c Springer-Verlag Berlin Heidelberg 2011
The Nearest Neighbor Spearman Footrule Distance
353
A ranking is an interval order if the voters specify their preferences by associating an interval with each candidate. Candidate x is then preferred over y if the interval of x ends before the one of y begins, while overlapping intervals represent incomparabilities or ties. In the most general case the voters describe their preferences by partial orders. In this case unrelatedness (ties and incomparabilities) is not transitive and the preference relation is not negatively transitive. In all orders for two unrelated candidates, no matter if they are tied or incomparable, the voter accepts any local order on them without penalty or cost. Nevertheless, we will stress the different intuition behind unrelated candidates by speaking of tied candidates (∼ =) in bucket orders and of unrelated ( ≺, meaning tied or incomparable) candidates in interval or partial orders. The common distance measures for two total orders σ and τ are the Kendall tau and the Spearman footrule distance, K(σ, τ ) and F (σ, τ ). K(σ, τ ) counts the number of disagreements of candidates, while F (σ, τ ) accumulates the mismatches, summing the distances of the positions of each candidate. Investigations on ranking problems have focused on total orders or permutations. Its generalization to bucket orders has been considered more recently by Ailon [1] and Fagin et al. [12]. The focus and main result in [12] is the equivalence of several distance measures, especially the Hausdorff versions of the Kendall tau and Spearman footrule distances introduced by Critchlow [9]. Ailon [1] studied the nearest neighbor Kendall tau distance for bucket orders. In this work we generalize rankings to partial and interval orders, and measure the distance by the nearest neighbor Spearman footrule distance. Our emphasis is on the complexity of computing distances and rank aggregations. We establish a sharp separation between efficient algorithms and NP-completeness. In particular, we show that the nearest neighbor Spearman footrule distance can be computed in linear time for two bucket orders and for a total and an interval order. In contrast, these computations are NP-complete for a total and a partial order, and hence for the more general cases. Concerning the Spearman footrule distance and total orders, the rank aggregation problem can be solved efficiently using a weighted bipartite matching [11]. This sharply contrasts our NP-completeness result for the rank aggregation problem with bucket orders. Furthermore, we establish the equivalence between the nearest neighbor Spearman footrule distance and the nearest neighbor Kendall tau distance, which means that they are within constant multiple of each other. Finally, we achieve constant factor approximations for the computation of the nearest neighbor Spearman footrule distance of a total and a partial order as well as for the rank aggregation problem for bucket orders. This work is organized as follows: In Sect. 2 we introduce orders and distances. In Sect. 3 and Sect. 4 we consider the complexity of distance and rank aggregation problems. Sect. 5 addresses the equivalence of the nearest neighbor Kendall tau and Spearman footrule distances of partial orders and establishes the constant factor approximability for some problems, which we have shown to be NP-complete. We conclude with some open problems in Sect. 6.
354
2
F.J. Brandenburg, A. Gleißner, and A. Hofmeier
Preliminaries
For a binary relation R on a domain D and for each x, y ∈ D, we denote x ≺R y if (x, y) ∈ R, and x ⊀R y if (x, y) ∈ / R. A binary relation κ is a (strict) partial order if it is irreflexive, asymmetric and transitive, i. e., x ⊀κ x, x ≺κ y ⇒ y ⊀κ x, and x ≺κ y ∧ y ≺κ z ⇒ x ≺κ z for all x, y, z ∈ D. Candidates x and y are called unrelated if x ⊀κ y ∧y ⊀κ x, which we denote by x κ y. The intuition of x ≺κ y ≺ is that κ ranks x before y, which means a preference for x. A partial order α is an interval order if there is a bijection I from D into a set of intervals with I(x) = [lx , rx ] and x ≺α y ⇔ rx < ly . W. l. o. g., the boundaries of the intervals are integers between 1 and |D|. A partial order π is a bucket order if it is irreflexive, asymmetric, transitive and negatively transitive, which says that for each x, y, z ∈ D, x ≺π y ⇒ x ≺π z ∨z ≺π y. Hence, the domain is partitioned into a sequence of buckets B1 , . . . , Bt such that x ≺π y if there are i, j with i < j and x ∈ Bi and y ∈ Bj . Note that x and y are unrelated if they are in the same bucket. Thus, unrelatedness is an equivalence relation on tied candidates x ∼ =π y within a bucket. Finally, a partial order τ is a total order if it is irreflexive, asymmetric, transitive and complete, i. e., x ≺τ y ∨ y ≺τ x for all x, y ∈ D with x = y. Then τ is a permutation of the elements of D. τ can also be considered as a bijection τ : D → {1, . . . , |D|}. Clearly, total ⊂ bucket ⊂ interval ⊂ partial, where ⊂ expresses a generalization. For two total orders σ and τ the Kendall tau distance counts the disagreements or inversions of pairs of candidates, K(σ, τ ) = |{{x, y} ⊆ D : x ≺σ y ∧ y ≺τ x}|. The Spearman footrule distance is the L1 -norm taking the difference of the po sitions of the candidates into account, F (σ, τ ) = x∈D |σ(x) − τ (x)|. We consider distances between generalized orders based on their sets of total extensions. A total order τ is a total extension of a partial order κ if τ does not contradict κ, i. e., x ≺κ y ⇒ x ≺τ y for all x, y ∈ D. Definition 1. For partial orders κ and μ on a domain D define the nearest neighbor Spearman footrule and Kendall tau distances via their extensions, FN N (κ, μ) = min{F (τ, σ) : τ ∈ Ext(κ), σ ∈ Ext(μ)} KN N (κ, μ) = min{K(τ, σ) : τ ∈ Ext(κ), σ ∈ Ext(μ)} Observe that the nearest neighbor distances fail the axioms of a metric. They do neither satisfy the identity of indiscernible d(x, y) = 0 ⇔ x = y nor does the triangle inequality hold. Proposition 1. The nearest neighbor Kendall tau and Spearman footrule distances coincide with their mates on total orders τ and σ, i. e. KN N (τ, σ) = K(τ, σ) and FN N (τ, σ) = F (τ, σ). In this work we consider the following problems.
The Nearest Neighbor Spearman Footrule Distance
355
Definition 2. Given two orders κ and μ on a domain D and an integer k, the distance problem for a distance d is whether or not d(κ, μ) ≤ k. Definition 3. Given orders κ1 , . . . , κr on a domain D and an integer k, the rank aggregation problem a distance d is whether or not there exists a total for r order τ on D such that i=1 d(κi , τ ) ≤ k. A total order τ ∗ minimizing k is a consensus ranking. For a partial order κ on a domain D and a set X ⊆ D we write [X ] if X is totally ordered by κ in a way that is clear from the respective context. For sets X , Y ⊆ D, we write X ≺κ Y if x ≺κ y for all x ∈ X and y ∈ Y. We call X unrelated by κ if xi κ xj for all xi , xj ∈ X . ≺ In the following proofs we use shifting and switching operations on total orders. For two total orders σ1 and σ2 on a domain D and candidates x, y ∈ D we say that σ2 is derived from σ1 by shifting x up to position p if σ2 (c) = σ1 (c) for all c ∈ D with σ1 (c) < σ1 (x) or with σ1 (c) > p, and if σ2 (c) = σ1 (c) − 1 for all c ∈ D with σ1 (x) < σ1 (c) ≤ p, and if σ2 (x) = p. Shifting x down to position p is defined analogously. We say that σ2 is derived from σ1 by switching x and y, if σ2 (c) = σ1 (c) for all c ∈ D \ {x, y}, and if σ2 (x) = σ1 (y), and if σ2 (y) = σ1 (x).
3
Distance Problems
In this section we address the computation of the nearest neighbor Spearman footrule distance of two bucket orders, of a total and an interval order and of a total and a partial order. Theorem 1. The nearest neighbor Spearman footrule distance of two bucket orders can be computed in linear time. Proof. (Sketch) We start with the definition of an operation, that breaks ties within a bucket order. The refinement of a bucket order γ by a bucket order π is the bucket order π ∗ γ such that x ≺π∗γ y ⇔ x ≺γ y ∨ x ∼ =γ y ∧ x ≺π y holds for all x, y ∈ D. Hence, a tie in γ may be broken by π. Clearly, if π is a total order, then π ∗ γ is a total order. ∗ is an associative operation, so for a third bucket order η on D, η ∗ π ∗ γ makes sense. Note that refinement is only defined for bucket orders, but not for interval or partial orders. Fagin et al. [12] have characterized the Hausdorff Spearman footrule distance of two bucket orders in terms of refinements. Adopting techniques from [12], we obtain the corresponding characterization for the nearest neighbor Spearman footrule distance of two bucket orders γ and π on a domain D and derive FN N (γ, π) = F (ρ ∗ π ∗ γ, ρ ∗ γ ∗ π), where ρ is an arbitrary total order on D. The theorem follows, since refinements as well as the Spearman footrule distance between two total orders can obviously be computed in linear time. Theorem 2. The nearest neighbor Spearman footrule distance of a total and an interval order can be computed in linear time.
356
F.J. Brandenburg, A. Gleißner, and A. Hofmeier
Proof. (Sketch) Let α be an interval order on a domain D with an interval [lx , rx ] for each candidate x ∈ D, and let σ be a total order on D. Then the following algorithm computes a total order τ ∗ ∈ Ext(α) with F (τ ∗ , σ) = FN N (α, σ). The algorithm successively builds τ ∗ taking |D| steps. For k = 1, . . . , |D| it determines x ∈ D with τ ∗ (x) = k. We will refer to this as x being placed at position k. In each step k the algorithm holds the set Ak of α-admissible candidates consisting of all not yet placed candidates x, for which all candidates y with y ≺α x have already been placed. Due to the specification of the α-admissible candidates, τ ∗ ∈ Ext(α) holds. Lk contains all late candidates x ∈ Ak , whose contribution to F (τ ∗ , σ) increases by one in the k + 1-th step if x is not placed in the k-th step. Ek contains all early candidates x ∈ Ak , whose contribution will decrease by one. If there are any late candidates, the algorithm places any at position k. Otherwise, it chooses one of the early candidates x with the smallest right interval boundary rx .
1 2 3 4 5 6 7 8 9
Input: Interval order α, total order σ on a domain D Output: Total order τ ∗ ∈ Ext(α) with F (τ ∗ , σ) = FN N (α, σ) foreach x ∈ D do set τ ∗ (x) ←⊥; for k = 1, . . . , |D| do Ak = {x ∈ D : τ ∗ (x) =⊥ ∧∀y≺α x τ ∗ (y) =⊥}; Lk = {x ∈ Ak : σ(x) ≤ k}; Ek = {x ∈ Ak : σ(x) > k}; if Lk = ∅ then choose an arbitrary x ∈ Lk and set τ ∗ (x) ← k; else choose an arbitrary x ∈ Ek with rx = miny∈Ek ry and set τ ∗ (x) ← k;
10 11
return τ ∗ ; Algorithm 1. Computing FNN of an interval order and a total order
To prove the correctness of Algorithm 1, we consider the set of optimal orders τ ∈ Ext(α) with F (τ, σ) = FN N (α, σ). We compare the total order τ ∗ computed by Algorithm 1 with the optimal order τ , which coincides with τ ∗ on the positions 1, . . . , z and z is maximal. Then τ ∗ places some candidate y at position z + 1, whereas y is placed at a later position by τ . By an analysis of the possible cases, it can be shown that y can be shifted in τ to position z + 1 while preserving the Spearman footrule distance to σ. Thus, we obtain another optimal order with a larger coincidence with τ ∗ . From these observations we can conclude that τ ∗ is optimal, too, and Algorithm 1 is correct. For the linear run time, instead of rebuilding Ak , Lk and Ek at each step, we implicitly hold them in an array a of length |D|, in which the beginning (resp. the end) of the interval of each not yet placed candidate x ∈ D is stored
The Nearest Neighbor Spearman Footrule Distance
357
at a[i] iff lx = i (resp. iff rx = i), and a pointer p on the smallest rx of all α-admissible candidates. Recall that the boundaries of the intervals of α are integers between 1 and |D|, so that a can be initialized via bucket sort. a and p can be updated within each step in amortized O(1) time, as each candidate only once is removed from a, becomes α-admissible, and switches from early to late during the execution of the algorithm. As the computation of the Spearman footrule distance on total orders can be implemented to run in linear time, the theorem follows. A partial order completely changes the picture, and shows a sharp separation between an interval and a partial order, when the distance to a total order is of concern. By a reduction from Clique [13] we show: Theorem 3. The distance problem for the nearest neighbor Spearman footrule distance of a total and a partial order is NP-complete. Proof. Let a graph G = (V, E) with V = {v1 , . . . , vn } and E = {e1 , . . . , em } and a positive integer k be an instance of Clique. Clearly, Clique remains NP-complete for k ≥ 3. For convenience let k ∗ = k + k2 . Furthermore, Clique remains NP-complete for m ≥ k ∗ , as otherwise we add pairs of vertices vi , vi and edges {vi , vi } for 1 ≤ i ≤ k∗ to V and E. We therefore assume k ≥ 3 and m ≥ k∗ . We reduce to an instance of the distance problem, i. e., a domain D, a partial order κ and a total order σ on D, and a positive integer k ∈ N as follows. We use V and E as sets of candidates, introduce two additional sets of candidates B = {b1 , . . . , bn8 } and F = {f1 , . . . , fm−k∗ } and let D = V ∪ E ∪ B ∪ F. Now construct σ = [E] ≺σ [B] ≺σ [V] ≺σ [F ] with V, E, B and F each being consecutively totally ordered by σ. κ is constructed as follows: F is consecutively totally ordered by κ, while V, E and B are each unrelated by κ. Furthermore b ≺κ c for each b ∈ B and c ∈ {V ∪ E ∪ F } and f ≺κ c for each f ∈ F and c ∈ {V ∪ E}. Finally, the most important part of κ is the specification for V and E. Here for each v ∈ V, e ∈ E, we set v ≺κ e if e is incident to v in G and v refer to thisas the incidence property). To complete ≺κ e, otherwise (we will the reduction, we set k = 2m − 2 k2 n8 + n7 . We show that G contains a clique of size at least k iff FN N (κ, σ) ≤ k . “⇒”: First suppose that G contains a clique of size k, i. e., a complete subgraph G = (V , E ) with |V | = k and therefore |E | = k2 . We now compute a total order τ ∗ on D and show that τ ∗ ∈ Ext(κ) and F (τ ∗ , σ) ≤ k . Let τ ∗ = [F ] ≺τ ∗ [V ] ≺τ ∗ [E ] ≺τ ∗ [B] ≺τ ∗ [V \ V ] ≺τ ∗ [E \ E ] with B and F being consecutively totally ordered and V , E , V \ V and E \ E being arbitrarily totally ordered. Now τ ∗ ∈ Ext(κ), as τ ∗ keeps the incidence property and all other constraints of κ. Considering F (τ ∗ , σ), it is easy to see that τ ∗ and σ both rank m candidates before b1 . As both consecutively totally order B, we have τ ∗ (b) = σ(b) for all b ∈ B and the contribution of each b ∈ B to F (τ ∗ , σ) is zero. Due to its effect, we will refer to B as the blocker in the following.
358
F.J. Brandenburg, A. Gleißner, and A. Hofmeier
For all candidates c ∈ {V ∪ E ∪ F } we now distinguish whether they are ranked before the blocker by both τ ∗ and σ (type 1 ), ranked after the blocker by both τ ∗ and σ (type 2 ), or ranked before the blocker by τ ∗ and after the blocker by σ or vice versa (type 3 ). Following the definition of τ ∗ and σ, all e ∈ E are of type 1, all v ∈ V \ V are oftype 2 and all c ∈ {F ∪ V ∪ (E \ E )} are of type 3. In total there are n − k + k2 ≤ n + m candidates of type 1 and 2, and 2m − 2 k2 candidates of type 3. As both τ ∗ and σ rank m candidates before the blocker and n + m − k ∗ ≤ n + m candidates after the blocker, the contribution of a candidate of type 1 or 2 to F (τ ∗ , σ) is at most n + m, while the contribution of a candidate of type 3 is at most |D| = n8 + n + m + m − k ∗ ≤ n8 + n + 2m. Summing up these contributions, we derive F (τ ∗ , σ) ≤ k and thus FN N (κ, σ) ≤ k . “⇐”: Now suppose FN N (κ, σ) ≤ k , i. e., there exists a total order τ + ∈ Ext(κ) with F (τ + , σ) ≤ k . We first show that then there is a total order τ ∗ ∈ Ext(κ) with F (τ ∗ , σ) ≤ k and additionally τ ∗ (bi ) = σ(bi ) for all bi ∈ B. Therefore, choose the total order τ1 ∈ Ext(κ) with F (τ1 , σ) = FN N (κ, σ), that ranks the longest prefix of b1 , . . . , bn8 in the same way as σ does, i. e., τ1 maximizes the quantity z such that s ≤ z ⇒ σ(bs ) = τ1 (bs ). If z = n8 , we are done, so suppose by contradiction z < n8 and consider candidate bz+1 . We now obtain a total order τ2 from τ1 , which ranks b1 , . . . , bz , and bz+1 the same way as σ does. If τ1 (bz+1 ) > σ(bz+1 ), we obtain τ2 from τ1 by shifting bz+1 down to position σ(bz+1 ). If τ1 (bz+1 ) < σ(bz+1 ) and thus τ1 (bz+1 ) < σ(b1 ), we derive τ2 from τ1 by shifting bz+1 up to position σ(b1 )−1 and then switching it with the candidate at position σ(bz+1 ). As all candidates b ∈ B are unrelated to all other candidates in κ, we have τ2 ∈ Ext(κ). As all performed switching and shifting operations decrease the quantity |τ2 (bz+1 ) − σ(bz+1 )| compared to |τ1 (bz+1 ) − σ(bz+1 )| by the amount bz+1 is moved, it is easy to see that F (σ, τ2 ) ≤ F (σ, τ1 ), which is a contradiction to our assumption that τ1 maximizes the aforementioned quantity z. Thus we conclude τ ∗ (bi ) = σ(bi ) for all bi ∈ B. Considering τ ∗ the contribution of each b ∈ B to F (τ ∗ , σ) is zero. Again we call B a blocker and classify the candidates of V ∪ E ∪ F into types 1, 2 and 3. Each candidate of type 3 contributes at least n8 to F (τ ∗ , σ). As F (τ ∗ , σ) ≤ k = k 8 2m − 2 2 n + n7 , there are at most nk8 = 2m − 2 k2 candidates of type 3. All m − k ∗ candidates of F are of type 3. Hence, there are at most m + k − k2 candidates of type 3 within V ∪ E. Again, according to the definition of κ and σ, we have that each v ∈ V is of type 3 iff τ ∗ ranks it before the blocker, while each e ∈ E is of type 3 iff τ ∗ ranks it after the blocker. Let V be the set of candidates from V which are ranked before the blocker, and E be the set of candidates from E which are ranked before the blocker by τ ∗ . As τ ∗ ranks m candidates before the blocker, of which m − k ∗ are from F , |V | + |E | = k ∗ . As τ ∗ has the incidence property, |V | ≥ k. As on the other hand |V | > k would yield too many candidates of type 3, we have |V | = k and thus |E | = k2 and again due to the incidence property, each of the k2 edges within E is incident to two of the k vertices within V , and therefore G = (V , E ) forms a clique of size k in G.
The Nearest Neighbor Spearman Footrule Distance
359
The theorem follows, since the reduction runs in polynomial time and the containment of the distance problem in NP is straightforward.
4
Rank Aggregation Problem
The rank aggregation problem aims at finding a consensus ranking for a list of voters represented by partial orders. It is NP-hard for the Kendall tau distance [3] even for an even number of at least four voters represented by total orders [5,11]. The NP-hardness also holds for related problems, such as computing top-k-lists [1] or determining winners [3,4,14,23]. However, the rank aggregation problem for total orders under the Spearman footrule distance can be solved by a weighted bipartite matching, see [11]. We emphasize this result and show the NP-completeness for bucket orders by a reduction from Maximum Optimal Linear Arrangement (Max-Ola), which is reduced from Optimal Linear Arrangement (Ola) [13]. For a graph G = (V, E) with n vertices and m edges, and for a positive integer k, Ola asks whether or not there exists a permutation τ on V with ≤ k. Max-Ola is a modified version of Ola, in which {u,v}∈E |τ (u) − τ (v)| we ask for a τ with {u,v}∈E |τ (u) − τ (v)| ≥ k . It can be shown by induction 3 that for a complete graph, {u,v}∈E |τ (u) − τ (v)| = n 6−n for any τ . So we derive a reduction from Ola to Max-Ola, in which we make use of the complementary 3 graph and ask for a τ with {u,v}∈E |τ (u) − τ (v)| ≥ n 6−n − k = k . Theorem 4. The rank aggregation problem for an arbitrary number of bucket orders under the Spearman footrule distance is NP-complete. Proof. (Sketch) For the reduction from Max-Ola to the rank aggregation problem, consider the vertices V as candidates and add two candidates x1 , x2 with x1 , x2 ∈ / V, forming the domain D = V ∪{x1 , x2 }. Let k = 4nm+4m−2k. There are two lists of bucket orders on D, the edge voters Π1 and the dummy voters Π2 . There are k + 1 identical dummy voters πs in Π2 . For s ∈ {1, . . . , k + 1}, πs = {x1 }V{x2 } . For each edge {u, v} ∈ E, Π1 contains two bucket orders πuv and πvu with πuv = {u}(D \ {u, v}){v} and πvu = {v}(D \ {u, v}){u} . Let the total order τ ∗ on D be any solution of the rank aggregation instance. ∗ The dummy voters now x1 and x2 at the extremal positions 1 force τ to rank and |D| as otherwise πs ∈Π2 FN N (τ ∗ , πs ) > k due to the number of dummy voters. In the following suppose that τ ∗ satisfies τ ∗ (x1 ) = 1 and τ ∗ (x2 ) = |D|. Then the dummy voters do not generate any cost, since then τ ∗ ∈ Ext(πs ) such that FN N (τ ∗ , πs ) ≤ F (τ ∗ , τ ∗ ) = 0. Next we consider the cost contributed by the edge voters. Choose any single pair of edge-voters πuv ,πvu ∈ Π1 . Following the proof of Theorem 1,
360
F.J. Brandenburg, A. Gleißner, and A. Hofmeier
FN N (τ ∗ , πuv ) = F (ρ ∗ πuv ∗ τ ∗ , ρ ∗ τ ∗ ∗ πuv ) for an arbitrary total order ρ. As τ ∗ is a total order, we have ρ ∗ πuv ∗ τ ∗ = τ ∗ and ρ ∗ τ ∗ ∗ πuv = τ ∗ ∗ πuv . Therefore FN N (τ ∗ , πuv ) = F (τ ∗ , τ ∗ ∗ πuv ). With an analogous argument we get FN N (τ ∗ , πvu ) = F (τ ∗ , τ ∗ ∗πvu ). W. l. o. g. let τ ∗ (u) < τ ∗ (v) (otherwise we switch the roles of u and v). Let A = {w ∈ D : 2 ≤ τ ∗ (w) < τ ∗ (u)}, let B = {w ∈ D : τ ∗ (u) < τ ∗ (w) < τ ∗ (v)} and let C = {w ∈ D : τ ∗ (v) < τ ∗ (w) ≤ |D| − 1}. We use [A] to denote τ ∗−1 (2), . . . , τ ∗−1 (τ ∗ (u) − 1) and use [B] and [C] in an analogous way. Then according to the definition of πuv and πvu in the above reduction, we have τ ∗ ∗ πuv = u, x1 , [A], [B], [C], x2 , v , τ ∗ ∗ πvu = v, x1 , [A], [B], [C], x2 , u , and τ∗ = x1 , [A], u, [B], v, [C], x2 . Thus we have a contribution of 2 to F (τ ∗ , τ ∗ ∗ πuv ) + F (τ ∗ , τ ∗ ∗ πvu ) for each w ∈ A ∪ C ∪ {x1 , x2 }, a contribution of 0 for each w ∈ B, and a contribution of |D| − 1 for each u and v. Observe that |A| = τ ∗ (u) − 2, |B| = τ ∗ (v) − τ ∗ (u) − 1 and |C| = |D| − τ ∗ (v) − 1. Now, summing those quantities yields FN N (τ ∗ , πuv ) + FN N (τ ∗ , πvu ) = 4n + 4 − 2 |τ ∗ (u) − τ ∗ (v)|. Summing over all m pairs πuv , πvu ∈ Π1 gives us FN N (τ ∗ , π) = 4nm + 4m − 2 · |τ ∗ (u) − τ ∗ (v)| . π∈Π1
πuv ,πvu ∈Π1
With this result we are able to transform a solution Max-Ola into a solution of the rank aggregation problem and vice versa by simply adding resp. removing the candidates x1 and x2 to resp. from the extremal positions. The theorem follows, since the reduction clearly runs in polynomial time and the containment of the rank aggregation problem in NP is straightforward.
5
Approximation Algorithms
For total orders σ and τ , the Kendall tau and the Spearman footrule distances are related by the Diaconis-Graham inequality [10], which says that K(σ, τ ) ≤ F (σ, τ ) ≤ 2K(σ, τ ). Fagin et al. [12] have extended this inequality to the Hausdorff distances on arbitrary sets (and thus for partial orders). With a proof similar to [12] we show that this inequality also holds for nearest neighbor distances of partial orders. Theorem 5. The Diaconis-Graham inequality holds for partial orders κ and μ under the nearest neighbor distances. KN N (κ, μ) ≤ FN N (κ, μ) ≤ 2KN N (κ, μ) . Proof. Consider κ , κ ∈ Ext(κ) and μ , μ ∈ Ext(μ), such that FN N (κ, μ) = F (κ , μ ) and KN N (κ, μ) = K(κ , μ ). Then KN N (κ, μ) = K(κ , μ ) ≤ K(κ , μ ) ≤ F (κ , μ ) = FN N (κ, μ) .
The Nearest Neighbor Spearman Footrule Distance
361
where K(κ , μ ) ≤ K(κ , μ ) follows from the fact that KN N (κ, μ) = K(κ , μ ) and K(κ , μ ) ≤ F (κ , μ ) is derived from the Diaconis-Graham inequality for total orders. Accordingly, FN N (κ, μ) = F (κ , μ ) ≤ F (κ , μ ) ≤ 2K(κ , μ ) = 2KN N (κ, μ) . Combining these inequalities completes the proof.
Theorem 6. Computing the nearest neighbor Spearman footrule distance between a partial and a total order is 6-approximable. Proof. We first consider the problem of computing the nearest neighbor Kendall tau distance between a partial order κ and a total order τ . This problem is closely related to the constrained feedback arc set problem for weighted tournaments. A weighted tournament G = (V, E, w) is a graph with edges (u, v) ∈ E and (v, u) ∈ E for all u, v ∈ V with u = v, which assigns weights w(e) ∈ [0, 1] to each e ∈ E. In the constrained feedback arc set problem there is a weighted tournament G = (V, E, w) and a partial order on V , which defines the set of constraint edges EC ⊆ E. The output of the problem is a total order σ on V , which respects the partial order, i. e., u ≺σ v if (u, v) ∈ EC , and minimizes u≺σ v w(v, u). According to van Zuylen et al. [21,22], there is a deterministic 3-approximation algorithm for the problem, if w(u, v) + w(v, u) = 1 for each u, v ∈ V . We transform κ and τ into a constrained feedback arc set problem on tournaments such that κ defines the constraint edges and τ defines the edge weights. For each candidate introduce a vertex v ∈ V and for each pair of vertices u, v ∈ V let w(u, v) = 1 and w(v, u) = 0 if u ≺τ v. An edge (u, v) is constrained, if u ≺κ v. The nearest neighbor Kendall tau distance between κ and τ asks for the total extension of κ, where as many ties as possible are broken according to τ . Due to the constraint edges, a solution σ of the constrained feedback arc set problem always is an extension of κ. Each edge (v, u) with w(v, u) = 1 and u ≺σ v corresponds toa pair of vertices where τ and σ disagree. Therefore, we can conclude that u≺σ v w(v, u) = KN N (κ, τ ) and thus, computing the nearest neighbor Kendall tau distance between a total and a partial order is 3-approximable. Theorem 5 now yields the result. Theorem 7. The rank aggregation problem for bucket orders using the nearest neighbor Spearman footrule distance is 4-approximable by a deterministic algorithm and 3-approximable by a randomized algorithm. Proof. This follows immediately from Theorem 5 and a result of Ailon [1], who has shown that the rank aggregation problem for bucket orders under the nearest neighbor Kendall tau distance is 2-approximable by a deterministic algorithm and 1.5-approximable by a randomized algorithm.
6
Conclusion and Open Problems
In this work we have investigated the nearest neigbor Spearman footrule distance on rankings with incomplete information. The incompleteness is expressed by
362
F.J. Brandenburg, A. Gleißner, and A. Hofmeier
bucket, interval and partial orders. The step from interval orders to partial orders implies a jump in the complexity from linear time to NP-completeness for the computation of the distance to a total order. The distance problem between two interval orders or an interval and a bucket order is still open. Furthermore, there is the jump to NP-completeness for the rank aggregation problem from total to bucket orders. Our new NP-complete problems have good approximations. Our linear time algorithms, the NP-reductions, and the approximations used quite different techniques. It is left open to improve the given approximation ratios and to establish an approximation, e.g., for the rank agregation problem for the general case with partial rankings. A further area of investigations addresses the Kendall tau distance and other measures, such as the Hausdorff distance [12]. Acknowledgments. The authors are grateful to an anonymous referee for the careful reading and helpful suggestions, especially on cleaning up the proof of Theorem 6.
References 1. Ailon, N.: Aggregation of partial rankings, p-ratings and top-k lists. Algorithmica 57, 284–300 (2010) 2. Aslam, J.A., Montague, M.H.: Models for metasearch. In: Proceedings of the 24th Annual International Conference on Research and Development in Information Retrieval (SIGIR), pp. 275–284. ACM, New York (2001) 3. Bartholdi III, J.J., Tovey, C.A., Trick, M.A.: Voting schemes for which it can be difficult to tell who won the election. Social Choice and Welfare 6, 157–165 (1989) 4. Betzler, N., Dorn, B.: Towards a dichotomy for the possible winner problem in elections based on scoring rules. Journal of Computer and System Sciences 76, 812–836 (2010) 5. Biedl, T., Brandenburg, F.J., Deng, X.: On the complexity of crossings in permutations. Discrete Mathematics 309, 1813–1823 (2009) 6. Borda, J.C.: M´emoire aux les ´elections au scrutin (1781) 7. Cohen, W.W., Schapire, R.E., Singer, Y.: Learning to order things. Journal of Artificial Intelligence Research 10, 243–270 (1999) ´ 8. Condorcet, M.-J.: Essai sur l’application de l’analyse ` a la probalit´e des d´ecisions rendues ` a la pluralit´e des voix (1785) 9. Critchlow, D.E.: Metric methods for analyzing partially ranked data. Lecture Notes in Statistics, vol. 34. Springer, Berlin (1985) 10. Diaconis, P., Graham, R.L.: Spearman’s footrule as a measure of disarray. Journal of the Royal Statistical Society, Series B 39, 262–268 (1977) 11. Dwork, C., Kumar, R., Naor, M., Sivakumar, D.: Rank aggregation methods for the web. In: Proceedings of the 10th International World Wide Web Conference (WWW 2010), pp. 613–622 (2001) 12. Fagin, R., Kumar, R., Mahdian, M., Sivakumar, D., Vee, E.: Comparing partial rankings. SIAM Journal on Discrete Mathematics 20, 628–648 (2006) 13. Garey, M.R., Johnson, D.S.: Computers and Intractability; A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York (1990)
The Nearest Neighbor Spearman Footrule Distance
363
14. Hemaspaandra, E., Hemaspaandra, L.A., Rothe, J.: Exact analysis of Dodgson elections: Lewis Carroll’s 1876 voting system is complete for parallel access to NP. Journal of the ACM 44, 806–825 (1997) 15. Lebanon, G., Lafferty, J.D.: Cranking: Combining rankings using conditional probability models on permutations. In: Proceedings of the 19th International Conference Machine Learning (ICML), pp. 363–370. Morgan Kaufmann, San Francisco (2002) 16. Lullus, R.: Artifitium electionis personarum (1283) 17. Lullus, R.: De arte eleccionis (1299) 18. Montague, M.H., Aslam, J.A.: Condorcet fusion for improved retrieval. In: Proceedings of the 2002 International Conference on Information and Knowledge Management (CIKM), pp. 538–548. ACM, New York (2002) 19. Renda, M.E., Straccia, U.: Web metasearch: Rank vs. score based rank aggregation methods. In: Proceedings of the 2003 Symposium on Applied Computing (SAC), pp. 841–846. ACM, New York (2003) 20. Sese, J., Morishita, S.: Rank aggregation method for biological databases. Genome Informatics 12, 506–507 (2001) 21. van Zuylen, A., Hegde, R., Jain, K., Williamson, D.P.: Deterministic pivoting algorithms for constrained ranking and clustering problems. In: Proceedings of the 18th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 405–414 (2007) 22. van Zuylen, A., Williamson, D.P.: Deterministic pivoting algorithms for constrained ranking and clustering problems. Mathematics of Operations Research 34, 594–620 (2009) 23. Xia, L., Conitzer, V.: Determining possible and necessary winners under common voting rules given partial orders. In: Proceedings of the 23rd National Conference on Artificial Intelligence (AAAI), pp. 196–201. AAAI Press, Menlo Park (2008) 24. Yager, R.R., Kreinovich, V.: On how to merge sorted lists coming from different web search tools. Soft Computing Research Journal 3, 83–88 (1999)
Minimum Width Rectangular Annulus Joydeep Mukherjee1 , Priya Ranjan Sinha Mahapatra2, Arindam Karmakar3, and Sandip Das3 2
1 Institute of Mathematical Sciences, Chennai, India Department of Computer Science and Engineering, University of Kalyani, India 3 ACM Unit, Indian Statistical Institute, Kolkata, India
Abstract. In this paper, we identify a minimum width rectangular annulus that encloses a given set of n points in a plane. We propose an O(n2 log n) time and O(n) space algorithm for this problem. To the best of our knowledge this is the first sub-cubic algorithm for rectangular annulus for arbitrary orientation.
1
Introduction
The problem of enclosing a planar point set P = {p1 , p2 , . . . , pn } by a minimum sized geometric object such as circle [15], rectangle [17], square and triangle [14] have been well studied in computational geometry. In some cases, the enclosing object is orientation-invariant, that is, the region bounded by the object remains same under rotation (for example circle). However, if the enclosing object is orientation-dependent, then it becomes difficult to compute the optimal orientation over all possible orientations. Finding geometric objects that fit nicely to a set P of n planar points is an important objective in the study of computational metrology [12]. If the object is a circle, the geometric fitting problem is equivalent to the problem of computing a minimum width annulus that contains P . In mathematics, an annulus is a ring-shaped geometric figure, or more generally, it is the area between two concentric circles. Minimum width annulus problem computes two concentric circles such that all planar points of P are contained by the annulus thus formed and the difference of the two radii is minimum. Wainstein [18] and Roy et al. [16] independently propose O(n2 ) time algorithm to find a minimum width annulus. Ebara et al. [11] prove that the center of the optimal annulus is either a vertex of the closest-point Voronoi diagram of P , or a vertex of the farthest-point Voronoi diagram, or an intersection point of a pair of edges of the two diagrams. Based on this observation, they propose an O(n2 ) time algorithm. One can develop simple O(n log n + k) time algorithm for computing minimum width annulus where k is the number of these intersections. Agarwal et al. [4] uses parametric 8 search to compute a minimum width annulus in O(n 5 + ) time. Later, Agarwal 3 and Sharir [3] improve the expected running time to O(n 2 + ). Duncan et al. [10] as well as Bose et al. [7] consider an important variant of minimum width annulus problem. Given the radius r of the outer (or inner, M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 364–374, 2011. c Springer-Verlag Berlin Heidelberg 2011
Minimum Width Rectangular Annulus
365
or median) circle enclosing the point set, both of these works independently compute the minimum width circular annulus in O(n log n) time. For a set P of n points in the Euclidean plane, D´ıaz-B´an ˜ ez et al. [9] consider the problem of computing an empty annulus A of largest width inside a bounded region containing point set P . Their proposed algorithm finds an empty annulus A in O(n3 log n) time and O(n) space. Other variations of minimum width annulus problem depend on the shape of the geometric object as well as the distance metric used to compute the width of an annulus. Barequet et al. [6] define δ-annulus of a convex polygon Q as the closed region such that all planar points set P are at distance at most δ from the boundary of polygon Q. Given a convex polygon Q with m vertices and a distance δ, they propose an O(n3 log(mn) + m) time and O(m + n) space algorithm to compute a δ-annulus of arbitrary orientation that contains maximum number of points from P . Considering l1 as the distance metric, Gluchshenko et al. [13] present an optimal O(n log n) time algorithm to compute an axis-parallel rectilinear annulus of minimum width that encloses the planar point set P . The reader is referred to [5,2,8] for further study and applications. Based on the motivation of the above studies, we consider the problem of minimum width rectangular annulus which we define in Section 2 along with some notations. Section 3, considers rectangular annulus of fixed orientation. In Section 4, we compute the minimum width annulus of arbitrary orientation.
2
Problem Definition and Notations
Let P = {p1 , p2 , . . . , pn} be set of n points lying in the euclidean plane. CH(P ) denotes the convex hull of the point set P . d(pi , pj ) denotes the distance between points pi and pj . The perpendicular distance between pi and a line or a line segment s is termed d(pi , s). A rectangle (of fixed orientation) in the plane is called minimum enclosing rectangle (MER) if it contains all the members of P and no other smaller rectangle of such orientation can enclose it. Observe that each of the four sides of a MER must contain at least one point of P and the points defining that MER are the points from CH(P ). Two rectangles are said to be parallel if each side of one rectangle is parallel to a side of the other. Center of a rectangle is the intersection point of its diagonals. bd(R) and int(R) denote the boundary and interior of a rectangle R respectively. Consider two mutually parallel rectangles R and R where R ⊂ R. The region A = R \ int(R ) bounded by these two rectangles is defined as the rectangular annulus for a point set P where P lies in the rectangle R but does not lie in int(R ). Larger and the smaller rectangles of an annulus will be denoted as outer and inner rectangles respectively. From now on, the terms rectangular annulus and annulus will be used interchangeably and moreover they will enclose the point set P . In our work, the sides of the rectangles corresponding to an annulus may not be axis-parallel. A line/line-segment is said to be of orientation θ if it makes an angle θ with the positive direction of the x-axis. The function d(p, q, θ) is the perpendicular distance between a pair of θ-oriented parallel lines passing through
366
J. Mukherjee et al.
R lef t side
top side
R
bottom side right side
θ Fig. 1. Annulus of orientation θ
p and q. The rectangle Rθ whose top or bottom side makes an angle θ with the positive direction of x-axis is denoted as a θ oriented rectangle. A θ oriented annulus has its outer rectangle oriented at an angle θ with the positive direction of x-axis. For the sake of clarity of our discussion, we assign some ordering on the sides of the rectangles of the annulus. Consider the corner of the rectangle with maximum y-coordinate. The side of the rectangle incident to that corner having non-negative slope is denoted as the top side. The other side incident to this corner is designated as left side. Bottom and right sides are defined analogously. Top-width of an annulus is defined as the perpendicular distance between the top sides of the outer and inner rectangles of that annulus. Similarly we can define right-width, bottom-width and left-width of an annulus. The maximum among the top-, right-, bottom- and left- width of a rectangular annulus is defined as the width of the annulus. ω(Aθ ) denotes the width of a θ oriented annulus Aθ . In this paper, our objective is to compute a rectangular annulus of minimum width over all possible orientations that encloses P . Let Aθ be the minimum width annulus at an orientation θ. Note that the annulus with minimum width may not be unique. Consider a minimum width annulus Aθ whose width ω(Aθ ) is determined by the distance between the top sides of inner and outer rectangles Rθ and Rθ . Keeping the inner rectangle fixed, we can expand the outer rectangle until the distances between the corresponding sides are not greater than ω(Aθ ). All the intermediate annuli thus formed are minimal width annuli at orientation θ. Now we have the following observation. Observation 1. For a fixed orientation θ, one of the minimal width annulus Aθ must have a MER as its outer rectangle. By the above observation, we only consider the MERs as the outer rectangles for determining the annuli of different orientations. Let l(R) be the length of the longest side of a rectangle R. We have the following observation. Observation 2. For any minimal width annulus Aθ , ω(Aθ ) ≤ Observation 2 leads to following corollary.
l(Rθ ) 2 .
Minimum Width Rectangular Annulus
367
Corollary 1. For any orientation θ, there exists a minimal width annulus Aθ such that the center of the outer rectangle Rθ will lie inside or on the boundary of the inner rectangle Rθ . In the next section, we compute the axis-parallel annulus of minimum width.
3
Axis-Parallel Annulus
To locate a minimal width axis-parallel annulus, we start with an axis-parallel MER R0 that encloses the point set P . Now our objective is to find a maximal empty axis-parallel rectangle R0 such that (i) R0 is wholly contained inside R0 , (ii) the center of R0 lies inside R0 and (iii) over all possible maximal empty rectangles, R0 minimizes the width of the annulus thus formed. Maximal empty rectangle in the sense that this is not enclosed by any other bigger axis-parallel empty rectangle. If a point pi ∈ P coincides with the center of R0 , then the width of the optimal annulus is l(R2 0 ) (by observation 2). We look for all maximal empty rectangles that lies inside R0 and contains the center of R0 . The empty rectangle that minimizes the width of the annulus is the desired rectangle. Following observation bounds the number of such empty rectangles. Observation 3. Total number of maximal empty axis-parallel rectangles that contain the center of R0 is bounded by O(n2 ). Proof. A rectangle is uniquely defined by at least one point on each of its sides. Consider all pairs of points that can define the top and bottom side of an empty rectangle. Each such pair generates a unique maximal empty rectangle. Possible number of such choices is quadratic. Thus for a fixed orientation, the search space of a minimal width annulus is O(n2 ). We denote the top, right, bottom and left sides of R0 as t(R0 ), r(R0 ), b(R0 ) and l(R0 ) respectively. Analogously define the sides of the inner rectangle R0 . Define T (R0 ) as the set of points pi (∈ P ) inside the rectangle R0 such that each pi ∈ T (R0 ) has the top side of R0 as its nearest side among the other three sides of R0 . Therefore T (R0 ) = {pi | d(pi , t(R0 )) ≤ min{d(pi , r(R0 )), d(pi , b(R0 )), d(pi , l(R0 ))}. Similarly we can define the sets R(R0 ), B(R0 ) and L(R0 ). Let pt be the element of T (R0 ) such that d(pt , t(R0 )) = max{d(pi , t(R0 ) | pi ∈ T (R0 )}. Similarly define pr , pb and pl such that d(pr , r(R0 )) = max{d(pi , r(R0 ) | pi ∈ R(R0 )}, d(pb , b(R0 )) = max{d(pi , b(R0 ) | pi ∈ B(R0 )} and d(pl , l(R0 )) = max{d(pi , l(R0 ) | pi ∈ L(R0 )} respectively. The following observation leads to an O(n) time algorithm for locating a minimal width axis-parallel annulus. Observation 4. There exists a minimal axis-parallel annulus A0 whose inner rectangle R0 has the points pt , pr , pb and pl on its top, right, bottom and left sides respectively. The above observation determines the points that lie on each side of the inner rectangle R0 . Thus we have the following theorem.
368
J. Mukherjee et al.
Theorem 1. Given a point set P in the euclidean plane, we can compute the minimal width axis-parallel annulus of P in O(n) time. Proof. The points on the top, right, bottom and left boundaries are points of P that have maximum y-coordinate, maximum x-coordinate, minimum ycoordinate and minimum x-coordinate respectively. Thus the axis-parallel MER can be computed in linear time. In another O(n) time we can compute the points that define the inner rectangle R0 . Thus the theorem follows.
4
Arbitrarily Oriented Annulus
Here we determine rectangular annuli of various orientations. From these oriented annuli, we choose the one that have the smallest width. To compute this we have to generate all possible θ oriented MERs where θ varies in a continuous angular interval. By observation 1, the outer rectangle of a minimal width annulus of any orientation will be a MER in that orientation. Observe that all possible distinct MERs can be generated if we rotate the MERs in the continuous angular interval [0, π2 ]. This is true since the top side of the MERs can have orientations in the angular interval [0, π2 ] only. Now generating all such intervals is quite infeasible. Our idea is to discretize the angular interval [0, π2 ] into a finite set of intervals. Regarding minimum enclosing rectangle of a point set, the following results are important. For any orientation, the MER of a point set is also the MER for the CH(P ). Each side of a MER will always contain at least one point from CH(P ). Our algorithm for computing the minimum width annulus maintains the MER over all possible orientation θ (0 ≤ θ ≤ π2 ). Below we describe the procedure for partitioning the angular interval [0, π2 ], such that the points on the boundary of the MERs oriented within a sub-interval are same. Now we have the following observation. Observation 5. (i) The angular interval [0, π2 ] can be partitioned into a set of primary intervals {[α1 , β1 ], [α2 , β2 ], . . . , [αm , βm ]}, such that for each interval [αi , βi ] the points of P on the top, right, bottom and left side of all the MERs Rθ (θ ∈ [αi , βi ]) are invariant. (ii) The number of such intervals m is bounded by 2k where k is the number of vertices of CH(P ). Proof. Without loss of generality, we start with the axis-parallel MER R0 . Now we go on changing the orientation of MER in clockwise direction until a point of CH(P ) appears on any of its boundary or a point on the boundary of MER disappears. This will happen when a side of MER coincide with an edge of CH(P ). This is also true for the other sides of the MER. Note that the set of four points on the boundary of MER changes during the rotation of MER. As illustration, let pt0 be the point on the top side of MER. Consider the convex edges e1 and e2 incident to the point pt0 where e1 and e2 make angles θ1 and θ2 with the x-axis (θ1 < θ2 ). Observe that the MERs over all orientation θ
Minimum Width Rectangular Annulus
369
pt0 e1
e2
θ1
θ2
Fig. 2. Local continuous domain of a point
(θ1 ≤ θ ≤ θ2 ) will contain pt0 on its boundary. At an orientation θ1 , pt0 will appear on the boundary of the MER and disappear when the MER is oriented at an angle greater than θ2 (see figure 2). Compute the angular interval [γi , δi ] for each point pi ∈ CH(P ), such that the point pi lies on the boundary of a MER Rθ (θ ∈ [γi , δi ]). Each interval [γi , δi ] is termed as local continuous domain for the point pi of CH(P ). Let L = {[γ1 , δ1 ], [γ2 , δ2 ], . . . , [γk , δk ]} be the set of local continuous domains for all points of CH(P ). Note that local continuous domains of the four points that lie on the top, right, bottom and left sides of θ oriented MER Rθ are overlapping. Thus the elements of L may overlap. Arrival or removal of a point on/from the boundary of a MER is an event point in our procedure. Therefore we discretize the angular interval [0, π2 ] into some intervals such that for each interval the points on the boundary of the MERs do not change. Local continuous domain [γi , δi ] of a point pi ∈ CH(P ) can be divided into at most two sub-domains depending on whether pi lies on the top, right, bottom or right side of the MERs. We divide each local continuous domain into two such sub-domains and sort the whole set of sub-domains over the interval [0, π2 ]. These sorted endpoints of such sub-domains induces a partition of the whole interval [0, π2 ]. The minimal segments of the partition are called primary intervals. We rename this primary intervals as I1 , I2 , . . . , Im where m ≤ 2k and Ii corresponds to an unique angular interval [αi , βi ]. Observe that for each primary interval Ii , we have a unique set of four points pti , pri , pbi , pli of CH(P ) that defines the possible MERs oriented within [αi , βi ]. Hence the result follows. Until now we have discussed about the orientations of the outer rectangles. The interval [0, π2 ] is partitioned into a set a of primary intervals. Now we consider the possible set of the inner empty rectangles corresponding to a primary interval [αi , βi ]. Our aim is to subdivide each primary interval [αi , βi ] into sub-intervals such that each sub-interval corresponds to a unique set of four points that defines all the maximal empty rectangles oriented within the range [αi , βi ]. Recall the axis-parallel case. There we partitioned the points inside R0 in four subsets corresponding to four sides of R0 depending on which side was nearest from a point. But in this case orientation of the MERs are continuously changing.
370
J. Mukherjee et al.
d(p, li, θ) lower envelope
d(p, bi, θ) d(p, ri, θ) d(p, ti , θ)
αi
βi
Fig. 3. Lower envelope of the distance functions
Analogous to the distance between a point and fixed side of R0 (in axis-parallel case), here we define a distance function of a point p and a side of Rθ where θ varies over a primary interval [αi , βi ]. Consider the MERs oriented within the primary interval [αi , βi ] where the points ti , ri , bi and li are aligned with the top, right, bottom and left side of the MERs respectively. Note that, a side (say top) of the outer rectangle will be the nearest from p (∈ P ) over a continuous angular interval but may change side over another angular interval within the primary interval [αi , βi ]. Thus we also seek the angular intervals within the primary interval through which each side of the MER will be the nearest from p. Actually we are using the same idea of computing the inner rectangle of the axis-parallel case. The only difference is that the orientation is not fixed. To get such nearest-side information, we define a function d(p, q, θ) that denotes the perpendicular distance between a point p and a θ oriented line segment passing through a point q. We have the following observation. Observation 6. Given two points p and q, the function d(p, q, θ) for θ ∈ [αi , βi ] is a unimodal sine function. We define functions fi (p, θ) = min{d(p, ti , θ), d(p, ri , θ), d(p, bi , θ), d(p, li , θ)} for θ ∈ Ii and 1 ≤ i ≤ m. We denote fi (p, .) as an univariate function over angular interval [αi , βi ] for some fixed point p. Similarly we express d(p, ti , ·), d(p, ri , ·), d(p, bi , ·) and d(p, li , ·) as functions over angular interval [αi , βi ]. Note that, for a fixed point p, fi (p, .) is the lower envelope of these four functions over the angular interval [αi , βi ]. Observation 7. For any fixed point p and primary interval Ii , the lower envelope fi (p, .) can have at most four connected portions of the graphs of functions d(p, ti , ·), d(p, ri , ·), d(p, bi , ·), d(p, li , ·). Moreover, each such portion of the lower
Minimum Width Rectangular Annulus
371
envelope corresponds to a side of the MER that is nearest form p within the interval corresponding to that segment. Consider the functions fi (pj , θ) for all points pj inside the MERs over the primary interval Ii . For any primary interval Ii we have O(n) such functions. Define a function git(p, θ) that has value d(p, ti , θ) for θ belongs to the portion of interval Ii and p is nearer to top side of a MER compared to any other sides. Otherwise the value of the function is zero. Thus we define the following function. fi (p, θ) if fi (p, θ) = d(p, ti , θ), θ ∈ Ii ; t gi (p, θ) = 0 Otherwise. Observe that for any given θ ∈ Ii , max{git (p, θ)} indicates the top width of the minimal width annulus Aθ . For any primary interval Ii = [αi , βi ], the upper envelope of the set of functions git (pj , .) for all pj partitions Ii into maximum connected sub-intervals on the xaxis so that they cover the entire interval Ii . For each such sub-interval, the same function git(p, .) appears on the upper envelope for all points over the interval. Each such sub-interval corresponds to the function git (pk , ·). This signifies that for any θ within the sub-interval there exists an optimal annulus at orientation θ, where pk lies on the top side of the inner rectangle. Similarly we can define the functions gib (p, ·), gil (p, ·) and gir (p, ·) with respect to bottom, left and right of MER respectively. Observation 8. The number of pairwise intersection of two functions git(pj , .) and git (pk , .) having nonzero values is at most one, for pj , pk ∈ P . Proof. Assume that the two functions git (pj , .) and git (pk , .) of non-null values intersect at an orientation, say θ. This intersection signifies that the points pj and pk are on the top boundary of the inner rectangle of the minimum width annulus A(θ). Now any pair of points pj and pk can appear on the boundary of the inner rectangle at most once since two points define a unique line. Thus the observation follows. The above observation bounds the combinatorial complexity of the upper envelope of the set of functions git (p, .), gib (p, .), gil (p, .) and gir (p, .). over a primary interval. Observation 9. For nonzero upper envelope of git (pj , .), the size of the upper envelope for a primary interval [αi , βi ] is bounded by O(nα(n)) where α(n) is the inverse Ackermann function. Proof. Proof follows from the theory of Davenport-Schinzel sequences [1].
Therefore at orientation θ ∈ [αi , βi ], the width of an optimal annulus will be maximum of the functional values git (pt , θ), gib (pb , θ), gil (pl , θ) and gir (pr , θ) where git (pt , θ) appears at the upper envelope of functions git (p1 , ·), git (p2 , ·), . . . , git (pn , ·) at an angle θ and similarly for gib (pb , ·), gil (pl , ·), gir (pr , ·). We define an
372
J. Mukherjee et al.
annulus at any orientation by two quadruplets of points that define the boundaries of the inner and outer rectangles. From observation 9, we have at most O(n2 α(n)) number of such pairs of quadruplets such that at any orientation the boundaries of the inner and outer rectangles corresponding to the optimal annulus can be defined by one such pair. 4.1
Algorithm and Complexity
Now we are in a position to describe our algorithm for finding a minimal width rectangular annulus of arbitrary orientation. Consider the primary intervals I1 , I2 , . . ., Im partitioning the range of possible angle of orientation. As described in observation 5, the points aligned with top, left, right, bottom of the outer rectangle of an annulus at orientation θ are invariant for all angle θ lying within a primary interval Ij . Note that this set of primary intervals can be identified in O(n) time. From Observation 7, we observe that for any point p, and for a given primary interval Ii we can have at most four θ values where nearest boundary of MER from p changes. We can compute those θ values for given p and Ii in constant time. Those θ values can partition Ii in four sub-intervals. So for n points we have 4n partitions of Ii such that for θ in each such partition, the four points on the boundary of MER are invariant and have information of point set which are nearest to a particular side of MER, say left, compare to any other sides. So for any such θ, we can determine the inner rectangle of annulus using the similar technique presented for axis-parallel case in section 3. Note that the time required to generate this partition of angular interval [0, π2 ] is O(n2 log n). Observe that if a point p inside the MER at orientation θ ∈ Ii is nearer to top side of the MER compare to any other sides of MER then git (p, θ) has nonzero value and denote the distance of p from top side of MER at orientation θ. Therefore we conclude that maxp∈P {git (p, θ)} express the top-width for the annulus at orientation θ. But observe that the point of P for which maximum is attained may vary by varying θ on a sub-interval we obtained last. So it leads to a further partitioning of these intervals. The following observation gives a direction for further partitioning of the primary intervals with respect to the inner empty rectangles. Observation 10. Suppose the functions git(pj , ·) and git (pk , ·) intersect at an orientation θ and git (pj , θ) = maxp∈P {git (p, θ)}. Then the inner rectangle of minimum width annulus of orientation θ contains the points pj and pk on its top side. The observation gives an upper bound on the number of intersection between all pairs of functions g. Configuration of a maximal empty rectangle changes when two points appear on the same side of that rectangle. This happens when two functions, say git (pj , .) and git (pk , .) intersect. Thus we have O(n2 ) possible intersection points. From the above discussion, we have partitioned the angular interval [0, π2 ] into O(n2 ) sub-intervals due to the following event types:
Minimum Width Rectangular Annulus
373
(a) arrival or removal of a point on/from the boundary of the outer rectangle, (b) points change their respective nearest side among top, left, bottom or right boundaries of the outer rectangle, (c) arrival or removal of a point on/from the boundary of the inner rectangle. Now we have the final theorem. Theorem 2. Given a set P of n points in a plane, an arbitrary oriented minimal width annulus enclosing P , can be computed in O(n2 log n) time and O(n) space. Proof. Given CH(P ), computing the primary intervals corresponding to the oriented MERs requires O(n) time and space [17]. Starting with the axis-parallel case, we maintain four lists of points corresponding to the four sides of the MERs. Each list corresponding to a side of the MER contains the elements of P nearer to it compared to the other sides. Update the lists at the above mentioned O(n2 ) event points. Each update requires O(log n) time. Hence the theorem.
5
Conclusion
In this work we have proposed an O(n2 log n) time and O(n) space algorithm for the rectangular annulus problem. We are not aware of any published work on this problem.
References 1. Sharir, M., Agarwal, P.: Davenport-Schinzel Sequences and their Geometric Applications. Cambridge University Press, Cambridge (2010) 2. Agarwal, P., Sharir, M.: Efficient Algorithms for Geometric Optimization. ACM Computing Survey 30, 412–458 (1998) 3. Agarwal, P.K., Sharir, M.: Efficient randomized algorithms for some geometric optimization problems. Discrete Computational Geometry 16, 317–337 (1996) 4. Agarwal, P.K., Sharir, M., Toledo, S.: Applications of parametric searching in geometric optimization. Journal of Algorithms 17, 292–318 (1994) 5. Abellanas, M., Hurtado, F., Icking, C., Ma, L., Palop, B., Ramos, P.A.: Best Fitting Rectangles. In: Proc. European Workshop on Computational Geometry (2003) 6. Barequet, G., Briggs, A.J., Dickerson, M.T., Goodrich, M.T.: Offset-polygon annulus placement problems. Computational Geometry: Theory and Applications 11, 125–141 (1998) 7. de Berg, M., Bose, P., Bremner, D., Ramaswami, S., Wilfong, G.: Computing constrained minimum-width annuli of point sets. Computer Aided Design 30, 267–275 (1998) 8. Barequet, G., Dickerson, M.T., Goodrich, M.T.: Voronoi diagrams for convex polygon-offset distance functions. Discrete Computational Geometry 25, 271–291 (2001) 9. D´ıaz-B´ an ˜ez, J.M., Hurtado, F., Meijer, H., Rappaport, D., Sellar´es, J.A.: The Largest Empty Annulus Problem. International Journal of Computational Geometry and Applications 13, 317–325 (2003)
374
J. Mukherjee et al.
10. Duncan, C.A., Goodrich, M.T., Ramos, E.A.: Efficient approximation and optimization algorithms for computational metrology. In: Proc. 8th ACM-SIAM Sympos. Discrete Algorithms, pp. 121–130 (1997) 11. Ebara, H., Fukuyama, N., Nakano, H., Nakanishi, Y.: Roundness algorithms using the Voronoi diagrams. In: Abstract: 1st Canadian Conference in Computational Geometry, vol. 41 (1989) 12. Foster, L.W.: GEO-METRICS II: The application of geometric tolerancing techniques. Addison-Wesley, Reading (1982) 13. Gluchshenko, O., Hamacher, H.W., Tamir, A.: An optimal O(n log n) algorithm for finding an enclosing planar rectilinear annulus of minimum width. Operation Research Letters 37, 168–170 (2009) 14. O’Rourke, J., Aggarwal, A., Maddila, S., Baldwin, M.: An optimal algorithm for finding minimal enclosing triangles. Journal of Algorithms 7, 258–269 (1986) 15. Preparata, F.P., Shamos, M.I.: Computational Geometry: An Introduction. Springer, Berlin (1988) 16. Roy, U., Zhang, X.: Establishment of a pair of concentric circles with the minimum radial separation for assessing roundness error. Computer Aided Design 24, 161–168 (1992) 17. Toussaint, G.T.: Solving geometric problems with the rotating calipers. In: Proc. IEEE MELECON (1983) 18. Wainstein, A.D.: A non-monotonous placement problem in the plane. In Software Systems for Solving Optimal Planning Problems. In: Abstract: 9th All-Union Symp. USSR, Symp., pp. 70–71 (1986)
An Experimental Study on Generating Planar Graphs Sascha Meinert and Dorothea Wagner Karlsruhe Institute of Technology (KIT), 76128 Karlsruhe, Germany {sascha.meinert,dorothea.wagner}@kit.edu
Abstract. We survey several planar graph generators that were selected according to availability, theoretical interest, easiness of implementation and efficiency. We experimentally study graph properties that allow for a basic classification of the generators. This analysis is extended by means of advanced algorithmical behavior on the generated graphs, in particular kernelization of fixed-parameter tractable problems. We will see the major influence of instance selection on algorithmic behavior. This selection has been disregarded in several publications, which deduce general results from non-representative data sets. Altogether, this study helps experimenters to carefully select sets of planar graphs that allow for a meaningful interpretation of their results.
1 Introduction Planar graphs are an important class of graphs since many algorithms are custom tailored and thus perform much better on this subclass than in the general case. For an experimental analysis, experimenters have to set up data sets that attest a broad applicability to algorithms. These data sets should be described precisely. However, many publications fail by either sketchy descriptions or inappropriate data set selection. For instance, works exist that describe the use of the LEDA library [16] for random planar graph generation [2,1,6]. They speak either of the random planar graph generator or a specific representative planar graph generating function of LEDA. In fact, LEDA offers at least five functions to randomly generate planar graphs. They are named similar or, even worse, identical and their behavior is completely different, depending on the parameters used. Obviously, experimenters want easy to use planar graph generators and do not want to care about inherent generator details. They use one generator in the hope that a representative data set is created. As we will see later this is a crucial misestimation that may either completely flaw or at least bias experimental results. Note that due to space restrictions some details had to be omitted which can be found in [17]. Related Work. Ideally, an algorithm should be tested on all graphs of a given class to conclude that it performs well. On several classes of planar graphs Plantri1 [14] would be a good choice, as it is capable of generating all isomorphism-free graphs of certain graph size. As the sheer number of planar graphs is way too large it is obvious to ask for a representative sample. Thus, planar graphs that are generated uniformly at random [12,8,5] may be an appropriate choice. The implementation of such a generator is 1
Excluded as it is infeasible to generate all non-isomorphic planar graphs of large size.
M. Atallah, X.-Y. Li, and B. Zhu (Eds.): FAW-AAIM 2011, LNCS 6681, pp. 375–387, 2011. c Springer-Verlag Berlin Heidelberg 2011
376
S. Meinert and D. Wagner
a challenging issue. Hence, non uniform but easier to implement generators gain importance. These can often be found in algorithmic libraries, e.g., the LEDA library [16]. Contribution. We empirically study eight selected planar graph generators by means of running time, basic graph properties and algorithmic behavior. Additionally, we report on the completeness of each generator, i.e., whether it is able to generate all planar graphs with positive probability. This work gives an overview of several planar graph generators by means of theoretical background and algorithmic behavior, which enables experimenters to compile representative data sets that allow for a meaningful interpretation of algorithmical experiments and their reproducibility. Outline. First, the functionality, and theoretical background of each planar graph generator is described in Section 2. Additionally, this section provides information about the implementations, which includes abbreviated library function calls, and their modifications where it became necessary. Then, the planar graph generators are experimentally surveyed in Section 3. There, we first describe our generated data sets and our recommended parameter selection. The generated graphs are used to analyze basic graph properties in local as well as global scope to classify the graph generators. Afterwards, we sharpen this classification by means of algorithmic behavior, e.g., fixed parameter tractable (FPT) kernelization algorithms. Finally, we conclude this work with a recommendation which generators should be chosen to create a compilation of data sets that allows for meaningful interpretations of experiments.
2 Graph Generators From here on a graph G = (V, E) is considered to be a simple, labeled, undirected and planar graph, where V is the set of vertices {1, . . . , n} and E is the set of edges. A planar graph can be embedded in the plane without edge crossings. A planar graph together with a planar embedding is called a planar map. The selected graph generators presented in this section either are available in libraries, have low running times, are of theoretical interest or are based on ideas that are easy to implement. In our opinion this collection represents the important planar graph generators available. We separate the generators into two groups according to the input parameters. The first group are (n)-generators that take as a parameter the number of nodes n. Clearly, the number of edges of graphs generated by such a generator is random. The second group consists of the generators additionally taking the number of edges m as a parameter, denoted by (n,m)-generator. They allow for an arbitrary number of edges. As always, a degree of freedom implies the difficult decision on how parameters have to be selected reasonably. For our evaluation we created benchmark sets with each generator. Each planar graph generator had to generate graphs of size 5, 10, 25, 50, 75, 100, 250, 500, 1 000, 2 500 and 5 000 nodes n in increasing size. Since some graph generators have high running time we set a cut-off time to 14 days. For each graph size n we generated 4n graphs. If a graph generator failed to create the requested number of graphs within the time limit we report this behavior in the detailed generator descriptions later on. In the case of the (n,m)-generators, for each node count, graphs were generated having m = in/4 edges for i = 1, . . . , 11. The number of graphs generated for each of the n, m combinations is
An Experimental Study on Generating Planar Graphs
377
4n. All (n,m)-graphs were generated within the time limit. Note that the (n,m)-generators presented here first generate a maximal planar graph and then randomly delete edges until m edges remain. 2.1 (n)-generators The generators presented here can be subdivided into two groups according to their generation process. The first group consists of combinatorial generators, whereas the geometric generators form the second group. All of the presented (n)-generators are complete. Two of them are expected to draw planar graphs uniformly at random from the set of all planar graphs with the given vertex set v = {1, . . ., n}. Fusy. The planar graph generator developed by Fusy [12] is based on the principles of a Boltzmann Sampler [10]. Labeled graphs of size n are drawn uniformly at random. The running time is in O(n2 ) if the exact number of nodes is sampled or O( εn ) for an approximated graph size within [n(1 − ε ), n(1 + ε )]. The available implementation [11] is the linear-time version of the algorithm. The sampler is based on probabilities described using generating functions, which have to be evaluated laboriously for every number of nodes in a preprocessing step. Note that the Fusy generator cannot be used as an out of the box generator for two reasons. First, the implementation allows the graphs only to consist either of 1 000, 10 000 or 100 000 nodes. Second, only a marginal number of graphs were close to the desired size, i.e., within the interval [0.95n, 1.05n]. In particular, the ratio of all generated graphs that have inappropriate size nˆ was on average 77% for 3 ≤ nˆ < 0.95n and 21% for 25n ≥ nˆ > 1.05n, depending on the targeted graph size. Hence, only 2% of the generated graphs were within the targeted interval. We modified the generator to reject graphs of inappropriate size. Markov Chain. The planar graph generator by Denise et al. is based on a simple Markov chain [8]. The algorithm chooses a pair of nodes u, v at random. Now the transitions are as follows. If edge e = (u, v) exists, it is deleted. If not, a check is done whether the graph G = (V, E + e) is planar. In the case of planarity the edge is inserted. Otherwise it is discarded and the Markov chain remains in the current state. The stationary distribution of this Markov chain is uniform over all subgraphs of a given graph. Unfortunately, the mixing time of the Markov chain is unknown, but the authors expect that the equilibrium distribution should be reached after 3n2 iterations [8]. This behavior is verified by all our tests that we performed on 40 000 graphs of size 50 generated by 3n2 , n3 and n4 iterations. Generation of larger graph sizes is not feasible because of the long running time. The outcomes of all our tests were similar, independent of the number of iterations. Kuratowski. The Kuratowski generator is based on the Kuratowski theorem, which states that a graph is planar if and only if no subgraph is present that is a subdivision of K5 or K3,3 . The generator starts with a non-planar random graph. Iteratively, the algorithm searchs for a K5 or K3,3 subgraph and removes one of its edges until no more Kuratowski violations exist. Clearly, the running time of the Kuratowski generator strongly depends on the density of the initial graph. To possibly speed up the generation process we analyzed graph properties of graphs that were created from random graphs with edge size m equal to m = n log n and m ∈ θ (n2 ). The outcomes of our tests were
378
S. Meinert and D. Wagner
similar. Thus, graphs with m = n log n edges were generated as source for applying the Kuratowski algorithm. LEDA subroutine: KURATOWSKI(graph, V, E, deg). Intersection. This geometric (n)-generator is provided by the LEDA library. It is based on the intersection of line segments. The generator chooses n segments, constructs the corresponding arrangement and keeps the first n nodes. In the last step missing edges are inserted to make the graph connected. LEDA subroutine: random planar graph( graph, xcoords, ycoords, n). 2.2 (n,m)-generators Similar to the (n)-generators, (n,m)-generators rely either on combinatorial or on geometric approaches. Combinatorial generators triangulate the graph while adding nodes to it. Geometric generators first place points at random in a uniform sized rectangle. Afterwards the point set is triangulated. Note that the combinatorial generators create maximal planar graphs whereas the geometric ones generate planar triangulations, i.e., each face is bounded by three edges, except possibly the exterior face. No (n,m)generator is known that creates graphs uniformly at random. Convex Hull Triangulation. The LEDA library [16] provides a geometric convex hull triangulation algorithm (CHT) that is based on a sweep line. First, the nodes v ∈ V are sorted lexicographically, i.e., by x- and then by y-coordinate, such that v1 , . . . , vn denotes the sorted order. The algorithm processes the vertices in this order. Nodes are inserted and connected to all previous nodes they can see. In this way, after step i, the current graph consists of a triangulation of the first i points. The next vertex is connected to a subset of the previously inserted points lying on the convex hull. LEDA subroutine: random planar map(graph, xcoords, ycoords, int n, int m). By construction, when node vi is processed, node vi−1 is part of the current convex hull and can be seen by node vi . Thus, an edge (vi , vi−1 ) is added and vi becomes part of the new convex hull. Since edges are never removed, the sequence v1 , . . . , vn is a Hamiltonian path in the output triangulation. Thus, CHT cannot generate Non-Hamiltonian triangulations, which are known to exist [15]. Hence, CHT is not complete. Delaunay. The LEDA library [16] contains a Delaunay triangulation algorithm, which can be used to generate planar graphs. This generator is not complete as not every maximal planar graph is Delaunay realizable [9]. LEDA subroutine: DELAUNAY TRIANG( list L, GRAPH DT). Expansion. The node Expansion algorithm was first presented by Bowen et al. [7], who also showed its completeness. Note that the graph generator is combinatorial but generates an embedding as well. In particular, incident edges e1 , . . . , ek of each node are cyclically ordered. The algorithm starts with a K4 graph. Nodes are inserted by expanding a randomly selected node u along two incident edges ei and e j , 1 ≤ i, j ≤ k, i = j where k is the number of edges incident with u. Node u is expanded into two new nodes u1 and u2 . Additionally the edges ei and e j are doubled while updating their target node to u1 and to u2 , respectively. Thus, a face with four nodes is created, which is then triangulated randomly. The edges ei and e j separate the incident edges of u into
An Experimental Study on Generating Planar Graphs
379
Table 1. Summary of the studied generators. Asterisk marked results can be found in this work. generator Fusy [12] Intersection [16] Kuratowski [16] Markov [8]
complexity O(n) O(n log n) O(n2 log n) O(n3 )
complete yes yes yes yes
uniform yes no∗ no∗ yes
generator CHT [16] Delaunay [16] Expansion [7] Insertion [16]
complexity O(n + m) O(n2 ) O(n) O(n)
complete no∗ no [9] yes no
uniform no no open no
two subsets. These have to be assigned to u1 and u2 ; which is easy due to the ordering of the stored edges. Thus, a careful implementation yields linear running time. Insertion. The Node Insertion algorithm is available in the LEDA library [16]. It starts out with a triangle and iteratively picks a face f uniformly at random, inserts a new vertex and connects it to all vertices of f . LEDA subroutine: void random planar map( graph, int n, int m). Note that graphs generated by the Insertion generator always contain a node of degree at most 3. Hence, k-regular graphs with k > 3 cannot be generated. Therefore, Insertion is not complete. 2.3 Summary Table 1 gives an overview of the origin, complexity, completeness and possible uniform generation. We do not report on uniform generation of subclasses of planar graphs. Hence, an incomplete generator implies non-uniform generation. Due to their complexity Markov and Kuratowski were not capable of generating graphs larger than 500 and 1000 nodes, respectively. Hence, these generators cannot be recommended for large scale planar graph generation. In contrast, the other generators perform quite well. An exception is Delaunay; it generated all requested graph sizes but due to its complexity it may not be capable of generating really large graphs. Note that the running time of LEDA’s Intersection implementation is not specified but experiments indicate a running time of O(n log n). Additionally note that the completeness of Intersection and Kuratowski follows from their definitions and that uniform generation is quite unlikely, which is shown by our experiments.
3 Experiments We already described the performance of the generators, which together with the theoretical background allows to decide whether a generator is capable of generating graphs of favored size. In this section we further classify the presented planar graph generators by means of basic graph properties in local as well as globar scope. This classification is strengthened with respect to algorithmical behavior. Altogether, this result will help experimenters to reasonably compile data sets. But first, we report on the generation of our data-sets, which are then used in our experimental studies. 3.1 Dataset Generation Usually, in experimental studies a broad applicability of newly developed algorithms should be confirmed. In our case it is not feasible to generate all planar graphs of a
380
S. Meinert and D. Wagner
certain size n, especially when algorithms should be tested on larger instances. Obviously, a representative sample should be chosen. The (n)-generators sample graphs by their underlying behavior, which includes the number of generated edges. In contrast, the (n,m)-generators’ number of edges can be set arbitrarily. This raises the difficult question how to set the number of edges in a representative way. A first idea is to set the number of nodes and edges the (n,m)-generators have to create to the number of nodes and edges created by an (n)-generator, which allows to compare them with each other. As aforementioned, Fusy and Markov are expected to generate graphs uniformly at random but Markov was not capable of generating graphs of larger size. Thus, we generate a data set using the number of nodes and edges predefined by Fusy as input for the (n,m)-generators. This distribution is referred to as Fusy distribution. Each generator created 40 000 graphs whose number diverged by ±5% from 1 000 nodes as described in Section 2.1. Giminez and Noy [13] found that the average degree of a randomly selected planar graph is asymptotically normal. A graph of node count n is expected to contain μ ≈ 2.21n edges on average with a standard deviation of σ ≈ 0.65n. Fusy and Markov exactly fit the theoretical distribution. A consequence of this distribution is that with increasing node count the average degree of a randomly generated planar graph gets closer to its expected value. In particular, the standard deviation of the average degree for 1 000 nodes is σ1000 ≈ 0.025, which states with high probability only a small subset within the interval of possible edges m ∈ [0, 3n − 6] is generated. Thus a fourth data set was created by the (n,m)-generators whose average degree correspond to a normal distribution with mean μ = 2.21 and standard deviation σ = 0.65. This dataset of 40 000 values was chosen to span a larger part of the interval [0, 3n − 6], which should give a better overview how (n,m)-generators behave on a spreaded distribution. This distribution is referred to as Fixed Average Degree distribution. 3.2 Basic Graph Properties In the following basic, local and global graph properties of the generated planar graphs will be analyzed. Thereby, a classification of the generators is done. This gives a first sketch which generators should be used for a representative data-set compilation.
3.0 1.5
● ● ●
0.0
Average Degree
Average Degree. One of the very basic questions answered recently by Giminez and Noy [13] was the expected average degree of a random planar graph. According to the theoretical results the distributions of the average degree of Fusy and Markov match the expected distribution, see Figure 1. Intersection and Kuratowski can each clearly Fusy Inters. Kurato. Markov Fixed be separated from the other generators. For comparison, the Fixed Average Degree dis- Fig. 1. Inherent distributions of the average tribution used by the (n,m)-generators is degree of the (n)-generators and the Fixed Average Degree distribution shown. ● ●
● ●
● ●
● ● ● ● ● ● ● ● ●
Degree Sequence. The average degree describes a graph only roughly. A better way to reflect the structure of a graph is its degree sequence. Hence, in Figure 2 the degree
Delaunay
Expansion
Fusy
Insertion
0.10
0.20
0.30
CHT
381
0.00
Fraction of nodes
An Experimental Study on Generating Planar Graphs
0
2
4
6
8 10 0
2
4
6
8 10 0
2
4
6
8 10 1
3
5
7
9
0
2
4
6
8 10
Node Degree
Fig. 2. The distribution of the degree sequence of graphs generated by the (n,m)-generators using the Fusy distribution. For a better overview, outliers have been removed and the degree sequence has been cut off at 10 nodes.
sequence distributions of graphs generated by the (n,m)-generators using the Fusy distribution are shown. Note that nodes with a degree larger than 10 have been cut off. All graphs except Fusy consist of more than one connected component. Thus, Fusy contains no nodes with degree zero. The plot shows that CHT, Expansion and Fusy behave very similar and cannot be separated from each other. Insertion has more nodes of degree 2 and the peak at degree 3. This slope then decreases rapidly. The Delaunay generator has a larger mean. Its number of nodes having a degree less than 4 is much smaller compared to the other generators. The peak is at degree 4. More than 50% of the nodes have either degree 4 or 5. The slope then decreases very quickly. Although having similar trends the absolute values differ quite much. We further study the degree sequence distribution by the number of entries that are necessary to describe a graph. Our assumption is that it correlates with the graphs’ structural complexity. Note that we do not expect this to correlate with algorithmic complexity. In Figure 3 the number of degree sequence entries of the (n,m)-generators using the Fusy distribution as well as the Fixed Average Degree distribution are shown. Again, Delaunay and Insertion can be separated clearly from the other generators, which have a similar distribution of the degree sequence entries. The Delaunay generator has nearly a constant number of entries for all graphs and thus exhibits a regular structure. In contrast the Insertion generated graphs show the largest variance. Diameter. So far we analyzed elementary properties that were easy to obtain. By this, we got an idea which generators could complement each other. This classification will now be extended by a global property, namely, the diameter of a graph. The diameter of a graph is the length of the longest shortest path between all pairs of nodes in a graph. Thus, their values describes how compact a graph is. Figure 4 shows the diameters of graphs generated by the (n)- and (n,m)-generators using the Fusy distribution. The diameters of Intersection and Kuratowski are very large compared to the other generators. The graphs of both generators are connected and simultaneously have very low average degrees. Thus, the structure is more tree-like, which results in high diameters. The (n,m)-generators show some differences. For example, Insertion has a very small diameter whereas Delaunay has the largest mean diameter. Additionally, Insertion and CHT have small spreads. This difference can be explained by their generation process. Delaunay generates a comb-like regular structure whereas Insertion and CHT insert
S. Meinert and D. Wagner
● ● ●
30
● ●
●
●
● ● ●
● ●
10 ●
CHT
● ● ●
● ●
● ● ●
● ●
Expansion
Fusy
Insertion
● ● ●
● ● ●
● ●
● ●
●
●
●
●
●
●
●
● ●
●
●
●
●
●
● ●
● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ●
CHT
●
● ●
●
● ●
● ●
●
●
● ●
●
● ● ● ● ● ●
Delaunay
● ● ●
●
●
10
● ● ●
●
●
●
20
●
Number of Entries
30 20
Number of Entries
● ● ●
● ● ●
40
● ●
40
382
Delaunay
Expansion
Insertion
40
● ● ●
Fusy
Kuratowski
Markov
● ● ● ● ● ● ● ● ● ●
● ● ●
30
Diameter ● ● ●
Intersection
●
●
20
60
80
● ● ● ● ●
10
●
20
40
Diameter
120
Fig. 3. The number of values of the degree sequence is shown. Both sides show graphs generated with (n,m)-generators. On the left side graphs underlying the Fusy distribution are shown. The graphs on the right side are generated using the Fixed Average Degree distribution, which have been split into six groups of increasing edge count for each generator.
● ● ● ● ●
● ● ● ● ● ● ● ● ●
●
● ● ● ●
Fusy
Insertion
●
●
CHT
Delaunay
Expansion
Fig. 4. The diameters of the (n)-generators (left) and of the (n,m)-generators using the Fusy distribution (right)
shortcuts, i.e., long edges, which reduce both the diameter and its spread. Altogether, the studied diameter of graphs confirms the basic classification on a global scale. Clustering Coefficient. We complete our basic classification of the planar graph generators by the analysis of a local property. Namely, we measure the density of each vertex’ neighborhood, in particular we compute the clustering coefficient (CC) of a graph [19]. Figure 5 shows the clustering coefficients of the (n)-generators. Clearly, Kuratowski and Intersection can be separated from the other generators. This can be explained with the average degree being very small for Kuratowski. The graph is tree like and thus its CC is very small. The Intersection graphs have somewhat larger average degree that allow for a more complex graph than a tree. Hence, it exhibits a slightly larger interconnection. In the case of the (n,m)-generators three groups can be separated. The first consists of the Delaunay generated graphs. Due to the generation process the CC is less than of the other groups. The second consists of CHT, Expansion and Fusy. Minor differences within this group can be seen but they cannot be separated clearly. The Insertiongenerated graphs represent the third group. Their generation process leads to a high interconnection of the neighbors, which results in a very large CC. 3.3 Algorithmical Behavior So far, basic, local and global properties of the generated graphs have been analyzed. This analysis would allow for a classification of the generators with respect to a
0.1
● ● ● ● ● ● ● ● ● ●
Fusy
Intersection
Kuratowski
383
0.50
● ● ● ● ● ●
0.40
Clustering Coefficient
●
0.2
0.3
● ● ● ● ●
0.30
0.4
● ●
● ●
0.0
Clustering Coefficient
An Experimental Study on Generating Planar Graphs
Markov
● ● ● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ● ●
● ● ● ●
● ● ● ● ●
● ● ● ● ● ● ●
● ● ●
● ● ● ● ● ● ● ● ●
● ● ● ● ●
CHT
Delaunay
Expansion
Fusy
Insertion
Fig. 5. Clustering coefficients of the (n)-generators (left) and the (n,m)-generators using the Fusy distribution (right)
Expansion
Fusy
Insertion
Inters.
Kurato.
Markov
0
0
1
0
1
1
0
0.4
0.8
Delaunay
0.0
Fraction of nodes
CHT
0
2
4
2
4
2
4
3
2
2
4
k−core
Fig. 6. Coreness distribution of (n)- and (n,m)-generators using the Fusy distribution, outliers have been removed
complementary compilation. We now want to strengthen our proposition by a study of advanced algorithmical behavior, in particular by applying FPT algorithms [18]. K-Core Decomposition. First, we study topological properties of the generated graphs. To this end we use the k-core decomposition [20]. This method destructively simplifies the graph. Iteratively, nodes are removed from the graph by increasing degree k. This procedure is applied until all nodes have been pruned off the graph. The k-core of a graph is a maximal subgraph in which each vertex has at least degree k. A node has coreness k if it is part of the k-core but not of the k + 1-core. In Figure 6 the coreness distribution of graphs generated by the (n)- and (n,m)-generators using the Fusy distribution are shown. Note that outliers have been removed to give a better overview. Evidently, connected graphs do not have nodes with coreness zero. The Intersection and Kuratowski graphs only consist of nodes with coreness one and two. Again, the group consisting of CHT, Expansion, Fusy and Markov can hardly be distinguished. Due to its generation process Insertion does not have a 4-core. Delaunay graphs are dominated by the amount of nodes with coreness three. Thus, Delaunay and Insertion can be clearly separated from the other generators. K-Vertex Cover. We now take a first glance at an FPT problem. A problem is FPT if it admits an algorithm with running time O( f (k)nO(1) ), where f is an arbitrary function depending only on k. The problem we examine is k-vertex cover (k-VC). A vertex cover (VC) of a graph G is a subset C ∈ V (G) such that C ∩ {u, v} = 0, / ∀{u, v} ∈ E(G). The k-VC problem asks whether a VC of size |C| ≤ k exists. To solve k-VC a kernelization algorithm is applied in a preprocessing step, which reduces the initial instance to solve
S. Meinert and D. Wagner
0.8 0.6 0.4 0.2 0.0
Kernel Size of PDS
1.0
384
CHT
Delaunay
Expansion
Insertion
Fig. 7. Size of the PDS kernel of (n,m)-generators using the Fixed Average Degree distribution. The total number of generated graphs has been divided into eleven groups of increasing edge count, outliers have been removed.
in polynomial time to its problem kernel. The topological information we gained can be very useful. For instance, it can be used to estimate the size of the kernel when kVC kernelization is applied to graphs originating from a certain generator, where others performed extensive experimental studies [2,6]. Two kernelization rules exist how to handle degree one and two nodes. Thus, the problem reduction roughly equals the sum of the number of the nodes having coreness 0, 1 or 2. Recalling the coreness distribution outcomes in Figure 6 we see that Intersection and Kuratowski can be solved optimally. The best reduction of the remaining generators achieves Insertion. In contrast to that, Delaunay has the smallest reduction of all generators. The remaining generators behave very similarly. Planar k-Dominating Set. So far we used topological information, in particular the coreness distribution, to estimate algorithmical complexity. Now, we confirm different algorithmical behavior on the generated graphs solving planar k-dominating set (PDS), which is also FPT for planar graphs. A dominating set (DS) is a set D ⊆ V (G) of vertices such that each vertex in V (G) \ D has a neighbor in D. The PDS problem asks whether a DS of size |D| ≤ k exists. Similar to k-vertex cover, first a problem kernel is computed. However, the problem reduction of PDS does not rely on the degree of the nodes but the neighborhood of an examined node. The algorithms described in [4] and [3] have been implemented. The reduction is based on two kernelization and seven search tree rules. Alber et al. report impressive kernelization results [1] on several real world instances as well as artificially generated graphs. The authors were mainly interested in showing the algorithmical performance on real world problems but the data set also contained planar graphs that seem to not be selected representatively. Figure 7 presents the size of the PDS kernel. The large reduction reported was only partly achieved. CHT, Delaunay and Expansion show a large variance in the reduction whereas Insertion can be reduced in most times by an amount of about 85%. Thus, the selection of the graph generator has a high impact on the results achieved by this algorithm and a wrong selection would greatly bias the results gained [1]. Treewidth. So far, the topological information and one FPT algorithm confirm our classification. But we aim at establishing a broad base for the classification. We achieve this by studying the treewidth of a graph, the number of nodes that are mapped to the tree nodes of a tree decomposition of the graph. It is NP-hard to compute the treewidth of a
385
40
50
An Experimental Study on Generating Planar Graphs
●
CHT
Delaunay
Expansion
●
Fusy
●
Insertion
30
Treewidth
● ●
● ● ● ● ●
20
● ● ● ●
● ● ● ●
0 3 5 10
20
● ● ● ●
0 35
10
Treewidth
30
40
● ● ● ●
● ●
●
CHT
● ● ● ●
Delaunay
● ● ●
● ●
Expansion
● ● ●
● ●
Insertion
Fig. 8. Upper- and lower bounds of the treedwidth heuristics computed by LibTW [21] of the largest connected component of (n,m)-generated graphs according to the Fusy- (left) and the Fixed Average Degree distribution (right). For each generator the left boxplot shows the upper bound and the right boxplot the lower bound.
graph. Nevertheless, if the treewidth of a graph class is bounded, several NP-hard combinatorial problems can be solved in polynomial time. A k-tree is defined recursively as follows. The complete graph Kk on k vertices is a k-tree. Given a k-tree G on n ≥ k vertices, a k-tree on n + 1 vertices is obtained by adding a new vertex u and edges connecting u to every vertex of a Kk subgraph in G. A graph is a partial k-tree if it is a subgraph of some k-tree. Partial k-trees are exactly the graphs with tree width up to k. This is exactly the way graphs are generated by the Insertion generator. Hence, Insertion generated graphs have treewidth at most 3 and are often not appropriate instances when dealing with NP-hard problems. Figure 8 shows the outcomes of LibTW [21] upper- and lower-bound heuristics, which were applied to graphs generated by the (n,m)-generators using the Fusy- and Fixed Average Degree distributions. The heuristics confirm the bounded treewidth of Insertion generated graphs. The treewidth of CHT is larger than Insertion but is rather small compared to the other generators. The treewidth of Expansion partially equals the treewidth of Fusy. Delaunay generated graphs seem to be very hard instances since the span of upper- and lower bound is largest.
4 Conclusions This work is motivated by the ambigous description and inappropriate data-set selection found in many experimental works. To our knowledge no work exists that systematically analyzes planar graph generators, particularly with regard to assembling a complementary compilation of planar graph generators that allow for a meaningful interpretation of experimental work. This study allows for such a classification of a selection of planar graph generators, namely four (n)-generators (Fusy, Markov, Intersection, Kuratowski) and four (n,m)-generators (CHT, Delaunay, Expansion, Insertion). Fusy and Markov are capable of generating graphs uniformly at random. However, with growing size the expected average degree tends to a fixed value of 2.21, which by no means represents the possible interval [0, . . . , (3n − 6)/n]. The (n,m)-generators allow for an arbitrary average degree. Hence, we recommend a distribution of the average degree that spans this interval much better.
386
S. Meinert and D. Wagner
We empirically studied eight selected planar graph generators by means of running time, basic graph properties and algorithmic behavior. In our implementations we rely on the LEDA library, which provides several planar graph generators. Unfortunately, these are confusably named, which we cleaned up. It turned out that Kuratowski and Markov are not efficient enough to run large scale tests. The efficient generator Fusy is capable of drawing graphs uniformly at random but cannot be used as an out of the box generator. By a detailed analysis of basic graph properties most of the graph generators can be classified into groups. Thus, Delaunay and Insertion can clearly be distinguished from each other and from the group consisting of CHT, Expansion and Fusy. The latter group shows small differences at various tests but none allows for a clear separation. These differences and groupings can also be observed when FPT kernelization algorithms are applied. As a basic principle, experimental works should precisely describe the origin of the used data sets, which for generated graphs includes their distribution of the average degree. Experimenters should keep in mind which structural properties their algorithms exploit and ensure that the used data sets exhibts well distributed and representative structural properties to allow for significant empirical results. Because of the manifold properties of graphs that may be of interest, it is hard to present a general recommendation which of the studied generators to use. Nevertheless, theoreticians verifying practicability in a small experiment should rely on a uniform generator or use Expansion with a spreaded distribution of the average degree. For detailed experimental works, experimenters should compile data sets that at least consist of Expansion, Delaunay and Insertion generated graphs. Expansion overlaps CHT and Fusy to a certain extent. Nevertheless, both CHT and Fusy complement the data set.
References 1. Alber, J., Betzler, N., Niedermeier, R.: Experiments on data reduction for optimal domination in networks. Annals of Operations Research 146(1), 105–117 (2006) 2. Alber, J., Dorn, F., Niedermeier, R.: Experimental evaluation of a tree decomposition-based algorithm for vertex cover on planar graphs. Discrete Applied Mathematics 145(2), 219–231 (2005) 3. Alber, J., Fan, H., Fellows, M.R., Fernau, H., Niedermeier, R., Rosamond, F., Stege, U.: A refined search tree technique for dominating set on planar graphs. Journal of Computer and System Sciences 71(4), 385–405 (2005) 4. Alber, J., Fellows, M.R., Niedermeier, R.: Efficient data reduction for dominating set: a linear problem kernel for the planar case. In: Penttonen, M., Schmidt, E.M. (eds.) SWAT 2002. LNCS, vol. 2368, pp. 150–159. Springer, Heidelberg (2002), http://theinf1. informatik.uni-jena.de/publications/swat02.pdf 5. Bodirsky, M., Gr¨opl, C., Kang, M.: Generating labeled planar graphs uniformly at random. Theor. Comput. Sci. 379(3), 377–386 (2007) 6. Boros, E., Hammer, P.L., Tavares, G.: Preprocessing of unconstrained quadratic binary optimization. Technical report, Rutgers Center for Operations Research, RUTCOR (2006) 7. Bowen, R., Fisk, S.: Generations of triangulations of the sphere. Mathematics of Computation 21(98), 250–252 (1967) 8. Denise, A., Vasconcellos, M., Welsh, D.J.A.: The random planar graph. Congressus Numerantium 113, 61–79 (1996)
An Experimental Study on Generating Planar Graphs
387
9. Dillencourt, M.B.: Realizability of delaunay triangulations. Inf. Process. Lett. 33, 283–287 (1990) 10. Duchon, P., Flajolet, P., Louchard, G., Schaeffer, G.: Boltzmann samplers for the random generation of combinatorial structures. Combinatorics, Probability and Computing 13(4-5), 577–625 (2004) ´ Implementation of a boltzman sampler for planar graphs (2005), http://www. 11. Fusy, E.: lix.polytechnique.fr/~fusy/Programs/BoltzmannPlanarGraphs.tar.gz ´ Uniform random sampling of planar graphs in linear time. Random Structures & 12. Fusy, E.: Algorithms 35(4), 464–522 (2009) 13. Gimin´ez, O., Noy, M.: Asymptotic enumeration and limit laws of planar graphs. Journal of the American Mathematical Society (2008) 14. Brinkmann, G., McKay, B.: Fast generation of planar graphs, http://cs.anu.edu.au/ ~bdm/papers/plantri-full.pdf 15. Helden, G.: Hamiltonicity of maximal planar graphs and planar triangulations. Ph.d. thesis, RWTH Aachen (2007) 16. Mehlhorn, K., N¨aher, S.: The LEDA Platform of Combinatorial and Geometric Computing. Cambridge University Press, Cambridge (1999) 17. Meinert, S., Wagner, D.: An Experimental Study on Generating Planar Graphs. Technical report, ITI Wagner, Faculty of Informatics, Karlsruhe Institute of Technology (2011) 18. Niedermeier, R.: Invitation to Fixed Parameter Algorithms. Oxford University Press, Oxford (2006) 19. Schank, T., Wagner, D.: Approximating Clustering Coefficient and Transitivity. Journal of Graph Algorithms and Applications 9(2), 265–275 (2005) 20. Seidman, S.B.: Network Structure and Minimum Degree. Social Networks 5, 269–287 (1983) 21. van Dijk, T., van den Heuvel, J.-P., Slob, W.: Computing treewidth with LibTW (2006), http://www.treewidth.com/docs/LibTW.pdf
Author Index
Aleksandrowicz, Gadi 90 Alipour, Sharareh 343 Barequet, Gill 90 Benko, Attila 176 Birks, Martin 319, 330 Brandenburg, Franz J. 352 Cai, Jin-Yi 1 Cai, Junqing 82 Caragiannis, Ioannis 185 Chang, Zhuo 308 Chen, Danny Z. 196 Chen, Lin 36, 244 Chen, Min 176 Chen, Shikun 264 Chen, Yong 208 Chin, Francis Y.L. 308 Cole, Daniel 319 Dai, Wenqiang 29 Das, Sandip 364 D´ osa, Gy¨ orgy 176 Fan, Chenglin 113 Fellows, Michael R. 4 Feng, Qilong 156 Feng, Yi 29 Fung, Stanley P.Y. 319, 330 Gleißner, Andreas 352 Goebel, Randy 46 Govindaiah, Swetha 58 Guo, Jiong 156 Guo, Longkun 300 Han, Xin 176, 308 He, Jing 70, 147 Hofmeier, Andreas 352 Hu, Shi-Wei 168 Jiang, Wei Ju, Wenqi
233 113
Kaklamanis, Christos 185 Karmakar, Arindam 364 Koutsoupias, Elias 6 Kyropoulou, Maria 185 Le, Trong Dao 275 Leong, Hon Wai 275 Li, Hao 82 Li, Mengjun 264 Li, Yong 220 Li, Zhong 46 Li, Zhoujun 264 Liang, Hongyu 70, 147 Lin, Guohui 46 Liu, Fayao 220 Liu, Tian 233 Luo, Jun 113 Luo, Weizhong 156 Luo, Wenchang 36, 244 M´ aˇcajov´ a, Edita 136 Mahapatra, Priya Ranjan Sinha Maz´ ak, J´ an 136 Meinert, Sascha 375 Misiolek, Ewa 196 Moczurad, Wlodzimierz 255 Mukherjee, Joydeep 364 Nagamochi, Hiroshi Ning, Wantao 82 Oguri, Fumiya Ren, Tienan
100
287 233
Shen, Hong 300 Snoeyink, Jack 8 Song, Xiaoyu 264 Tan, Xuehou 125 Tan, Zhiyi 208 Ting, Hing-Fung 308 Uno, Yushi
287
364
390
Author Index
Wagner, Dorothea 375 Wang, Jianxin 156 Wang, Lusheng 46 Wang, Tao-Ming 168 Weng, Kerui 10 Wu, Gangshan 125 Xiao, Mingyu 100 Xiong, Wei 220 Xu, Ke 233 Xu, Yinfeng 17 Xue, Huichao 319
Yin, Jianping
220
Zarei, Alireza 343 Zhan, Yubin 220 Zhang, An 208 Zhang, Guochuan 244 Zhang, Huaming 58 Zhang, Huili 17 Zhang, Melvin 275 Zhang, Yong 308 Zhao, Zhiheng 220 Zhou, Chenyang 176 Zhu, Binhai 113