Professional Documents
Culture Documents
Both approaches
Cognitive Science and
Cognitive Neuroscience are now distinct from AI
Aristotle: what are correct arguments/thought
processes?
Several Greek schools developed various forms of
logic: notation and rules of derivation for thoughts
Direct line through mathematics and philosophy to
modern AI
Problems:
1. Not all intelligent behavior is mediated by logical
deliberation
2. What is the purpose of thinking? What thoughts
should I have?
Rational behavior: doing the right thing
An example
crossing a street but died of the fallen cargo
door from 33,000ft irrational?
Omniscience
Environment
Actuators
Sensors
Goal-based agents
Utility-based agents
Simple reflex agents
It uses just condition-action rules
The rules are like the form “if … then …”
efficient but have narrow range of applicability
start
69
Example: vacuum world
Single-state, start in #5.
Solution?
70
Example: vacuum world
Single-state, start in #5.
Solution? [Right, Suck]
Sensorless, start in
{1,2,3,4,5,6,7,8} e.g.,
Right goes to {2,4,6,8}
Solution?
71
Example: vacuum world
Sensorless, start in
{1,2,3,4,5,6,7,8} e.g.,
Right goes to {2,4,6,8}
Solution?
[Right,Suck,Left,Suck]
Contingency
Nondeterministic: Suck may
dirty a clean carpet
Partially observable: location, dirt at current location.
Percept: [L, Clean], i.e., start in #5 or #7
Solution?
72
Example: vacuum world
Sensorless, start in
{1,2,3,4,5,6,7,8} e.g.,
Right goes to {2,4,6,8}
Solution?
[Right,Suck,Left,Suck]
Contingency
Nondeterministic: Suck may
dirty a clean carpet
Partially observable: location, dirt at current location.
Percept: [L, Clean], i.e., start in #5 or #7
Solution? [Right, if dirt then Suck]
73
Example: The 8-puzzle
states?
actions?
goal test?
path cost?
14 Jan 2004 CS 3243 - Blind Search 74
Example: The 8-puzzle
95
Informed Search Strategies
A search strategy which searches the most
promising branches of the state-space first can:
find a solution more quickly,
Disadvantage
It can get stuck in loops.
It is not optimal.
Greedy Best-First Search
Where
g(n) = cost so far to reach n
h(n) = estimated cost to goal from n
Optimization techniques
Direct (closed-form)
Search (generate-test)
Heuristic search (e.g Hill Climbing)
Genetic Algorithm
107
Outline
Constraint Satisfaction Problems (CSP)
Backtracking search for CSPs
Local search for CSPs
108
Constraint satisfaction problems (CSPs)
109
Example: Map-Coloring
110
Example: Map-Coloring
111
Constraint graph
Binary CSP: each constraint relates two variables
Constraint graph: nodes are variables, arcs are
constraints
112
Varieties of CSPs
Discrete variables
finite domains:
n variables, domain size d O(dn) complete assignments
e.g., Boolean CSPs, incl.~Boolean satisfiability (NP-complete)
infinite domains:
integers, strings, etc.
e.g., job scheduling, variables are start/end days for each job
need a constraint language, e.g., StartJob1 + 5 ≤ StartJob3
Continuous variables
e.g., start/end times for Hubble Space Telescope observations
linear constraints solvable in polynomial time by linear
programming
113
Varieties of constraints
Unary constraints involve a single variable,
e.g., SA ≠ green
Binary constraints involve pairs of variables,
e.g., SA ≠ WA
114
Example: Cryptarithmetic
Variables: F T U W
R O X1 X2 X3
Domains: {0,1,2,3,4,5,6,7,8,9}
Constraints: Alldiff (F,T,U,W,R,O)
O + O = R + 10 · X1
X1 + W + W = U + 10 · X2
X2 + T + T = O + 10 · X3
X3 = F, T ≠ 0, F ≠ 0
115
Real-world CSPs
Assignment problems
e.g., who teaches what class
Timetabling problems
e.g., which class is offered when and where?
Transportation scheduling
Factory scheduling
Notice that many real-world problems involve real-
valued variables
116
Standard search formulation (incremental)
Let's start with the straightforward approach, then fix it
118
Backtracking example
119
Backtracking example
120
Backtracking example
121
Backtracking example
122
Improving backtracking efficiency
123
Most constrained variable
Most constrained variable:
choose the variable with the fewest legal
values
124
Most constraining variable
Tie-breaker among most constrained
variables
Most constraining variable:
choose the variable with the most
constraints on remaining variables
125
Least constraining value
Given a variable, choose the least
constraining value:
127
Forward checking
Idea:
Keep track of remaining legal values for unassigned
variables
Terminate search when any variable has no legal values
128
Forward checking
Idea:
Keep track of remaining legal values for unassigned
variables
Terminate search when any variable has no legal values
129
Forward checking
Idea:
Keep track of remaining legal values for unassigned
variables
Terminate search when any variable has no legal values
130
Constraint propagation
Forward checking propagates information from
assigned to unassigned variables, but doesn't
provide early detection for all failures:
132
Arc consistency
Simplest form of propagation makes each arc
consistent
X Y is consistent iff
133
Arc consistency
Simplest form of propagation makes each arc
consistent
X Y is consistent iff
134
Arc consistency
Simplest form of propagation makes each arc consistent
X Y is consistent iff
135
Local search for CSPs
Hill-climbing, simulated annealing typically work with
"complete" states, i.e., all variables assigned
To apply to CSPs:
allow states with unsatisfied constraints
operators reassign variable values
136
Example: 4-Queens
States: 4 queens in 4 columns (44 = 256 states)
Actions: move queen in column
Goal test: no attacks
Evaluation: h(n) = number of attacks
138