VIEWS: 0 PAGES: 25 POSTED ON: 2/12/2012
CSC 791B - Sp Top: Adv Netw Dsgn Complexity Theory Introduction Copyright Rudra Dutta, NCSU, Spring, 2005 1 Algorithms Information representation by bits Algorithms as manipulators of bits Abstract manipulations of abstract data types – Not specific to machine architecture etc. Copyright Rudra Dutta, NCSU, Spring, 2005 2 Asymptotic Complexity Complexity - number of elemental steps required – What is a step? – Worst case, average case? Naturally, problem instances of bigger “size” can reasonably take more steps Asymptotic - beyond a certain “size” f,g: N N f is O(g) iff N,c: f(n) c g(n) n N g is (f) f is (g) iff f is O(g) and (g) Copyright Rudra Dutta, NCSU, Spring, 2005 3 Languages Alphabet - a finite set of symbols (S) String - finite ordered list of symbols from S – The empty string is denoted by e Universe of strings S* – All strings of length k - Sk Concatenation, suffix, prefix, substring Language - a subset of S* Characteristic function cL Examples on S = {0,1} – L = {00,01,10,11} = S2 – L = {x ends with a single 0 after one or more 1’s} Copyright Rudra Dutta, NCSU, Spring, 2005 4 Infinite Sets and Computability Function, domain, co-domain, range Surjective (onto) – Range = co-domain Injective (one-to-one) – Distinct elements mapped to distinct elements Bijective: both Bijection allows comparison of infinite set sizes – |N| = |E| = |O| = 0 , countable infinity – Q = N x N, 0 . 0 = 0 – Diagonalization argument : R is not countable – 2N is not countable - most functions not computable Copyright Rudra Dutta, NCSU, Spring, 2005 5 Automata Finite Automata or FSM – States, transition function – FSM’s as language acceptors Determinism – NDFA: accept if an accepting sequence exists – Magic – DFA’s in parallel (not inherently different from DFA) 1 0,1 0 0 1 0 0 0,1 0,1 1 1 0,1 0,1 Copyright Rudra Dutta, NCSU, Spring, 2005 6 Computational Models A language (or function) is a problem – Program computes desirable quantity for each instance of a problem - decision or optimization Regular expressions and regular languages – Shown to be equivalent to finite automata The Halting Problem – A diagonalization argument on programs – Assume such a program exists – Make another which stops only if it returns “yes” Universal models of computation – Several now known, (polynomial) equivalent Copyright Rudra Dutta, NCSU, Spring, 2005 7 Turing Machines Turing machine is quite convenient – Concept of “steps” and “space” are obvious – Difference in scale with practical computers Reads problem on tape, ends with solution – Non-determinism does not increase power – Multiple tapes do not increase power Acceptors and enumerators Finite-state control Copyright Rudra Dutta, NCSU, Spring, 2005 8 Computability Primitive Recursive functions – Zero, Succ, Pick – Build other functions by: Substitution Primitive recursion: f(0) = x, f(i + 1) = h(i, f(i)) PR functions are computable, but computable functions that are not PR exist – Diagonalization Partial Recursive functions – Not defined for all input - avoid diagonalization – µ-recursion or minimization: find minimum (extra) argument that makes another function return zero Copyright Rudra Dutta, NCSU, Spring, 2005 9 Function Classes All partial functions total not total partial recursive primitive recursive Copyright Rudra Dutta, NCSU, Spring, 2005 10 Further on Computability Recursive and R.E. sets Rice’s Theorem Reductions, classes of reduction Hardness, easiness, completeness Copyright Rudra Dutta, NCSU, Spring, 2005 11 Classes and Reductions Some problems are equivalent to others Others are “at least as difficult as” Concept of reduction – More explanatory names: “equivalence” or “transformability” Different kinds of reduction – Generic versus specific – Turing versus many-to-one Reductions allow equivalence classes to be built – But finding first complete problem (generic) could be difficult Copyright Rudra Dutta, NCSU, Spring, 2005 12 Equivalence Classes Copyright Rudra Dutta, NCSU, Spring, 2005 13 Cook’s Theorem Satisfiability is NP-Complete – A collection of Boolean clauses – Problem: Decide whether truth assignment satisfying all the clauses exists Given an instance of a decision problem in NP, an instance of Satisfiability can be produced in polynomial time, which is satisfiable iff the original instance is a “yes” instance Copyright Rudra Dutta, NCSU, Spring, 2005 14 Many-to-One Reductions First show problem at hand is in NP Pick a known NPC problem to reduce from – All instances of the problem must be amenable to reduction – If not, danger of picking tractable subset Define a function to transform instance into instance of target – Must be polynomial procedure – Need not reach all instances of target – Hence many-to-one, not one-to-one or onto Special case: restriction – Of problem space, not solution method Copyright Rudra Dutta, NCSU, Spring, 2005 15 Well Known NPC Problems Three-satisfiability – Each clause has exactly three literals – 1in3Sat – NAE3Sat MaxCut Partition Exact Cover by 3-sets Chromatic number Knapsack Bin-packing Copyright Rudra Dutta, NCSU, Spring, 2005 16 An Example Knapsack: Given a set of elements, a positive integer size and value for each, a positive integer size upper bound and value lower bound, does a subset meeting the bounds exist? Partition: Given a set of elements, each with a positive integer size such that the sum of all sizes is an even number, can the set by partitioned into two subsets such that the sum of elements in each subset is equal? Restriction: In Knapsack, allow only instances where the sum of all sizes is a multiple of 2, size equals value for each element, and bounds are each equal to half the sum of sizes Copyright Rudra Dutta, NCSU, Spring, 2005 17 Approximations Practically, very close may be worth a cigar “Close” is defined as fraction of or difference from the optimal objective value – Must be constant An approximation to an NPC problem which is in P is quite valuable May be possible to customize the algorithm to obtain any desired approximation ratio – Polynomial Time Approximation Scheme However, many problems are NP-approximable Copyright Rudra Dutta, NCSU, Spring, 2005 18 Networking Context Many network design problems are complex It is important to know whether optimal solutions may be tractably attempted If not, approximations/heuristics may be attempted NPC reduction method may provide an insight into profitable heuristic methods Copyright Rudra Dutta, NCSU, Spring, 2005 19 Specific Problem - Star Network Traffic grooming - details of problem left out One “hub” node, all other nodes are source/destination (no routing) Copyright Rudra Dutta, NCSU, Spring, 2005 20 Star Solution Forms Some s-d traffic can be . O O E O E E E E O O . O O E E O O E O optically routed E O . E O E E E O O – Follow own lightpaths E O O . O O E O E O – No other traffic E E E O . E O E O O component can share O O O E E . E O E O Therefore, suffices to O E O E O O . E O O E E E O E E O . E O specify a “mask” O O E E O O E E . O E O O O E E O O E . Copyright Rudra Dutta, NCSU, Spring, 2005 21 Star Network Intuition Matter of choosing some out of all – Choosing one “fills up” the wavelength – Forces others not to be chosen – This is like “Knapsack” ! . O O E O E E E E O O . O O E E O O E O E O . E O E E E O O E O O . O O E O E O “Value” of element E E E O . E O E O O O O O E E . E O E O magnitude of traffic O E O E O O . E O O “Weight” of element E E E O E E O . E O magnitude of other O O E E O O E E . O traffic, same source/same destination E O O O E E O O E . Copyright Rudra Dutta, NCSU, Spring, 2005 22 Problem with Knapsack Easiest correspondence – one source only, rest destination (only) Does not work ! – Very specific family of Knapsack instances – Weight and value are have strict inverse relation – Picking greedily from most valuable will always work • We need to use the multiple rows in the traffic matrix – But how ? Copyright Rudra Dutta, NCSU, Spring, 2005 23 Intuition – two rows enough With just one row, weight and value cannot be separated – With two independent rows, correlation gone But can choose elements out of two rows completely freely – More freedom than we need . . . . . . . . . . – Need to restrict by construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . O E O E O O . . O O E E E O E E . . E O . . . . . . . . . . . . . . . . . . . . Copyright Rudra Dutta, NCSU, Spring, 2005 24 Final Reduction “Hub traffic” prevents both source traffic being optically routed to any destination – “one or the other”. Therefore again becomes a matter of choosing which of the traffic components from the first source to put in the “Knapsack”. Finally, transformation that a satisfactory solution to Knapsack yields one for the star, and vice versa. Copyright Rudra Dutta, NCSU, Spring, 2005 25