Parallel and Distributed Computing

Similar documents
Finite Model Generation for Isabelle/HOL Using a SAT Solver

CS446: Machine Learning Fall Problem Set 4. Handed Out: October 17, 2013 Due: October 31 th, w T x i w

Mixed Integer Linear Programming

2SAT Andreas Klappenecker

Where Can We Draw The Line?

Combinatorial Optimization

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

CSE Theory of Computing Fall 2017 Project 1-SAT Solving

8.1 Polynomial-Time Reductions

Horn Formulae. CS124 Course Notes 8 Spring 2018

PROPOSITIONAL LOGIC (2)

Massively Parallel Seesaw Search for MAX-SAT

Homework 4 Solutions

Polynomial SAT-Solver Algorithm Explanation

Implementation of a Sudoku Solver Using Reduction to SAT

Lecture 14: Lower Bounds for Tree Resolution

P -vs- NP. NP Problems. P = polynomial time. NP = non-deterministic polynomial time

CS 267: Automated Verification. Lecture 13: Bounded Model Checking. Instructor: Tevfik Bultan

8 NP-complete problem Hard problems: demo

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

NP-Complete Reductions 2

Randomness and Computation March 25, Lecture 5

NP and computational intractability. Kleinberg and Tardos, chapter 8

Combining forces to solve Combinatorial Problems, a preliminary approach

Notes on CSP. Will Guaraldi, et al. version /13/2006

Satisfiability. Michail G. Lagoudakis. Department of Computer Science Duke University Durham, NC SATISFIABILITY

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

SAT Solvers. Ranjit Jhala, UC San Diego. April 9, 2013

Example: Map coloring

Linear Time Unit Propagation, Horn-SAT and 2-SAT

Towards More Effective Unsatisfiability-Based Maximum Satisfiability Algorithms

Boolean Functions (Formulas) and Propositional Logic

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Lecture Notes on Binary Decision Diagrams

Improving Unsatisfiability-based Algorithms for Boolean Optimization

NP-Completeness. Algorithms

Module 4. Constraint satisfaction problems. Version 2 CSE IIT, Kharagpur

Notes on CSP. Will Guaraldi, et al. version 1.7 4/18/2007

Fixed-Parameter Algorithm for 2-CNF Deletion Problem

Parallelizing SAT Solver With specific application on solving Sudoku Puzzles

W4231: Analysis of Algorithms

Integrating Probabilistic Reasoning with Constraint Satisfaction

Learning a SAT Solver from Single-

CMPUT 366 Intelligent Systems

CS 512, Spring 2017: Take-Home End-of-Term Examination

Exam in Algorithms & Data Structures 3 (1DL481)

SAT-CNF Is N P-complete

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

NP-Completeness of 3SAT, 1-IN-3SAT and MAX 2SAT

CMPUT 366 Assignment 1

Deductive Methods, Bounded Model Checking

SAT Solver. CS 680 Formal Methods Jeremy Johnson

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Seminar decision procedures: Certification of SAT and unsat proofs

Chapter 10 Part 1: Reduction

Projects for Advanced Functional Programming 2015

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

color = 3 color = 1 color = 2 color = 3

Exercises Computational Complexity

1.4 Normal Forms. We define conjunctions of formulas as follows: and analogously disjunctions: Literals and Clauses

Local Two-Level And-Inverter Graph Minimization without Blowup

1 Definition of Reduction

Full CNF Encoding: The Counting Constraints Case

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Complexity Classes and Polynomial-time Reductions

Projects for Advanced Functional Programming 2017

Satisfiability-Based Algorithms for 0-1 Integer Programming

Lower Bounds and Upper Bounds for MaxSAT

CSc Parallel Scientific Computing, 2017

An Efficient Framework for User Authorization Queries in RBAC Systems

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

TypeChef: Towards Correct Variability Analysis of Unpreprocessed C Code for Software Product Lines

Optimization Methods in Management Science

Control Structures in Java if-else and switch

P Is Not Equal to NP. ScholarlyCommons. University of Pennsylvania. Jon Freeman University of Pennsylvania. October 1989

Institut for Matematik & Datalogi November 15, 2010 Syddansk Universitet. DM528: Combinatorics, Probability and Randomized Algorithms Ugeseddel 3

Parallelizing Partial MUS Enumeration

Search Pruning Conditions for Boolean Optimization

Logic Programming with Satisfiability

A New Reduction from 3-SAT to Graph K- Colorability for Frequency Assignment Problem

Unrestricted Nogood Recording in CSP search

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Data Structure and Algorithm Homework #3 Due: 2:20pm, Tuesday, April 9, 2013 TA === Homework submission instructions ===

Logic Programming with Satisfiability

UML CS Algorithms Qualifying Exam Fall, 2004 ALGORITHMS QUALIFYING EXAM

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

CS-E3200 Discrete Models and Search

Decision Procedures for Equality Logic. Daniel Kroening and Ofer Strichman 1

Validating Plans with Durative Actions via Integrating Boolean and Numerical Constraints

Solving 3-SAT. Radboud University Nijmegen. Bachelor Thesis. Supervisors: Henk Barendregt Alexandra Silva. Author: Peter Maandag s

CPSC 320 Notes: What's in a Reduction?

Minimum Satisfying Assignments for SMT. Işıl Dillig, Tom Dillig Ken McMillan Alex Aiken College of William & Mary Microsoft Research Stanford U.

MajorSat: A SAT Solver to Majority Logic

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang

9.1 Cook-Levin Theorem

A Study of High Performance Computing and the Cray SV1 Supercomputer. Michael Sullivan TJHSST Class of 2004

Circuit versus CNF Reasoning for Equivalence Checking

Parallel Search for Boolean Optimization

Transcription:

Parallel and Distributed Computing Project Assignment MAX-SAT SOLVER Version 1.0 (07/03/2016) 2015/2016 2nd Semester

CONTENTS Contents 1 Introduction 2 2 Problem Description 2 2.1 Illustrative Example................................... 2 2.2 Discussion of the Algorithm to Implement....................... 2 3 Implementation Details 3 3.1 Input Data........................................ 3 3.2 Output Data....................................... 3 3.3 Sample Problem..................................... 3 4 Part 1 - Serial implementation 4 5 Part 2 - OpenMP implementation 4 6 Part 3 - MPI implementation 4 7 What to Turn in, and When 4 Revisions Version 1.0 (March 7th, 2016) Initial Version 1

2 PROBLEM DESCRIPTION 1 Introduction The purpose of this class project is to gain experience in parallel programming on an SMP and a multicomputer, using OpenMP and MPI, respectively. For this assignment you are to write a sequential and two parallel implementations of a Maximum Satisfiability (MAXSAT) solver. 2 Problem Description The Boolean Satisfiability Problem, simply known as SAT, is the problem of determining if there exists an assignment of the variables in a Boolean formula such that it evaluates to true. Although the format of the formula description is irrelevant, a format commonly used in practice is the conjunctive normal form (CNF). Under CNF, a Boolean formula consists of a conjunction of clauses, and a clause is a disjunction of literals. A literal is simply either a variable, then called positive literal, or the negation of a variable, then called negative literal. The maximum satisfiability problem (MAXSAT) can be seen as a generalization of SAT. MAXSAT is defined as the problem of determining the maximum number of clauses, of a given Boolean formula in conjunctive normal form, that can be made true by an assignment of the variables. 2.1 Illustrative Example Consider the following Boolean formula in CNF: φ = (A) (A B) (B C) (A B C) which has 3 variables (A, B and C) and 4 clauses, each with 1, 2, 2, and 3 literals respectively. It is easily verified that this formula is not satisfiable: the first clauses implies that A = 0; since A = 0, the second clause implies that B = 1; replacing these values in the third and fourth clauses we get (C) (C). However, for this project we are looking for the assignment that maximizes the number of the CNF clauses that evaluate to 1. Of course, if the formula is satisfiable, the solution to MAXSAT is the number of clauses in the formula. For our example, we achieve a MAXSAT solution of 3 with any assignment to C. 2.2 Discussion of the Algorithm to Implement A brute force approach to the MAXSAT problem is just to test the formula for all possible variable assignments. There are many sophisticated techniques to make this search more efficient. For this project, we do not want any type of research about these techniques. Keep in mind that the focus is the parallelization strategy. You are to implement a simple branch and bound search for the MAXSAT solution. The search should be made using a binary tree, where each level corresponds to a variable and the two children of each node correspond to the two possible assignments to that variable. Every time you arrive to a leaf of the tree (all variables have been assigned), the number of satisfied clauses is registered and the maximum value found should be saved. During the search the current maximum value should be used as a lower bound to prune the search. If at any node the total number of clauses minus the clauses that are unsatisfied by the current partial variable assignment is lower than this lower bound then we do not need to descend the tree further as it is guaranteed that no better solution can be found below. 2

3 IMPLEMENTATION DETAILS For this project you should not only determine the MAXSAT value, but also the number of different variable assignments that achieve that maximum number of satisfied clauses. 3 Implementation Details 3.1 Input Data The description of the problem is contained in a file (e.g., ex1.in) that starts with two positive integers indicating, respectively, the number of variables (nvar < 128) and the number of clauses (ncl < 2 16 ) in the formula. Then, each line will contain one of the clauses. To simplify, each variable is identified by an integer, signed to indicate a positive or negative literal. Hence, each line is a sequence of signed integers ending with a value 0. Your program should allow one and only one input parameter in the command line, used to specify the name of this input file. 3.2 Output Data The output of this problem should be, in two separate lines: in the first line, two integers separated by a space, the first the value of MAXSAT and the second the number of different complete variable assignments that achieve MAXSAT in the second line, one of the assignments that achieve MAXSAT (not important which), indicated as a sequence of integers separated by a space, positive for a value 1, negative for a value 0. Your program should send these two output lines (and nothing else) to the standard output, the project cannot be graded unless you follow these input and output rules! 3.3 Sample Problem Consider the formula φ above. The input file (e.g., ex1.in) that describes this formula will be: 3 4-1 0 1 2 0-2 3 0 1-2 -3 0 The program execution for this case should be: $ maxsat-serial ex1.in 3 7-1 2 3 $ (the last line can actually be any assignment except 1 2-3). 3

7 WHAT TO TURN IN, AND WHEN 4 Part 1 - Serial implementation Write a serial implementation of the algorithm in C (or C++). Name the source file of this implementation maxsat-serial.c. As stated, your program should expect exactly one input parameter. This will be your base for comparisons, it is expected that the branch and bound implementation should be as efficient as possible. 5 Part 2 - OpenMP implementation Write an OpenMP implementation of the algorithm, with the same rules and input/output descriptions. Name this source code maxsat-omp.c. You can start by simply adding OpenMP directives, but you are free, and encouraged, to modify the code in order to make the parallelization more effective and more scalable. Be careful about synchronization and load balancing! 6 Part 3 - MPI implementation Write an MPI implementation of the algorithm as for OpenMP, and address the same issues. Name this source code maxsat-mpi.c. For MPI, you will need to modify your code substantially. Besides synchronization and load balancing, you will need to take into account the minimization of the impact of communication costs. Extra credits will be given to groups that present a combined MPI+OpenMP implementation. 7 What to Turn in, and When You must eventually submit the sequential and both parallel versions of your program (please use the filenames indicated above) and the times to run the parallel versions on input data that will be made available (for 1, 2, 4 and 8 parallel tasks). Note that we will not be using any level of compiler optimizations to evaluate the performance of your programs, so you shouldn t also. You must also submit a short report about the results (1-2 pages) that discusses: the approach used for parallelization what decomposition was used what were the synchronization concerns and why how was load balancing addressed what are the performance results, and are they what you expected You will turn in the serial version and OpenMP parallel version at the first due date, with the short report, and then the serial version again (hopefully the same) and the MPI parallel version at the second due date, with an updated report. Both the code and the report will be uploaded to the Fenix system in a zip file. Name these files as g<n>omp.zip and g<n>mpi.zip, where <n> is your group number. 1st due date (serial + OMP): April 8th, until 5pm. Note: your project will be tested in the practical class just after the due date. 2nd due data (serial + MPI): May 13th, until 5pm. Note: your project will be tested in the practical class just after the due date. 4