Midterm CSG270 Spring 2007 Karl Lieberherr.

Slides:



Advertisements
Similar presentations
The behavior of SAT solvers in model checking applications K. L. McMillan Cadence Berkeley Labs.
Advertisements

Exploiting SAT solvers in unbounded model checking
Lists: An internal look
Building Java Programs Interactive Programs w/ Scanner What is a class? What is an object? What is the difference between primitive and object variables?
CSCI 160 Midterm Review Rasanjalee DM.
Single Variable and a Lot of Variables The declaration int k; float f; reserve one single integer variable called k and one single floating point variable.
Student Data Score First Name Last Name ID GPA DOB Phone... How to store student data in our programs? 1.
1 Arrays Chapter 9. 2 Outline  The array structure (Section 9.1)  Array declaration  Array initialization  Array subscripts  Sequential access to.
IBM Labs in Haifa © 2005 IBM Corporation Adaptive Application of SAT Solving Techniques Ohad Shacham and Karen Yorav Presented by Sharon Barner.
Classes and Methods Write a class called C1 containing: A static variable SV of type int. A static method SM with one parameter, of type C1, and a void.
1 Chapter 2 Introductory Programs. 2 Getting started To create and run a Java program –Create a text file with a.java extension for the source code. For.
COS 320 Compilers David Walker. Outline Last Week –Introduction to ML Today: –Lexical Analysis –Reading: Chapter 2 of Appel.
Conditionals and Recursion "To iterate is human, to recurse divine." - L. Peter Deutsch.
Iteration. Adding CDs to Vic Stack In many of the programs you write, you would like to have a CD on the stack before the program runs. To do this, you.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
Slide: 1 Copyright © AdaCore Subprograms Presented by Quentin Ochem university.adacore.com.
ECE122 Feb. 22, Any question on Vehicle sample code?
UBC March The Evergreen Project: How To Learn From Mistakes Caused by Blurry Vision in MAX-CSP Solving Karl J. Lieberherr Northeastern University.
UBC March The Evergreen Project: The Promise of Polynomials to Boost CSP/SAT Solvers* Karl J. Lieberherr Northeastern University Boston joint work.
Unification Algorithm Input: a finite set Σ of simple expressions Output: a mgu for Σ (if Σ is unifiable) 1. Set k = 0 and  0 = . 2. If Σ  k is a singleton,
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Midterm CSG 110 Karl Lieberherr. Managing Software Development Managers of software development must first be software developers.
Textbook: Data Structures and the Java Collections Framework 3rd Edition by William Collins William Collins.
More About Objects and Methods Chapter 5. Outline Programming with Methods Static Methods and Static Variables Designing Methods Overloading Constructors.
UBC March The Evergreen Project: How To Learn From Mistakes Caused by Blurry Vision in MAX-CSP Solving Karl J. Lieberherr Northeastern University.
Fibonacci Numbers and the Raw Materials Karl Lieberherr.
Objects and Classes Mostafa Abdallah
Static. 2 Objectives Introduce static keyword –examine syntax –describe common uses.
Managing Software Development Karl Lieberherr. Manage a significant program from requirements to implementation We wrote requirements. We wrote several.
Methods of Software Development Karl Lieberherr Spring 2007.
JAVA PROGRAMMING PART III. METHOD STATEMENT Form of method statement [ ] [static] ( [ ]) { } Example public static void main(String args[])
Problem 1 Bank.  Manage customers’ bank account using the following operations: Create a new account given a customer’s name and initial account. Deposit.
LINKED LISTS Midwestern State University CMPS 1053 Dr. Ranette Halverson 1.
Operating System Discussion Section. The Basics of C Reference: Lecture note 2 and 3 notes.html.
Classes and Objects - Part I. What is an Object? An Object has two primary components: state – properties of the object behavior – operations the object.
Costas Busch - LSU1 Time Complexity. Costas Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
UBC March The Evergreen Project: The Promise of Polynomials to Boost CSP/SAT Solvers* Karl J. Lieberherr Northeastern University Boston joint work.
PhD March The Evergreen Project: How To Learn From Mistakes Caused by Blurry Vision in MAX-CSP Solving Karl J. Lieberherr Northeastern University.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
Introduction to programming in java Lecture 21 Arrays – Part 1.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
Lecture 12: Dividing Up Work. Why Using Functions Divide-and-conquer making large program development more manageable. Software reusability Use existing.
More on Arrays Review of Arrays of ints, doubles, chars
Examples of Classes & Objects
Java Array Object Chuen-Liang Chen Department of Computer Science
Time Complexity Costas Busch - LSU.
Creating Your OwnClasses
Data Structure Interview
Section 5: HW6 and Interfaces
CSC 113 Tutorial QUIZ I.
Lecture 13 Input/Output Files.
Chapter 5 Function Basics
Simple Classes in C# CSCI 293 September 12, 2005.
NP-Completeness Proofs
Classes & Objects: Examples
Java Tutotrial for [NLP-AI] 2
The Post Correspondence Problem
Cs212: Data Structures Computer Science Department Lecture 2: Arrays.
Classes Lecture 7 from Chapter /1/11.
Lecture 21: Crosscutting Aspect-Oriented Programming Background
CS2011 Introduction to Programming I Methods (II)
Recap Week 2 and 3.
Section 5: HW6 and Interfaces
EECE.2160 ECE Application Programming
EE 312 Final Exam Review.
Dichotomies in CSP Karl Lieberherr inspired by the paper:
EECE.2160 ECE Application Programming
Midterm Winter 2002 Karl Lieberherr.
Presentation transcript:

Midterm CSG270 Spring 2007 Karl Lieberherr

Question 1: SAT Rank 2 instance 14 : 1 2 0 14 :       3 4 0 14 :           5 6 0  7 : 1    3            0  7 : 1        5      0  7 :       3   5      0  7 :   2    4         0  7 :   2         6   0  7 :         4   6   0 14: 1 2 = or(1 2) 7: 1 3 = or(!1 !3) = F adapted DIMACS format find maximum assignment and proof that it is maximum

Solution Strategy The MAX-CSP transition system gives many options: Choose initial assignment. Has significant impact on length of proof. Best to start with a maximum assignment. variable ordering. Irrelevant because start with maximum assignment. value ordering: Also irrelevant.

rank 2 10: 1 = or(1) 5: 1 = or(!1) 14: 1 2 = or(1 2) 7: 1 3 = or(!1 !3) SAT Rank 2 instance N={1 !2 !3 4 5 !6} unsat=1/9 {}|F|{}|N -> D UP* {1* !3 !5 4 6}|F|{}|N -> SSR Restart {}|F|5(1)|N -> UP* {!1 2 !4 !6 5 3}F|5(1)|N -> SSR {!1 2 !4 !6 5 3}F|5(1),0()|N -> Finale end 14 : 1 2 0 14 :       3 4 0 14 :           5 6 0  7 : 1    3            0  7 : 1        5      0  7 :       3   5      0  7 :   2    4         0  7 :   2         6   0  7 :         4   6   0 adapted DIMACS format

Rank 2 relations ba 1 00 0 0 2 01 1 0 4 10 0 1 8 11 1 1 10 12 10(1) = or(1) = or(*,1), don’t mention second argument 12(1) = or(1) = or(1,*), 10(2,1) = 12(1,2) 0() = empty clause

UP / D

Question 3a CSP = <comments> List(Comment) Preamble <constraints> List(Constraint) EOF. Comment = "c" <comment> Line . Preamble = "p" <numVariables> int <numConstraints> int ["rank" <rank> Rank]. // default rank is 3 Constraint = Relation [Weight] ":" List(Variable) "0" . Relation = <relationNumber> int . Rank = <v> int. Weight = <v> int . If we omit “rank” we destroy the LL(1) property of the cd. Because what follows <rank> is also an int (a <relation>) The cd becomes ambiguous: p 6 9 3 3 : could mean: rank 3 relation3 but it could also mean: relation 3 weight 3.

Question 3c Introduce an auxiliary variable and express x = (a or b) x = (!a or b) x = (!a or !b) using relations of rank 3. Iterate until all clauses are of rank 3 or less as in hw 1. But what if we have constraints other relations than or and we express MAX-CSP. Is for MAX-CSP rank 3 sufficient?

Question 3c: DAJ public aspect hydrogen { public void Molecule.print() { Print v = new Print(); _s0(v); } void Molecule._s0(Print v) {s0();} void Molecule._s0() { java.util.BitSet[] tokens = { new java.util.BitSet() }; tokens[0].set(0); _s0(tokens); } void Molecule._s0(java.util.BitSet[] tokens) { { java.util.BitSet[] newTokens = { new java.util.BitSet () }; if (tokens[0].get(0)) { newTokens[0].set(0); if (!newTokens[0].isEmpty()) if (atoms != null) _s0_crossing_atoms(newTokens); void Molecule._s0_crossing_atoms(java.util.BitSet[] token s) { this.atoms._s0(tokens); } …

Molecule = "<molecule" MoleculeId ">" Atoms Bonds "</molecule>". Atoms = "<atomArray>" List(Atom) "</atomArray>". Atom = "<atom" AtomId ElementType HydrogenCount ">" "</atom>". MoleculeId = "id=" String. AtomId = "id=" String. ElementType = "elementType=" String. HydrogenCount = "hydrogenCount=" String. Bonds = "<bondArray>" List(Bond) "</bondArray>". Bond = "<bond" BondId AtomRefs2 "/>". BondId = "id=" String. AtomRefs2 = "atomRefs2=" <first> String <second> String. List(S) ~ {S}. aspect hydrogen { declare traversal: void print(): "from Molecule to HydrogenCount" (Print); }