SlideShare a Scribd company logo
1 of 5
Download to read offline
1
February 28, 2014 CS21 Lecture 22 1
CS21
Decidability and Tractability
Lecture 22
February 28, 2014
Outline
• the class NP
– NP-complete problems: subset sum
– NP-complete problems: NAE-3-SAT, max-cut
• the class co-NP
• the class NP Å coNP
February 28, 2014 CS21 Lecture 22 2
February 28, 2014 CS21 Lecture 22 3
SUBSET-SUM is NP-complete
Theorem: the following language is NP-
complete:
SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) :
there is a subset of S that sums to B}
• Proof:
– Part 1: SUBSET-SUM NP. Proof?
– Part 2: SUBSET-SUM is NP-hard.
• reduce from?
our reduction had
better produce super-
polynomially large B
(unless we want to
prove P=NP)
February 28, 2014 CS21 Lecture 22 4
SUBSET-SUM is NP-complete
• We are reducing from the language:
3SAT = { φ : φ is a 3-CNF formula that has a
satisfying assignment }
to the language:
SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) :
there is a subset of S that sums to B}
February 28, 2014 CS21 Lecture 22 5
SUBSET-SUM is NP-complete
• φ = (x1 x2 x3) ( x1 x4 x3) … (…)
• Need integers to play the role of truth
assignments
• For each variable xi include two integers in
our set S:
– xi
TRUE and xi
FALSE
• set B so that exactly one must be in sum
February 28, 2014 CS21 Lecture 22 6
SUBSET-SUM is NP-complete
x1
TRUE = 1 0 0 0 … 0
x1
FALSE = 1 0 0 0 … 0
x2
TRUE = 0 1 0 0 … 0
x2
FALSE = 0 1 0 0 … 0
…
xm
TRUE = 0 0 0 0 … 1
xm
FALSE = 0 0 0 0 … 1
B = 1 1 1 1 … 1
• every choice of one
from each
(xi
TRUE,xi
FALSE) pair
sums to B
• every subset that
sums to B must
choose one from
each (xi
TRUE,xi
FALSE)
pair
2
February 28, 2014 CS21 Lecture 22 7
SUBSET-SUM is NP-complete
• φ = (x1 x2 x3) ( x1 x4 x3) … (…)
• Need to force subset to “choose” at least
one true literal from each clause
• Idea:
– add more digits
– one digit for each clause
– set B to force each clause to be satisfied.
February 28, 2014 CS21 Lecture 22 8
SUBSET-SUM is NP-complete
– φ = (x1 x2 x3) ( x1 x4 x3) … (…)
x1
TRUE = 1 0 0 0 … 0 1
x1
FALSE = 1 0 0 0 … 0 0
x2
TRUE = 0 1 0 0 … 0 1
x2
FALSE = 0 1 0 0 … 0 0
x3
TRUE = 0 0 1 0 … 0 0
x3
FALSE = 0 0 1 0 … 0 1
… :
B = 1 1 1 1 … 1 ? ? ? ?
…
…
clause 1
clause 2
clause 3
clause k
:
February 28, 2014 CS21 Lecture 22 9
SUBSET-SUM is NP-complete
– B = 1 1 1 1 … 1 ? ? ? ?
– if clause i is satisfied sum might be 1, 2, or 3
in corresponding column.
– want ? to “mean” 1
– solution: set ? = 3
– add two “filler” elements for each clause i:
– FILL1i = 0 0 0 0 ... 0 0 ... 0 1 0 ... 0
– FILL2i = 0 0 0 0 ... 0 0 ... 0 1 0 ... 0
column for clause i
February 28, 2014 CS21 Lecture 22 10
SUBSET-SUM is NP-complete
• Reduction: m variables, k clauses
– for each variable xi:
• xi
TRUE has ones in positions k + i and {j : clause j
includes literal xi}
• xi
FALSE has ones in positions k + i and {j : clause j
includes literal xi}
– for each clause i:
• FILL1i and FILL2i have one in position i
– bound B has 3 in positions 1…k and 1 in
positions k+1…k+m
February 28, 2014 CS21 Lecture 22 11
SUBSET-SUM is NP-complete
• Reduction computable in poly-time?
• YES maps to YES?
– choose one from each (xi
TRUE,xi
FALSE) pair
corresponding to a satisfying assignment
– choose 0, 1, or 2 of filler elements for each
clause i depending on whether it has 3, 2, or 1
true literals
– first m digits add to 1; last k digits add to 3
February 28, 2014 CS21 Lecture 22 12
SUBSET-SUM is NP-complete
• NO maps to NO?
– at most 5 ones in each column, so no carries
to worry about
– first m digits of B force subset to choose
exactly one from each (xi
TRUE,xi
FALSE) pair
– last k digits of B require at least one true
literal per clause, since can only sum to 2
using filler elements
– resulting assignment must satisfy φ
3
February 28, 2014 CS21 Lecture 22 13
Not-All-Equal 3SAT
(x1 x2 x3) ( x1 x4 x3) … (…)
Theorem: the following language is NP-
complete:
NAE3SAT = {φ : φ is a 3-CNF formula for which there
exists a truth assignment in which every clause has at
least 1 true literal and at least 1 false literal}
• Proof:
– Part 1: NAE3SAT NP. Proof?
– Part 2: NAE3SAT is NP-hard. Reduce from?
February 28, 2014 CS21 Lecture 22 14
NAE3SAT is NP-complete
• We are reducing from the language:
CIRCUIT-SAT = {C : C is a Boolean circuit for
which there exists a satisfying truth assignment}
to the language:
NAE3SAT = {φ : φ is a 3-CNF formula for which there
exists a truth assignment in which every clause has at
least 1 true literal and at least 1 false literal}
February 28, 2014 CS21 Lecture 22 15
NAE3SAT is NP-complete
• Recall reduction to 3SAT
– variables x1, x2, …,xn, gates g1, g2, …, gm
– produce clauses:
gi
z
• (gi z)
• ( z gi)
gi
z1
• ( z1 gi)
• ( z2 gi)
• ( gi z1 z2)
z2
gi
z1
• ( gi z1)
• ( gi z2)
• ( z1 z2 gi)
z2
output gate gm:
• (gm)
not all true in a satisfying
assignment
not all true in a satisfying
assignment
February 28, 2014 CS21 Lecture 22 16
NAE3SAT is NP-complete
• modified reduction to NAE3SAT
– variables x1, x2, …,xn, gates g1, g2, …, gm
– produce clauses:
gi
z
• (gi z w)
• ( z gi w)
gi
z1
• ( z1 gi w)
• ( z2 gi w)
• ( gi z1 z2)
z2
gi
z1
• ( gi z1 w)
• ( gi z2 w)
• ( z1 z2 gi)
z2
output gate gm:
• (gm w)
February 28, 2014 CS21 Lecture 22 17
NAE3SAT is NP-complete
• Does the reduction run in
polynomial time?
• YES maps to YES
– already know how to get a
satisfying assignment to the
BLUE variables
– set w = FALSE
• ( z1 gi w)
• ( z2 gi w)
• ( gi z1 z2)
• ( gi z1 w)
• ( gi z2 w)
• ( z1 z2 gi)
• (gi z w)
• ( z gi w)
• (gm w)
February 28, 2014 CS21 Lecture 22 18
NAE3SAT is NP-complete
• NO maps to NO
– given NAE assignment A
– complement A’ is a NAE
assignment
– A or A’ has w = FALSE
– must have TRUE BLUE
variable in every clause
– we know this implies C
satisfiable
• ( z1 gi w)
• ( z2 gi w)
• ( gi z1 z2)
• ( gi z1 w)
• ( gi z2 w)
• ( z1 z2 gi)
• (gi z w)
• ( z gi w)
• (gm w)
4
February 28, 2014 CS21 Lecture 22 19
MAX CUT
• Given graph G = (V, E)
– a cut is a subset S V
– an edge (x, y) crosses the cut if x S and y V – S
or x V – S and y S
– search problem:
find cut maximizing number of edges crossing the cut
February 28, 2014 CS21 Lecture 22 20
MAX CUT
• Given graph G = (V, E)
– a cut is a subset S V
– an edge (x, y) crosses the cut if x S and y V – S
or x V – S and y S
– search problem:
find cut maximizing number of edges crossing the cut
February 28, 2014 CS21 Lecture 22 21
MAX CUT
Theorem: the following language is NP-
complete:
MAX CUT = {(G = (V, E), k) : there is a cut S V with at
least k edges crossing it}
• Proof:
– Part 1: MAX CUT NP. Proof?
– Part 2: MAX CUT is NP-hard.
• reduce from?
February 28, 2014 CS21 Lecture 22 22
MAX CUT is NP-complete
• We are reducing from the language:
NAE3SAT = {φ : φ is a 3-CNF formula for which there
exists a truth assignment in which every clause has at
least 1 true literal and at least 1 false literal}
to the language:
MAX CUT = {(G = (V, E), k) : there is a cut S V with at
least k edges crossing it}
February 28, 2014 CS21 Lecture 22 23
MAX CUT is NP-complete
• The reduction:
– given instance of NAE3SAT (n nodes, m clauses):
(x1 x2 x3) ( x1 x4 x5) … ( x2 x3 x3 )
– produce graph G = (V, E) with node for each literal
x2
x1
x4
x1
x5
x4
x3
x2
x5
x3
• triangle for each
3-clause
• parallel edges
for each 2-clause
February 28, 2014 CS21 Lecture 22 24
MAX CUT is NP-complete
– if cut selects TRUE literals, each clause contributes 2
if NAE, and < 2 otherwise
– need to penalize cuts that correspond to inconsistent
truth assignments
– add ni parallel edges from xi to xi (ni = # occurrences)
(repeat variable in 2-clause to make 3-clause for this calculation)
x2
x1
x4
x1
x5
x4
x3
x2
x5
x3
• triangle for each
3-clause
• parallel edges
for each 2-clause
5
February 28, 2014 CS21 Lecture 22 25
MAX CUT is NP-complete
• YES maps to YES
– take cut to be TRUE literals in a NAE truth
assignment
– contribution from clause gadgets: 2m
– contribution from (xi, xi) parallel edges: 3m
x2
x1
x4
x1
x5
x4
x3
x2
x5
x3 • triangle for each 3-clause
• parallel edges for each 2-
clause
• ni parallel edges from xi to xi
• set k = 5m
February 28, 2014 CS21 Lecture 22 26
MAX CUT is NP-complete
• NO maps to NO
– Claim: if cut has xi, xi on same side, then can move
one to opposite side without decreasing # edges
crossing cut
– contribution from (xi, xi) parallel edges: 3m
– contribution from clause gadgets must be 2m
– conclude: there is a NAE assignment
x2
x1
x4
x1
x5
x4
x3
x2
x5
x3
• triangle for each 3-clause
• parallel edges for each 2-
clause
• ni parallel edges from xi to xi
• set k = 5m
February 28, 2014 CS21 Lecture 22 27
MAX CUT is NP-complete
Claim: if cut has xi, xi on same side, then can
move one to opposite side without decreasing #
edges crossing cut
• Proof:
xi
...
xi
a edges
b edges
ni
edges
xi
...
xi
xi
...
xi
a+b ≤ 2ni
a + ni
b + ni
a + ni ≥ a + b or
b + ni ≥ a + b

More Related Content

What's hot

The Total Strong Split Domination Number of Graphs
The Total Strong Split Domination Number of GraphsThe Total Strong Split Domination Number of Graphs
The Total Strong Split Domination Number of Graphsinventionjournals
 
Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Traian Rebedea
 
Introduction to Treewidth
Introduction to TreewidthIntroduction to Treewidth
Introduction to TreewidthASPAK2014
 
Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)Tomonari Masada
 
QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017Fred J. Hickernell
 
A sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentialsA sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentialsVjekoslavKovac1
 
Chapter-4: More on Direct Proof and Proof by Contrapositive
Chapter-4: More on Direct Proof and Proof by ContrapositiveChapter-4: More on Direct Proof and Proof by Contrapositive
Chapter-4: More on Direct Proof and Proof by Contrapositivenszakir
 
Density theorems for Euclidean point configurations
Density theorems for Euclidean point configurationsDensity theorems for Euclidean point configurations
Density theorems for Euclidean point configurationsVjekoslavKovac1
 
A Note on Correlated Topic Models
A Note on Correlated Topic ModelsA Note on Correlated Topic Models
A Note on Correlated Topic ModelsTomonari Masada
 
Multilinear singular integrals with entangled structure
Multilinear singular integrals with entangled structureMultilinear singular integrals with entangled structure
Multilinear singular integrals with entangled structureVjekoslavKovac1
 
Neural Collaborative Subspace Clustering
Neural Collaborative Subspace ClusteringNeural Collaborative Subspace Clustering
Neural Collaborative Subspace ClusteringTakahiro Hasegawa
 
A T(1)-type theorem for entangled multilinear Calderon-Zygmund operators
A T(1)-type theorem for entangled multilinear Calderon-Zygmund operatorsA T(1)-type theorem for entangled multilinear Calderon-Zygmund operators
A T(1)-type theorem for entangled multilinear Calderon-Zygmund operatorsVjekoslavKovac1
 
Some Examples of Scaling Sets
Some Examples of Scaling SetsSome Examples of Scaling Sets
Some Examples of Scaling SetsVjekoslavKovac1
 
Cost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree gamesCost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree gamesvinnief
 

What's hot (20)

The Total Strong Split Domination Number of Graphs
The Total Strong Split Domination Number of GraphsThe Total Strong Split Domination Number of Graphs
The Total Strong Split Domination Number of Graphs
 
Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9Algorithm Design and Complexity - Course 9
Algorithm Design and Complexity - Course 9
 
Introduction to Treewidth
Introduction to TreewidthIntroduction to Treewidth
Introduction to Treewidth
 
Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)Topic modeling with Poisson factorization (2)
Topic modeling with Poisson factorization (2)
 
QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017QMC Error SAMSI Tutorial Aug 2017
QMC Error SAMSI Tutorial Aug 2017
 
445 colouring0
445 colouring0445 colouring0
445 colouring0
 
Poisson factorization
Poisson factorizationPoisson factorization
Poisson factorization
 
A sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentialsA sharp nonlinear Hausdorff-Young inequality for small potentials
A sharp nonlinear Hausdorff-Young inequality for small potentials
 
Chapter-4: More on Direct Proof and Proof by Contrapositive
Chapter-4: More on Direct Proof and Proof by ContrapositiveChapter-4: More on Direct Proof and Proof by Contrapositive
Chapter-4: More on Direct Proof and Proof by Contrapositive
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Density theorems for Euclidean point configurations
Density theorems for Euclidean point configurationsDensity theorems for Euclidean point configurations
Density theorems for Euclidean point configurations
 
A Note on Correlated Topic Models
A Note on Correlated Topic ModelsA Note on Correlated Topic Models
A Note on Correlated Topic Models
 
Multilinear singular integrals with entangled structure
Multilinear singular integrals with entangled structureMultilinear singular integrals with entangled structure
Multilinear singular integrals with entangled structure
 
Neural Collaborative Subspace Clustering
Neural Collaborative Subspace ClusteringNeural Collaborative Subspace Clustering
Neural Collaborative Subspace Clustering
 
Assignment 2 daa
Assignment 2 daaAssignment 2 daa
Assignment 2 daa
 
A T(1)-type theorem for entangled multilinear Calderon-Zygmund operators
A T(1)-type theorem for entangled multilinear Calderon-Zygmund operatorsA T(1)-type theorem for entangled multilinear Calderon-Zygmund operators
A T(1)-type theorem for entangled multilinear Calderon-Zygmund operators
 
Some Examples of Scaling Sets
Some Examples of Scaling SetsSome Examples of Scaling Sets
Some Examples of Scaling Sets
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Cost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree gamesCost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree games
 
Imc2017 day2-solutions
Imc2017 day2-solutionsImc2017 day2-solutions
Imc2017 day2-solutions
 

Viewers also liked

The Max Cut Problem
The Max Cut ProblemThe Max Cut Problem
The Max Cut Problemdnatapov
 
Solving the traveling salesman problem by genetic algorithm
Solving the traveling salesman problem by genetic algorithmSolving the traveling salesman problem by genetic algorithm
Solving the traveling salesman problem by genetic algorithmAlex Bidanets
 
Travelling Salesman Problem
Travelling Salesman ProblemTravelling Salesman Problem
Travelling Salesman ProblemShikha Gupta
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmgarima931
 

Viewers also liked (6)

The Max Cut Problem
The Max Cut ProblemThe Max Cut Problem
The Max Cut Problem
 
Solving the traveling salesman problem by genetic algorithm
Solving the traveling salesman problem by genetic algorithmSolving the traveling salesman problem by genetic algorithm
Solving the traveling salesman problem by genetic algorithm
 
Shortest Path Problem
Shortest Path ProblemShortest Path Problem
Shortest Path Problem
 
Travelling Salesman Problem
Travelling Salesman ProblemTravelling Salesman Problem
Travelling Salesman Problem
 
Analysis of Algorithm
Analysis of AlgorithmAnalysis of Algorithm
Analysis of Algorithm
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 

Similar to Max cut

course slides of Support-Vector-Machine.pdf
course slides of Support-Vector-Machine.pdfcourse slides of Support-Vector-Machine.pdf
course slides of Support-Vector-Machine.pdfonurenginar1
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2S.Shayan Daneshvar
 
Infinite series Lecture 4 to 7.pdf
Infinite series Lecture 4 to 7.pdfInfinite series Lecture 4 to 7.pdf
Infinite series Lecture 4 to 7.pdfNishadKotkar
 
Skiena algorithm 2007 lecture20 satisfiability
Skiena algorithm 2007 lecture20 satisfiabilitySkiena algorithm 2007 lecture20 satisfiability
Skiena algorithm 2007 lecture20 satisfiabilityzukun
 
How good are interior point methods? Klee–Minty cubes tighten iteration-compl...
How good are interior point methods? Klee–Minty cubes tighten iteration-compl...How good are interior point methods? Klee–Minty cubes tighten iteration-compl...
How good are interior point methods? Klee–Minty cubes tighten iteration-compl...SSA KPI
 
Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...
Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...
Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...Yandex
 
Eighan values and diagonalization
Eighan values and diagonalization Eighan values and diagonalization
Eighan values and diagonalization gandhinagar
 
Skiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionSkiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionzukun
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxarifimad15
 
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01Asad Bukhari
 
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01Nur Kamila
 
Additional Mathematics form 4 (formula)
Additional Mathematics form 4 (formula)Additional Mathematics form 4 (formula)
Additional Mathematics form 4 (formula)Fatini Adnan
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Fabian Pedregosa
 

Similar to Max cut (20)

Approx
ApproxApprox
Approx
 
Np cooks theorem
Np cooks theoremNp cooks theorem
Np cooks theorem
 
course slides of Support-Vector-Machine.pdf
course slides of Support-Vector-Machine.pdfcourse slides of Support-Vector-Machine.pdf
course slides of Support-Vector-Machine.pdf
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 
Infinite series Lecture 4 to 7.pdf
Infinite series Lecture 4 to 7.pdfInfinite series Lecture 4 to 7.pdf
Infinite series Lecture 4 to 7.pdf
 
Skiena algorithm 2007 lecture20 satisfiability
Skiena algorithm 2007 lecture20 satisfiabilitySkiena algorithm 2007 lecture20 satisfiability
Skiena algorithm 2007 lecture20 satisfiability
 
Imc2017 day1-solutions
Imc2017 day1-solutionsImc2017 day1-solutions
Imc2017 day1-solutions
 
How good are interior point methods? Klee–Minty cubes tighten iteration-compl...
How good are interior point methods? Klee–Minty cubes tighten iteration-compl...How good are interior point methods? Klee–Minty cubes tighten iteration-compl...
How good are interior point methods? Klee–Minty cubes tighten iteration-compl...
 
Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...
Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...
Subgradient Methods for Huge-Scale Optimization Problems - Юрий Нестеров, Cat...
 
Eighan values and diagonalization
Eighan values and diagonalization Eighan values and diagonalization
Eighan values and diagonalization
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
 
Skiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reductionSkiena algorithm 2007 lecture21 other reduction
Skiena algorithm 2007 lecture21 other reduction
 
Imc2016 day2-solutions
Imc2016 day2-solutionsImc2016 day2-solutions
Imc2016 day2-solutions
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam Help
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptx
 
QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...
QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...
QMC: Operator Splitting Workshop, A Splitting Method for Nonsmooth Nonconvex ...
 
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01
 
Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01Spm add-maths-formula-list-form4-091022090639-phpapp01
Spm add-maths-formula-list-form4-091022090639-phpapp01
 
Additional Mathematics form 4 (formula)
Additional Mathematics form 4 (formula)Additional Mathematics form 4 (formula)
Additional Mathematics form 4 (formula)
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
 

Recently uploaded

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseWSO2
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformWSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Recently uploaded (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Max cut

  • 1. 1 February 28, 2014 CS21 Lecture 22 1 CS21 Decidability and Tractability Lecture 22 February 28, 2014 Outline • the class NP – NP-complete problems: subset sum – NP-complete problems: NAE-3-SAT, max-cut • the class co-NP • the class NP Å coNP February 28, 2014 CS21 Lecture 22 2 February 28, 2014 CS21 Lecture 22 3 SUBSET-SUM is NP-complete Theorem: the following language is NP- complete: SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) : there is a subset of S that sums to B} • Proof: – Part 1: SUBSET-SUM NP. Proof? – Part 2: SUBSET-SUM is NP-hard. • reduce from? our reduction had better produce super- polynomially large B (unless we want to prove P=NP) February 28, 2014 CS21 Lecture 22 4 SUBSET-SUM is NP-complete • We are reducing from the language: 3SAT = { φ : φ is a 3-CNF formula that has a satisfying assignment } to the language: SUBSET-SUM = {(S = {a1, a2, a3, …, ak}, B) : there is a subset of S that sums to B} February 28, 2014 CS21 Lecture 22 5 SUBSET-SUM is NP-complete • φ = (x1 x2 x3) ( x1 x4 x3) … (…) • Need integers to play the role of truth assignments • For each variable xi include two integers in our set S: – xi TRUE and xi FALSE • set B so that exactly one must be in sum February 28, 2014 CS21 Lecture 22 6 SUBSET-SUM is NP-complete x1 TRUE = 1 0 0 0 … 0 x1 FALSE = 1 0 0 0 … 0 x2 TRUE = 0 1 0 0 … 0 x2 FALSE = 0 1 0 0 … 0 … xm TRUE = 0 0 0 0 … 1 xm FALSE = 0 0 0 0 … 1 B = 1 1 1 1 … 1 • every choice of one from each (xi TRUE,xi FALSE) pair sums to B • every subset that sums to B must choose one from each (xi TRUE,xi FALSE) pair
  • 2. 2 February 28, 2014 CS21 Lecture 22 7 SUBSET-SUM is NP-complete • φ = (x1 x2 x3) ( x1 x4 x3) … (…) • Need to force subset to “choose” at least one true literal from each clause • Idea: – add more digits – one digit for each clause – set B to force each clause to be satisfied. February 28, 2014 CS21 Lecture 22 8 SUBSET-SUM is NP-complete – φ = (x1 x2 x3) ( x1 x4 x3) … (…) x1 TRUE = 1 0 0 0 … 0 1 x1 FALSE = 1 0 0 0 … 0 0 x2 TRUE = 0 1 0 0 … 0 1 x2 FALSE = 0 1 0 0 … 0 0 x3 TRUE = 0 0 1 0 … 0 0 x3 FALSE = 0 0 1 0 … 0 1 … : B = 1 1 1 1 … 1 ? ? ? ? … … clause 1 clause 2 clause 3 clause k : February 28, 2014 CS21 Lecture 22 9 SUBSET-SUM is NP-complete – B = 1 1 1 1 … 1 ? ? ? ? – if clause i is satisfied sum might be 1, 2, or 3 in corresponding column. – want ? to “mean” 1 – solution: set ? = 3 – add two “filler” elements for each clause i: – FILL1i = 0 0 0 0 ... 0 0 ... 0 1 0 ... 0 – FILL2i = 0 0 0 0 ... 0 0 ... 0 1 0 ... 0 column for clause i February 28, 2014 CS21 Lecture 22 10 SUBSET-SUM is NP-complete • Reduction: m variables, k clauses – for each variable xi: • xi TRUE has ones in positions k + i and {j : clause j includes literal xi} • xi FALSE has ones in positions k + i and {j : clause j includes literal xi} – for each clause i: • FILL1i and FILL2i have one in position i – bound B has 3 in positions 1…k and 1 in positions k+1…k+m February 28, 2014 CS21 Lecture 22 11 SUBSET-SUM is NP-complete • Reduction computable in poly-time? • YES maps to YES? – choose one from each (xi TRUE,xi FALSE) pair corresponding to a satisfying assignment – choose 0, 1, or 2 of filler elements for each clause i depending on whether it has 3, 2, or 1 true literals – first m digits add to 1; last k digits add to 3 February 28, 2014 CS21 Lecture 22 12 SUBSET-SUM is NP-complete • NO maps to NO? – at most 5 ones in each column, so no carries to worry about – first m digits of B force subset to choose exactly one from each (xi TRUE,xi FALSE) pair – last k digits of B require at least one true literal per clause, since can only sum to 2 using filler elements – resulting assignment must satisfy φ
  • 3. 3 February 28, 2014 CS21 Lecture 22 13 Not-All-Equal 3SAT (x1 x2 x3) ( x1 x4 x3) … (…) Theorem: the following language is NP- complete: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} • Proof: – Part 1: NAE3SAT NP. Proof? – Part 2: NAE3SAT is NP-hard. Reduce from? February 28, 2014 CS21 Lecture 22 14 NAE3SAT is NP-complete • We are reducing from the language: CIRCUIT-SAT = {C : C is a Boolean circuit for which there exists a satisfying truth assignment} to the language: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} February 28, 2014 CS21 Lecture 22 15 NAE3SAT is NP-complete • Recall reduction to 3SAT – variables x1, x2, …,xn, gates g1, g2, …, gm – produce clauses: gi z • (gi z) • ( z gi) gi z1 • ( z1 gi) • ( z2 gi) • ( gi z1 z2) z2 gi z1 • ( gi z1) • ( gi z2) • ( z1 z2 gi) z2 output gate gm: • (gm) not all true in a satisfying assignment not all true in a satisfying assignment February 28, 2014 CS21 Lecture 22 16 NAE3SAT is NP-complete • modified reduction to NAE3SAT – variables x1, x2, …,xn, gates g1, g2, …, gm – produce clauses: gi z • (gi z w) • ( z gi w) gi z1 • ( z1 gi w) • ( z2 gi w) • ( gi z1 z2) z2 gi z1 • ( gi z1 w) • ( gi z2 w) • ( z1 z2 gi) z2 output gate gm: • (gm w) February 28, 2014 CS21 Lecture 22 17 NAE3SAT is NP-complete • Does the reduction run in polynomial time? • YES maps to YES – already know how to get a satisfying assignment to the BLUE variables – set w = FALSE • ( z1 gi w) • ( z2 gi w) • ( gi z1 z2) • ( gi z1 w) • ( gi z2 w) • ( z1 z2 gi) • (gi z w) • ( z gi w) • (gm w) February 28, 2014 CS21 Lecture 22 18 NAE3SAT is NP-complete • NO maps to NO – given NAE assignment A – complement A’ is a NAE assignment – A or A’ has w = FALSE – must have TRUE BLUE variable in every clause – we know this implies C satisfiable • ( z1 gi w) • ( z2 gi w) • ( gi z1 z2) • ( gi z1 w) • ( gi z2 w) • ( z1 z2 gi) • (gi z w) • ( z gi w) • (gm w)
  • 4. 4 February 28, 2014 CS21 Lecture 22 19 MAX CUT • Given graph G = (V, E) – a cut is a subset S V – an edge (x, y) crosses the cut if x S and y V – S or x V – S and y S – search problem: find cut maximizing number of edges crossing the cut February 28, 2014 CS21 Lecture 22 20 MAX CUT • Given graph G = (V, E) – a cut is a subset S V – an edge (x, y) crosses the cut if x S and y V – S or x V – S and y S – search problem: find cut maximizing number of edges crossing the cut February 28, 2014 CS21 Lecture 22 21 MAX CUT Theorem: the following language is NP- complete: MAX CUT = {(G = (V, E), k) : there is a cut S V with at least k edges crossing it} • Proof: – Part 1: MAX CUT NP. Proof? – Part 2: MAX CUT is NP-hard. • reduce from? February 28, 2014 CS21 Lecture 22 22 MAX CUT is NP-complete • We are reducing from the language: NAE3SAT = {φ : φ is a 3-CNF formula for which there exists a truth assignment in which every clause has at least 1 true literal and at least 1 false literal} to the language: MAX CUT = {(G = (V, E), k) : there is a cut S V with at least k edges crossing it} February 28, 2014 CS21 Lecture 22 23 MAX CUT is NP-complete • The reduction: – given instance of NAE3SAT (n nodes, m clauses): (x1 x2 x3) ( x1 x4 x5) … ( x2 x3 x3 ) – produce graph G = (V, E) with node for each literal x2 x1 x4 x1 x5 x4 x3 x2 x5 x3 • triangle for each 3-clause • parallel edges for each 2-clause February 28, 2014 CS21 Lecture 22 24 MAX CUT is NP-complete – if cut selects TRUE literals, each clause contributes 2 if NAE, and < 2 otherwise – need to penalize cuts that correspond to inconsistent truth assignments – add ni parallel edges from xi to xi (ni = # occurrences) (repeat variable in 2-clause to make 3-clause for this calculation) x2 x1 x4 x1 x5 x4 x3 x2 x5 x3 • triangle for each 3-clause • parallel edges for each 2-clause
  • 5. 5 February 28, 2014 CS21 Lecture 22 25 MAX CUT is NP-complete • YES maps to YES – take cut to be TRUE literals in a NAE truth assignment – contribution from clause gadgets: 2m – contribution from (xi, xi) parallel edges: 3m x2 x1 x4 x1 x5 x4 x3 x2 x5 x3 • triangle for each 3-clause • parallel edges for each 2- clause • ni parallel edges from xi to xi • set k = 5m February 28, 2014 CS21 Lecture 22 26 MAX CUT is NP-complete • NO maps to NO – Claim: if cut has xi, xi on same side, then can move one to opposite side without decreasing # edges crossing cut – contribution from (xi, xi) parallel edges: 3m – contribution from clause gadgets must be 2m – conclude: there is a NAE assignment x2 x1 x4 x1 x5 x4 x3 x2 x5 x3 • triangle for each 3-clause • parallel edges for each 2- clause • ni parallel edges from xi to xi • set k = 5m February 28, 2014 CS21 Lecture 22 27 MAX CUT is NP-complete Claim: if cut has xi, xi on same side, then can move one to opposite side without decreasing # edges crossing cut • Proof: xi ... xi a edges b edges ni edges xi ... xi xi ... xi a+b ≤ 2ni a + ni b + ni a + ni ≥ a + b or b + ni ≥ a + b