IS BINARY ENCODING APPROPRIATE FOR THE PROBLEM-LANGUAGE RELATIONSHIP?

Similar documents
On the Complexity of the Policy Improvement Algorithm. for Markov Decision Processes

Assignment 1 (concept): Solutions

6.001 Notes: Section 4.1

Dynamic Programming Algorithms

Theoretical Computer Science

The strong chromatic number of a graph

Chapter 15 Introduction to Linear Programming

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Algorithms Exam TIN093/DIT600

3 No-Wait Job Shops with Variable Processing Times

in this web service Cambridge University Press

Treewidth and graph minors

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Module 7. Independent sets, coverings. and matchings. Contents

Digital Logic Design: a rigorous approach c

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Binary Search to find item in sorted array

Decreasing the Diameter of Bounded Degree Graphs

Data Compression - Seminar 4

Discrete Mathematics

1 Variations of the Traveling Salesman Problem

Mathematical and Algorithmic Foundations Linear Programming and Matchings

Solutions to the Second Midterm Exam

1 Definition of Reduction

Theorem 2.9: nearest addition algorithm

On Considerations of Language in the Diagonal Proof

CIS 194: Homework 6. Due Monday, February 25. Fibonacci numbers

Faster parameterized algorithms for Minimum Fill-In

AXIOMS FOR THE INTEGERS

Parameterized graph separation problems

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

Graph Theory Questions from Past Papers

9 abcd = dcba b + 90c = c + 10b b = 10c.

9 abcd = dcba b + 90c = c + 10b b = 10c.

Maximal Monochromatic Geodesics in an Antipodal Coloring of Hypercube

arxiv: v1 [cs.cc] 30 Jun 2017

LP-Modelling. dr.ir. C.A.J. Hurkens Technische Universiteit Eindhoven. January 30, 2008

II (Sorting and) Order Statistics

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

Topology Homework 3. Section Section 3.3. Samuel Otten

Cantor s Diagonal Argument for Different Levels of Infinity

Module 11. Directed Graphs. Contents

Multi-Cluster Interleaving on Paths and Cycles

Algorithms (III) Yu Yu. Shanghai Jiaotong University

The Cartesian product of cycles C n1, C n2,, C ns, denoted C n1 C n2 C ns can be viewed as the Cayley graph of Abelian group Z n1 Z n2 Z ns

9/10/2018 Algorithms & Data Structures Analysis of Algorithms. Siyuan Jiang, Sept

Lecture 6: Arithmetic and Threshold Circuits

Optimization I : Brute force and Greedy strategy

Practice Final Exam Solutions

Algorithms (III) Yijia Chen Shanghai Jiaotong University

Dynamic Programming Algorithms

Comparing the strength of query types in property testing: The case of testing k-colorability

A.1 Numbers, Sets and Arithmetic

8 Matroid Intersection

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

Chapter 3: Theory of Modular Arithmetic 1. Chapter 3: Theory of Modular Arithmetic

I. Recursive Descriptions A phrase like to get the next term you add 2, which tells how to obtain

Solutions to Homework 10

1 Elementary number theory

Using Arithmetic of Real Numbers to Explore Limits and Continuity

COLORING EDGES AND VERTICES OF GRAPHS WITHOUT SHORT OR LONG CYCLES

CS2 Algorithms and Data Structures Note 1

CSE 20 DISCRETE MATH WINTER

On-line Steiner Trees in the Euclidean Plane

EC121 Mathematical Techniques A Revision Notes

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #23 Loops: Precedence of Operators

2 The Fractional Chromatic Gap

Minimum Cost Edge Disjoint Paths

Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have

On the Max Coloring Problem

Math 4242 Polynomial Time algorithms, IndependentSet problem

1 i n (p i + r n i ) (Note that by allowing i to be n, we handle the case where the rod is not cut at all.)

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Sorting lower bound and Linear-time sorting Date: 9/19/17

Fast and Simple Algorithms for Weighted Perfect Matching

Lecture 8: The Traveling Salesman Problem

Elementary maths for GMT. Algorithm analysis Part I

Recursively Enumerable Languages, Turing Machines, and Decidability

On Covering a Graph Optimally with Induced Subgraphs

DOWNLOAD PDF BIG IDEAS MATH VERTICAL SHRINK OF A PARABOLA

Coloring edges and vertices of graphs without short or long cycles

Polynomial-Time Approximation Algorithms

Recognizing Interval Bigraphs by Forbidden Patterns

Exact Algorithms Lecture 7: FPT Hardness and the ETH

Core Membership Computation for Succinct Representations of Coalitional Games

ALGORITHMIC DECIDABILITY OF COMPUTER PROGRAM-FUNCTIONS LANGUAGE PROPERTIES. Nikolay Kosovskiy

Lecture notes on the simplex method September We will present an algorithm to solve linear programs of the form. maximize.

Introduction to Automata Theory. BİL405 - Automata Theory and Formal Languages 1

THE GROWTH OF LIMITS OF VERTEX REPLACEMENT RULES

INTERLEAVING codewords is an important method for

A Reduction of Conway s Thrackle Conjecture

CSE 21 Spring 2016 Homework 4 Answer Key

AtCoder World Tour Finals 2019

Chapter 5 VARIABLE-LENGTH CODING Information Theory Results (II)

Transcription:

Theoretical Computer Science 19 (1982) 337-341 North-Holland Publishing Company NOTE IS BINARY ENCODING APPROPRIATE FOR THE PROBLEM-LANGUAGE RELATIONSHIP? Nimrod MEGIDDO Statistics Department, Tel Aviv University, Tel Aviv, Israel Communicated by M. Nivat Received January 1982 Abstract. It is proved that there exist encoding schemes which are arbitrarily as efficient as the binary encoding (in terms of compactness and arithmetic operations), with respect to which Khachiyan's algorithm for Linear Programming is exponential. This constitutes an objection to the standard translation of problems into languages via the binary encoding. When we speak about the complexity of a problem in which numbers are involved, we usually think of a formalization as a language recognition problem where the numbers are encoded in binary. Most of the people believe that the work of Khachiyan [2] has resolved the question of the complexity of linear programming. However, if we wish to be precise, Khachiyan has proven that the language of linear inequalities in binary encoding belongs to the class P. The complexity of linear programming as a problem (rather than a language) still constitutes an interesting open question. A major open question is the following: Is there an algorithm and is there a polynomial p(m, n) such that every set of rn ~inkar inequalities in n variables can be solved by the algorithm in less than p(m, n) arithmetic operations? We shall call such an algorithm genuinely-polynomial. Special linear programming problems for which genuinely-polynomial algorithms are known are the max-flow problem, the shortest-path problem and the assignment problem. One may argue that the distinction between polynomial and genuinely-polynomial is not essential since the amount of time required for the arithmetic operations is at least proportional to the logarithms of the numbers. More specifically, let A denote the maximal absolute value of a coefficient in a given set of rn inequalities in n variables with integral coefficients. Khachiyan's algorithm works in q(m, n, log A) time where q is a certain polynomial, whereas a genuinely-polynomial algorithm requires at least p(m, n) log A time. So, in what sense are the two notions distinct? The answer is simple. A genuinely-polynomial algorithm runs in polynomial time whenever the arithmetic operations can be carried out in polynomial time, whereas Khachiyan's 0304-3975/82/0000-0000/$02.75 @ 1982 North-Holland

338 N. Megiddo algorithm may require exponential time even when the arithmetic operations are polynomial. We will enhance the argument of the preceding paragraph by proving the following: Theorem. For every E > 0 there exists an encoding scheme (i.e., a one-to-one mapping E : Z + (0, 1)") such that (i) For every integer N # 0 the length of E(N), denoted by l(n), satisfies l(n) (1 +EN llog21nii + 1). (ii) Comparisons and arithmetic operations can be carried out in time polynomial in the l(n)'s (uniformly in E). (iii) There are infinitely many numbers N such that l(n) = O(log1og N). The theorem claims that there exist encoding schemes which are almost as efficient as the binary encoding (in the sense of (i)) and are also convenient for manipulating arithmetics. The third property implies that algorithms like Khachiyan's run in exponential time if such encoding schemes are being used. This is because when those numbers which are represented compactly (i.e., in O(log1og N) bits) appear in the set of inequalities then the factor log N which appears in the runtime is exponential in terms of loglog N. Proof. We will first prove the claim of the theorem with respect to E = 1 and then indicate how to extend it for any E > 0. For simplicity let us work with positive numbers. Let N be any positive integer and let B(N) = b1b2... bk denote its binary representation, i.e., bi E {0,1} k (i = 1,..., k), bl = 1 and N = xi=, bi2kpi. The binary expansion consists of blocks of consecutive ones and blocks of consecutive zeros. The sequence of lengths of these blocks characterizes the number N. In our scheme we will represent these lengths in binary and separate them by commas. Later, the commas will be eliminated.' Specifically, the encoding E(N) is recursively defined as follows. If bi = 1 (i = 1,..., k) then we define E(N) = B(k); otherwise, let jl = min{i: bi = 0) andj2=min{i: i>jl,bi=l}anddefinee(n)=b(jl-1),b(j2-jl),e(bj,... bk).for example, the number 63631 which is encoded in binary as 11 11100011111100 will be encoded in our scheme as 101,11,110,10. An obvious way to eliminate the commas is as follows. We will utilize only the odd-numbered bits for representing the block-lengths. The even-numbered bits will represent the commas according to the convention that a comma exists where an even-numbered bit contains a one. For example our number 63631 will be encoded without the commas as 1000111011101001100. The number of bits required by this encoding scheme is less than twice the number of bits required in binary. The worst-cases are numbers ' An efficient method for eliminating the commas is described by Even and Rodeh [I]. Instead of doubling the number of bits, their method adds to an n-bit number O(log n) more bits to eliminate a delimiter.

Binary encoding and the problem-language relationship 339 like 170, whose binary expansion is 10101010. In our scheme it is 1,1,1, 1,1, 1, 1,l or, without the commas, 11 11 11 11 11 11 11 1. It is obvious that claim (i) is true in our case. Also, claim (iii) is proved by the numbers of the form N = 2K - 1. This encoded in binary is a string of K ones and in our scheme it requires 2 [log2k1 + 1 bits which is O(log1og N). We will now show how to perform the arithmetic operations and comparisons using our encoding scheme. For simplicity of notation we will work with the version that uses commas. To compare two positive numbers Nl, N2 we operate as follows. Suppose E(N1) = Al,..., A, and E(N2) = B1,..., B, where the Ails and Bi's are binary representations of block-lengths in the expansion of N1 and N2, respectively. Let A = C A; and B = C Bi. If A > B (A < B) then N1 > N2 (N1 < N2). Suppose A = B. Now, if Al > BI (A1 < B1) then N1 > N2 (N1 < N2). If also A1 = B1 then if A2 > B2 (A2 < B2) then NI < N2 (N1 > N2) and so on. Obviously, the comparison between two numbers in our encoding scheme reduces to comparisons in binary of block-lengths. We conclude that comparisons can be done in linear time. Additions can also be carried out in linear time. We first note that a number A; (or Bi) represents a block of ones if i is odd and a block of zeros if i is even. We start from the blocks represented by A, and B,. Consider, for example, the case where r is even and s is odd. The last block in the expansion of the number Nl + N2 consists of ones. If A, f B, then the length of that block is equal to min(a, B,). If A, = B, then we need to compare ArP1 with BSp1 in order to tell the length of the first block; if A,-1 = B,-l then we need to proceed to and Bs-2 and so on. However, in any case the addition N1 + N2 amounts to no more than r + s additions and comparisons between Ai's and Bi's. Multiplication is naturally more complicated but can also be carried out in polynomial time. Consider first the case where we need to multiply two numbers N1, N2 encoded as above, however assuming s = 1. In other words, N2 = 2B1-1. In this case we first find E(N1. (N2+ 1)) and then subtract N1. The multiplication of N1 by N2+1 is simple: If r is odd then E(Nl (N2+1))=A1,...,A,, B1 and if r is even then E(Nl - (N2+l))=Al,...,Ar-1, (A,+B1). Thus, in this case E(Nl N2) is found in linear time. It is easy to see that, in general, E(N1 N2) can be found by multiplying Nl by the odd-numbered blocks of N2, shifting and adding, in time which is O((1 log Ai)(C log B;)). There are of course faster ways for multiplication in our scheme which resemble the faster methods for multiplication in binary. To prove the theorem for an arbitrary E > 0, we modify the encoding as follows. We select an integer M which is sufficiently large, depending on E. In the encoding scheme EM(N) which we define below the bits whose locations are at 1 and 2 (mod (M + 2)) play a distinguished role. They indicate how the contents of the succeeding M bits should be interpreted. This is explained in detail below. An example is given in the Appendix. Suppose B(N) = 6162... bk. Consider the first block of consecutive ones. If its length L is less than or equal to M then the first M +2 bits in EM(N) will be

340 N. Megiddo Olblb;!... bm. The prefix 01 indicates that what follows is copied from the binary representation of N. Suppose L is greater than M and let al... aim denote the binary expansion of L using an integral multiple of M bits (possibly with leading zeros). The first i(m+2) bits in EM(N) will then be llal... ~ ~ l O a ~. a2~10a2m+1.. + ~... a3m10a(i-~,m+1... ai~.theprefix 11 inbits 1,2 indicates that at that point we start to describe in binary representation the length of a block of consecutive ones from B(N). Similarly, we will use the prefix 00 to signify the start of a binary representation of a length of a block of zeros. The pair 10 indicates continuation of the same interpretation from the preceding group of M bits. Inductively, suppose we have translated all the bits bl,..., bi from B(N) to EM(N) and we are now at the bit numbered q(m +2)+ 1. We now consider the bits bi+l,..., bi+m+l. If they are identical then we write 00 or 11 (depending on the contents of these identical bits) in the bits q(m+2)+ 1 and q(m+2)+20fem(n).wethenlookatthenumberl=min{i: i>j, biz bi+l}-1-1. This is the length of the maximal block of identical bits starting at bj+l. Consider the expansion of L in an integral multiple of M bits (possibly with leading zeros). We now copy this expansion into EM(N) starting at bit q(m+2)+3, using the continuation code 10 in (q + l)(m + 2) + 1, (q + l)(m + 2) + 2, (q + 2)(M + 2) + 1, (q + 2)(M + 2) + 2, etc., if necessary. If, on the other hand, the bits bi+l,..., bj+m+l are not all identical, then we simply copy the bits bj+l,..., bj+m into EM(N) starting at bit q(m + 2) + 3 while the bits q(m + 2) + 1 and q(m + 2) + 2 contain the prefix 01. We then proceed by induction. We note that the bits copied directly from B(N) contribute on the average (M +2)/M bits in EM(N) per bit in B(N). On the other hand, a block of length L (L> M) which is translated into EM(N) via the expansion of its length occupies [( llogzlj + 1)/M1.(M + 2) bits. The ratio of the latter to the number L is maximal when L = M + 1. That maximal ratio is (M + 2)/(M + 1). Thus, by selecting M large enough we can make the ratio arbitrarily close to one. The elementary operations in EM are essentially the same as in E. This in fact completes the proof. 0 It is easy to see that a stronger theorem can be proved if we are willing to represent lengths of blocks by the lengths of blocks in the binary representation of the lengths of the blocks, etc. This would enable us to strengthen claim (iii) and prove that there exist infinitely many numbers N such that l(n) = O(loglog1og N) or 1(N) =O(loglogloglog N), etc. This demonstrates that an algorithm like Khachiyan7s looks very poor when we operate with encoding schemes which are arbitrarily as efficient as the binary encoding, while any genuinely-polynomial algorithm would remain polynomial in any such encoding scheme. We hope this will motivate further research in the direction of genuinely-polyi~omial algorithms. It is conceivable though that a genuinely-polynomial algorithm for linear programming exists only if P = NP. However, for the case of linear inequalities with at most two variables per inequality a genuinely-polynomial algorithm is known [3]. For the transportation problem the question is still open to the best of the author's knowledge, even though the dual has only two variables per inequality.

Binary encoding and the problem-language relationship Appendix We show as an example the encoding of the number 1033731 under the scheme E5. First, the binary representation of the number is 11 11 110001 100000001 1. The first block is of length 6 and hence we find the binary representation of the number 6, i.e., 110. With the prefix 11 the first block is encoded 1100110. The following 5 bits are not all identical so they are copied with the prefix 01 i.e., 010001 1. The following 5 bits are identical and in fact the block is of length 7. So, with the prefix 00 it is encoded 0000111. The rest of the bits are encoded with the prefix 01 again, i.e., 0111. In summary, E5(1033731) = ~ O O I ~ O ~ O O O I I ~ O O I I I ~ I I. References [I] S. Even and M. Rodeh, Efficient encoding of commas between strings, Comm. ACM 21 (1978) 315-317. [2] L.G. Khachiyan, A polynomial algorithm in linear programming, Soviet Math. Dokl. 20 (1979) 191-194. [3] N. Megiddo, Towards a genuinely polynomial algorithm for linear programming, Discussion Paper No. 493, The Center for Mathematical Studies in Economics and Management Science, Northwestern University, Evanston, IL 60201 (1981).