Projeto e Análise de Algoritmos Prof. Ruy Luiz Milidiú

Documentos relacionados
Projeto e Análise de Algoritmos Prof. Ruy Luiz Milidiú

Projeto e Análise de Algoritmos Prof. Ruy Luiz Milidiú

SCC-210 Algoritmos Avançados. Capítulo 9 Grafos. Adaptado por João Luís G. Rosa

Uma introdução à indecilibidade a forma máxima de complexidade!

Uma introdução à indecilibidade a forma máxima de complexidade!

Análise e Projeto de Algoritmos

Projeto e Análise de Algoritmos

Cap. 2 Conceitos Básicos em Teoria dos Grafos

Teoria da Complexidade Computacional

Algoritmos de aproximação

Aula 12: Programação Inteira

Complexidade de Algoritmos

Lista de Exercícios Programação Inteira. x 2 0 e inteiros.

Ciclos hamiltonianos e o problema do caixeiro viajante

Instituto Tecnológico de Aeronáutica

Algoritmos de Aproximação Segundo Semestre de 2012

DIAGNÓSTICO DE MATEMÁTICA

Algoritmos em Grafos COM11087-Tópicos Especiais em Programação I

Teoria da Complexidade Computacional

GRAFOS E ALGORITMOS TEORIA DE GRAFOS

Redução polinomial. Permite comparar o grau de complexidade de problemas diferentes.

O estudo utilizando apenas este material não é suficiente para o entendimento do conteúdo. Recomendamos a leitura das referências no final deste

Grafos Hamiltonianos e o Problema do Caixeiro Viajante. Prof. Ademir Constantino Departamento de Informática Universidade Estadual de Maringá

Projeto e Análise de Algoritmos NP Completude. Prof. Humberto Brandão

Introdução à classe de problemas NP- Completos

Aula 12 - Correção de erros

Redução de Cook-Levin e Considerações Finais

Análise de Algoritmos. Slides de Paulo Feofiloff

UNIVERSIDADE FEDERAL DO RIO DE JANEIRO DEPARTAMENTO DE CIÊNCIAS DA COMPUTAÇÃO. 5 a Lista de Exercícios

Análise e Síntese de Algoritmos

Análise e Síntese de Algoritmos

Algoritmos Combinatórios: Introdução

Problemas Intratáveis ou computação eficiente X computação ineficiente

COMPUTAÇÃO E PROGRAMAÇÃO

Teoria dos Grafos. Edson Prestes

Análise e Síntese de Algoritmos. Problemas NP-Completos CLRS, Cap. 34

Teoria e Algoritmos em Grafos

Busca e Decisão. Problemas de Otimização. Kakuro. P e NP. Pode-se resolver o Kakuro somente resolvendo problemas de decisão?

Análise e Síntese de Algoritmos. Algoritmos em Grafos CLRS, Cap. 22

Partição dos grafos P 4 -laden em conjuntos independentes e cliques

Divisão de Engenharia Mecânica. Programa de Pós-Graduação em Engenharia Aeronáutica e Mecânica. Prova de Seleção para Bolsas 1 o semestre de 2014

Reduções de Problemas Difíceis

OBSTRUÇÕES DE COGRAFOS-(K, L)

Circuitos Eulerianos Ciclos Hamiltonianos O Problema do Caixeiro Viajante CAMINHAMENTOS BASEADO EM TOWNSEND (1987), CAP. 7.

Grafos e Algoritmos de Busca

Lista de Exercícios Programação Inteira. x 2 0 e inteiros.

INSTITUTO SUPERIOR TÉCNICO Análise e Síntese de Algoritmos. RESOLUÇÃO DO 2 o TESTE

Análise de Algoritmos

Como saber se um problema está em NP e não está em P?

TEORIA DE COMPLEXIDADE

SCC Modelagem Computacional em Grafos Profª Rosane Minghim 1º sem ª lista de exercícios

Projeto e Análise de Algoritmos Aula 8: Algoritmos Gulosos (DPV 5; CLRS 4)

CSE 521: Design and Analysis of Algorithms I

Instituto Tecnológico de Aeronáutica

Programa. Análise de algoritmos. Notação Big-O. Sistemas de Informação Geográfica II. Análise de algoritmos

Visão geral sobre sistemas digitais

Por que não encontramos algoritmos polinomiais para muitos problemas?

Teorema da Galeria de Arte

Aula nº / Outubro/ 07. Problema do carteiro chinês

Por que não encontramos algoritmos polinomiais para muitos problemas?

Computação e Programação 2009 / 2010

Teoria dos Grafos. Valeriano A. de Oliveira, Socorro Rangel, Silvio A. de Araujo. Departamento de Matemática Aplicada

Melhores momentos AULA 24. Algoritmos p.906/953

Algoritmos Combinatórios: Backtracking com Bounding

Aula 29 - Conversores A/D e D/A

76) 1.1 Sim 1.2 Não 1.3 Não

SCC603 Algoritmos e Estruturas de Dados II Prof.a Rosane Minghim 1o sem. 2013

Códigos Corretores de Erros e Cliques de Grafos

Aula 21 Ordenação externa

Chapter 2. Basics of Algorithm Analysis. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Grafos planares. Algoritmos em Grafos. Marco A L Barbosa

Técnicas de Concepção de Algoritmos: Branch and Bound

Grafo planar: Definição

DINTER UFF/IFTM - Análise e Síntese de Algoritmos - Lista de Exercícios

Complexidade de Algoritmos. Edson Prestes

AULA 15. Algoritmos p.600/637

Programação Dinâmica. Prof. Anderson Almeida Ferreira. Adaptado do material elaborado por Andrea Iabrudi Tavares

Bastam Quatro Cores. Celina Miraglia Herrera de Figueiredo. Programa de Engenharia de Sistemas e Computação

GRAFOS Aula 02 Formalização: definições Max Pereira

Mathematical Foundation I: Fourier Transform, Bandwidth, and Band-pass Signal Representation PROF. MICHAEL TSAI 2011/10/13

DESENV. E IMPLEMENTAÇÃO DE ALGORITMOS 29/09/2018. Este caderno contém 11 páginas com a descrição de 10 problemas definidos a seguir:

Algoritmos de Aproximação Segundo Semestre de 2012

Teoria dos Grafos Aula 17

Instituto Tecnológico de Aeronáutica

Circuito Hamiltoniano. Brute Force Greedy Heuristics

ANÁLISE DE ALGORITMOS (INF 1721)

Programação Dinâmica. Prof. Anderson Almeida Ferreira

Noções da Teoria dos Grafos

Instituto Tecnológico de Aeronáutica

04 Grafos: caminhos e coloração SCC0503 Algoritmos e Estruturas de Dados II

Volmir Eugênio Wilhelm Departamento de Engenharia de Produção UFPR 45

INTRATABILIDADE e NP-COMPLETUDE

Teoria dos Grafos. Valeriano A. de Oliveira Socorro Rangel Departamento de Matemática Aplicada.

TEORIA DE COMPLEXIDADE

Teoria dos Grafos Aula 6

Noções da Teoria dos Grafos. André Arbex Hallack

Departamento de Engenharia de Produção UFPR 57

Polinomial: função de complexidade é O(p(n)), onde p(n) é um polinômio.

Caminhos mínimos de todos os pares

Transcrição:

Projeto e Análise de Algoritmos Prof. Ruy Luiz Milidiú 5/5/2014 Ruy Luiz Milidiú 1

Redução 5/5/2014 Ruy Luiz Milidiú 2

Resumo Objetivo Apresentar o príncipio da redução de um problema a outro Sumário O algoritmo de redução De subcadeia ótima para caminho mais curto De circuito hamiltoniano para caixeiro viajante De satisfabilidade para programação linear inteira De satisfabilidade para 3-satisfabilidade De 3SAT para 3-COLOR 5/5/2014 Ruy Luiz Milidiú 3

Redução Para quem só tem um martelo tudo se parece com pregos! 5/5/2014 Ruy Luiz Milidiú 4

Subcadeia de Soma Máxima Entrada a = (a 1, a 2,, a n ) um vetor de inteiros Saída: I e J tais que a I + a I+1 + + a J é máximo. quando todos os valores de a são negativos, então a subseqüência vazia é escolhida e o valor máximo da soma é considerado 0. 5/5/2014 Ruy Luiz Milidiú 5

Caminho mais longo 0 0 0 0 a 0 1 a 1 2 a 2 3 a 3 4 4 5 0 0 0 0 5/5/2014 Ruy Luiz Milidiú 6

Redução Subcadeia de soma máxima reduz para Caminho mais longo 5/5/2014 Ruy Luiz Milidiú 7

Circuito Hamiltoniano 5/5/2014 Ruy Luiz Milidiú 8

Circuito Hamiltoniano Entrada Saída Circuito simples que contém todos os vértices. G = (V,E) grafo não dirigido SIM G tem circuito Hamiltoniano NÃO G não tem circuito Hamiltoniano 5/5/2014 Ruy Luiz Milidiú 9

Caixeiro viajante 1 2 1 1 1 2 1 2 1 custo mínino n? 2 5/5/2014 Ruy Luiz Milidiú 10

Redução Circuito Hamiltoniano reduz para Caixeiro viajante 5/5/2014 Ruy Luiz Milidiú 11

SAT Entrada Satisfabilidade Saída C = C 1 C 2... C m C i = y k onde y k {x k, x k } k J(i) SIM existe atribuição consistente com C=TRUE NÃO caso contrário 5/5/2014 Ruy Luiz Milidiú 12

PLI 1 = (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 1 x 2 x 3 ) minimize x 1 + (1-x 3 ) tal que x 1 + (1-x 3 ) 1 (1-x 2 ) + x 3 1 x 2 + x 3 1 x 1, x 2, x 3 {0,1} x 1 + (1-x 2 ) + (1-x 3 ) 1 5/5/2014 Ruy Luiz Milidiú 13

Redução SAT reduz para PLI 5/5/2014 Ruy Luiz Milidiú 14

SAT Entrada Satisfabilidade Saída C = C 1 C 2... C m C i = y k onde k {x k, x k } k J(i) SIM existe atribuição consistente com C = 1? NÃO caso contrário 5/5/2014 Ruy Luiz Milidiú 15

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 16

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) ( 1 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 17

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) ( 1 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 18

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) ( 1 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 19

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 0) ( x 2 x 3 ) (x 2 x 3 ) ( 1 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 20

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 (y 1 y 1 )) ( x 2 x 3 ) (x 2 x 3 ) ( 1 (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 21

3SAT 1 = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 x 11 = 0 1 = (x 1 x 3 y 1 ) (x 1 x 3 y 1 ) ( x 2 x 3 ) (x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 22

3SAT C = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 11 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 e 1 = (x 1 x 3 y 1 ) (x 1 x 3 y 1 ) ( x 2 x 3 y 2 ) ( x 2 x 3 y 2 ) (x 2 x 3 y 3 ) (x 2 x 3 y 3 ) (x 1 x 2 y 4 ) ( y 4 x 3 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 23

3SAT C = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 1 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 e 1 = (x 1 x 3 y 1 ) (x 1 x 3 y 1 ) ( x 2 x 3 y 2 ) ( x 2 x 3 y 2 ) (x 2 x 3 y 3 ) (x 2 x 3 y 3 ) (x 1 x 2 y 4 ) ( y 4 x 3 y 5 ) ( y 5 x 4 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 24

3SAT C = x 11 (x 1 x 3 ) ( x 2 x 3 ) (x 2 x 3 ) (x 1 x 2 x 3 ) (x 1 x 2 x 3 x 4 x 7 x 8 ) x 11 = 1 e 1 = (x 1 x 3 y 1 ) (x 1 x 3 y 1 ) ( x 2 x 3 y 2 ) ( x 2 x 3 y 2 ) (x 2 x 3 y 3 ) (x 2 x 3 y 3 ) (x 1 x 2 x 3 ) (x 1 x 2 y 4 ) ( y 4 x 3 y 5 ) ( y 5 x 4 y 6 ) ( y 6 x 7 x 8 ) 5/5/2014 Ruy Luiz Milidiú 25

Redução SAT reduz para 3SAT 5/5/2014 Ruy Luiz Milidiú 26

3-COLOR 5/5/2014 Ruy Luiz Milidiú 27

3-COLOR 3-COLOR de G=(V,E) f: V {1,2,3} {u,v} E então f(u) f(v) Problema de decisão uma 3-COLOR de G? 5/5/2014 Ruy Luiz Milidiú 28

3SAT 3-COLOR ( X X) = T (X Y) = T X X X Y G T F T 5/5/2014 Ruy Luiz Milidiú 29

3SAT 3-COLOR X Y cor(x) = cor(y) A B Z 5/5/2014 Ruy Luiz Milidiú 30

3SAT 3-COLOR X Y cor(x) = cor(y) A B então Z cor(z) = cor(x) = cor(y) 5/5/2014 Ruy Luiz Milidiú 31

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 1 X 2 X 2 X 3 X 3 G T F 5/5/2014 Ruy Luiz Milidiú 32

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 1 X 2 X 2 X 3 X 3 G T F 5/5/2014 Ruy Luiz Milidiú 33

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 34

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 35

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 36

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 37

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 38

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T Absurd! 5/5/2014 Ruy Luiz Milidiú 39

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 40

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 41

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 42

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 43

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 44

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 45

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 46

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 47

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 48

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 49

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 50

3SAT 3-COLOR C = (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) X 1 X 2 X 3 T 5/5/2014 Ruy Luiz Milidiú 51

3SAT 3-COLOR C é capaz de satisfação existe f que é uma 3-COLOR de G 5/5/2014 Ruy Luiz Milidiú 52

Redução 3SAT reduz para 3-COLOR 5/5/2014 Ruy Luiz Milidiú 53

3-COLOR SAT 1 5 2 4 3 5/5/2014 Ruy Luiz Milidiú 54

3-COLOR SAT f(1) 1 f(5) 5 2 f(2) f(4) 4 3 f(3) 5/5/2014 Ruy Luiz Milidiú 55

3-COLOR SAT 1 cores bit bit bit 5 2 4 3 5/5/2014 Ruy Luiz Milidiú 56

3-COLOR SAT for u = 1..n for k =1,2,3 X uk indicadora de cor k ao nó u X uk = 1 X uk = 0 nó u tem cor k nó u não tem cor k 5/5/2014 Ruy Luiz Milidiú 57

3-COLOR apenas 3 cores distintas exatamente uma cor por nó cores diferentes para nós incidentes na mesma aresta 5/5/2014 Ruy Luiz Milidiú 58

Unicidade Um e apenas um! (x 1 x 2 x 3 ) (x 1 x 2 ) (x 1 x 3 ) (x 2 x 3 ) x y = x y (x 1 x 2 x 3 ) (x 1 x 2 ) (x 1 x 3 ) (x 2 x 3 ) 5/5/2014 Ruy Luiz Milidiú 59

Uma cor por nó A = A exatamente uma cor por nó (X 11 X 12 X 13 ) (X 11 X 12 ) (X 11 X 13 ) (X 12 X 13 ) (X n1 X n2 X n3 ) (X n1 X n2 ) (X n1 X n3 ) (X n2 X n3 ) 5/5/2014 Ruy Luiz Milidiú 60

Uma cor por nó V cores diferentes para nós indicentes na mesma aresta [(X u1 X v1 ) (X u2 X v2 ) (X u3 X v3 )] {u,v} A 5/5/2014 Ruy Luiz Milidiú 61

3-COLOR SAT C = A V Atribuição Verificação 5/5/2014 Ruy Luiz Milidiú 62

Equivalência SAT 3-SAT 3-COLOR SAT 5/5/2014 Ruy Luiz Milidiú 63

3-COLOR PLANAR-3-COLOR 5/5/2014 Ruy Luiz Milidiú 64

3-COLOR 5/5/2014 Ruy Luiz Milidiú 65

3-COLOR 5/5/2014 Ruy Luiz Milidiú 66

3-COLOR 5/5/2014 Ruy Luiz Milidiú 67

3-COLOR 5/5/2014 Ruy Luiz Milidiú 68

3-COLOR 5/5/2014 Ruy Luiz Milidiú 69

3-COLOR 5/5/2014 Ruy Luiz Milidiú 70

3-COLOR 5/5/2014 Ruy Luiz Milidiú 71

3-COLOR 5/5/2014 Ruy Luiz Milidiú 72

3-COLOR 5/5/2014 Ruy Luiz Milidiú 73

3-COLOR 5/5/2014 Ruy Luiz Milidiú 74

3-COLOR 5/5/2014 Ruy Luiz Milidiú 75

3-COLOR Cantos opostos tem a mesma cor! 5/5/2014 Ruy Luiz Milidiú 76

3-COLOR 3-COLOR PLANAR u v 5/5/2014 Ruy Luiz Milidiú 77 G

3-COLOR 3-COLOR PLANAR u v G* 5/5/2014 Ruy Luiz Milidiú 78

3-COLOR 3-COLOR PLANAR u v G 5/5/2014 Ruy Luiz Milidiú 79

3-COLOR 3-COLOR PLANAR G é 3-COLOR G é 3-COLOR 5/5/2014 Ruy Luiz Milidiú 80

3-COLOR 3-COLOR PLANAR G é 3-COLOR G é 3-COLOR u u v u 5/5/2014 Ruy Luiz Milidiú 81

3-COLOR 3-COLOR PLANAR G é 3-COLOR G é 3-COLOR u u u v u u 5/5/2014 Ruy Luiz Milidiú 82

3-COLOR 3-COLOR PLANAR G é 3-COLOR G é 3-COLOR u u u v u u 5/5/2014 Ruy Luiz Milidiú 83

3-COLOR 3-COLOR PLANAR G é 3-COLOR G é 3-COLOR u u u v u u 5/5/2014 Ruy Luiz Milidiú 84

3-COLOR 3-COLOR PLANAR G é 3-COLOR G é 3-COLOR u u u v u u 5/5/2014 Ruy Luiz Milidiú 85

Planar k-colorability PLANAR-2-COLOR linear time PLANAR-3-COLOR Hard PLANAR-4-COLOR O(1) time 5/5/2014 Ruy Luiz Milidiú 86

Planar k-colorability [Appel-Haken, 1976] Every planar map is 4-colorable Resolved century-old open problem 50 days processing many special cases First major theorem to be proved using computer False intuition If PLANAR-3-COLOR is hard then so is PLANAR-4-COLOR and PLANAR-5-COLOR 5/5/2014 Ruy Luiz Milidiú 87

Subset Sum Given a set natural of numbers {w 1,, w n } and an integer W, is there a subset that adds up to exactly W? Remark input integers are encoded in binary polynomial reduction must be polynomial in binary encoding. 5/5/2014 Ruy Luiz Milidiú 88

Subset Sum Input { 1, 4, 16, 64, 256, 1040, 1041, 1093, 1284, 1344 } W = 3754 Output 1 + 16 + 64 + 256 + 1040 + 1093 + 1284 = 3754 Yes 5/5/2014 Ruy Luiz Milidiú 89

3-SAT SUBSET-SUM C = (x y z) (x y z) (x y z) X Y Z C1 C2 C3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 4 5/5/2014 Ruy Luiz Milidiú 90 2 1 2 1 2 1 100010 100101 10100 10011 1110 1001 200 100 20 10 2 1 111444

Partition Given natural numbers v 1,, v m, can they be partitioned into two subsets that add up to the same value? ½ i v i 5/5/2014 Ruy Luiz Milidiú 91

SUBSET-SUM PARTITION W, w 1,, w n SUBSET-SUM instance PARTITION instance m = n+2 v 1 = w 1 v 2 = w 2 v n = w n v n+1 = 2. i w i - W v n+2 = i w i + W v n+1 = 2 i w i - W W v n+2 = i w i + W i w i - W The two new elements cannot be in the same part! 5/5/2014 Ruy Luiz Milidiú 92