Download presentation
Presentation is loading. Please wait.
Published byLeona Lyons Modified over 9 years ago
1
Complexity 2-1 Problems and Languages Complexity Andrei Bulatov
2
Complexity 2-2 Math Prerequisites —— Alphabets and Languages An alphabet is a (finite) set of symbols, e.g. ={0,1}, ={0,1,…,9}, ={A,F,G,T}, ={a,b,c,…,z}, A string (or a word) over an alphabet is a (finite) sequence of symbols from , e.g. =0010110111, =314159, =FAGFTTAGT, =turingmachine Length of a string is the number of symbols in , denoted ( ). Empty string is a string containing no symbols. The set of all non-empty strings over is denoted by The set of all strings over (including the empty string) is denoted by * A language over alphabet is any subset of *, e.g.
3
Complexity 2-3 Models of Computation To make statements about what can and cannot be computed we need to define a scientific model of computation We start with a very simple model which identifies 3 aspects of any computation: process input output
4
Complexity 2-4 Input and Output We shall also make some other simplifying assumptions: Input is a sequence of symbols in some fixed alphabet. This means we need to define some way of encoding the description of our problem as a sequence of symbols Output is either: A single bit indicating yes or no ; (In this model we consider only decision problems — that is, problems which require a yes/no answer) A sequence of symbols from the same alphabet as the input. (In this model we also allow search and optimisation problems — that is, problems which require the computation of some answer or of a best answer from some set of possibilities.)
5
Complexity 2-5 Decision Problems In the first part of this course we will focus on decision problems The standard way to define a decision problem is to describe a generic instance, and a yes/no question about each instance. Instance: A finite directed graph G and vertices s and t Question: Is there a path from s to t ? Reachability
6
Complexity 2-6 Examples — Graph Problems Instance: A finite graph G. Question: Does G have an Euler Curcuit? - i.e., a cycle that goes through each edge exactly once Euler, 1736 Euler Circuit Instance: A finite graph G. Question: Does G have a Hamilton Curcuit? - i.e., a cycle that goes through each vertex exactly once Hamilton, 1850 Hamilton Circuit
7
Complexity 2-7 Instance: A finite graph G and an integer K. Question: Does G have a clique of size K ? - i.e., a set of K vertices that are fully connected Clique Examples — Graph Problems Instance: A finite graph G and an integer K. Question: Does G have a colouring with K colours? - i.e., an assignment of colours to vertices such that adjacent vertices have different colours Colouring
8
Complexity 2-8 1 10 3 6 7 4 8 5 2 9 Does this graph have an Euler Circuit? Does this graph have a Hamilton Circuit? Does it have a clique of size 4? Does it have a 3-colouring? A Graph Problem Instance
9
Complexity 2-9 Example Instance: An integer m n matrix M, vectors,, and an integer B. Question: Is there a rational vector such that, and ? Linear Programming
10
Complexity 2-10 Example Instance: A finite set of cities, a positive integer distance between each pair, and an integer B. Question: Is there a permutation of such that Travelling Salesperson(D)
11
Complexity 2-11 Encodings To input problems to a computer, each instance must be encoded in a string of symbols over some alphabet. To do this we need an encoding scheme. To ensure that encoding the problem does not change its essential nature, an encoding scheme must be concise: Not add unnecessary information, or padding (e.g. the solution!) Represent numerical information efficiently (not in base 1!)
12
Complexity 2-12 Question What is a suitable encoding scheme for graphs?
13
Complexity 2-13 Languages For a decision problem , and an encoding scheme e with alphabet , the set of strings corresponding to instances with answer yes is denoted L ( ,e) and called the language associated with and e. Note that L ( ,e) * For decision problems we just want to decide if a given string belongs to L ( ,e)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.