190 likes | 391 Views
CS182 Intelligent Machines: Reasoning, Actions and Plans. Section 4. Reminder -- CSP for course requirements (1). Alby -Bach University (ABU) wants to start a new degree program: B.S in Judgment Day Prevention (JDP). Suppose the degree program is associated with the following courses:
E N D
CS182 Intelligent Machines: Reasoning, Actions and Plans Section 4
Reminder -- CSP for course requirements (1) Alby-Bach University (ABU) wants to start a new degree program: B.S in Judgment Day Prevention (JDP). Suppose the degree program is associated with the following courses: • 15-211 Fundamental Data Structures and Algorithms • 15-212 Principles of Programming • 15-381 Artificial Intelligence: Representation and Problem-Solving • 15-681 Machine Learning • 80-310 Logic and Computation • 21-484 Graph Theory • 70-122 Accounting • 70-311 Organizational Behavior • 19-601 Information Warfare
CSP for course requirements (2) In order to graduate from the degree program, one must complete the following four requirements: • Algorithms Requirement: (15-211 AND 15-212) OR (15-211 AND 15-381) OR (15-681 AND 21-484) • Machine Learning Requirement: 15-381 OR 15-681 OR 80-310 • Communications Requirement: 21-484 OR 70-311 OR 70-122 • Information Warfare Requirement: 15-381 OR 19-601
CSP for course requirements (3) In addition, the department imposes the following restrictions: • Information Aggressiveness Restriction: So that they can’t make their programs TOO smart, students can take only one class from the set 15-381, 15-681, and 19-601. • Basic Arithmetic Restriction: Students can’t take both 15-211 and 70-122. • Organization Restriction: Students can’t take both 21-484 and 70-311. • Finally, courses cannot be used to count towards multiple graduation requirements - so if you use 15-381 to fulfill part of the Algorithms requirement it can’t count towards either the Machine Learning Requirement or the Information Warfare Requirement.
Model the problem as CSP (1) • What are the variables? • AR_1 • AR_2 • MLR • CR • IWR
Model the problem as CSP (2) • What are the domains? • AR_1: 15-211, 15-212, 15-381, 15-681, 21-484 • AR_2: 15-211, 15-212, 15-381, 15-681, 21-484 • MLR: 15-381, 15-681, 80-310 • CR: 21-484, 70-122, 70-311 • IWR: 15-381, 19-601
Model the problem as CSP (3) • What are the constraints? • IAR: 1 of 15-381, 15-681, and 19-601 can be assigned to the 5 variables. • BAR: 1 of 15-211 and 70-122 can be assigned to the 5 variables • OR: 1 of 21-484 and 70-311 can be assigned to the 5 variables • No double counting: if a variable is assigned to one variable it can’t be assigned to another variable • Hidden constraint between AR_1 and AR_2
Depth-First Search for CSP • AR_1: 15-211, 15-212, 15-381, 15-681, 21-484 • AR_2: 15-211, 15-212, 15-381, 15-681, 21-484 • MLR: 15-381, 15-681, 80-310 • CR: 21-484, 70-122, 70-311 • IWR: 15-381, 19-601 AR: (15-211 & 15-212) |(15-211 & 15-381) |(15-681 &21-484) MLR: : 15-381 OR 15-681 OR 80-310 CR: 21-484 OR 70-311 OR 70-122 IWR: 15-381 OR 19-601 Only one of 15-381, 15-681, and 19-601; Only one of 15-211 and 70-122; Only one of 21-484 and 70-311 No double credit AR_1 = 15-211 AR_2 = 15-212 MLR = 15-381 MLR = 15-681 MLR = 80-310 CR = 21-484 CR = 70-122 CR = 70-311 CR = 21-484 CR = 70-122 CR = 70-311 CR = 21-484 IWR= 15-381 IWR= 19-601 IWR= 15-381 IWR= 19-601 IWR= 15-381 IWR= 19-601 IWR= 15-381 IWR= 19-601 IWR= 15-381
Depth-First Search + Forward Checking AR: (15-211 & 15-212) |(15-211 & 15-381) |(15-681 &21-484) MLR: : 15-381 OR 15-681 OR 80-310 CR: 21-484 OR 70-311 OR 70-122 IWR: 15-381 OR 19-601 Only one of 15-381, 15-681, and 19-601; Only one of 15-211 and 70-122; Only one of 21-484 and 70-311 No double credit • AR_1: 15-211, 15-212, 15-381, 15-681, 21-484 • AR_2: 15-211, 15-212, 15-381, 15-681, 21-484 • MLR: 15-381, 15-681, 80-310 • CR: 21-484, 70-122, 70-311 • IWR: 15-381, 19-601 AR_1 = 15-211 Backtrack here! AR_2 = 15-212 MLR = 15-381 MLR = 15-681 …
Course Scheduling with Propositional Logic • A simplified version of course scheduling (in natural language): • Communications Requirement: 21-484 OR 70-311 OR 70-122 • Information Warfare Requirement: 15-381 OR 19-601 • Students can graduate as long as both requirements are satisfied
Representation in Propositional Logic • 21-484 70-31170-122 CR • 15-38119-601 IWR • CR IWRGraduate!
Theorem Proving • A student took 70-311 and 15-381 but not 19-601, prove that this student can graduate
A Resolution Algorithm • Prove KBis equivalent to prove KBis true, and thus equivalent to prove KBis unsatisfiable! • Resolution Algorithm: Prove by Contradiction - Get the set of clauses in the CNF representation of KB - Whenever possible, apply the resolution rule to pairs of clauses - If an empty clause is produced, KBis false and KB
Theorem Proving with Resolution • Knowledge Base: • 21-484 70-31170-122 CR • 15-38119-601 IWR • CR IWR Graduate! • 15-381 • 19-601
Step 1: Convert into CNF • 21-484 70-31170-122 CR ( 21-484CR) ( 70-311CR) ( 70-122 CR) • 15-38119-601IWR (15-381 IWR) (19-601IWR) • CR IWRGraduate CRIWR Graduate • , 15-381, 19-601 • Graduate
Step 2: Apply Resolution Rules • Clauses: • 21-484 CR • 70-311CR • 70-122CR • 15-381 IWR • 19-601IWR • CR IWR Graduate • 70-311 • 15-381 • 19-601 • Graduate CR Graduate IWR {}
WalkSAT(Clauses, max_flips, p) • Choose a random model m (randomassignment to each variable) • If m satisfies constraints • Return m • Else, while num_flips < max_flips • With probability p choose a variable to “flip” randomly • With probability 1-p choose flip the variable that minimizes number of unsatisfied constraints • Return null
“WalkSAT” for course scheduling • What does it mean to “flip”? • What are the input clauses? • Example: • Assume our random assignment is just the first value from the domain for each: AR_1: 15-211,AR_2: 15-211 , MLR: 15-381, CR: 21-484, IWR: 15-381 • If we draw random<p, we choose randomly on of these to flip (for example, flip 15-211 to 15-212 • If we draw random>p we need to find the change that will minimize the number of unsatisfied constraints (try at home)