+ All Categories

1-9-sum

Date post: 15-Apr-2016
Category:
Upload: raedadobeadobe
View: 3 times
Download: 0 times
Share this document with a friend
Description:
1-9-sum
36
Artificial Intelligence Chapters Reviews Readings: Chapters 3-8 of Russell & Norvig.
Transcript

Artificial Intelligence

Chapters Reviews

Readings: Chapters 3-8 of Russell &Norvig.

Topics covered in the midterm

Solving problems by searching (Chap. 3)How to formulate a search problem?How to measure a search strategy?What are popular uninformed search strategies?

Informed search and exploration (Chap. 4)What are the greedy best-first search and A*?How to design and use a heuristic function?What is local search? Hill-climbing? Simulatedannealing?What are Genetic Algorithms?

Topics covered in the midterm

Adversarial SearchWhat’s the minimax algorithm?What’s Alpha-Beta pruning?

Propositional Logic (Chap. 7.1-7.5)What are its syntax and semantics?Validity vs. satisfiability?How to obtain CNF?What’s the truth-table inference system?What’s the inference rule system?What’s resolution and its property?

Topics covered in the midterm

Propositional Satisfiability (SAT) (Chap. 7.6)How to formulate an instance of SAT?What’s a backtracking search?What’s DIMACS CNF format?How to use local search for SAT?

First-order Logic (Chap. 8)What are its syntax and semantics?What are quantifiers and their meaning?What’s a model of a FOL sentence?How to use FOL to describe assertions and queries?

Topics covered in the midterm

Inference in First Order Logic (Chap. 9)What is unification and how to do it?What’s resolution?How to use resolution to prove a theorem?What is Prolog?What is the syntax for a Prolog program?What kind of resolution strategies in Prolog?

A TechnicalityThe resolution rule alone is not complete.

For example, the set {

α︷ ︸︸ ︷

P (x) ∨ P (y),

β︷ ︸︸ ︷

¬P (x) ∨ ¬P (y)} isunsatisfiable.

But all we can do is start with

P (x) ∨ P (y) ¬P (x) ∨ ¬P (y)

P (y) ∨ ¬P (y)︸ ︷︷ ︸

γ

But then, resolving γ with α, or γ with β leads nowhere.(try it!)

FactorsLet ϕ be a CNF sentence of the form below whereα1 ∨ α2 are both positive (or negative) literals

α1 ∨ α2 ∨ β

If ϕ1, ϕ2 unify with mgu θ then

θ(α1 ∨ β)

is a factor of ϕ.

Example: P (x) is a factor of P (x) ∨ P (y) becauseP (x), P (y) unify with mgu = {y/x}

Too Many Choices!A resolution-based inference system has just one ruleto apply to build a proof.

However, at any step there may be several possibleways to apply the resolution rule.

P

Q

R R

~R

~Q~P \/ R

False ~P

~Q \/ R~P \/ Q

~P

Several resolution strategies have been developed inorder to reduce the search space.

Some Resolution StrategiesUnit resolution: Unit resolution only.

Input resolution: One of the two clauses must be an inputclause.

Set of support: One of the two clauses must be from adesigned set called set of support. New resolvent areadded into the set of support.

Linear resolution The latest resolvent must be used in thecurrent resolution.

Note: The first 3 strategies above are incomplete.The Unit resolution strategy is equivalent to the Inputresolution strategy: a proof in one strategy can beconverted into a proof in the other strategy.

Search Trees in PrologA search tree is representation of all possible computation paths. Allpossible proofs of a query are represented in one search tree.

Consider, for example, the following program.

member(X,[X|Ys]).

member(X,[Y|Ys]) :- member(X,Ys).

The following is a search tree for the goal member(a,[a,b,a]).

member(a,[a,b,a])

/ \

succ member(a,[b,a])

/ \

fail member(a, [a])

/ \

succ member(a, [])

/ \

fail fail

Traversing Search TreeProlog traverses a search tree in a depth-first manner.

We may not find a proof even if one exists, because depth-firstsearch is an incomplete search procedure.

The order of clauses and the order of literals in a clause decide thestructure of the search tree.

Different goal orders result in search trees with different structures.Consider the following example

q(a).

p(s(Y)) :- p(Y).

The results for query p(X), q(X) and query q(X), p(X) are quitedifferent.

Changes in rule order permutes the branches of the search tree.

When writing Prolog program, make sure a successful path in thesearch tree appears before any infinite search tree path.

Unification in PrologA query ?- test. will succeed for the followingprogram:

less(X,succ(X)).test :- less(Y,Y).

Why? This because Prolog uses an unsound unificationalgorithm: The occur check is omitted for the purpose ofefficiency.

occur check: If v =? t and v occurs in t, then failure.

Another Example: An infinite loop for the query test.

test :- leq(Y,Y).leq(X,s(X)) :- leq(X,X).

Resolution Strategies in PrologSet of support: The query (negative clauses) is the onlyclause in the set of support.

Input strategy: One of the two clauses must be an inputclause.

Linear strategy: Only one resolvent is saved at any time.

The literals in the resolvent is organized as a stack:First In, Last Out.

The clauses are treated in the order they are listed.

The literals in one clause are treated in the order fromleft to right.

Note: The first three strategies are equivalent for Hornclauses.

Exercise Problems

Chap. 3: 1, 3, 6, 7, 9, 11, 13, 17.

Chap. 4: 2, 3, 4, 9, 11, 12, 15.

Chap. 6: 2, 3, 15.

Chap. 7: 3, 4, 5, 6, 8, 12.

Chap. 8: 2, 3, 4, 6, 7, 8, 10, 11, 15

Exercise 3.1Define in your own words the following items: state, statespace, search tree, search node, action, successorfunction, and branching factor.

Exercise 3.1State: A condition of (a problem or an agent) being in astage or form

State space: A collection of all states

Action: An act which causes a state to change toanother state, called successor.

Successor function: returns all the successors of a state

Branching factor: The maximum number of successorsof any state

Search tree: A graphical representation of the order ofsuccessors explored from the initial state.

Search node: A node in the search tree which containsthe information of a state and its location in the tree.

Exercise 3.3Suppose that LEGAL-ACTION(s) denotes the set of actionsthat are legal in state s, and RESULT(a, s) denotes the statethat results from performing a legal action a in state s.Define SUCCESSOR-FN in terms of LEGAL-ACTIONS and RESULT,and vice versa.

Exercise 3.3Suppose that LEGAL-ACTION(s) denotes the set of actionsthat are legal in state s, and RESULT(a, s) denotes the statethat results from performing a legal action a in state s.Define SUCCESSOR-FN in terms of LEGAL-ACTIONS and RESULT,and vice versa.

SUCCESSOR-FN(s) = { RESULT(a, s) | a ∈ LEGAL-ACTIONS(s) }

LEGAL-ACTIONS(s) = {a | RESULT(a, s) ∈ SUCCESSOR-FN(s) }

Exercise 3.6Does a finite state space always lead to a finite searchtree? How about a finite state space that is a tree? Can yoube more precise about what types of state spaces alwayslead to finite search trees?

Exercise 3.6Does a finite state space always lead to a finite searchtree? No. Without checking duplicates in a path, a loopmay occur.

How about a finite state space that is a tree? Yes.

Can you be more precise about what types of statespaces always lead to finite search trees? Acyclicgraphs of successor relations will always lead to finitesearch trees. Finite state space with duplicate checkingin a path will always lead to finite search trees.

Exercise 3.7bA 3-foot-tall monkey is in a room where some bananas aresuspended from the 8-foot ceiling. Hw would like to get thebananas. The room contains two stackable, movable,climbing 3-foot-high crates.

initial state

goal test

successor function

cost function

Exercise 3.7binitial state: Initially, four objects, m (monkey), b (bananas), c1 (crate1),c2 (crate2), are at four different locations l1, l2, l3, and l4, respectively.We use (l1, l2, l3, l4) as the initial state.

goal test: To get bananas, crate2 must be at location l2; crate1 mustbe on top of crate2 (c2); monkey must be on top of crate1 (c1). Thatis, the goal state is (c1, l2, c2, l2). Switching crate1 and crate2, wehave another goal state: (c2, l2, l2, c1).

successor function: There are many.

1. s((l1, l2, l3, l4)) = {(l2, l2, l3, l4), (l3, l2, l3, l4), (l4, l2, l3, l4)}

2. s((l3, l2, l3, l4)) = {(l2, l2, l2, l4), ...}

3. s((l2, l2, l2, l4)) = {(l4, l2, l2, l4), ...}

4. s((l4, l2, l2, l4)) = {(l2, l2, l2, l2), ...}

5. s((l2, l2, l2, l2)) = {(l2, l2, c2, l2), ...}

6. ...

cost function: 1 for each action.

Exercise 3.9The missionaries and cannibals problem is usually stated asfollows. Three missionaries and three cannibals are on oneside of a river, along with a boat that can hold one or twopeople. Find a way to get everyone to the other side,without ever leaving a group of missionaries in oneplaceoutnumered by the cannibals in that place.

a. Formulate the problem precisely, making only thosedistinctions necessary to ensure a valid solution.

...

Exercise 3.9astates: {〈b,m, c〉 | b ∈ {0, 1}, 0 ≤ m ≤ 3, 0 ≤ c ≤3, (m = c ∨ m ∈ {0, 1})}

initial state: 〈1, 3, 3〉

goal test: 〈0, 0, 0〉

successor function: There are not many.

a solution: 〈1, 3, 3〉 → 〈0, 3, 1〉 → 〈1, 3, 2〉 → 〈0, 3, 0〉 →〈1, 3, 1〉 → 〈0, 1, 1〉 → 〈1, 2, 2〉 → 〈0, 0, 2〉 → 〈1, 0, 3〉 →〈0, 0, 1〉 → 〈1, 0, 2〉 → 〈0, 0, 0〉

Exercise 3.11iterative lengthening search

a Show that this algorithm is optimal for general pathcosts.

b How many iterations for solution depth d and unit stepcosts?

c If the minumum possible cost is ε, how many iterationsare required in the worst case?

d ...

Exercise 3.13Describe a state space in which iterative deepening searchperforms much worse than depth-first search (for example,O(n2) vs. O(n)).

Exercise 3.17Let us consider that actions can have negative costs.

a If the negative costs are arbitrarily large, explain whythis will force any optiomal algorithms to explore theentire state space.

b Does it help if we know the negative costs are notsmaller than a negative constant c?

c ...

d ...

e ...

Exercise 4.2The heuristic path algorithm is a best-first search in which theobjectiv e function is f(n) = (2 − w)g(n) + wh(n). for whatvalues of w is this algorithm guaranteed to be optimal?What kind of search does this perform when w = 0? Whenw = 1? When w = 2?

Exercise 4.3Prove each of the following statements:

a Breadth-first search is a special case of uniform-costsearch.

b Breadth-first search, depth-first search, anduniform-cost search are special cases of best-firstsearch.

c Uniform-cost search is a special case of A∗ search.

Exercise 4.4Devise a state space in which A∗ using GRAPTH-SEARCH

returns a suboptiomal solution with an h(n) function that isadmissible but inconsistent.

Exercise 4.9One of the relaxatio of the 8-puzzle in which a tile can movefrom square A to square B if B is blank. Explain why thisheuristic is at least as accurate as h1 (misplaced tiles), andshow cases where it is more accurate than both h1 and h2

(Manhattan distance).

Exercise 4.11Give the name of the algorithm that results from each of thefollowing special cases:

a Local beam search with k = 1.

b Local beam search with k = ∞.

c Simulated annealing with T = 0 (supposing notermination) at all times.

c Genetic algorithm with population size N = 1.

Exercise 4.12Sometimes there is no good evalution function for aproblem, but there is a good comparison method: a way totell whether one node is better than another, withoutassigning numerical values to either. Show that this isenough to do a best-first search. Is there an analog of A∗?

Exercise 4.15aDevise a hill-climbing approach to solve TSP.

Exercise 6.3Draw the complete game tree:

Write each state as (sA, sB) where sA and sB denote thetoken locations.

Put each terminal state in square boxes and write itsgame value in a circle.

Put loop states (states that already appear on the pathto the root) in double square boxes.

Exercise 6.15Describe how the minimax and alpha-beta algorithmschange for two-player, non-zero-sum games in which eachplayer has his or her own utility function. You may assumethat each player knows the other’s utility function. Is itpossible for any node to be pruned by alpha-beta?


Recommended