ROEVER ENGINEERING COLLEGE Elambalur,Perambalur DEPARTMENT OF CSE AI UNIT-I

Size: px
Start display at page:

Download "ROEVER ENGINEERING COLLEGE Elambalur,Perambalur DEPARTMENT OF CSE AI UNIT-I"

Transcription

1 ROEVER ENGINEERING COLLEGE Elambalur,Perambalur DEPARTMENT OF CSE AI UNIT-I 1. DEFINE AGENT AND ITS TYPE. An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators Human agent: eyes, ears, and other organs for sensors; hands, legs, mouth, and other body parts for actuators Robotic agent: cameras and infrared range finders for sensors; various motors for actuators 2. EPLAIN Agents and environments The agent function maps from percept histories to actions: [f: P* A] The agent program runs on the physical architecture to produce f agent = architecture + program Vacuum-cleaner world

2 Percepts: location and contents, e.g., [A,Dirty] Actions: Left, Right, Suck, NoOp 3. Define Rational agents and PEAS standards An agent should strive to "do the right thing", based on what it can perceive and the actions it can perform. The right action is the one that will cause the agent to be most successful Performance measure: An objective criterion for success of an agent's behavior E.g., performance measure of a vacuum-cleaner agent could be amount of dirt cleaned up, amount of time taken, amount of electricity consumed, amount of noise generated, etc. An agent should strive to "do the right thing", based on what it can perceive and the actions it can perform. The right action is the one that will cause the agent to be most successful Performance measure: An objective criterion for success of an agent's behavior E.g., performance measure of a vacuum-cleaner agent could be amount of dirt cleaned up, amount of time taken, amount of electricity consumed, amount of noise generated, etc. PEAS: Performance measure, Environment, Actuators, Sensors Must first specify the setting for intelligent agent design

3 Consider, e.g., the task of designing an automated taxi driver: Performance measure Environment Actuators Sensors Must first specify the setting for intelligent agent design Consider, e.g., the task of designing an automated taxi driver: Performance measure: Safe, fast, legal, comfortable trip, maximize profits Environment: Roads, other traffic, pedestrians, customers Actuators: Steering wheel, accelerator, brake, signal, horn Sensors: Cameras, sonar, speedometer, GPS, odometer, engine sensors, keyboard Agent: Medical diagnosis system Performance measure: Healthy patient, minimize costs, lawsuits Environment: Patient, hospital, staff Actuators: Screen display (questions, tests, diagnoses, treatments, referrals) Sensors: Keyboard (entry of symptoms, findings, patient's answers) Agent: Part-picking robot Performance measure: Percentage of parts in correct bins Environment: Conveyor belt with parts, bins Actuators: Jointed arm and hand Sensors: Camera, joint angle sensors Agent: Interactive English tutor Performance measure: Maximize student's score on test Environment: Set of students Actuators: Screen display (exercises, suggestions, corrections) Sensors: Keyboard

4 4. Give the task Environment types Fully observable (vs. partially observable): An agent's sensors give it access to the complete state of the environment at each point in time. Deterministic (vs. stochastic): The next state of the environment is completely determined by the current state and the action executed by the agent. (If the environment is deterministic except for the actions of other agents, then the environment is strategic) Episodic (vs. sequential): The agent's experience is divided into atomic "episodes" (each episode consists of the agent perceiving and then performing a single action), and the choice of action in each episode depends only on the episode itself. Static (vs. dynamic): The environment is unchanged while an agent is deliberating. (The environment is semidynamic if the environment itself does not change with the passage of time but the agent's performance score does) Discrete (vs. continuous): A limited number of distinct, clearly defined percepts and actions. Single agent (vs. multiagent): An agent operating by itself in an environment. The environment type largely determines the agent design The real world is (of course) partially observable, stochastic, sequential, dynamic, continuous, multi-agent

5 5. Agent functions and programs An agent is completely specified by the agent function mapping percept sequences to actions One agent function (or a small equivalence class) is rational Aim: find a way to implement the rational agent function concisely Table-lookup agent \input{algorithms/table-agent-algorithm} Drawbacks: Huge table Take a long time to build the table No autonomy Even with learning, need a long time to learn the table entries Agent types Four basic types in order of increasing generality: Simple reflex agents Model-based reflex agents Goal-based agents Utility-based agents Simple reflex agents

6 Model-based reflex agents Goal-based agents Utility-based agents

7 Learning agents

8 Example: Romania On holiday in Romania; currently in Arad. Flight leaves tomorrow from Bucharest Formulate goal: be in Bucharest Formulate problem: states: various cities actions: drive between cities Find solution: sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

9 Deterministic, fully observable single-state problem Agent knows exactly which state it will be in; solution is a sequence Non-observable sensorless problem (conformant problem) Agent may have no idea where it is; solution is a sequence Nondeterministic and/or partially observable contingency problem percepts provide new information about current state often interleave} search, execution Unknown state space exploration problem Example: The 8-puzzle

10 states? locations of tiles actions? move blank left, right, up, down goal test? = goal state (given) path cost? 1 per move [Note: optimal solution of n-puzzle family is NP-hard] Example: robotic assembly states?: real-valued coordinates of robot joint angles parts of the object to be assembled actions?: continuous motions of robot joints goal test?: complete assembly path cost?: time to execute

11 6. Elobarate Tree search algorithms Basic idea: offline, simulated exploration of state space by generating successors of already-explored states (a.k.a.~expanding states) Implementation: general tree search

12 Implementation: states vs. nodes A state is a (representation of) a physical configuration A node is a data structure constituting part of a search tree includes state, parent node, action, path cost g(x), depth The Expand function creates new nodes, filling in the various fields and using the SuccessorFn of the problem to create the corresponding states.

13 Search strategies A search strategy is defined by picking the order of node expansion Strategies are evaluated along the following dimensions: completeness: does it always find a solution if one exists? time complexity: number of nodes generated space complexity: maximum number of nodes in memory optimality: does it always find a least-cost solution? Time and space complexity are measured in terms of b: maximum branching factor of the search tree d: depth of the least-cost solution m: maximum depth of the state space (may be ) 7. Explain Uninformed search strategies Uninformed search strategies use only the information available in the problem definition Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search Breadth-first search Expand shallowest unexpanded node Implementation: fringe is a FIFO queue, i.e., new successors go at end

14 Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b2+b3+ +bd + b(bd-1) = O(bd+1) Space? O(bd+1) (keeps every node in memory) Optimal? Yes (if cost = 1 per step) Space is the bigger problem (more than time) Uniform-cost search Expand least-cost unexpanded node Implementation: fringe = queue ordered by path cost Equivalent to breadth-first if step costs all equal Complete? Yes, if step cost ε Time? # of nodes with g cost of optimal solution, O(bceiling(C*/ ε)) where C* is the cost of the optimal solution Space? # of nodes with g cost of optimal solution, O(bceiling(C*/ ε)) Optimal? Yes nodes expanded in increasing order of g(n) Depth-first search Expand deepest unexpanded node

15 Implementation: fringe = LIFO queue, i.e., put successors at front Properties of depth-first search Complete? No: fails in infinite-depth spaces, spaces with loops Modify to avoid repeated states along path complete in finite spaces Time? O(bm): terrible if m is much larger than d but if solutions are dense, may be much faster than breadth-first Space? O(bm), i.e., linear space! Optimal? No Depth-limited search = depth-first search with depth limit l, i.e., nodes at depth l have no successors

16 Recursive implementation: Iterative deepening search

17 Number of nodes generated in a depth-limited search to depth d with branching factor b: NDLS = b0 + b1 + b2 + + bd-2 + bd-1 + bd Number of nodes generated in an iterative deepening search to depth d with branching factor b: NIDS = (d+1)b0 + d b^1 + (d-1)b^ bd-2 +2bd-1 + 1bd For b = 10, d = 5, NDLS = , , ,000 = 111,111 NIDS = , , ,000 = 123,456 Overhead = (123, ,111)/111,111 = 11% Properties of iterative deepening search Complete? Yes Time? (d+1)b0 + d b1 + (d-1)b2 + + bd = O(bd)

18 Space? O(bd) Optimal? Yes, if step cost = 1 8.How to avoid Repeated states? Failure to detect repeated states can turn a linear problem into an exponential one! Graph search

19 UNIT-II 1.Explain all the informed search strategies. Best-first search Idea: use an evaluation function f(n) for each node estimate of "desirability" Expand most desirable unexpanded node Implementation: Order the nodes in fringe in decreasing order of desirability Special cases: greedy best-first search A* search Romania with step costs in km

20 Greedy best-first search Evaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goal e.g., hsld(n) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal Greedy best-first search example Properties of greedy best-first search Complete? No can get stuck in loops, e.g., Iasi Neamt Iasi Neamt Time? O(bm), but a good heuristic can give dramatic improvement Space? O(bm) -- keeps all nodes in memory Optimal? No Give detail note on A* search Idea: avoid expanding paths that are already expensive Evaluation function f(n) = g(n) + h(n) g(n) = cost so far to reach n

21 h(n) = estimated cost from n to goal f(n) = estimated total cost of path through n to goal A * search example

22 Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) h * (n), where h * (n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic Example: h SLD (n) (never overestimates the actual road distance Theorem: If h(n) is admissible, A * using Optimality of A* (proof) Suppose some suboptimal goal G2 has been generated and is in the fringe. Let n be an unexpanded node in the fringe such that n is on a shortest path to an optimal goal G. f(g2) = g(g2) since h(g2) = 0 g(g2) > g(g) since G2 is suboptimal f(g) = g(g) since h(g) = 0 f(g2) > f(g) from above Consistent heuristics

23 A heuristic is consistent if for every node n, every successor n' of n generated by any action a, h(n) c(n,a,n') + h(n') If h is consistent, we have f(n') = g(n') + h(n') = g(n) + c(n,a,n') + h(n') g(n) + h(n) = f(n) i.e., f(n) is non-decreasing along any path. Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal Optimality of A* A* expands nodes in order of increasing f value Gradually adds "f-contours" of nodes Contour i has all nodes with f=fi, where fi < fi+1

24 Properties of A$^*$ Complete? Yes (unless there are infinitely many nodes with f f(g) ) Time? Exponential Space? Keeps all nodes in memory Optimal? Yes Admissible heuristics E.g., for the 8-puzzle: h1(n) = number of misplaced tiles h2(n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) h1(s) =? h2(s) =? Dominance If h2(n) h1(n) for all n (both admissible) then h2 dominates h1 h2 is better for search Typical search costs (average number of nodes expanded): d=12 IDS = 3,644,035 nodes A*(h1) = 227 nodes A*(h2) = 73 nodes

25 d=24 IDS = too many nodes A*(h1) = 39,135 nodes A*(h2) = 1,641 nodes Relaxed problems A problem with fewer restrictions on the actions is called a relaxed problem The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution 2. Explain Local search algorithms with examples In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution State space = set of "complete" configurations Find configuration satisfying constraints, e.g., n-queens In such cases, we can use local search algorithms keep a single "current" state, try to improve it Example: n-queens Put n queens on an n n board with no two queens on the same row, column, or diagonal

26 Hill-climbing search "Like climbing Everest in thick fog with amnesia" Hill-climbing search: 8-queens problem

27 Hill-climbing search: 8-queens problem Simulated annealing search Idea: escape local maxima by allowing some "bad" moves but gradually decrease their frequency

28 Properties of simulated annealing search One can prove: If T decreases slowly enough, then simulated annealing search will find a global optimum with probability approaching 1 Widely used in VLSI layout, airline scheduling, etc Local beam search Keep track of k states rather than just one Start with k randomly generated states At each iteration, all the successors of all k states are generated If any one is a goal state, stop; else select the k best successors from the complete list and repeat. Genetic algorithms

29 A successor state is generated by combining two parent states Start with k randomly generated states (population) A state is represented as a string over a finite alphabet (often a string of 0s and 1s) Evaluation function (fitness function). Higher values for better states. Produce the next generation of states by selection, crossover, and mutation Genetic algorithms Fitness function: number of non-attacking pairs of queens (min = 0, max = 8 7/2 = 28) 24/( ) = 31%

30 3.Explain the Constraint satisfaction problems (CSPs) Standard search problem: state is a "black box any data structure that supports successor function, heuristic function, and goal test CSP: state is defined by variables Xi with values from domain Di goal test is a set of constraints specifying allowable combinations of values for subsets of variables Simple example of a formal representation language Allows useful general-purpose algorithms with more power than standard search algorithms Example: Map-Coloring

31 Variables WA, NT, Q, NSW, V, SA, T Domains Di = {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)} Constraint graph

32 Binary CSP: each constraint relates two variables Constraint graph: nodes are variables, arcs are constraints Varieties of CSPs Discrete variables finite domains: n variables, domain size d O(dn) complete assignments e.g., Boolean CSPs, incl.~boolean satisfiability (NPcomplete) 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 Unary constraints involve a single variable, e.g., SA green

33 Binary constraints involve pairs of variables, e.g., SA WA Higher-order constraints involve 3 or more variables, e.g., cryptarithmetic column constraints 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 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 Standard search formulation (incremental) Let's start with the straightforward approach, then fix it

34 States are defined by the values assigned so far Initial state: the empty assignment { } Successor function: assign a value to an unassigned variable that does not conflict with current assignment fail if no legal assignments Goal test: the current assignment is complete 1. This is the same for all CSPs 2. Every solution appears at depth n with n variables use depth-first search 3. Path is irrelevant, so can also use complete-state formulation 4. b = (n - l )d at depth l, hence n! dn leaves Backtracking search Variable assignments are commutative}, i.e., [ WA = red then NT = green ] same as [ NT = green then WA = red ] Only need to consider assignments to a single variable at each node b = d and there are $d^n$ leaves Depth-first search for CSPs with single-variable assignments is called backtracking search Backtracking search is the basic uninformed algorithm for CSPs Can solve n-queens for n 25

35 Backtracking example Improving backtracking efficiency 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?

36 Most constrained variable Most constrained variable: choose the variable with the fewest legal values a.k.a. minimum remaining values (MRV) heuristic Tie-breaker among most constrained variables Most constraining variable: choose the variable with the most constraints on remaining variables Least constraining value Given a variable, choose the least constraining value: the one that rules out the fewest values in the remaining variables Combining these heuristics makes 1000 queens feasible Forward checking

37 Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values Constraint propagation Forward checking propagates information from assigned to unassigned variables, but doesn't provide early detection for all failures:

38 NT and SA cannot both be blue! Constraint propagation repeatedly enforces constraints locally Arc consistency\ Simplest form of propagation makes each arc consistent X Y is consistent iff for every value x of X there is some allowed y Simplest form of propagation makes each arc consistent X Y is consistent iff for every value x of X there is some allowed y Arc consistency algorithm AC-3

39 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 Variable selection: randomly select any conflicted variable Value selection by min-conflicts heuristic: choose value that violates the fewest constraints i.e., hill-climb with h(n) = total number of violated constraints 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

40 Given random initial state, can solve n-queens in almost constant time for arbitrary n with high probability (e.g., n = 10,000,000) 4. Explain min-max algorithms with example "Unpredictable" opponent specifying a move for every possible opponent reply Time limits unlikely to find goal, must approximate Game tree (2-player, deterministic, turns)

41 \ Minimax Perfect play for deterministic games Idea: choose move to position with highest minimax value = best achievable payoff against best play E.g., 2-ply game:

42 Minimax algorithm Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(bm) Space complexity? O(bm) (depth-first exploration) For chess, b 35, m 100 for "reasonable" games exact solution completely infeasible α-β pruning example

43 Pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(bm/2) doubles depth of search A simple example of the value of reasoning about which computations are relevant (a form of metareasoning) Why is it called α-β? α is the value of the best (i.e., highest-value) choice found so far at any choice point along the path for max If v is worse than α, max will avoid it prune that branch

44 Define β similarly for min The α-β algorithm

45 Resource limits Suppose we have 100 secs, explore 104 nodes/sec 106 nodes per move Standard approach: cutoff test: e.g., depth limit (perhaps add quiescence search) evaluation function = estimated desirability of position Evaluation functions For chess, typically linear weighted sum of features Eval(s) = w1 f1(s) + w2 f2(s) + + wn fn(s) e.g., w1 = 9 with white queens) (number of black queens), etc. f1(s) = (number of Cutting off search

46 MinimaxCutoff is identical to MinimaxValue except 1. Terminal? is replaced by Cutoff? 2. Utility is replaced by Eval Does it work in practice? m=4 bm = 106, b=35 4-ply lookahead is a hopeless chess player! 4-ply human novice 8-ply typical PC, human master 12-ply Deep Blue, Kasparov Deterministic games in practice Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions.» Chess: Deep Blue defeated human world champion Garry Kasparov in a six-game match in Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply. Othello: human champions refuse to compete against computers, who are too good. Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves.

47 UNIT-III 1. What are all the logics involved in AI? Propositional logic is declarative Propositional logic allows partial/disjunctive/negated information (unlike most data structures and databases) Propositional logic is compositional: meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2 Meaning in propositional logic is context-independent (unlike natural language, where meaning depends on context) Propositional logic has very limited expressive power (unlike natural language) E.g., cannot say "pits cause breezes in adjacent squares except by writing one sentence for each square Explain the uses First-order logic Whereas propositional logic assumes the world contains facts, first-order logic (like natural language) assumes the world contains Objects: people, houses, numbers, colors, baseball games, wars, Relations: red, round, prime, brother of, bigger than, part of, comes between, Functions: father of, best friend, one more than, plus, Syntax of FOL: Basic elements Constants KingJohn, 2, NUS,... Predicates Brother, >,... Functions Sqrt, LeftLegOf,... Variables x, y, a, b,... Connectives,,,, Equality = Quantifiers, Atomic sentences

48 Atomic sentence = (term1,...,termn) predicate or term1 = term2 Term = function (term1,...,termn) or constant or variable E.g., Brother(KingJohn,RichardTheLionheart) > (Length(LeftLegOf(Richard)), Length(LeftLegOf(KingJohn))) Complex sentences Complex sentences are made from atomic sentences using connectives S, S1 S2, S1 S2, S1 S2, S1 S2, E.g. Sibling(KingJohn,Richard) Sibling(Richard,KingJohn) >(1,2) (1,2) >(1,2) >(1,2) Truth in first-order logic Sentences are true with respect to a model and an interpretation Model contains objects (domain elements) and relations among them Interpretation specifies referents for constant symbols predicate symbols function symbols relations objects relations functional An atomic sentence predicate(term1,...,termn) is true

49 referred to by term1,...,termn referred to by predicate iff the objects are in the relation Models for FOL: Example Universal quantification <variables> <sentence> Everyone at NUS is smart: x At(x,NUS) Smart(x) x P is true in a model m iff P is true with x being each possible object in the model

50 Roughly speaking, equivalent to the conjunction of instantiations of P ) Smart(KingJohn) Smart(Richard) Smart(NUS) At(KingJohn,NUS At(Richard,NUS) At(NUS,NUS)... A common mistake to avoid Typically, is the main connective with Common mistake: using as the main connective with : x At(x,NUS) Smart(x) means Everyone is at NUS and everyone is smart Existential quantification <variables> <sentence> Someone at NUS is smart: x At(x,NUS) Smart(x)$ x P is true in a model m iff P is true with x being some possible object in the model Roughly speaking, equivalent to the disjunction of instantiations of P ) Smart(KingJohn) Smart(Richard) Smart(NUS) At(KingJohn,NUS At(Richard,NUS) At(NUS,NUS)... Another common mistake to avoid

51 Typically, is the main connective with Common mistake: using as the main connective with : x At(x,NUS) Smart(x) anyone who is not at NUS! is true if there is Properties of quantifiers x y is the same as y x x y is the same as y x x y is not the same as y x x y Loves(x,y) There is a person who loves everyone in the world y x Loves(x,y) Everyone in the world is loved by at least one person Quantifier duality: each can be expressed using the other x Likes(x,IceCream) x Likes(x,IceCream) x Likes(x,Broccoli) x Likes(x,Broccoli) Equality term1 = term2 is true under a given interpretation if and only if term1 and term2 refer to the same object E.g., definition of Sibling in terms of Parent: x,y Sibling(x,y) [ (x = y) m,f (m = f) Parent(m,x) Parent(f,x) Parent(m,y) Parent(f,y)]

52 Using FOL The kinship domain: Brothers are siblings x,y Brother(x,y) Sibling(x,y) One's mother is one's female parent m,c Mother(c) = m (Female(m) Parent(m,c)) Sibling is symmetric x,y Sibling(x,y) Sibling(y,x) The set domain: s Set(s) (s = {} ) ( x,s2 Set(s2) s = {x s2}) x,s {x s} = {} x,s x s s = {x s} x,s x s [ y,s2} (s = {y s2} (x = y x s2))] s1,s2 s1 s2 ( x x s1 x s2) s1,s2 (s1 = s2) (s1 s2 s2 s1) x,s1,s2 x (s1 s2) (x s1 x s2) x,s1,s2 x (s1 s2) (x s1 x s2) Interacting with FOL KBs Suppose a wumpus-world agent is using an FOL KB and perceives a smell and a breeze (but no glitter) at t=5: Tell(KB,Percept([Smell,Breeze,None],5)) Ask(KB, a BestAction(a,5)) I.e., does the KB entail some best action at t=5? Answer: Yes, {a/shoot} substitution (binding list) Given a sentence S and a substitution σ, Sσ denotes the result of plugging σ into S; e.g., S = Smarter(x,y) σ = {x/hillary,y/bill} Sσ = Smarter(Hillary,Bill)

53 Ask(KB,S) returns some/all σ such that KB σ Knowledge base for the wumpus world Perception t,s,b Percept([s,b,Glitter],t) Glitter(t) Reflex t Glitter(t) BestAction(Grab,t) Deducing hidden properties x,y,a,b Adjacent([x,y],[a,b]) [x-1,y],[x,y+1],[x,y-1]} [a,b] {[x+1,y], Properties of squares: s,t At(Agent,s,t) Breeze(t) Breezy(s) Squares are breezy near a pit: Diagnostic rule---infer cause from effect s Breezy(s) \Exi{r} Adjacent(r,s) Pit(r)$ Causal rule---infer effect from cause r Pit(r) [ s Adjacent(r,s) Breezy(s)$ ] 2. Explain the concept of Knowledge engineering in FOL 1. Identify the task 2. Assemble the relevant knowledge 3. Decide on a vocabulary of predicates, functions, and constants 4. Encode general knowledge about the domain 5. Encode a description of the specific problem instance 6. Pose queries to the inference procedure and get answers 7. Debug the knowledge base The electronic circuits domain

54 1. Identify the task Does the circuit actually add properly? (circuit verification) 2. Assemble the relevant knowledge Composed of wires and gates; Types of gates (AND, OR, XOR, NOT) Irrelevant: size, shape, color, cost of gates 3. Decide on a vocabulary Alternatives: Type(X1) = XOR Type(X1, XOR) XOR(X1) 4. Encode general knowledge of the domain t1,t2 Connected(t1, t2) Signal(t1) = Signal(t2) t Signal(t) = 1 Signal(t) = t1,t2 Connected(t1, t2) Connected(t2, t1) g Type(g) = OR Signal(Out(1,g)) = 1 n Signal(In(n,g)) = 1 g Type(g) = AND Signal(Out(1,g)) = 0 n Signal(In(n,g)) = 0 g Type(g) = XOR Signal(Out(1,g)) = 1 Signal(In(1,g)) Signal(In(2,g)) g Type(g) = NOT Signal(Out(1,g)) Signal(In(1,g)) 5. Encode the specific problem instance Type(X1) = XOR Type(X2) = XOR Type(A1) = AND Type(A2) = AND Type(O1) = OR

55 Connected(Out(1,X1),In(1,X2)) ),In(1,X1)) Connected(Out(1,X1),In(2,A2)) ),In(1,A1)) Connected(Out(1,A2),In(1,O1)) ),In(2,X1)) Connected(Out(1,A1),In(2,O1)) ),In(2,A1)) Connected(Out(1,X2),Out(1,C1)) ),In(2,X2)) Connected(Out(1,O1),Out(2,C1)) ),In(1,A2)) Connected(In(1,C1 Connected(In(1,C1 Connected(In(2,C1 Connected(In(2,C1 Connected(In(3,C1 Connected(In(3,C1 6. Pose queries to the inference procedure What are the possible sets of values of all the terminals for the adder circuit? i1,i2,i3,o1,o2 Signal(In(1,C_1)) = i1 Signal(In(2,C1)) = i2 Signal(In(3,C1)) = i3 Signal(Out(1,C1)) = o1 Signal(Out(2,C1)) = o2 7. Debug the knowledge base May have omitted assertions like 1 0 Universal instantiation (UI) Every instantiation of a universally quantified sentence is entailed by it: v α Subst({v/g}, α) and ground term g for any variable v

56 E.g., x King(x) Greedy(x) Evil(x) yields: King(John) Greedy(John) Evil(John) King(Richard) Greedy(Richard) Evil(Richard) King(Father(John)) Greedy(Father(John)) Evil(Father(John))... Existential instantiation (EI) For any sentence α, variable v, and constant symbol k that does not appear elsewhere in the knowledge base: v α Subst({v/k}, α) E.g., x Crown(x) OnHead(x,John) yields: Crown(C1) OnHead(C1,John) new constant symbol, called a Skolem constant provided C1 is a Reduction to propositional inference Suppose the KB contains just the following: x King(x) Greedy(x) Evil(x) King(John) Greedy(John) Brother(Richard,John)

57 Instantiating the universal sentence in all possible ways, we have: King(John) Greedy(John) Evil(John) King(Richard) Greedy(Richard) Evil(Richard) King(John) Greedy(John) Brother(Richard,John) The new KB is propositionalized: proposition symbols are King(John), Greedy(John), Evil(John), King(Richard), etc. Every FOL KB can be propositionalized so as to preserve entailment (A ground sentence is entailed by new KB iff entailed by original KB) Idea: propositionalize KB and query, apply resolution, return result Problem: with function symbols, there are infinitely many ground terms, e.g., Father(Father(Father(John))) Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositionalized KB Idea: For n = 0 to do create a propositional KB by instantiating with depth-$n$ terms see if α is entailed by this KB Problem: works if α is entailed, loops if α is not entailed

58 Theorem: Turing (1936), Church (1936) Entailment for FOL is semidecidable (algorithms exist that say yes to every entailed sentence, but no algorithm exists that also says no to every nonentailed sentence.) Problems with propositionalization Propositionalization seems to generate lots of irrelevant sentences. E.g., from: x King(x) Greedy(x) Evil(x) King(John) y Greedy(y) Brother(Richard,John) it seems obvious that Evil(John), but propositionalization produces lots of facts such as Greedy(Richard) that are irrelevant With p k-ary predicates and n constants, there are p nk instantiations. 3. Explain with example Unification and Lifting theorm. We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works Unify(α,β) = θ if αθ = βθ

59 p θ q Knows(John,x) Knows(John,Jane) Knows(John,x) Knows(y,OJ) Knows(John,x) )) Knows(John,x) Knows(y,Mother(y Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z17,OJ) We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works p Unify(α,β) = θ if αθ = βθ θ q Knows(John,x) Knows(John,x) Knows(John,Jane) {x/jane}} Knows(y,OJ) Knows(John,x) )) Knows(John,x) Knows(y,Mother(y Knows(x,OJ)

60 Standardizing apart eliminates overlap of variables, e.g., Knows(z17,OJ) We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works p Unify(α,β) = θ if αθ = βθ θ q Knows(John,x) Knows(John,x) Knows(John,x) )) Knows(John,x) Knows(John,Jane) {x/jane}} Knows(y,OJ) {x/oj,y/john}} Knows(y,Mother(y Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z17,OJ) We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works p Unify(α,β) = θ if αθ = βθ θ q Knows(John,x) Knows(John,x) Knows(John,Jane) {x/jane}} Knows(y,OJ) {x/oj,y/john}}

61 Knows(John,x) )) John)}} Knows(John,x) Knows(y,Mother(y {y/john,x/mother( Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z17,OJ) We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/john,y/john} works p Unify(α,β) = θ if αθ = βθ θ q Knows(John,x) Knows(John,x) Knows(John,x) )) John)}} Knows(John,x) Knows(John,Jane) {x/jane}} Knows(y,OJ) {x/oj,y/john}} Knows(y,Mother(y {y/john,x/mother( Knows(x,OJ) {fail} Standardizing apart eliminates overlap of variables, e.g., Knows(z17,OJ) To unify Knows(John,x) and Knows(y,z), θ = {y/john, x/z } or θ = {y/john, x/john, z/john} The first unifier is more general than the second.

62 There is a single most general unifier (MGU) that is unique up to renaming of variables. MGU = { y/john, x/z }

63 Generalized Modus Ponens (GMP) p1', p2',, pn', ( p1 p2 pn q) qθ p1' is King(John) p2' is Greedy(y) θ is {x/john,y/john} p1 is King(x) p2 is Greedy(x) q is Evil(x) q θ is Evil(John) GMP used with KB of definite clauses (exactly one positive literal) All variables assumed universally quantified Soundness of GMP Need to show that p1',, pn', (p1 pn q) qθ = piθ for all I provided that pi'θ Lemma: For any sentence p, we have p pθ by UI 1. (p1 pn q) (p1 pn q)θ = (p1θ pnθ qθ) 2. p1', \;, \;pn' p1' pn' p1'θ pn'θ 3. From 1 and 2, qθ follows by ordinary Modus Ponens Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal... it is a crime for an American to sell weapons to hostile nations: American(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x)

64 Nono has some missiles, i.e., x Owns(Nono,x) Missile(x): Owns(Nono,M1) and Missile(M1) all of its missiles were sold to it by Colonel West Missile(x) Owns(Nono,x) Sells(West,x,Nono) Missiles are weapons: Missile(x) Weapon(x) An enemy of America counts as "hostile : Enemy(x,America) Hostile(x) West, who is American American(West) The country Nono, an enemy of America Enemy(Nono,America) 4.Explain the forward chaining and backward chaining algorithms with examples Forward chaining algorithm

65 Properties of forward chaining

66 Sound and complete for first-order definite clauses Datalog = first-order definite clauses + no functions FC terminates for Datalog in finite number of iterations May not terminate in general if α is not entailed This is unavoidable: entailment with definite clauses is semidecidable Efficiency of forward chaining Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1 match each rule whose premise contains a newly added positive literal Matching itself can be expensive: Database indexing allows O(1) retrieval of known facts e.g., query Missile(x) retrieves Missile(M1) Forward chaining is widely used in deductive databases Hard matching example Diff(wa,nt) Diff(wa,sa) Diff(nt,q) Diff(nt,sa) Diff(q,nsw) Diff(q,sa) Diff(nsw,v) Diff(nsw,sa) Diff(v,sa) Colorable() Diff(Red,Blue) Diff(Green,Red) Diff(Green,Blue) Diff(Blue,Red) Diff (Red,Green) Diff(Blue,Green)

67 Colorable() is inferred iff the CSP has a solution CSPs include 3SAT as a special case, hence matching is NP-hard Backward chaining algorithm

68 Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops fix by checking current goal against every goal on stack Inefficient due to repeated subgoals (both success and failure) fix using caching of previous results (extra space) Widely used for logic programming Logic programming: Prolog Algorithm = Logic + Control Basis: backward chaining with Horn clauses + bells & whistles Europe, Japan (basis of 5th Generation project) techniques 60 million LIPS Widely used in Compilation

69 Program = set of clauses = head :- literal1, literaln. criminal(x) :- american(x), weapon(y), sells(x,y,z), hostile(z). Depth-first, left-to-right backward chaining Built-in predicates for arithmetic etc., e.g., X is Y*Z+3 Built-in predicates that have side effects (e.g., input and output predicates, assert/retract predicates) Closed-world assumption ("negation as failure") e.g., given alive(x) :- not dead(x). alive(joe) succeeds if dead(joe) fails

E.g., Brother(KingJohn,RichardTheLionheart)

E.g., Brother(KingJohn,RichardTheLionheart) First-Order Logic Chapter 8 Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL 1 Pros and cons of propositional logic Propositional logic is declarative

More information

Solving problems by searching

Solving problems by searching Solving problems by searching Chapter 3 Some slide credits to Hwee Tou Ng (Singapore) Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms Heuristics

More information

Informed search algorithms. Chapter 4

Informed search algorithms. Chapter 4 Informed search algorithms Chapter 4 Material Chapter 4 Section 1 - Exclude memory-bounded heuristic search 3 Outline Best-first search Greedy best-first search A * search Heuristics Local search algorithms

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Section 1 3 Constraint Satisfaction 1 Outline Constraint Satisfaction Problems (CSP) Backtracking search for CSPs Local search for CSPs Constraint Satisfaction

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Search Marc Toussaint University of Stuttgart Winter 2015/16 (slides based on Stuart Russell s AI course) Outline Problem formulation & examples Basic search algorithms 2/100 Example:

More information

Informed Search. Best-first search. Greedy best-first search. Intelligent Systems and HCI D7023E. Romania with step costs in km

Informed Search. Best-first search. Greedy best-first search. Intelligent Systems and HCI D7023E. Romania with step costs in km Informed Search Intelligent Systems and HCI D7023E Lecture 5: Informed Search (heuristics) Paweł Pietrzak [Sec 3.5-3.6,Ch.4] A search strategy which searches the most promising branches of the state-space

More information

Outline. Forward chaining Backward chaining Resolution. West Knowledge Base. Forward chaining algorithm. Resolution-Based Inference.

Outline. Forward chaining Backward chaining Resolution. West Knowledge Base. Forward chaining algorithm. Resolution-Based Inference. Resolution-Based Inference Outline R&N: 9.3-9.6 Michael Rovatsos University of Edinburgh Forward chaining Backward chaining Resolution 10 th February 2015 Forward chaining algorithm West Knowledge Base

More information

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Today: Informed search algorithms

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Dr Ahmed Rafat Abas Computer Science Dept, Faculty of Computers and Informatics, Zagazig University arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg/ Informed search algorithms

More information

2006/2007 Intelligent Systems 1. Intelligent Systems. Prof. dr. Paul De Bra Technische Universiteit Eindhoven

2006/2007 Intelligent Systems 1. Intelligent Systems. Prof. dr. Paul De Bra Technische Universiteit Eindhoven test gamma 2006/2007 Intelligent Systems 1 Intelligent Systems Prof. dr. Paul De Bra Technische Universiteit Eindhoven debra@win.tue.nl 2006/2007 Intelligent Systems 2 Informed search and exploration Best-first

More information

Solving problems by searching

Solving problems by searching Solving problems by searching Chapter 3 Systems 1 Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms Systems 2 Problem-solving agents Systems 3 Example:

More information

Set 7: Predicate logic Chapter 8 R&N. ICS 271 Fall 2015

Set 7: Predicate logic Chapter 8 R&N. ICS 271 Fall 2015 Set 7: Predicate logic Chapter 8 R&N ICS 271 Fall 2015 Outline New ontology objects, relations, properties, functions New Syntax Constants, predicates, properties, functions New semantics meaning of new

More information

Problem solving and search

Problem solving and search Problem solving and search Chapter 3 TB Artificial Intelligence Slides from AIMA http://aima.cs.berkeley.edu 1 /1 Outline Problem-solving agents Problem types Problem formulation Example problems Basic

More information

Robot Programming with Lisp

Robot Programming with Lisp 6. Search Algorithms Gayane Kazhoyan (Stuart Russell, Peter Norvig) Institute for University of Bremen Contents Problem Definition Uninformed search strategies BFS Uniform-Cost DFS Depth-Limited Iterative

More information

Inf2D 12: Resolution-Based Inference

Inf2D 12: Resolution-Based Inference School of Informatics, University of Edinburgh 09/02/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Last time Unification: Given α and β, find θ such that αθ = βθ Most general unifier

More information

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell)

Informed search algorithms. (Based on slides by Oren Etzioni, Stuart Russell) Informed search algorithms (Based on slides by Oren Etzioni, Stuart Russell) The problem # Unique board configurations in search space 8-puzzle 9! = 362880 15-puzzle 16! = 20922789888000 10 13 24-puzzle

More information

Chapter 2. Blind Search 8/19/2017

Chapter 2. Blind Search 8/19/2017 Chapter 2 1 8/19/2017 Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms 8/19/2017 2 8/19/2017 3 On holiday in Romania; currently in Arad. Flight leaves tomorrow

More information

Outline. Solving problems by searching. Problem-solving agents. Example: Romania

Outline. Solving problems by searching. Problem-solving agents. Example: Romania Outline Solving problems by searching Chapter 3 Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms Systems 1 Systems 2 Problem-solving agents Example: Romania

More information

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17 CSE 473: Artificial Intelligence Constraint Satisfaction Dieter Fox What is Search For? Models of the world: single agent, deterministic actions, fully observed state, discrete state space Planning: sequences

More information

Problem solving and search

Problem solving and search Problem solving and search Chapter 3 Chapter 3 1 Outline Problem-solving agents Problem types Problem formulation Example problems Uninformed search algorithms Informed search algorithms Chapter 3 2 Restricted

More information

CS 380: Artificial Intelligence Lecture #4

CS 380: Artificial Intelligence Lecture #4 CS 380: Artificial Intelligence Lecture #4 William Regli Material Chapter 4 Section 1-3 1 Outline Best-first search Greedy best-first search A * search Heuristics Local search algorithms Hill-climbing

More information

CSE 473: Artificial Intelligence

CSE 473: Artificial Intelligence CSE 473: Artificial Intelligence Constraint Satisfaction Luke Zettlemoyer Multiple slides adapted from Dan Klein, Stuart Russell or Andrew Moore What is Search For? Models of the world: single agent, deterministic

More information

Solving Problem by Searching. Chapter 3

Solving Problem by Searching. Chapter 3 Solving Problem by Searching Chapter 3 Outline Problem-solving agents Problem formulation Example problems Basic search algorithms blind search Heuristic search strategies Heuristic functions Problem-solving

More information

CS W4701 Artificial Intelligence

CS W4701 Artificial Intelligence CS W4701 Artificial Intelligence Fall 2013 Chapter 6: Constraint Satisfaction Problems Jonathan Voris (based on slides by Sal Stolfo) Assignment 3 Go Encircling Game Ancient Chinese game Dates back At

More information

CS 380: Artificial Intelligence Lecture #3

CS 380: Artificial Intelligence Lecture #3 CS 380: Artificial Intelligence Lecture #3 William Regli Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms 1 Problem-solving agents Example: Romania

More information

Review Adversarial (Game) Search ( ) Review Constraint Satisfaction ( ) Please review your quizzes and old CS-271 tests

Review Adversarial (Game) Search ( ) Review Constraint Satisfaction ( ) Please review your quizzes and old CS-271 tests Review Agents (2.1-2.3) Mid-term Review Chapters 2-6 Review State Space Search Problem Formulation (3.1, 3.3) Blind (Uninformed) Search (3.4) Heuristic Search (3.5) Local Search (4.1, 4.2) Review Adversarial

More information

ARTIFICIAL INTELLIGENCE. Informed search

ARTIFICIAL INTELLIGENCE. Informed search INFOB2KI 2017-2018 Utrecht University The Netherlands ARTIFICIAL INTELLIGENCE Informed search Lecturer: Silja Renooij These slides are part of the INFOB2KI Course Notes available from www.cs.uu.nl/docs/vakken/b2ki/schema.html

More information

Constraint Satisfaction

Constraint Satisfaction Constraint Satisfaction Philipp Koehn 1 October 2015 Outline 1 Constraint satisfaction problems (CSP) examples Backtracking search for CSPs Problem structure and problem decomposition Local search for

More information

Chapter 3 Solving problems by searching

Chapter 3 Solving problems by searching 1 Chapter 3 Solving problems by searching CS 461 Artificial Intelligence Pinar Duygulu Bilkent University, Slides are mostly adapted from AIMA and MIT Open Courseware 2 Introduction Simple-reflex agents

More information

Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems (CSPs) 1 Hal Daumé III (me@hal3.name) Constraint Satisfaction Problems (CSPs) Hal Daumé III Computer Science University of Maryland me@hal3.name CS 421: Introduction to Artificial Intelligence 7 Feb 2012 Many

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence hapter 1 hapter 1 1 Iterative deepening search function Iterative-Deepening-Search( problem) returns a solution inputs: problem, a problem for depth 0 to do result Depth-Limited-Search(

More information

Lecture 6: Constraint Satisfaction Problems (CSPs)

Lecture 6: Constraint Satisfaction Problems (CSPs) Lecture 6: Constraint Satisfaction Problems (CSPs) CS 580 (001) - Spring 2018 Amarda Shehu Department of Computer Science George Mason University, Fairfax, VA, USA February 28, 2018 Amarda Shehu (580)

More information

Chapters 3-5 Problem Solving using Search

Chapters 3-5 Problem Solving using Search CSEP 573 Chapters 3-5 Problem Solving using Search First, they do an on-line search CSE AI Faculty Example: The 8-puzzle Example: The 8-puzzle 1 2 3 8 4 7 6 5 1 2 3 4 5 6 7 8 2 Example: Route Planning

More information

Problem Solving and Search

Problem Solving and Search Artificial Intelligence Problem Solving and Search Dae-Won Kim School of Computer Science & Engineering Chung-Ang University Outline Problem-solving agents Problem types Problem formulation Example problems

More information

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 3, 4/6/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes 4/6/2005 EE562 1 Today: Basic

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Last update: February 25, 2010 Constraint Satisfaction Problems CMSC 421, Chapter 5 CMSC 421, Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local

More information

CS 8520: Artificial Intelligence

CS 8520: Artificial Intelligence CS 8520: Artificial Intelligence Solving Problems by Searching Paula Matuszek Spring, 2013 Slides based on Hwee Tou Ng, aima.eecs.berkeley.edu/slides-ppt, which are in turn based on Russell, aima.eecs.berkeley.edu/slides-pdf.

More information

Solving problems by searching

Solving problems by searching Solving problems by searching 1 C H A P T E R 3 Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms Outline 2 Problem-solving agents 3 Note: this is offline

More information

Informed search algorithms. Chapter 4

Informed search algorithms. Chapter 4 Informed search algorithms Chapter 4 Outline Best-first search Greedy best-first search A * search Heuristics Memory Bounded A* Search Best-first search Idea: use an evaluation function f(n) for each node

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs Chapter 5 2 Constraint satisfaction

More information

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides)

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides) Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides) Constraint satisfaction problems What is a CSP? Finite set of variables V, V 2,, V n Nonempty domain of possible values for

More information

CS 188: Artificial Intelligence Fall 2008

CS 188: Artificial Intelligence Fall 2008 CS 188: Artificial Intelligence Fall 2008 Lecture 4: CSPs 9/9/2008 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore 1 1 Announcements Grading questions:

More information

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens CS 188: Artificial Intelligence Fall 2008 Announcements Grading questions: don t panic, talk to us Newsgroup: check it out Lecture 4: CSPs 9/9/2008 Dan Klein UC Berkeley Many slides over the course adapted

More information

Solving problems by searching

Solving problems by searching Solving problems by searching Chapter 3 CS 2710 1 Outline Problem-solving agents Problem formulation Example problems Basic search algorithms CS 2710 - Blind Search 2 1 Goal-based Agents Agents that take

More information

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. Chapter 6 Constraint Satisfaction Problems Chapter 6 Office hours Office hours for Assignment 1 (ASB9810 in CSIL): Sep 29th(Fri) 12:00 to 13:30 Oct 3rd(Tue) 11:30 to 13:00 Late homework policy You get four late

More information

Informed Search. Dr. Richard J. Povinelli. Copyright Richard J. Povinelli Page 1

Informed Search. Dr. Richard J. Povinelli. Copyright Richard J. Povinelli Page 1 Informed Search Dr. Richard J. Povinelli Copyright Richard J. Povinelli Page 1 rev 1.1, 9/25/2001 Objectives You should be able to explain and contrast uniformed and informed searches. be able to compare,

More information

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.) Some slides adapted from Richard Lathrop, USC/ISI, CS 7 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always replies

More information

CS 4100 // artificial intelligence

CS 4100 // artificial intelligence CS 4100 // artificial intelligence instructor: byron wallace Constraint Satisfaction Problems Attribution: many of these slides are modified versions of those distributed with the UC Berkeley CS188 materials

More information

Problem solving and search

Problem solving and search Problem solving and search Chapter 3 Chapter 3 1 Problem formulation & examples Basic search algorithms Outline Chapter 3 2 On holiday in Romania; currently in Arad. Flight leaves tomorrow from Bucharest

More information

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong CS 88: Artificial Intelligence Spring 2009 Lecture 4: Constraint Satisfaction /29/2009 John DeNero UC Berkeley Slides adapted from Dan Klein, Stuart Russell or Andrew Moore Announcements The Python tutorial

More information

TDT4136 Logic and Reasoning Systems

TDT4136 Logic and Reasoning Systems TDT4136 Logic and Reasoning Systems Chapter 3 & 4.1 - Informed Search and Exploration Lester Solbakken solbakke@idi.ntnu.no Norwegian University of Science and Technology 18.10.2011 1 Lester Solbakken

More information

9/7/2015. Outline for today s lecture. Problem Solving Agents & Problem Formulation. Task environments

9/7/2015. Outline for today s lecture. Problem Solving Agents & Problem Formulation. Task environments Problem Solving Agents & Problem Formulation Defining Task Environments (AIMA 2.3) Environment types Formulating Search Problems Search Fundamentals AIMA 2.3, 3.1-3 2 3 Task environments To design a rational

More information

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY REPRESENTATION OF KNOWLEDGE PART A

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY REPRESENTATION OF KNOWLEDGE PART A UNIT II REPRESENTATION OF KNOWLEDGE PART A 1. What is informed search? One that uses problem specific knowledge beyond the definition of the problem itself and it can find solutions more efficiently than

More information

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Sina Institute, University of Birzeit

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Sina Institute, University of Birzeit Lecture Notes, Advanced Artificial Intelligence (SCOM7341) Sina Institute, University of Birzeit 2 nd Semester, 2012 Advanced Artificial Intelligence (SCOM7341) Chapter 4 Informed Searching Dr. Mustafa

More information

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems What is Search For? Assumptions about the world: a single agent, deterministic actions, fully observed state, discrete state space Planning:

More information

Artificial Intelligence p.1/49. n-queens. Artificial Intelligence p.2/49. Initial state: the empty board or a board with n random

Artificial Intelligence p.1/49. n-queens. Artificial Intelligence p.2/49. Initial state: the empty board or a board with n random Example: n-queens Put n queens on an n n board with no two queens on the same row, column, or diagonal A search problem! State space: the board with 0 to n queens Initial state: the empty board or a board

More information

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm Announcements Homework 4 Due tonight at 11:59pm Project 3 Due 3/8 at 4:00pm CS 188: Artificial Intelligence Constraint Satisfaction Problems Instructor: Stuart Russell & Sergey Levine, University of California,

More information

Uninformed Search. Problem-solving agents. Tree search algorithms. Single-State Problems

Uninformed Search. Problem-solving agents. Tree search algorithms. Single-State Problems Uninformed Search Problem-solving agents Tree search algorithms Single-State Problems Breadth-First Search Depth-First Search Limited-Depth Search Iterative Deepening Extensions Graph search algorithms

More information

Announcements. CS 188: Artificial Intelligence Fall 2010

Announcements. CS 188: Artificial Intelligence Fall 2010 Announcements Project 1: Search is due Monday Looking for partners? After class or newsgroup Written 1: Search and CSPs out soon Newsgroup: check it out CS 188: Artificial Intelligence Fall 2010 Lecture

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2006 Lecture 4: CSPs 9/7/2006 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore Announcements Reminder: Project

More information

CS 188: Artificial Intelligence. Recap: Search

CS 188: Artificial Intelligence. Recap: Search CS 188: Artificial Intelligence Lecture 4 and 5: Constraint Satisfaction Problems (CSPs) Pieter Abbeel UC Berkeley Many slides from Dan Klein Recap: Search Search problem: States (configurations of the

More information

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search:

Outline for today s lecture. Informed Search. Informed Search II. Review: Properties of greedy best-first search. Review: Greedy best-first search: Outline for today s lecture Informed Search II Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing 2 Review: Greedy best-first search: f(n): estimated

More information

Informed Search Algorithms. Chapter 4

Informed Search Algorithms. Chapter 4 Informed Search Algorithms Chapter 4 Outline Informed Search and Heuristic Functions For informed search, we use problem-specific knowledge to guide the search. Topics: Best-first search A search Heuristics

More information

CS 343: Artificial Intelligence

CS 343: Artificial Intelligence CS 343: Artificial Intelligence Constraint Satisfaction Problems Prof. Scott Niekum The University of Texas at Austin [These slides are based on those of Dan Klein and Pieter Abbeel for CS188 Intro to

More information

Informed Search and Exploration for Agents

Informed Search and Exploration for Agents Informed Search and Exploration for Agents R&N: 3.5, 3.6 Michael Rovatsos University of Edinburgh 29 th January 2015 Outline Best-first search Greedy best-first search A * search Heuristics Admissibility

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2010 Lecture 4: A* wrap-up + Constraint Satisfaction 1/28/2010 Pieter Abbeel UC Berkeley Many slides from Dan Klein Announcements Project 0 (Python tutorial) is due

More information

Downloaded from ioenotes.edu.np

Downloaded from ioenotes.edu.np Chapter- 3: Searching - Searching the process finding the required states or nodes. - Searching is to be performed through the state space. - Search process is carried out by constructing a search tree.

More information

Constraint Satisfaction. AI Slides (5e) c Lin

Constraint Satisfaction. AI Slides (5e) c Lin Constraint Satisfaction 4 AI Slides (5e) c Lin Zuoquan@PKU 2003-2018 4 1 4 Constraint Satisfaction 4.1 Constraint satisfaction problems 4.2 Backtracking search 4.3 Constraint propagation 4.4 Local search

More information

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Artificial Intelligence. Sina Institute, University of Birzeit

Dr. Mustafa Jarrar. Chapter 4 Informed Searching. Artificial Intelligence. Sina Institute, University of Birzeit Lecture Notes on Informed Searching University of Birzeit, Palestine 1 st Semester, 2014 Artificial Intelligence Chapter 4 Informed Searching Dr. Mustafa Jarrar Sina Institute, University of Birzeit mjarrar@birzeit.edu

More information

Solving problems by searching

Solving problems by searching Solving problems by searching CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2014 Soleymani Artificial Intelligence: A Modern Approach, Chapter 3 Outline Problem-solving

More information

Solving problems by searching. Chapter 3

Solving problems by searching. Chapter 3 Solving problems by searching Chapter 3 Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms 2 Example: Romania On holiday in Romania; currently in

More information

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems Constraint Satisfaction Problems N variables domain D constraints x 1 x 2 Instructor: Marco Alvarez University of Rhode Island (These slides

More information

DFS. Depth-limited Search

DFS. Depth-limited Search DFS Completeness? No, fails in infinite depth spaces or spaces with loops Yes, assuming state space finite. Time complexity? O(b m ), terrible if m is much bigger than d. can do well if lots of goals Space

More information

Solving problems by searching

Solving problems by searching Solving problems by searching CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2017 Soleymani Artificial Intelligence: A Modern Approach, Chapter 3 Outline Problem-solving

More information

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim INF5390 Kunstig intelligens First-Order Logic Roar Fjellheim Outline Logical commitments First-order logic First-order inference Resolution rule Reasoning systems Summary Extracts from AIMA Chapter 8:

More information

Multiagent Systems Problem Solving and Uninformed Search

Multiagent Systems Problem Solving and Uninformed Search Multiagent Systems Problem Solving and Uninformed Search Viviana Mascardi viviana.mascardi@unige.it MAS, University of Genoa, DIBRIS Classical AI 1 / 36 Disclaimer This presentation may contain material

More information

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012 /0/0 CSE 57: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer Space of Search Strategies Blind Search DFS, BFS,

More information

Chapter 3: Informed Search and Exploration. Dr. Daisy Tang

Chapter 3: Informed Search and Exploration. Dr. Daisy Tang Chapter 3: Informed Search and Exploration Dr. Daisy Tang Informed Search Definition: Use problem-specific knowledge beyond the definition of the problem itself Can find solutions more efficiently Best-first

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. S. Russell and P. Norvig. Artificial Intelligence:

More information

Solving Problems: Blind Search

Solving Problems: Blind Search Solving Problems: Blind Search Instructor: B. John Oommen Chancellor s Professor Fellow: IEEE ; Fellow: IAPR School of Computer Science, Carleton University, Canada The primary source of these notes are

More information

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search

CS 771 Artificial Intelligence. Problem Solving by Searching Uninformed search CS 771 Artificial Intelligence Problem Solving by Searching Uninformed search Complete architectures for intelligence? Search? Solve the problem of what to do. Learning? Learn what to do. Logic and inference?

More information

Spezielle Themen der Künstlichen Intelligenz

Spezielle Themen der Künstlichen Intelligenz Spezielle Themen der Künstlichen Intelligenz 2. Termin: Constraint Satisfaction Dr. Stefan Kopp Center of Excellence Cognitive Interaction Technology AG A Recall: Best-first search Best-first search =

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs Chapter 5 2 Constraint satisfaction

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

Informed search algorithms

Informed search algorithms CS 580 1 Informed search algorithms Chapter 4, Sections 1 2, 4 CS 580 2 Outline Best-first search A search Heuristics Hill-climbing Simulated annealing CS 580 3 Review: General search function General-Search(

More information

Solving Problems by Searching

Solving Problems by Searching Solving Problems by Searching Berlin Chen 2004 Reference: 1. S. Russell and P. Norvig. Artificial Intelligence: A Modern Approach. Chapter 3 1 Introduction Problem-Solving Agents vs. Reflex Agents Problem-solving

More information

Artificial Intelligence CS 6364

Artificial Intelligence CS 6364 Artificial Intelligence CS 6364 Professor Dan Moldovan Section 4 Informed Search and Adversarial Search Outline Best-first search Greedy best-first search A* search Heuristics revisited Minimax search

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence CSC348 Unit 3: Problem Solving and Search Syedur Rahman Lecturer, CSE Department North South University syedur.rahman@wolfson.oxon.org Artificial Intelligence: Lecture Notes The

More information

A.I.: Informed Search Algorithms. Chapter III: Part Deux

A.I.: Informed Search Algorithms. Chapter III: Part Deux A.I.: Informed Search Algorithms Chapter III: Part Deux Best-first search Greedy best-first search A * search Heuristics Outline Overview Informed Search: uses problem-specific knowledge. General approach:

More information

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set: Announcements Homework 1: Search Has been released! Due Monday, 2/1, at 11:59pm. On edx online, instant grading, submit as often as you like. Project 1: Search Has been released! Due Friday 2/5 at 5pm.

More information

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph Example: Map-Coloring Constraint Satisfaction Problems Western Northern erritory ueensland Chapter 5 South New South Wales asmania Variables, N,,, V, SA, Domains D i = {red,green,blue} Constraints: adjacent

More information

Artificial Intelligence Problem Solving and Uninformed Search

Artificial Intelligence Problem Solving and Uninformed Search Artificial Intelligence Problem Solving and Uninformed Search Maurizio Martelli, Viviana Mascardi {martelli, mascardi}@disi.unige.it University of Genoa Department of Computer and Information Science AI,

More information

Solving Problems: Intelligent Search

Solving Problems: Intelligent Search Solving Problems: Intelligent Search Instructor: B. John Oommen Chancellor s Professor Fellow: IEEE; Fellow: IAPR School of Computer Science, Carleton University, Canada The primary source of these notes

More information

AI: problem solving and search

AI: problem solving and search : problem solving and search Stefano De Luca Slides mainly by Tom Lenaerts Outline Problem-solving agents A kind of goal-based agent Problem types Single state (fully observable) Search with partial information

More information

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 8: First-Order Logic (FOL)

Introduction to Artificial Intelligence 2 nd semester 2016/2017. Chapter 8: First-Order Logic (FOL) Introduction to Artificial Intelligence 2 nd semester 2016/2017 Chapter 8: First-Order Logic (FOL) Mohamed B. Abubaker Palestine Technical College Deir El-Balah 1 Introduction Propositional logic is used

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Revised by Hankui Zhuo, March 14, 2018 Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search

More information

Review Agents ( ) Review State Space Search

Review Agents ( ) Review State Space Search Review Agents (2.1-2.3) Review State Space Search Mid-term Review Chapters 2-7 Problem Formulation (3.1, 3.3) Blind (Uninformed) Search (3.4) Heuristic Search (3.5) Local Search (4.1, 4.2) Review Adversarial

More information

CS 188: Artificial Intelligence Fall 2011

CS 188: Artificial Intelligence Fall 2011 Announcements Project 1: Search is due next week Written 1: Search and CSPs out soon Piazza: check it out if you haven t CS 188: Artificial Intelligence Fall 2011 Lecture 4: Constraint Satisfaction 9/6/2011

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2013 Soleymani Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition,

More information

TDDC17. Intuitions behind heuristic search. Recall Uniform-Cost Search. Best-First Search. f(n) =... + h(n) g(n) = cost of path from root node to n

TDDC17. Intuitions behind heuristic search. Recall Uniform-Cost Search. Best-First Search. f(n) =... + h(n) g(n) = cost of path from root node to n Intuitions behind heuristic search The separation property of GRAPH-SEARCH TDDC17 Seminar III Search II Informed or Heuristic Search Beyond Classical Search Find a heuristic measure h(n) which estimates

More information