Download presentation
Presentation is loading. Please wait.
Published byAvis Bruce Modified over 9 years ago
1
Variables “To be is to be the value of a variable.” - William Quine
2
Announcements Pset 1 and prog 1 were due yesterday Pset 2 and prog 2 are going out today Tiny (intro) email backlog Probability Review is… TBA still Mistake on Alpha / Beta agent algorithm
3
def miniMax(self, node, depth, alpha, beta, isMax): if node.isTerminal(): if isMax return node.utility() return –node.utility() if depth == 0: return self.getHeuristic(node) if isMax: for action in node.getLegalActions(): child = node.getSuccessorState(action) value = miniMax(child, depth -1, alpha, beta, not isMax) alpha = max(alpha, value) if beta <= alpha: break return alpha else: for action in node.getLegalActions(): child = node.getSuccessorState(action) value = self.miniMax(child, depth -1, alpha, beta, not isMax) beta = min(value, beta) if beta <= alpha: break return beta Alpha Beta Pruning return node.utility()
4
Programming Assignment Time
5
Consider asking for help. Email your TA (or rock on)
6
Problem Set Question Time
7
Total: 28 Hours / Student Ideal: 26 Hours / Student Units: 4.2 unit class
8
Homework Preference
9
Driverless Car Important Algo. Easy to Visualize Less Time Driverless Car
10
Search Variable Based Machine Learning CS221
11
Search Variable Based Machine Learning CS221
18
Image Segmentation
19
Chris Claire Home
20
Image Segmentation
22
Motivating Example
24
CSPs Commutatively: the order of application of actions has no effect on outcome
25
CSPs
26
Interesting in their own right Introduction to variable based models Inference is very similar to … [super secret stuff]
27
Formalization Inference Search Improved Search Arc Consistency Graph Structure Genetic Algorithms Weighted CSPs Image Segmentation CSPs
28
Real World Problem Formal Problem Solution Model the problem Apply an Algorithm Evaluate The AI Pipeline
29
Formally
30
Factor Graphs
31
Types of Domains
32
Constraints
33
Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red), (green,blue),(blue,red),(blue,green)} Example: Map Coloring
34
4 Feb 2004CS 3243 - Constraint Satisfaction34 Variables: F T U W R O X 1 X 2 X 3 Domains: {0,1,2,3,4,5,6,7,8,9} Constraints: – Alldiff (F,T,U,W,R,O) – O + O = R + 10 · X 1 – X 1 + W + W = U + 10 · X 2 – X 2 + T + T = O + 10 · X 3 – X 3 = F, T ≠ 0, F ≠ 0 Example: Crypto
35
Example: Student Seats Go!
36
Real World Problem Formal Problem Solution Model the problem Apply an Algorithm Evaluate The AI Pipeline
37
Inference 1. Search 2. Constraint Propagation
38
Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red), (green,blue),(blue,red),(blue,green)} Example 2: Map Coloring
39
Solutions are complete and consistent assignments, e.g., WA = red, NT = green,Q = red,NSW = green,V = red,SA = blue,T = green Example 2: Map Coloring
40
Binary CSP: each constraint relates two variables Constraint graph: nodes are variables, arcs are constraints Example 2: Map Coloring
41
Inference 1. Search 2. Constraint Propagation
42
4 Feb 2004CS 3243 - Constraint Satisfaction42 Search
46
General-purpose methods can give huge gains in speed: Which variable should be assigned next? In what order should its values be tried? Can we detect inevitable failure early? Improved Search
47
Choose the variable with the fewest legal values a.k.a. minimum remaining values (MRV) heuristic Most Constrained Variable
48
Tie-breaker among most constrained variables Choose the variable with the most constraints on remaining variables Most Constraining Variable
49
Given a variable, choose the assignment that rules out the fewest values in the remaining variables Least Constraining Assignment Fun fact: Combining these heuristics makes 1000 queens feasible
50
Inference 1. Search 2. Constraint Propagation
51
4 Feb 2004CS 3243 - Constraint Satisfaction51 Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values Forward Checking
52
4 Feb 2004CS 3243 - Constraint Satisfaction52 Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values Forward Checking
53
4 Feb 2004CS 3243 - Constraint Satisfaction53 Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values Forward Checking
54
4 Feb 2004CS 3243 - Constraint Satisfaction54 Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values Forward Checking Other ways to catch other failures
55
4 Feb 2004CS 3243 - Constraint Satisfaction55 At each iteration, make each arc consistent Arc Consistency
56
4 Feb 2004CS 3243 - Constraint Satisfaction56 At each iteration, make each arc consistent Arc Consistency
57
4 Feb 2004CS 3243 - Constraint Satisfaction57 At each iteration, make each arc consistent Arc Consistency
58
4 Feb 2004CS 3243 - Constraint Satisfaction58 At each iteration, make each arc consistent Arc Consistency
59
Graph Structure
60
Theorem: If a constraint graph has no loops then the CSP can be solved in O(nd 2 ) time linear in the number of variables! Compare difference with general CSP, where worst case is O(d n ) Trees are Easy
61
Non Trees
62
Tree Decomposition
63
Motivating Example Sudoku becomes easy (under 0.1s)
64
Flavors
65
Weighted CSP A B weight
66
Demo Example
68
Image Segmentation?
70
Genetic Algorithms Variables D = (D 1, D 2 … D n ) each with domain = {A, T, G, C} Try searching by creating populations, mating them with one another and mutating every once in a while. Just for fun!
71
Genetic Algorithms Just for fun!
72
Genetic Algorithms Just for fun!
73
Theme?
77
Mehran Sahami Probability
78
Motivating Example
80
And The Revolution Starts…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.