Internet EngineeringInternet Engineering
Czesław SmutnickiCzesław Smutnicki
Discrete Mathematics Discrete Mathematics – – Computational ComplexityComputational Complexity
CONTENTS
• Asymptotic notation• Decision/optimization problems• Calculation models• Turing machines• Problem, instances, data coding• Complexity classes• Polynomial-time algorithms• Theory of NP-completness• Approximate methods• Quality measures of approximation• Analysis of quality measures• Calculation cost• Competitive analysis (on-line algorithms)• Inapproximality theory
ASYMPTOTIC NOTATION – symbol O(n)
))(()( ngOnf
00 )()(0,,0 nnngcnfNnc
)(253 22 nOnn
)(8 23 nOnn
)(3 2nOn
Definition
Examples
ASYMPTOTIC NOTATION – symbol (n)
))(()( ngnf
00 )()(0,,0 nnnfngcNnc
)(253 22 nnn
)(8 23 nnn
)(3 2nn
Definition
Examples
ASYMPTOTIC NOTATION – symbol (n)
))(()( ngnf
021021 )()()(0,,0, nnngcnfngcNncc
)(253 22 nnn )(8 23 nnn )(12 2nn
Definition
Examples
ASYMPTOTIC NOTATION - symbol o(n)
0)(
)(lim ng
nfn
))(()( ngonf
Definition
Examples
)(3 2non )(253 22 nonn
ASYMPTOTIC NOTATION - symbol (n)
))(()( ngnf
)(
)(lim
ng
nfn
Definition
Examples
)(8 23 nnn )(253 22 nnn
DECISION/OPTIMIZATION PROBLEMS
• decision problem: answer yes-no2-partition problem: given numbers . Does a set
exist such that
• optimization problem: find min or max of the goal function valueknapsack problem: given numbers , and . Find the set such that ,
• any optimization problem can be transformed into decision problemknapsack problem: given numbers , , and . Does a set exist such that ,
nnnaaa ,...,, 21
},...,2,1{ nNI INi iIi i aa \
12 n naaa ,...,, 21 nccc ,...,, 21b
},...,2,1{ nNI NIIi ic max baIi i
22 n naaa ,...,, 21 nccc ,...,, 21
b y},...,2,1{ nNI ycIi i baIi i
CALCULATION MODELS
• Simple machine
• Finite-state machine
• Automata: Mealy
Moore
• Deterministic/non-deterministic finite automata
OIffOI oo :),,,(
S
oi
i o
OSIfSSIfffSOI osos :,:),,,,,(
OSIfSSIfsffSOI osoos :,:),,,,,,(
OSfSSIfsffSOI osoos :,:),,,,,,(
OSIfSIfsffSOI oS
soos :,2:),,,,,,(
DETERMINISTIC TURING MACHINE
SssSAfASAfSSAfsfffSA nymosomos ,},1,0,1{:,:,:),,,,,,(
s
0 1 2 3 4-1-2 …
NON-DETERMINISTIC TURING MACHINE
s
0 1 2 3 4-1-2 …
SssSAfASAfSAfsfffSA nymoS
somos ,},1,0,1{:,:,2:),,,,,,(
CODING
• Instance I/ Problem P• Decimal coding of I• Binary coding of I• Unary coding of I• Data string x(I)• Size N(I) of the instance I• Coding of numbers and structural elements
32logloglogloglog)( 110 ncaybnIN ni ii
32lglglglglg)( 12 ncaybnIN ni ii
32)( 11 ncaybnIN ni ii
COMPUTATIONAL COMPLEXITY FUNCTION
} whereI, instance thesolve tonecessary
machine computing of steps elementary ofnumber theis:max{)(
N(I)n
ttnfA
DEPENDS ON:• Coding rule• Model of calculations (DTM)
FUNDAMENTAL COMPLEXITY CLASSES
Polynomial time algorithm O(p(n)), p – polynomial, solvable by DTM, P class
Exponential time algorithm
NP class, solvable in O(p(n)) on NDTM = solvable in O(2p(n)) on DTM
10 60
n 10-5 s 6·10-5 s
n3 10-3 s 2·10-1 s
n5 10-1 s 13 m
2n 10-3 s 3366 y
NP COMPLETE PROBLEMS
21: PPf
yes)( yes 222 IfPI
)))((( 2INpO
POLYNOMIAL TIME TRANSFORMATION
PROBLEM P1 IS NP-COMPLETE IF P1 BELONGS TO NP CLASS AND FOR ANY P2 FROM NP CLASS, P2 IS POLYNOMIALLY TRANSFORMABLE TO P1
12 PP
PROBLEM IS PSEUDO-POLYNOMIAL (NPI CLASS) IF ITS COMPUTATIONAL COMPLEXITY FUNCTION IS A POLYNOMIAL OF N(I) AND MAX(I)
COMPLEXITY CLASSES
NP CLASS
P CLASS
NPI CLASS NP COMPLETE CLASS
STRONGLY NP COMPLETE CLASS
Thank you for your attention
DISCRETE MATHEMATICSCzesław Smutnicki
Top Related