internet engineering czesław smutnicki discrete mathematics – computational complexity

17
Internet Engineering Internet Engineering Czesław Smutnicki Czesław Smutnicki Discrete Mathematics Discrete Mathematics Computational Complexity Computational Complexity

Upload: lenard-ferguson

Post on 12-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

Internet EngineeringInternet Engineering

Czesław SmutnickiCzesław Smutnicki

Discrete Mathematics Discrete Mathematics – – Computational ComplexityComputational Complexity

Page 2: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational 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

Page 3: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

ASYMPTOTIC NOTATION – symbol O(n)

))(()( ngOnf

00 )()(0,,0 nnngcnfNnc

)(253 22 nOnn

)(8 23 nOnn

)(3 2nOn

Definition

Examples

Page 4: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

ASYMPTOTIC NOTATION – symbol (n)

))(()( ngnf

00 )()(0,,0 nnnfngcNnc

)(253 22 nnn

)(8 23 nnn

)(3 2nn

Definition

Examples

Page 5: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

ASYMPTOTIC NOTATION – symbol (n)

))(()( ngnf

021021 )()()(0,,0, nnngcnfngcNncc

)(253 22 nnn )(8 23 nnn )(12 2nn

Definition

Examples

Page 6: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

ASYMPTOTIC NOTATION - symbol o(n)

0)(

)(lim ng

nfn

))(()( ngonf

Definition

Examples

)(3 2non )(253 22 nonn

Page 7: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

ASYMPTOTIC NOTATION - symbol (n)

))(()( ngnf

)(

)(lim

ng

nfn

Definition

Examples

)(8 23 nnn )(253 22 nnn

Page 8: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

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

Page 9: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

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:),,,,,,(

Page 10: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

DETERMINISTIC TURING MACHINE

SssSAfASAfSSAfsfffSA nymosomos ,},1,0,1{:,:,:),,,,,,(

s

0 1 2 3 4-1-2 …

Page 11: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

NON-DETERMINISTIC TURING MACHINE

s

0 1 2 3 4-1-2 …

SssSAfASAfSAfsfffSA nymoS

somos ,},1,0,1{:,:,2:),,,,,,(

Page 12: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

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

Page 13: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

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)

Page 14: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

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

Page 15: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

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)

Page 16: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

COMPLEXITY CLASSES

NP CLASS

P CLASS

NPI CLASS NP COMPLETE CLASS

STRONGLY NP COMPLETE CLASS

Page 17: Internet Engineering Czesław Smutnicki Discrete Mathematics – Computational Complexity

Thank you for your attention

DISCRETE MATHEMATICSCzesław Smutnicki