Midterm Review CMSC421 – Fall 2006

Download Report

Transcript Midterm Review CMSC421 – Fall 2006

Midterm Review
CMSC421 – Fall 2006
CH1 Summary: Intro
AI Definitions: dimensions


human/rational
think/act
Three Major Components of AI Algorithms



Representation
Reasoning
Learning
What makes AI hard:


Problem Formulation
Computational Complexity
CH2 Summary: Intelligent Agents
An agent perceives and acts in an environment, has an architecture, and is
implemented by an agent program.
Task environment – PEAS (Performance, Environment, Actuators, Sensors)
The most challenging environments are inaccessible, nondeterministic, dynamic,
and continuous.
An ideal agent always chooses the action which maximizes its expected
performance, given its percept sequence so far.
An agent program maps from percept to action and updates internal state.

Reflex agents respond immediately to percepts.
 simple reflex agents
 model-based reflex agents


Goal-based agents act in order to achieve their goal(s).
Utility-based agents maximize their own utility function.
All agents can improve their performance through learning.
CH3 Summary: Problem Solving
Problem Formulation: state space, initial
state, successor function, goal test, path cost
Search tree  state space
Evaluation of strategies: completeness,
optimality, time and space complexity
Uninformed search strategies: breadth-first,
depth-first, and variants
Avoiding repeated states
CH4 Summary: Informed Search
Heuristics
Best-first Search Algorithms


Greedy Search
A*
 Admissible heuristics
Constructing Heuristic functions
Local Search Algorithms
CH5 Summary: Constraint Satisfaction
CSPs are a special kind of problem: states defined by values of a
fixed set of variables, goal test defined by constraints on
variable values
Backtracking=depth-first search with one variable assigned per
node
Variable ordering and value selection heuristics help significantly
Forward checking prevents assignments that lead to failure.
Constraint propagation does additional work to constrain values
and detect inconsistencies.
The CSP representation allows analysis of problem structure.
Tree structured CSPs can be solved in linear time.
Local Search, e.g., min-conflicts, is often effective in practice.
CH 6 Summary: Adversarial Search
Games illustrate several important points
about AI



Perfection is unattainable -> approximation
Good idea what to think about what to think
about
Heuristics can help
Problem Formulation: Game tree
Minimax procedure
Alpha-beta procedure
CH7 Summary: Logical Agents
Knowledge-based agents
Propositional and first-order logic


Inference, validity, equivalence and
satisfiability
Reasoning patterns
 Resolution
 Forward/backward chaining
CH 8, 9 Summary: FOL
Syntax - terms, WFF, quantifiers
New Inference rules for quantifiers
Unification
Horn clauses - FC, BC
Resolution Refutation
Converting to clausal form
Constraint Satisfaction
Constraint Satisfaction Problem
Set of variables {X1, X2, …, Xn}
Each variable Xi has a domain Di of possible
values
Usually Di is discrete and finite
Set of constraints {C1, C2, …, Cp}
Each constraint Ck involves a subset of
variables and specifies the allowable
combinations of values of these variables
Goal: Assign a value to every variable such
that all constraints are satisfied
CSP as a Search Problem
Initial state: empty assignment
Successor function: a value is assigned
to any unassigned variable, which does
not conflict with the currently assigned
variables
Goal test: the assignment is complete
Path cost: irrelevant
Questions
1. Which variable X should be assigned a value
next?
1.
Minimum Remaining Values/Most-constrained
variable
2. In which order should its domain D be
sorted?
1.
least constrained value
3. How should constraints be propagated?
1.
2.
forward checking
arc consistency
Adversarial Search
Specific Setting
Two-player, turn-taking, deterministic, fully
observable, zero-sum, time-constrained game
 State space
 Initial state
 Successor function: it tells which actions can be
executed in each state and gives the successor
state for each action
 MAX’s and MIN’s actions alternate, with MAX
playing first in the initial state
 Terminal test: it tells if a state is terminal and,
if yes, if it’s a win or a loss for MAX, or a draw
 All states are fully observable
Choosing an Action: Basic
Idea
1) Using the current state as the initial
state, build the game tree uniformly to
the maximal depth h (called horizon)
feasible within the time limit
2) Evaluate the states of the leaf nodes
3) Back up the results from the leaves to
the root and pick the best action
assuming the worst from MIN
 Minimax algorithm
Minimax Algorithm
1. Expand the game tree uniformly from the current
state (where it is MAX’s turn to play) to depth h
2. Compute the evaluation function at every leaf of
the tree
3. Back-up the values from the leaves to the root of
the tree as follows:
a.
b.
A MAX node gets the maximum of the evaluation of its
successors
A MIN node gets the minimum of the evaluation of its
successors
4. Select the move toward a MIN node that has the
largest backed-up value
Alpha-Beta Pruning
 Explore the game tree to depth h in
depth-first manner
 Back up alpha and beta values
whenever possible
 Prune branches that can’t lead to
changing the final decision
Example
The beta value of a MIN
node is an upper bound on
the final backed-up value.
It can never increase
b=1
2
1
Example
a=1
The alpha value of a MAX
node is a lower bound on
the final backed-up value.
It can never decrease
b=1
2
1
Alpha-Beta Algorithm
 Update the alpha/beta value of the parent
of a node N when the search below N has
been completed or discontinued
 Discontinue the search below a MAX node
N if its alpha value is  the beta value of a
MIN ancestor of N
 Discontinue the search below a MIN node
N if its beta value is  the alpha value of a
MAX ancestor of N
Logical Representations and
Theorem Proving
A Small Knowledge Base
1. Battery-OK  Bulbs-OK  Headlights-Work
2. Battery-OK  Starter-OK  Empty-Gas-Tank 
Engine-Starts
3.
4.
5.
6.
Engine-Starts  Flat-Tire  Car-OK
Starter-OK
Empty-Gas-Tank
Car-OK
Example
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlight-Work
Battery-OK
Starter-OK
Empty-Gas-Tank
Car-OK
negated goal
Flat-Tire
Engine-Starts  Car-OK
9,3
Engine-Starts
10, 8
Battery-OK  Starter-OK  Empty-Gas-Tank 11,2
Starter-OK  Empty-Gas-Tank 12,5
Empty-Gas-Tank 13, 6
{}
14,7
Following Material is Extra
Extra bonus, Free!
Not required for midterm
but sometimes just doing random
resolutions doesn’t work so hot….
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlights-Work
Battery-OK
Starter-OK
Empty-Gas-Tank
Car-OK
negated goal
Flat-Tire
Starter-OK  Empty-Gas-Tank  Engine-Starts
2,5
2,6
Battery-OK  Empty-Gas-Tank  Engine-Starts
Battery-OK  Starter-OK  Engine-Starts
2,7
Engine-Starts  Flat-Tire
3,8
Engine-Starts  Car-OK
3,9
Resolution Strategies
There are several methods for reducing the search space of a
resolution system.
Unit preference attempts first to do resolutions where one of
the sentences is a single literal. For example, resolving a single
sentence (such as R ) with the sentence R  Q  S provides a
sentence which is shorter.
The set of support method tries to identify a core set of
sentences (set of support) that are used in all the resolutions.
The tricky part is to select a small set of support.
Input resolution tries to use one of the input sentences with
some other sentence. Input resolution is not complete unless
the knowledge base is in Horn form. Linear resolution is a
generalization which allows us to have complete resolution
always.
The subsumption method eliminates all sentences which are
subsumed by an existing sentence in the knowledge database.
Example (Set-of-Support)
1.
2.
3.
4.
5.
6.
7.
8.
9.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlight-Work
Battery-OK
Starter-OK
Empty-Gas-Tank
Car-OK
Flat-Tire
Example (Set-of-Support)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlight-Work
Battery-OK
Starter-OK
Note the goal-directed
Empty-Gas-Tank
flavor
Car-OK
Flat-Tire
Engine-Starts  Car-OK
Engine-Starts
Battery-OK  Starter-OK  Empty-Gas-Tank
Starter-OK  Empty-Gas-Tank
Empty-Gas-Tank
False
Resolution Heuristics
Shortest-clause heuristic:
Generate a clause with the fewest
literals first
Example (Shortest-Clause)
1.
2.
3.
4.
5.
6.
7.
8.
9.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlight-Work
Battery-OK
Starter-OK
Empty-Gas-Tank
Car-OK
Flat-Tire
Example (Shortest-Clause)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlight-Work
Battery-OK
Starter-OK
Empty-Gas-Tank
Car-OK
Flat-Tire
Engine-Starts  Car-OK
Engine-Starts
Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank
Starter-OK  Empty-Gas-Tank
Empty-Gas-Tank
False
Resolution Heuristics
Simplifications heuristics:



Remove any clause containing two
complementary literals (tautology)
Remove any clause C that contains all the
literals of another clause C’
If a symbol always appears with the same
“sign”, remove all the clauses that contain
it (pure symbol)
Example (Pure Literal)
1.
2.
3.
4.
5.
6.
7.
8.
9.
Battery-OK  Bulbs-OK  Headlights-Work
Battery-OK  Starter-OK  Empty-Gas-Tank  Engine-Starts
Engine-Starts  Flat-Tire  Car-OK
Headlights-Work
Battery-OK
Starter-OK
Empty-Gas-Tank
Car-OK
Flat-Tire
Review: 2 Important Properties
#1: If KB |- Q then KB |= Q


If Q is derived from a set of sentences KB using a
given set of rules of inference, then Q is entailed
by KB.
Hence, inference produces only real entailments,
or any sentence that follows deductively from the
premises is valid.
#2: If KB |= Q then KB |- Q


If Q is entailed by a set of sentences KB, then Q
can be derived from KB using the rules of
inference.
Hence, inference produces all entailments, or all
valid sentences can be proved from the premises.