Michael Codish, Michael Frank, Amit Metodi

Slides:



Advertisements
Similar presentations
P, NP, NP-Complete Problems
Advertisements

NP-Hard Nattee Niparnan.
Time Complexity P vs NP.
Directed acyclic graphs with the unique dipath property J.-C. Bermond, M. Cosnard, S. Perennes Inria and CNRS 24 Nov Disco Workshop - Valparaiso.
Order encoding x i ↔ (X ≥ i)(X = 3) = [1,1,1,0,0] Problem (hard) Problem (hard) Solution CNF Encoding Finite Domain Problem Solving Model Constraint Model.
Programming with Boolean Satisfaction Michael Codish Department of Computer Science Ben Gurion University Beer-Sheva, Israel CP meets CAV Joint.
Saleem Sabbagh & Najeeb Darawshy Supervisors: Mony Orbach, Technion & Ilia Averbouch, IBM Started at: Winter 2012 Duration: Semester.
Max Cut Problem Daniel Natapov.
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
CS Department Fireside Chat All are welcome! Wed Nov 18, 5-6pm, Ols 228e/236d Kim Hazelwood and Wes Weimer Meet and ask them questions in a non-academic.
NP and NP Complete. Definitions A problem is in the class P if there is a polynomial time solution to the problem A problem is in the class NP if there.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Black-box (oracle) Feed me a weighted graph G and I will tell you the weight of the max-weight matching of G.
1 Slides by Asaf Shapira & Michael Lewin & Boaz Klartag & Oded Schwartz. Adapted from things beyond us.
Hardness Results for Problems
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 How to prove that a problem is NPC. 2 Cook Cook showed the first NPC problem: SAT Cook received Turing Award in 1982.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
Saleem Sabbagh & Najeeb Darawshy Supervisors: Mony Orbach, Technion & Ilia Averbouch, IBM Started at: Spring 2012 Duration: Semester.
Saleem Sabbagh & Najeeb Darawshy Supervisors: Mony Orbach, Technion & Ilia Averbouch, IBM Started at: Spring 2012 Duration: Semester.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 30, 2014.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
Construction We constructed the following graph: This graph has several nice properties: Diameter Two Graph Pebbling Tim Lewis 1, Dan Simpson 1, Sam Taggart.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
The Theory of NP-Completeness
NP-Complete Problems.
NP-completeness Ch.34.
Chapter 10 NP-Complete Problems.
Introduction to MiniSAT
Richard Anderson Lecture 26 NP-Completeness
COMPLEXITY THEORY IN PRACTICE
Dr. Rachel Ben-Eliyahu – Zohary
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
Richard Anderson Lecture 26 NP-Completeness
Hard Problems Introduction to NP
NP-Completeness (36.4-5) P: yes and no in pt NP: yes in pt NPH  NPC
ICS 353: Design and Analysis of Algorithms
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
CS 3343: Analysis of Algorithms
CSE 6408 Advanced Algorithms.
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Ideas for testing Transformations of cds 4/27/2019 AOO/Demeter.
The Theory of NP-Completeness
CSE 589 Applied Algorithms Spring 1999
A Few Sample Reductions
Instructor: Aaron Roth
Presentation transcript:

Michael Codish, Michael Frank, Amit Metodi Logic Programming with Max-Clique and its Application to Graph Coloring morad muslimany Ben-Gurion University of the Negev Joint work with: Michael Codish, Michael Frank, Amit Metodi {mcodish,frankm,moradm,amitmet}@cs.bgu.ac.il

Logic Programming with Max-Clique and its Application to Graph Coloring We will present pl-cliquer, a Prolog interface to the cliquer tool for the maximum clique problem. Agenda: Problem definitions and examples pl-cliquer Usage examples Experiments

Cliques, Maximum Cliques A clique in a graph 𝐺=(𝑉,𝐸) is a set 𝐶⊆𝑉 of pairwise adjacent vertices (∀ 𝑣 1 , 𝑣 2 ∈𝐶: 𝑣 1 , 𝑣 2 ∈𝐸) The maximum clique problem is about finding the largest clique in the graph

Cliques, Maximum Cliques A clique in a graph 𝐺=(𝑉,𝐸) is a set 𝐶⊆𝑉 of pairwise adjacent vertices (∀ 𝑣 1 , 𝑣 2 ∈𝐶: 𝑣 1 , 𝑣 2 ∈𝐸) The maximum clique problem is about finding the largest clique in the graph

Graph Coloring The problem of graph coloring is to find a labeling 𝑐:𝑉→𝑁 of the vertices of the graph such that 𝑖,𝑗 ∈𝐸⇔𝑐 𝑖 ≠𝑐(𝑗). The minimal graph coloring problem is to color the graph while using as few colors as possible. This number is called the Chromatic Number of the graph.

Graph Coloring The problem of graph coloring is to find a labeling 𝑐:𝑉→𝑁 of the vertices of the graph such that 𝑖,𝑗 ∈𝐸⇔𝑐 𝑖 ≠𝑐(𝑗). The minimal graph coloring problem is to color the graph while using as few colors as possible. This number is called the Chromatic Number of the graph.

Cliques and colorings Finding cliques is tremendously useful in the problem of Graph Coloring It is easy to show that the chromatic number of a graph 𝐺, 𝜒(𝐺), is greater than or equal to the size of the maximum clique, as all clique vertices must get different colors.

Hardness of these problems The clique decision problem (is there a clique of size ≤𝑘 in a graph) is NP-Complete Subsequently, the problem of finding a maximum clique is also NP-Hard. The graph coloring decision problem is NP- Complete In particular, the minimal graph coloring problem is NP-Hard

Hard but solvable in practice… Although the problem of maximum-clique is NP-Hard, it is solvable in practice in many graphs by various tools Cliquer is one such tool, which is a set of C routines for finding cliques in a graph

Logic Programming with Max-Clique and its Application to Graph Coloring We will present pl-cliquer, a Prolog interface to the Cliquer tool for the maximum clique problem. Agenda: Problem definitions and examples pl-cliquer Usage examples Experiments

pl-cliquer We have written an interface that connects Cliquer with SWI-Prolog, called pl-cliquer Provides five high-level predicates, and we will focus on the following three: graph_read_dimacs_file/5 clique_find_single/4 clique_find_n_sols/6

graph_read_dimacs_file(FileName,NVert,Weights,Graph,Options) Converts a graph in the standard DIMACS format to a Prolog representation as a Boolean adjacency matrix. Running example graph: FileName (content) NVert Weights Graph Options graph_read_dimacs_file(FileName,NVert,Weights,Graph,Options)

graph_read_dimacs_file(FileName,NVert,Weights,Graph,Options) Converts a graph in the standard DIMACS format to a Prolog representation as a Boolean adjacency matrix. Running example graph: 7 FileName (content) NVert Weights Graph Options graph_read_dimacs_file(FileName,NVert,Weights,Graph,Options)

clique_find_single(NVert,Graph,Clique,Options) Provides an interface to the Cliquer routine by the same name. Finds a single clique in the graph. 7 NVert Graph Clique Options clique_find_single(NVert,Graph,Clique,Options)

clique_find_single(NVert,Graph,Clique,Options) Provides an interface to the Cliquer routine by the same name. Finds a single clique in the graph. 7 NVert Graph Clique Options clique_find_single(NVert,Graph,Clique,Options)

clique_find_n_sols(MaxSols,NVert,Graph,Sols,Total,Options) Allows finding several cliques in a graph. min_weight(3) max_weight(4) maximal(false) 10 7 MaxSols NVert Graph Sols Total Options clique_find_n_sols(MaxSols,NVert,Graph,Sols,Total,Options)

clique_find_n_sols(MaxSols,NVert,Graph,Sols,Total,Options) Allows finding several cliques in a graph. min_weight(3) max_weight(4) maximal(false) 10 7 6 MaxSols NVert Graph Sols Total Options clique_find_n_sols(MaxSols,NVert,Graph,Sols,Total,Options)

Logic Programming with Max-Clique and its Application to Graph Coloring We will present pl-cliquer, a Prolog interface to the cliquer tool for the maximum clique problem. Agenda: Problem definitions and examples pl-cliquer Usage examples Experiments

Solving the Graph Coloring Problem We model the problem using a constraint language (BEE) The constraints model is then compiled to SAT using the BEE compiler (written in Prolog) The SAT instance is solved using a SAT solver via the Prolog interface (BEE allows a variety of solvers at its backend) The satisfied SAT instance assignment is decoded back to a graph coloring

Main Predicate We model the problem using a constraint language (BEE) The constraints model is then compiled to SAT using the BEE compiler (written in Prolog) The SAT instance is solved using a SAT solver via the Prolog interface (BEE allows a variety of solvers at its backend) The satisfied SAT instance assignment is decoded back to a graph coloring

?- graphColoring(Graph,5,Coloring) Example Can we solve our running example with 5 colors? ?- graphColoring(Graph,5,Coloring)

Example graphColoring(Graph, 5, Coloring)

?- graphColoring(Graph,5,Coloring) Example ?- graphColoring(Graph,5,Coloring)

pl-cliquer & graph coloring As well known, the maximum clique vertices can be preassigned different colors

pl-cliquer & graph coloring As well known, the maximum clique vertices can be preassigned different colors

pl-cliquer & graph coloring

Example – with pl-cliquer graphColoring(Graph,5,Coloring)

Logic Programming with Max-Clique and its Application to Graph Coloring We will present pl-cliquer, a Prolog interface to the cliquer tool for the maximum clique problem. Agenda: Problem definitions and examples pl-cliquer Usage examples Experiments

DIMACS Benchmarks – Selected Results With pl-cliquer and clique symmetry breaks Without pl-cliquer Instance Colors Cliquer Time BEE Time Clauses Vars SAT Time queen9_9 10 0.01 0.06 12026 547 6.91/sat myciel5 5 1170 195 0.85/unsat fpsol2.i.1 65 0.02 0/sat(BEE) school1_nsh 13 26.6 0/unsat(cl) BEE Time Clauses Vars SAT Time 0.06 24927 891 14.36/sat 0.01 1697 235 109.24/unsat 2.26 1121026 17781 1.87/sat 0.67 216343 4711 793.22/unsat

Toronto Benchmarks – Selected Results With pl-cliquer and clique symmetry breaks Without pl-cliquer Instance Colors Cliquer Time BEE Time Clauses Vars SAT Time pur-s-93 31 0.5 2.85 1098306 39613 3.36/sat 30 2.77 1005456 37849 1.44/unsat car-s-91 27 0.06 1.93 407155 12672 1578.48/sat car-f-92 0.2 1.15 179749 7634 0.73/sat BEE Time Clauses Vars SAT Time 14.43 3448166 71911 17.6/sat 7.18 3321648 70275 >86400 2.5 1018280 19897 2.6 713441 15616 4.35/sat

Questions?