ebook img

Elements of Combinatorial Computing PDF

265 Pages·1971·15.656 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Elements of Combinatorial Computing

To my parents and my MARvellous harem ELEMENTS OF COMBINATORIAL COMPUTING BY MARKB. WELLS Computer Science Research Group Leader, Los Alamos Scientific Laboratory of the University California, Los Alamos, New Mexico 87544 PERGAMON PRESS OXFORD · NEW^YORK TORONTO - SYDNEY . BRAUNSCHWEIG Pergamon Press Ltd., Headington Hill Hall, Oxford Pergamon Press inc., Maxwell House, Fairview Park, Elmsford, New York 10523 Pergamon of Canada Ltd., 207 Queen's Quay West, Toronto 1 Pergamon Press (Aust.) Pty. Ltd., 19a Boundary Street, Rushcutters Bay, N.S.W. 2011, Australia Vieweg & Sohn GmbH, Burgplatz 1, Braunschweig Copyright (c; 1971 Pergamon Press Inc. All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmit ted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of Pergamon Press Inc. First edition 1971 Library of Congress Catalog Card No. 77-129633 Printed in Hungary 08 016091 3 PREFACE THE development of high-speed computing over the past two decades has had an extra­ ordinary impact upon the scientific community. At first, this "computer revolution" most strongly influenced, and was influenced by, physicists, engineers, numerical ana­ lysts, and other applied scientists interested in performing arithmetic calculations to obtain numerical answers to their problems. However, the versatility of the electronic computer, its ability (crude and unplanned though it was and generally still is) to per­ form nonarithmetic manipulations, soon stimulated interest among "pure" mathemati­ cians—primarily, number theorists and algebraists—and among scientists of less numeri­ cally oriented disciplines such as operations research and linguistics. At present, "non- numerical computing"—computing in which the basic operations are nonarithmetic (e.g. logical, set-theoretic, symbol manipulative) and in which classical numerical analysis plays, if at all, a minor role—is gaining in importance. This book is about one aspect of nonnumerical computing: the high-speed manipulation (e.g. generation, covering, comparison) of combinatorial objects such as permutations, partitions, and linear graphs. There is, of course, a close kinship between this combinatorial computing and combina­ torial mathematics. In fact, most of the methods and examples appearing in this book are taken from the study of problems in combinatorial theory. Nevertheless, there is impor­ tant interaction between such computing and other disciplines. The techniques presented here find application in the fieldso f number theory, algebra, switching theory, biomathe- matics, game theory, and operations research, as well as combinatorics. The primary purpose of this book is to bring together under one cover the basic and important computer methods of solving problems which involve the handling of combi­ natorial entities (more generally, of finite sets). Moreover, we wish to assist the reader in gaining facility for constructing combinatorial algorithms of his own design. Thus special attention is given to the structure of the algorithm, why they work, and how they may be altered to accomplish similar but distinct tasks. Of course, we also hope that this book will be a source of ideas for workers in combinatorics and computer science. Two underlying goals of this book are to introduce the pure mathematician to the possi­ bilities of high-speed computation, and to point out to the computer scientist some of the needs of the research mathematician. With regard to these objectives, the language used for describing the algorithms is of central importance; and there are several considerations in choosing an algorithmic xi XU PREFACE language. Firstly, the language should be natural, i.e., it should be readable and reason­ ably concise, using established mathematical notation as much as possible. Use of an uncontrived, not altogether foreign, language simplifies and enhances understanding of the algorithms and eases the task of their modification. Secondly, the language should have a degree of sophistication which allows suppression of detail inessential to concep­ tual understanding of the processes. Certainly a user should not be required to repeat in detail the thought processes previously followed by other qualified algorithmists or computer designers. Finally, it is desirable to have the algorithmic language serve as the programming language, i.e., to have facilities available for the automatic translation of the algorithms into "absolute code" for a particular computer. This, of course, greatly shortens the time from problem conception to the production of useful results. (This capability should play a subordinate role in the design of the algorithmic language, however.) Algorithms are presented in this book in a language especially designed for combina­ torial computing. This language is both more natural and more sophisticated than the common programming languages Fortran and Algol. Also, most of its features have indeed been implemented—as part of the programming language Madcap for the Maniac II computer in Los Alamos. The language and its implementation are discussed in Chapters 1 and 2. Chapter 3 is both an introduction to combinatorial terminology and to data representation within a computer. The serious discussion of algorithms and their structure begins with Chapter 4. An attempt has been made to use notations from the language in textual descriptions of the algorithms as well as in the programs which implement the algorithms. Translation from the notation of this book to a programming language available on a specific computer should cause little difficulty, particularly if certain basic non- numerical operations such as logical or, logical and, shifting, and counting 1-bits are readily programmable for that machine. To simplify this translation, care has been taken to define sophisticated notations in terms of previously defined, more elementary notations which closely resemble familiar Fortran and Algol statements. Actually, sophistication is a relative matter. The science of computing and its lan­ guage of presentation, like mathematics, grows in steps, the methods and notation at one level being the building blocks for higher order methods and notation. With the tech­ niques and language presented here, we attempt to take but the first step in the founding of a science of combinatorial computing—the use of the word "elements" in the title of this book is certainly appropriate. We hope, however, to have achieved a unification of many of the basic concepts which can easily lead to more advanced methods and nota­ tions for combinatorial computing. This book is intended primarily for mathematically trained individuals interested in the use of high-speed digital computers for obtaining "answers" (counter-examples and heuristic data perhaps more so than final results) to combinatorial problems. Beyond basic mathematical training—finite set theory and the elements of algebra and number theory (number systems, groups, congruences, etc.)—this book presupposes only a grasp PREFACE XIJ1 of the concept of algorithmic computing. Actually, much computer and combinatorial terminology with which a person with this training could be expected to be familiar is herein explained anew. Just as the numerical analyst finds it necessary to employ differ­ ence equations when seeking help from a digital computer, the combinatorial analyst also finds it necessary to return to fundamentals for preparation of his computer programs. The fundamentals here, with which it is assumed the reader has facility, are the principle of induction (more precisely, the concept of recursive definition) and the logical rule-of- sum and rule-of-product (in a set-theoretic language, these are ΑΠΒ = 0 implies \AUB\ = \A\ + \B\ and \AXB\ = |^|-|#l> respectively). However, let the reader be warned that the elementary nature of the tools does not necessarily imply simplicity of the structures built with them. Many combinatorial algorithms are extremely com­ plicated, and their mastery involves much plain hard work. Discussion of the algorithms is for the most part casual; formal proofs are not in­ cluded. Nevertheless, this book is appropriate as a supplementary textbook for an upper class or graduate course in combinatorial theory, computing, or numerical analysis. (In this respect it should be noted that the order of Chapters 4, 5, and 6 is somewhat arbitrary, as is the order of the major sections i n Chapters 6 and 7.) Of course, this book could also be used as a basis for a course entitled, say, Introduction to Discrete Comput­ ing; although, for such an endeavor to be truly successful, an implementation of the language should be available to the student.1" Indeed, it is our hope that many of the language features used here will some day be incorporated into a generally available programming language. The exercises at the end of each major section are considered an integral part of the text. They should be read, even though not solved, since besides practice problems they contain definition of terminology, discussion of alternate methods and useful modifica­ tions, and suggestions for further research. Some of the programming exercises antici­ pate later discussion; hence their answers appear in the text. Most problems, however, are best pursued by actual computer experience. Answers to a few of these problems appear in Appendix II as tables calculated by the author. Asterisks are used to mark more difficult exercises, those which might better be called projects. The single bibliography at the end of the book is organized by chapter. It contains suggestions for further reading as well as cited references. Many of the works are listed by virtue of their expository character and the extensive bibliographies which they contain. All of the procedures presented in this book have been tested on the Maniac II com- t The author, as a Visiting Professor, used the manuscript of this book for a senior level course under the Department of Mathematical Sciences at Rice University, Houston, Texas, during the spring semester 1970. Translation to Burroughs Compatible Algol for the B5500 computer at Rice was annoying but not difficult. There is somewhat more material in this text than can be covered in one semester. A full year's course entitled "Combinatorics and Computing" could be fashioned from this book by introducing certain concepts of theoretical combinatorial analysis (e.g. generating functions, inclusion-exclusion^ Polya enumeration) at appropriate points in the presentation. χιν PREFACE puter at the University of California Los Alamos Scientific Laboratory, Los Alamos, New Mexico. However, since there is still the possibility of inaccuracies due to debugging oversights, language ambiguities, or other errors, the reader is advised to take nothing for granted. Many people have assisted me in diverse ways in the preparation of this work. First, I would like to thank the administration of the Los Alamos Scientific Laboratory for allowing me to undertake this project under their sponsorship. Discussions with Stanislaw Ulam, Roger Lazarus, Paul Stein, Robert Bivins, Nicholas Metropolis, Myron Stein, Marvin Wunderlich, Robert Korfhage, Donald Knuth, and Robert Floyd influenced this work. Particular thanks are due to Robert Bivins, Roger Lazarus, Nicholas Metropolis, and Paul Stein for their constructive comments upon reading the manuscript. I am indebted to Verna Gardiner for debugging assistance and to Donald Bradford for his patient help with the language development as well as for debugging assistance. The final manuscript was expertly typed by Margery McCormick and Dorothy Camillo. I also wish to thank Fred Cornwell, Jay London, and Jane Rasmussen for their clerical support. Finally, along a somewhat different vein, I would like to acknowl­ edge two especial debts—to Professor S. Ulam for his continued stimulation of my work and to Professor D. H. Lehmer whose commonsense approach to mathematics and computing has always been an inspiration to me. This work was performed under the auspices of the United States Atomic Energy Commission. CHAPTER 1 A LANGUAGE FOR COMBINATORIAL COMPUTING THE vocabulary of present-day computers is such that algorithms written in language intelligible to most scientists cannot be presented directly to the computer for execution —a translation is required. However, auxiliary computer programs can be written to accomplish "automatically" at least part of this translation. Such programs are called compilers; they translate a source program, written in source language (programming language), to an absolute machine code directly executable by the computer. It is desir­ able that the algorithmic language of the scientist and the source language be nearly identical, for then no translation by erring humans is required. The profit from a sophisticated programming language in which concepts may be expressed directly is considerable. The programmer who wishes to indicate an "iteration" (see§ 1.4) should no more have to be concerned with the details of setting, incrementing, and testing the dummy index than the mathematician should have to write lim **+*)-**> when he wishes to indicate the derivative of a function with respect to x. On the other hand, even if it were possible, it is probably not reasonable (due to efficiency considera­ tions) to allow programming language development to proceed without regard to auto­ matic translation of the language to computer code. In this book a language is used which is more sophisticated (especially for combinatorial computing) than the common programming languages Fortran and Algol, yet which also lends itself to efficient trans­ lation by a compiler. This language is described, quite informally, in this chapter. It is to be hoped that a mathematically trained individual having some familiarity with programming languages in general could skim rather lightly over this material. Efficient programming and certain aspects of the translation problem itself are discussed in Chapter 2. 1 2 ELEMENTS OF COMBINATORIAL COMPUTING 1.1. Fundamentals Our combinatorial language is a statement language, i.e. a (source) program for performing a certain task consists of a sequence of statements describing the calculation which is to take place. It is "user-oriented" in that standard mathematical notation and English, not foreign to an uninitiated user, are the basis of statement construction. 1.1.1. Program Structure The statements encountered in a program are of two types: formulae and control clauses. Most requisite computation is specified within a formula, while control clauses (conditional statements and iteration quantifiers—see later sections) govern the logical flow of the program. Formulae are usually written one per line, but may appear several per line separated by semicolons (semicolons are generally omitted from the end of a line). To indicate continuation onto the next line, very long statements are broken imme­ diately following an operation symbol, the "equals" symbol (used as the assignment operator—see below), or a comma. The statements under jurisdiction of a control clause are separated from that clause by a colon. Such statements which are written on separate lines are indented in order to display the extent of the jurisdiction. Indentation within indentation often occurs to several levels. The case where the number of levels is variable or indefinite is discussed in§ 1.5. For internal reference purposes (e.g. reference by transfer of control statements —see§ 1.3), any statement may be given a label consisting of an unsigned integer pre­ ceded by the number symbol #. These labels are placed in a special column just to the left of the statement sequence. An illustration of the structure of a program is given in Fig. 1.1. (Note: Fully capi­ talized words such as FORMULA, STATEMENTS, PROGRAM, ARGUMENTS are used in place of specific examples when program structure rather than notational detail is being emphasized.) A program often consists of several distinct segments, each segment designed to accomplish a particular part of the total job. For delimitation and reference purposes (e.g. describing program changes), segments are labeled with capital letters A, B, ..., and lines of program within a segment are then numbered 0, 1, ... ; a decimal point separates segment labels from line numbers. When exhibited, these segment and line labels appear at the far left as illustrated in Fig. 1.1. A segment may be used as a "procedure" (a finished program referenced via func­ tional notation—see § 1.1.4), in which case line 0 consists of the procedure name and list of arguments. Subsegments, labeled for example A.A., C.B., A.B.A., though useful in general, appear infrequently in this book. The nesting of segments and the "local- global" properties of names and statement labels used within a segment are discussed in § 2.4. A LANGUAGE FOR COMBINATORIAL COMPUTING 3 A.l FORMULA; FORMULA A.2 #1 CONTROL CLAUSE: A.3 FORMULAE A.4 CONTROL CLAUSE: FORMULA A.5 #2 STATEMENT A.6 STATEMENT PROGRAM B.O PROCEDURE NAME(ARGUMENTS) B.l STATEMENT FIG. 1.1. Sample program structure. A formula takes the form v = E (or E -* v), where v represents the name of a variable which is to be assigned the "numerical value" as computed from the mathematical expression E. (The use of the equals symbol as an assignment operator is a slight aberration from normal mathematical usage due to the admission of formulae such as / = /+ 1. We avoid this construction by use of von Neu­ mann's /+1 -* i. However, in general, this use of the equals symbol should cause no confusion. Symbols used by other languages for this assignment operation include: : = ,*-, and let ... =.) For names of variables, we use (1) the English letters in upper and lower case, A, B, ..., Z, a, b, ..., z, (2) these letters modified by a bar, tilde, star (asterisk), and/or an Arabic numeral, e.g. r, Ä, x*, p3*, and H2, and (3) the upper case English letters modified by a few lower case letters, e.g. Tag, Link, and Gt. These naming conventions give us ample freedom in choosing variable names without exceed­ ing the character limit of a normal mathematical typewriter. Also, with only a little care (which we indeed exercise), juxtaposition may be used to indicate multiplication. A statement of the form v ** u (where v and u represent names of variables) is equivalent to the following sequence of three formulae: d = u; u = v; υ — d with d used here as a dummy variable name. A statement of the form x,y,z = E

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.