Download presentation
Presentation is loading. Please wait.
1
Midterm CSG270 Spring 2007 Karl Lieberherr
2
Question 1: SAT Rank 2 instance
14 : : : 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
3
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.
4
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 : : : 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
5
Rank 2 relations ba 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
7
UP / D
8
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 : could mean: rank 3 relation3 but it could also mean: relation 3 weight 3.
9
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?
10
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); } …
11
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); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.