midterm review cmsc421 – fall 2006. ch1 summary: intro ai definitions: dimensions human/rational...

35
Midterm Review Midterm Review CMSC421 – Fall 2006

Post on 19-Dec-2015

220 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Midterm ReviewMidterm Review

CMSC421 – Fall 2006

Page 2: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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

Page 3: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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.

Page 4: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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

Page 5: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

CH4 Summary: Informed SearchCH4 Summary: Informed Search

HeuristicsBest-first Search Algorithms Greedy Search A*

Admissible heuristics

Constructing Heuristic functionsLocal Search Algorithms

Page 6: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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 valuesBacktracking=depth-first search with one variable assigned per nodeVariable ordering and value selection heuristics help significantlyForward 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.

Page 7: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

CH 6 Summary: Adversarial CH 6 Summary: Adversarial SearchSearch

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 treeMinimax procedureAlpha-beta procedure

Page 8: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

CH7 Summary: Logical Agents

Knowledge-based agentsPropositional and first-order logic Inference, validity, equivalence and

satisfiability Reasoning patterns

Resolution Forward/backward chaining

Page 9: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

CH 8, 9 Summary: FOL

Syntax - terms, WFF, quantifiersNew Inference rules for quantifiersUnification Horn clauses - FC, BCResolution RefutationConverting to clausal form

Page 10: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Constraint Satisfaction

Page 11: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Constraint Satisfaction Constraint Satisfaction ProblemProblem

Set of variables {X1, X2, …, Xn}Each variable Xi has a domain Di of possible valuesUsually Di is discrete and finiteSet of constraints {C1, C2, …, Cp}Each constraint Ck involves a subset of variables and specifies the allowable combinations of values of these variablesGoal: Assign a value to every variable such that all constraints are satisfied

Page 12: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

CSP as a Search ProblemCSP 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

Page 13: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

QuestionsQuestions

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. forward checking2. arc consistency

Page 14: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Adversarial Search

Page 15: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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

Page 16: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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 nodes3) Back up the results from the leaves to

the root and pick the best action assuming the worst from MIN

Minimax algorithm

Page 17: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Minimax Algorithm1. 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. A MAX node gets the maximum of the evaluation of its successors

b. 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

Page 18: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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

Page 19: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example

The beta value of a MINnode is an upper bound onthe final backed-up value.It can never increase

1

= 1

2

Page 20: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example

= 1

The alpha value of a MAXnode is a lower bound onthe final backed-up value.It can never decrease

1

= 1

2

Page 21: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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

Page 22: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Logical Representations and Theorem Proving

Page 23: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

A Small Knowledge BaseA Small Knowledge Base

1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank

Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Starter-OK 5. Empty-Gas-Tank 6. Car-OK

Page 24: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

ExampleExample1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlight-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire10. Engine-Starts Car-OK 9,311. Engine-Starts 10, 812. Battery-OK Starter-OK Empty-Gas-Tank 11,213. Starter-OK Empty-Gas-Tank 12,514. Empty-Gas-Tank 13, 615. {} 14,7

negated goal

Page 25: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Following Material is Extra

Extra bonus, Free!Not required for midterm

Page 26: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

but sometimes just doing random but sometimes just doing random resolutions doesn’t work so hot….resolutions doesn’t work so hot….

1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlights-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire10. Starter-OK Empty-Gas-Tank Engine-Starts11. Battery-OK Empty-Gas-Tank Engine-Starts12. Battery-OK Starter-OK Engine-Starts13. Engine-Starts Flat-Tire 14. Engine-Starts Car-OK

negated goal

2,52,6

2,73,8

3,9

Page 27: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Resolution StrategiesThere 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 ) with the sentence 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.

SQR R

Page 28: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example (Set-of-Support)Example (Set-of-Support)1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlight-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire

Page 29: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example (Set-of-Support)Example (Set-of-Support)1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlight-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire10. Engine-Starts Car-OK11. Engine-Starts12. Battery-OK Starter-OK Empty-Gas-Tank13. Starter-OK Empty-Gas-Tank14. Empty-Gas-Tank15. False

Note the goal-directedflavor

Page 30: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Resolution HeuristicsShortest-clause heuristic: Generate a clause with the fewest literals first

Page 31: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example (Shortest-Example (Shortest-Clause)Clause)1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlight-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire

Page 32: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example (Shortest-Example (Shortest-Clause)Clause)1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlight-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire10. Engine-Starts Car-OK11. Engine-Starts12. Bulbs-OK Headlights-Work13. Battery-OK Starter-OK Empty-Gas-Tank14. Starter-OK Empty-Gas-Tank15. Empty-Gas-Tank16. False

Page 33: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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)

Page 34: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

Example (Pure Literal)Example (Pure Literal)1. Battery-OK Bulbs-OK Headlights-Work2. Battery-OK Starter-OK Empty-Gas-Tank Engine-Starts3. Engine-Starts Flat-Tire Car-OK4. Headlights-Work5. Battery-OK6. Starter-OK 7. Empty-Gas-Tank 8. Car-OK 9. Flat-Tire

Page 35: Midterm Review CMSC421 – Fall 2006. CH1 Summary: Intro AI Definitions: dimensions human/rational think/act Three Major Components of AI Algorithms Representation

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.