An Interactive Tutorial for
NP-Completeness
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
2
NP-Completeness
5/19/2015
3
Students’ perception of NP-Completeness
Not at all difficult.
14%
2%
Somewhat less difficult
20%
Average difficulty
Somewhat more difficult
Much more difficult
64%
5/19/2015
4
Related Work
“Using Interactive Visualization for Teaching the Theory of NPcompleteness.”
“Incorporating an interactive visualization of NP-Completeness
proofs into a web-based learning environment.”
“Visualizing NP-completeness through circuit-based widgets.”
GraphBench
AlViE
Swan
5/19/2015
5
Tools and Framework
5/19/2015
OpenDSA
JSAV - JavaScript Algorithm Visualization library
Khan Academy exercises
6
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
7
NP-Complete problems covered:
Circuit-SAT
SAT
3-SAT
Clique
Independent Set
Vertex Cover
Hamiltonian Cycle
Traveling Salesman.
5/19/2015
8
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
9
Introducing the problem
Explanation of relevant context
Definition of the problem
Illustration with examples.
5/19/2015
(Example)
10
The NP-Complete problems
Circuit Satisfiability problem (Circuit-SAT)
The Formula Satisfiability problem (SAT)
The 3CNF Satisfiability problem ( 3SAT )
The Clique problem
The Independent Set problem
The Vertex Cover problem
The Hamiltonian Cycle problem
The Traveling Salesman problem
5/19/2015
11
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
12
Practice Exercises – Why?
Better illustration of the problem
Hands-on experience on problem instances
Help to appreciate the computation complexity.
5/19/2015
13
Practice Exercises – Design aspects
Generation of problem instances
Level of Difficulty
Solution and Verification
5/19/2015
14
The Practice Exercises
3-SAT
The Maximum Clique problem
The Maximum Independent Set problem
The Minimum Vertex Cover problem
The Hamiltonian cycle problem
The Traveling Salesman problem
5/19/2015
15
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
16
Proving NP-Completeness
NP
NP-Complete
NP-Hard
Reductions
5/19/2015
17
Reductions
5/19/2015
18
Proof of NP-Completeness
The visualizations should include –
Description of each step of a reduction.
Explanation of correctness of the reduction.
Illustration using examples.
5/19/2015
19
Order of Reductions
5/19/2015
20
Reductions in proving NP-Completeness
Reduction of Circuit-SAT to SAT
Reduction of SAT to 3-SAT
Reduction of 3-SAT to Clique problem
Reduction of Clique to Independent Set problem
Reduction of Independent Set to Vertex Cover problem
Reduction of 3-SAT to Hamiltonian Cycle problem
Reduction of Hamiltonian Cycle to Traveling Salesman problem
5/19/2015
21
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
22
Hypothesis
Students would spend a reasonable amount of time on the
tutorial if it helps in their learning.
Students would have a good experience with the tutorial.
5/19/2015
23
Analysis of Usage – Methodology
The tutorial was introduced as a supplementary resource in CS
5114 and CS 4104 in Spring 2015.
Interaction logs : We analyzed the logs of students’
interactions with the tutorial.
Student survey : We collect feedback from students in the
form of a survey.
5/19/2015
24
Challenges in analyzing Interaction logs
Distinguishing between users.
Distinguishing between actual usage and idle
time.
5/19/2015
25
CS-5114 : Categorized Usage
CS 5114 : Categorized usage
16
14
Time spent ( hours)
12
10
8
6
4
2
0
Date
Theory
5/19/2015
Reduction
Intro
Proof
26
CS-5114 : Usage per module
16
CS 5114 Analysis of time spent per module
14
Time spent ( hours)
12
10
8
6
4
2
0
LimComp
hamiltonianCycle
provingNPC
circuitSAT_to_SAT
independentSet
threeSAT_to_clique
threeSAT_to_hamiltonianCycle
5/19/2015
Date
Reduction
circuitSAT
threeSAT
SAT_to_threeSAT
vertexCover
clique_to_independentSet
hamiltonianCycle_to_TSP
NPComplete
NPCoping
SAT
clique
TSP
independentSet_to_vertexCover
27
CS-4104 : Categorized Usage
4104 Categorized usage analysis
3.5
3
Time spent (seconds)
2.5
2
1.5
1
0.5
0
Date
Theory
5/19/2015
Reduction
Intro
Proof
28
CS-4104 : Usage per module
3.5
CS 4104 Analysis of time spent per module
TIme spent (hours)
3
2.5
2
1.5
1
0.5
0
LimComp
circuitSAT
clique
independentSet
vertexCover
threeSAT_to_clique
clique_to_independentSet
5/19/2015
Date
Reduction
circuitSAT_to_SAT
provingNPC
SAT
hamiltonianCycle
NPCoping
hamiltonianCycle_to_TSP
NPComplete
threeSAT
threeSAT_to_hamiltonianCycle
TSP
SAT_to_threeSAT
independentSet_to_vertexCover
29
Time spent of exercises
Analysis of Exercises
1.2
1
TIme spent (hours)
0.8
0.6
0.4
0.2
0
3/26/2015
3/28/2015
4/2/2015
4/16/2015
4/22/2015
Date
hamiltonianCycle_KA
5/19/2015
threeSAT_KA
clique_KA
independentSet_KA
vertexCover_KA
30
TSP_KA
Overall usage for CS 5114
16
CS 5114 Analysis of time spent per module
14
Time spent (hours)
12
10
8
6
4
2
0
LimComp
hamiltonianCycle
provingNPC
circuitSAT_to_SAT
independentSet
threeSAT_to_clique
threeSAT_to_hamiltonianCycle
5/19/2015
Date
Reduction
circuitSAT
threeSAT
SAT_to_threeSAT
vertexCover
clique_to_independentSet
hamiltonianCycle_to_TSP
NPComplete
NPCoping
SAT
clique
TSP
independentSet_to_vertexCover
31
5/19/2015
LimComp
circuitSAT_to_SAT
threeSAT_to_hamiltonianCycle
vertexCover
NPCoping
Reduction
threeSAT
independentSet
hamiltonianCycle
independentSet_to_vertexCover
Date
NPComplete
clique
SAT
SAT_to_threeSAT
clique_to_independentSet
32
circuitSAT
provingNPC
TSP
threeSAT_to_clique
hamiltonianCycle_to_TSP
5/13/2015
5/12/2015
5/11/2015
5/10/2015
5/9/2015
5/8/2015
5/7/2015
5/6/2015
5/5/2015
5/4/2015
5/3/2015
5/2/2015
5/1/2015
4/30/2015
4/29/2015
4/28/2015
4/27/2015
4/26/2015
4/25/2015
4/24/2015
4/23/2015
4/22/2015
4/21/2015
4/20/2015
4/19/2015
6
4/18/2015
4/17/2015
4/16/2015
4/15/2015
4/14/2015
4/13/2015
4/12/2015
4/11/2015
4/10/2015
4/9/2015
4/8/2015
4/7/2015
4/6/2015
4/5/2015
4/4/2015
4/3/2015
4/2/2015
4/1/2015
TIme spent (hours)
Overall usage for CS 4104
7
CS 4104 Analysis of time spent per module for finals
5
4
3
2
1
0
Student Survey
CS 5114
CS 4104
• 23 out of 34 responded to the survey
• 36 out of 62 responded to the survey
• Average time spent as reported - 2.28
hours
• Average time spent as reported - 32
minutes
• 65% found it useful for their
homework
• 19% found it useful for their
homework
• 82% say they will use the tutorial to
prepare for finals.
• 86% say the tutorial will be helpful for
their finals.
• 97% of the students provided a
positive feedback when asked about
their experience with the tutorial.
• 72% of the students had a positive
feedback when asked about their
experience with the tutorial.
5/19/2015
33
Outline
Background and Motivation
Visualizations
The NP-Complete Problems
Practice Exercises on NP-Complete Problem Instances.
Proof of NP-Completeness
Analysis of Usage
Conclusion and Future work
5/19/2015
34
Conclusion
18 visualizations and 6 practice exercises in the tutorial.
Students think it is a good resource.
They use it on a need-to-know basis.
5/19/2015
35
Future work
Visualizations on more NP-Complete problems.
Pedagogical evaluation of the material.
5/19/2015
36
Thank you
Special mentions:
Dr . Cliff Shaffer
Dr. Lenwood Heath
Mohammed Farghally
Questions ??
5/19/2015
37