0% found this document useful (0 votes)
4 views60 pages

AI Unit 1

Uploaded by

chithra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views60 pages

AI Unit 1

Uploaded by

chithra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 60

UNIT I

Introduction: History of AI - problem spaces and search- Heuristic Search techniques –Best-first search-

Problem reduction-Constraint satisfaction-Means Ends Analysis. Intelligent agents: Agents and environment

– structure of agents and its functions


Unit I- Two Marks
1. Define AI as” Systems that think like humans”?
The exciting new effort to make computers think . . . machines with minds, in the full
and literal sense.

The automation of activities that we associate with human thinking, activities such
as decision-making, problem solving, learning.
2. Define AI as” Systems that think rationally”?
The study of mental faculties through the use of computational models. The study of
the computations that make it possible to perceive, reason, and act.
3. Define AI as” Systems that act like humans”?
The art of creating machines that perform functions that require intelligence when
performed by people.

The study of how to make computers do things at which, at the moment, people are
better.
4. Define AI as” Systems that act rationally”?
Computational intelligence is the study of design of intelligent agents.

Artificial intelligence is concerned with intelligent behavior in artifacts.

5. Explain the turning test approach for ‘acting humanly’?

Turing defined intelligent behavior as the ability to achieve human-level performance


in all cognitive tasks, sufficient to fool an interrogator.

The test he proposed is that the computer should be interrogated by a human via a
teletype, and passes the test if the interrogator cannot tell if there is a computer or a human
at the other end.
6. What are the things the computer needs to act as human?

The computer would need to possess the following capabilities:

 Natural language processing to enable it to communicate successfully in English (or


some other human language).

 Knowledge representation to store information provided before or during the


interrogation.

 Automated reasoning to use the stored information to answer questions and to


draw new conclusions.

 Machine learning to adapt to new circumstances and to detect and extrapolate


patterns.
7. To pass the total Turing Test, the computer needs what?To pass the total Turing Test, the
computer will need the, (COMPUTER VISION) computer vision to perceive objects, and
ROBOTICS to move them about.

2
8. Explain the cognitive modelling approach for’ Thinking humanly’?
If we say that a given program thinks like a human, we must have some way of
determining how humans think. We need to get inside the actual workings of human minds.
There are two ways to do this: through introspection—trying to catch our own thoughts as
they go by—or through psychological experiments.

9. Explain the laws of thought approach for’ Thinking rationally’?


The Greek philosopher Aristotle was one of the first to attempt to codify "right
thinking," that is, irrefutable reasoning processes. His famous syllogisms provided patterns
for argument structures that always gave correct conclusions given correct premises. For
example, "Socrates is a man; all men are mortal; therefore Socrates is mortal." These laws of
thought were supposed to govern the operation of the mind, and initiated the field of logic.

10. Explain the rational agent approach for’ acting rationally’?


Acting rationally means acting so as to achieve one's goals, given one's beliefs. An
agent is just something that perceives and acts. (This may be an unusual use of the word, but
you will get used to it.) In this approach, AI is viewed as the study and construction of
rational agents.

11. Give the advantages when we study AI as rational agent design?


o It is more general than the "laws of thought" approach, because correct
inference is only a useful mechanism for achieving rationality, and not a
necessary one.
o It is more amenable to scientific development than approaches based on
human behavior or human thought, because the standard of rationality is
clearly defined and completely general.

12. What are all the fields from which AI can be inherited?
AI can be inherited from
 Psychology
 Linguistic
 Philosophy
 Mathematics
 CS
3
 Economics
 Neuro science
 Control theory and cybernetics

13. What is the first successful knowledge-intensive system? Explain.


The first successful knowledge-intensive system is DENDRAL.
DENDRAL determines the 3D structure of the difficult chemical compound.

14. What is the first successful rule based expert system. Explain?
The first successful knowledge-intensive system is MYCIN.
MYCIN is used to diagnose the blood infectious disease.

15. Give the applications of AI?


The areas where AI can be applied are
 Autonomous planning and scheduling
 Game playing
 Autonomous control
 Diagnosis
 Logistic planning
 Robotics

16. Define an ‘Intelligent agent’? (Apr-May’15)


An agent is anything that can be viewed as perceiving its environment through
sensors and acting upon that environment through actuators.
E.g.: vacuum cleaner

17. Give the sensors and actuators for human, robotics and software agent?
Robotics agent:
Sensors: infrared rays, cameras
Actuators: motor
Software agent:
Sensors: keys in keyboard
Actuators: output displayed on screen

4
Human agent:
Sensors: eyes, ears, and other organs
Actuators: other body parts

18. How does an agents interact with environments through sensors and effectors?

PERCEPTS SENSORS

ENVIRONMENT AGENT

ACTION

ACTUATORS

19. Define an ideal rational agent?

For each possible percept sequence, an ideal rational agent should do whatever action
is expected to maximize its performance measure, on the basis of the evidence provided by the
percept sequence and whatever built-in knowledge the agent has.

20. What are the four things rational agent depend on?
The rational agent depends on four things:
• The performance measure that defines degree of success. (P)
• What the agent knows about the environment. (E)
• Everything that the agent has perceived so far. We will call this complete perceptual history
the percept sequence. (A)
• The actions that the agent can perform. (S)

21. What is an agent function?

An agent program tries to implement the agent architecture is called agent function.

Agent function=agent architecture + agent program

22. What are four types of environment?

The four types of environment are


5
1. Accessible vs. inaccessible
2. Deterministic vs nondeterministic
3. Episodic vs non episodic
4. Static vs dynamic
5. Discrete vs continuous
6. Single agent vs multi agent
23. Explain Accessible vs. inaccessible environment?

If an agent's sensory apparatus gives it access to the complete state of the


environment, then we say that the environment is accessible to that agent. An environment is
effectively accessible if the sensors detect all aspects that are relevant to the choice of action.
An accessible environment is convenient because the agent need not maintain any internal
state to keep track of the world.

24. Explain Deterministic vs. nondeterministic environment?

If the next state of the environment is completely determined by the current state
and the actions selected by the agents, then we say the environment is deterministic. In
principle, an agent need not worry about uncertainty in an accessible, deterministic
environment. If the environment is inaccessible, however, then it may appear to be
nondeterministic.

25. Explain Episodic vs. non episodic environment?

In an episodic environment, the agent's experience is divided into "episodes." Each


episode consists of the agent perceiving and then acting. The quality of its action depends
just on the episode itself, because subsequent episodes do not depend on what actions occur
in previous episodes. Episodic environments are much simpler because the agent does not
need to think ahead.

26. Explain Static vs. dynamic environment?

If the environment can change while an agent is deliberating, then we say the
environment is dynamic for that agent; otherwise it is static. Static environments are easy to
deal with because the agent need not keep looking at the world while it is deciding on an
action, nor need it worry about the passage of time. If the environment does not change with
6
the passage of time but the agent's performance score does, then we say the environment is
semi dynamic.

27. Explain Discrete vs. continuous environment?

If there are a limited number of distinct, clearly defined percepts and actions we
say that the environment is discrete. Chess is discrete—there are a fixed number of possible
moves on each turn. Taxi driving is continuous—the speed and location of the taxi and the
other vehicles sweep through a range of continuous values.

28. What are the four types of agent program?


The four types of agent program:
• Simple reflex agents
• Model based agent
• Goal-based agents
• Utility-based agents

29. What is simple reflex agent?


It is the simplest kind of agent. These agent selects action on the basis of the current
percept, ignoring the rest of the percept history.
E.g.: vacuum agent

30. What is model based agent?


The most effective way to handle partial observability is for the agent to keep track
of the part of the world it can’t see now. That is, the agent should maintain some sort of
internal states that depends on the percept history and thereby reflects at least some of the
unobserved aspects of the current state.

31. What is Goal-based agents?


Knowing about the current state of the environment is not always enough to decide
what to do. For example, at a road junction, the taxi can turn left, right, or go straight on. The
right decision depends on where the taxi is trying to get to. In other words, as well as a
current state description, the agent needs some sort of goal information, which describes
situations that are desirable— for example, being at the passenger's destination.

7
32. What is utility based agent?
Goals alone are not really enough to generate high-quality behavior. For example,
there are many action sequences that will get the taxi to its destination, thereby achieving the
goal, but some are quicker, safer, more reliable, or cheaper than others.
The customary terminology is to say that if one world state is preferred to another,
then it has higher utility for the agent.
Utility is therefore a function that maps a state9 onto a real number, which
describes the associated degree of happiness.

33. What is the advantage of learning agent?


It allows the agent to operate in initially unknown environment and to become
more competent than its initial knowledge alone might a low.

34. What are the four components of learning agent?


The four components of learning agent are
Learning element
Performance element
Critic
Problem generator

35. Explain the components of learning agent?


Learning element-it is responsible for improvement of the agent.
Performance element-what action it does for particular percept.
Problem generator- one which improves the learning element.it is responsible for
giving suggestions and actions to learning element. Critic-used to get feedback from
environment.

36. Write the algorithm for simple problem solving agent?


The algorithm is,
function SIMPLE-PROBLEM -SOLVING- AGENT(percept) returns an action
inputs: percept, a percept
static: seq, an action sequence, initially empty
state, some description of the current world state
8
goal, a goal, initially null
problem, a problem formulation


state UPDATE-STATE(state,
percept) if seq is empty then do

goal FORMULATE-GOAL(state)

problem FORMULATE-PROBLEM(state,

goal) seq SEARCH(problem)

action FIRST(seq)

seq REST(seq)
return action

37. Define search?


In general, an agent with several immediate options of unknown value can decide
what to do by jrst examining different possible sequences of actions that lead to states of
known value, and then choosing the best sequence. This process of looking for such a
sequence is called search.

38. What are the four components in a well defined problem?


The four components are,
 Initial state
 Successor function
 Goal test
 Path cost
39. What is uninformed search?
It means that they have no additional information about states beyond that
provided in the problem definition. All they can do is generate successors and distinguish
a goal state from a non-goal state.

40. Give the types of uninformed search?


Uninformed search types are,
 Breadth first search
 Uniform cost search

9
 Depth first search
 Depth limited search
 Iterative deepening depth first search
 Bidirectional search

41. Define breadth first search. (Nov ’13)


Breadth-first search is a simple strategy in which the root node is expanded first,
then all the successors of the root node are expanded next, then their successors, and so
on. In general, all the nodes are expanded at a given depth in the search tree before any
nodes at the next level are expanded.

42. What is uniform cost search?


Breadth-first search is optimal when all step costs are equal, because it always
expands the shallowest unexpanded node. By a simple extension, we can find an
algorithm that is optimal with any step cost function. Instead of expanding the shallowest
node, uniform-cost search expands the node n with the lowest path cost. Note that if all
step costs are equal, this is identical to breadth-first search.

43. Define depth first search.


Depth-first search always expands the deepest node in the current fringe of the
search tree. The search proceeds immediately to the deepest level of the search tree,
where the nodes have no successors. As those nodes are expanded, they are dropped
from the fringe, so then the search "backs up" to the next shallowest node that still has
unexplored successors.

44. Define depth limited search.


The problem of unbounded trees can be alleviated by supplying depth-first search
with a predetermined depth limit l. That is, nodes at depth l are treated as if they have no
successors. This approach is called depth-limited search. The depth limit solves the
infinite-path problem.

45. Define iterative deepening depth first search.


Iterative deepening search (or iterative deepening depth-first search) is a general
strategy, often used in combination with depth-first search that finds the best depth limit.
10
It does this by gradually increasing the limit-first 0, then 1, then 2, and so on-until a goal
is found. This will occur when the depth limit reaches d, the depth of the shallowest goal
node.

46. What is bidirectional search?


The idea behind bidirectional search is to run two simultaneous searches-one
forward from the initial state and the other backward from the goal, stopping when the
two searches meet in the middle.

47. Compare all uninformed searches.


Criterion Breadth Uniform Depth Depth Iterative Bidirectional
first cost first limited deepening
Completeness Yes Yes No No Yes Yes
Optimality Yes Yes No No Yes Yes
d+1 m l d d/2
Time O(b ) O(b[c*/ ε]) O(b ) O(b ) O(b ) O(b )
d+1 d/2
Space O(b ) O(b[c*/ ε]) O(bm) O(bl) O(bd) O(b )

48. Define informed search.


Informed search strategy--one that uses problem-specific knowledge beyond the definition
of the problem itself-can find solutions more efficiently than an uninformed strategy.

49. What is best first search?


Best-first search is an instance of the general TREE-SEARCH or GRAPH-SEARCH
algorithm in which a node is selected for expansion based on an evaluation function, f (n).

50. What is heuristic function?


A key component of informed searches is heuristic function, denoted by
h(n). h(n) = estimated cost of the cheapest path from node n to a goal node.

51. What is greedy best first search?


Greedy best-first search tries to expand the node that is closest to the goal, on the
grounds that this is likely to lead to a solution quickly. Thus, it evaluates nodes by using
just the heuristic function: f(n) = h(n).

11
52. What is A* search?
It evaluates nodes by combining g(n), the cost to reach the node, and h(n),the cost
to get from the node to the goal.
f(n)=g(n)+h(n).
Since g(n) gives the path cost from the start node to node n, and h(n) is the estimated cost
of the cheapest path from n to the goal, we have
f (n) = estimated cost of the cheapest solution through n

53. What is recursive best first search?


It is a simple recursive algorithm that attempts to mimic the operation of standard
best-first search.
It keeps track of the f-value of the best alternative path available from any
ancestor of the current node. If the current node exceeds this limit, the recursion unwinds
back to the alternative path. As the recursion unwinds, RBFS replaces the f - value of each
node along the path with the best f -value of its children. In this way, RBFS remembers the
f -value of the best leaf in the forgotten sub tree and can therefore decide whether it's
worth reexpanding the sub tree at some later time.

54. Define Tic Tac Toe Problem (Nov’13)


Tic-tac-toe (also known as Noughts and crosses or Xs and Os) is a paper-and-pencil game for two players,
X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their
marks in a horizontal, vertical, or diagonal row wins the game.

55. What is Artificial Intelligence?(Apr-May’14)(Nov-Dec’14)

The theory and development of computer systems able to perform tasks normally requiring
human intelligence, such as visual perception, speech recognition, decision-making, and translation
between languages.

56. List out the advantages of Depth first search (Apr-May’14)

DFS requires less memory, since only the nodes on the current path are stored.

DFS may find the solution without examining much of the search space at all.

12
57. What are the components of Production System?(Nov-Dec’14)

Components of production system are,

 Set of Rules
 Control Stratergy
 Knowledge Database
 Rule Applier

58. Define Constraint Satisfaction.

Constraint satisfaction problems (CSPs) are mathematical problems defined as a set of


objects whose state must satisfy a number of constraints or limitations. CSPs represent the entities
in a problem as a homogeneous collection of finite constraints over variables, which are solved by
constraint satisfaction methods.

59. Define Heuristic function (Apr- May ’15)

A heuristic function is a function that maps from problem state description to the measures
of desirability. It is usually represented as numbers. Well designed heuristic function can play
important part in efficiently guiding a search process towards a solution

Unit I- 11 Marks

1. What is AI , Describe the various categories of AI?


Views of AI fall into four categories:
Thinking humanly Thinking rationally

“The automation of activities that we “ The study of mental faculties


associate with human thinking, activities through the use of computational
such as decision-making, problem models”
solving, learning…”

Acting humanly Acting rationally


“The study of how to make computers do “Computational intelligence is the
things at which, at the moment, people study of the design of intelligent
are better” agents”

Acting humanly: Turing Test


– Turing (1950) "Computing machinery and intelligence":

13

– "Can machines think?" "Can machines behave intelligently?"
– Operational test for intelligent behavior: the Imitation Game

– Predicted that by 2000, a machine might have a 30% chance of fooling a lay person for
5 minutes
– Anticipated all major arguments against AI in following 50 years
– Suggested major components of AI: knowledge, reasoning, language understanding,
learning
Turing test
– Three rooms contain a person, a computer, and an interrogator.
– The interrogator can communicate with the other two by teleprinter.
– The interrogator tries to determine which the person is and which is the machine.
– The machine tries to fool the interrogator into believing that it is the person.
– If the machine succeeds, then we conclude that the machine can think.
– A program that succeeded would need to be capable of:
– natural language understanding & generation;
– knowledge representation;
– learning;
– Automated reasoning.
– ELIZA: A program that simulated a psychotherapist interacting with a patient and
successfully passed the Turing Test.

Thinking humanly: cognitive modeling


– 1960s "cognitive revolution": information-processing psychology
– Requires scientific theories of internal activities of the brain
– How to validate? Requires
– Predicting and testing behavior of human subjects (top-down)
– Or 2) Direct identification from neurological data (bottom-up)
– Both approaches (roughly, Cognitive Science and Cognitive Neuroscience)
14
– Are now distinct from AI
– Try to understand how the mind works. How do we think?
– Two possible routes to find answers:
– By introspection. We figure it out ourselves!
– By experiment. Draw upon techniques of psychology to conduct controlled
experiments. (.Rat in a box.)

Thinking rationally: "laws of thought"


– Aristotle: what are correct arguments/thought processes?
– Several Greek schools developed various forms of logic: notation and rules of
derivation for thoughts; may or may not have proceeded to the idea of mechanization
– Direct line through mathematics and philosophy to modern AI
– Problems:
– Not all intelligent behavior is mediated by logical deliberation
– What is the purpose of thinking? What thoughts should I have?
– Trying to understand how we actually think is one route to AI. But how about how we
should think.
– Use logic to capture the laws of rational thought as symbols.
– Reasoning involves shifting symbols according to well-defined rules (like algebra).
– Result is idealized reasoning.

Acting rationally: rational agent


– Rational behavior: doing the right thing
– The right thing: that which is expected to maximize goal achievement, given the
available information
– Doesn't necessarily involve thinking – e.g., blinking reflex – but thinking should be in
the service of rational action
Rational agents
– An agent is an entity that perceives and acts
– This course is about designing rational agents

– Abstractly, an agent is a function from percept histories to actions:[f: P* A]

15
– For any given class of environments and tasks, we seek the agent (or class of agents)
with the best performance
– Caveat: computational limitations make perfect rationality unachievable
 Design best program for given machine resources

2. Discuss the History of AI

PREHISTORY

– Philosophy Logic, methods of reasoning, mind as physical


system foundations of learning, language,
rationality
– Mathematics Formal representation and proof algorithms,
computation, (un)decidability, (in) tractability,
probability
– Economics utility, decision theory
– Neuroscience physical substrate for mental activity
– Psychology phenomena of perception and motor control,
experimental techniques
– Computer building fast computers
engineering
– Control theory design systems that maximize an objective
function over time
– Linguistics knowledge representation, grammar

History
– The birth of AI (1943 – 1956)
– Pitts and McCulloch (1943): simplified mathematical model of neurons (resting/firing
states) can realize all propositional logic primitives (can compute all Turing
computable functions)
– Allen Turing: Turing machine and Turing test (1950)
– Claude Shannon: information theory; possibility of chess playing computers
– Tracing back to Boole, Aristotle, Euclid (logics, syllogisms)

16
– Early enthusiasm (1952 – 1969)
– 1956 Dartmouth conference
o John McCarthy (Lisp);
o Marvin Minsky (first neural network machine);
o Alan Newell and Herbert Simon (GPS);

– Emphasize on intelligent general problem solving


o GSP (means-ends analysis);
o Lisp (AI programming language);
o Resolution by John Robinson (basis for automatic theorem proving);
o heuristic search (A*, AO*, game tree search)
– Emphasis on knowledge (1966 – 1974)
– domain specific knowledge is the key to overcome existing difficulties
– knowledge representation (KR) paradigms
– declarative vs. procedural representation
– Knowledge-based systems (1969 – 1999)
– DENDRAL: the first knowledge intensive system (determining 3D structures of
complex chemical compounds)
o MYCIN: first rule-based expert system (containing 450 rules for diagnosing
blood infectious diseases) EMYCIN: an ES shell
– PROSPECTOR: first knowledge-based system that made significant profit (geological ES
for mineral deposits)
– AI became an industry (1980 – 1989)
– wide applications in various domains
– commercially available tools
– Current trends (1990 – present)
– more realistic goals
– more practical (application oriented)
– distributed AI and intelligent software agents
– resurgence of neural networks and emergence of genetic algorithms

State of the Art

Autonomous planning and scheduling

17
 Route planning
 Automated scheduling of actions in space craft’s Game playing
 IBM's Deep Blue defeated G.Kasparov (the human world champion) (1997)
 The program FRITZ running on an ordinary PC drawed with V.Kramnik (the
human world champion) (2002) Autonomous control
 Automated car steering
 The Mars mission Diagnosis
 Literature describes a case where a leading expert was convinced by a
computer diagnostic Logistic planning
 Defence Advanced Research Project Agency stated that this single application
more than paid back DARPA's 30-year investment in AI Robotics
 Microsurgery RoboCup . By the year 2050, develop a team of fully autonomous
humanoid robots that can win against the human world soccer champion team

3. What is an intelligent agent and its environments?

Agents
– 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
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
18
– Agent = architecture + program
Vacuum-cleaner world

– Percepts: location and contents, e.g., [A, Dirty]


– Actions: Left, Right, Suck, NoOp
– A vacuum-cleaner agent
– input {tables/vacuum-agent-function-table}

Rational agents
– 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.
– Rational Agent: For each possible percept sequence, a rational agent should select an
action that is expected to maximize its performance measure, given the evidence
provided by the percept sequence and whatever built-in knowledge the agent has.
– Rationality is distinct from omniscience (all-knowing with infinite knowledge)
– Agents can perform actions in order to modify future percepts so as to obtain useful
information (information gathering, exploration)
– An agent is autonomous if its behavior is determined by its own experience (with
ability to learn and adapt)
PEAS
– PEAS: 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:

19
 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
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
20
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 semi dynamic 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.

Chess with Chess without Taxi driving


a clock a clock
Fully observable Yes Yes No
Deterministic Strategic Strategic No
Episodic No No No
Static Semi Yes No
Discrete Yes Yes No
Single agent No No No

– The environment type largely determines the agent design


The real world is (of course) partially observable, stochastic, sequential, dynamic,
continuous, multi-agent

4. Explain Structure of agents and its functions (Nov’13)(Nov-Dec’14)(Nov’15)

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
Drawbacks:

21
– 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


The simplest kind of agent is the simplex reflex agent. These agents select actions on
the basis of the current percept, ignoring the rest of the percept history.

Example: Agent function for vacuum agent

Percept sequence Action

[A, clean] Right

[A,Dirty] Suck

[B,Clean] Left

[B, Dirty] Suck

[A,clean],[A,clean] Right

[A,clean],[A,Dirty] Suck

[A,clean],[A,clean], [A,clean] Right

[A,clean],[A,clean], [A,dirty] Suck

An agent program for this agent is


Function REFLEX-VACUUM-AGENT([location,status]) returns an action

If status=dirty then return suck

Else if location = A then return right

Else if location = B then return left

The vacuum agent program is very small. But some processing is done on the visual input to
establish the condition-action rule. For eg., if car-in-front-is-braking then initiate braking.
The following figure shows how the condition-Action rules allow the agent to make the
connection from percept to action.

Rectangles: Current internal state of the agent’s decision process


Ovals: Background information used in the process

The agent program is given below:

Function SIMPLE-REFLEX-AGENT (percept) returns an action

Static: rules, a set of condition-action rules

State<- INTERPRET-INPUT (percept)

Rule<- RULE-MATCH (state, rules)

Action <- RULE-ACTION [rule]

Return action

23
Function

INTERPRET-INPUT: generates an abstracted description of the current state from the


percept

RULE-MATCH: returns the first rule in the set of rules that matches the given state
description.

This agent will work only if the correct decision can be made Ion the basis of only the current
percept. I.e. only if the environment is fully observable.

Model-based reflex agents


To handle partial observability, the agent should maintain some sort of internal state that
depends on the percept history and thereby reflects at least some of the unobserved aspects
of the current state.

Updating this internal state information requires two kinds of knowledge to be encoded in
the agent program.

o How the world evolves independently of the agent


o How the agent’s actions affect the world.
This knowledge can be implemented in simple Boolean circuits called model of the world. An
agent that uses such a model is called a model-based agent.

The following figure shows the structure of the reflex agent with internal state,
showing how the current percept is combined with the old internal state to generate the
updated description of the current state.

24
The agent program is shown below:
Function REFLEX-AGENT-WITH-STATE (percept) returns an action

Static: state, a description of the current world state

Rules, a set of condition-action rules

Action, the most recent action, initially none

State <- UPDATE-STATE (state, action, percept)

Rule<- RULE-MATCH (state, rules)

Action<- RULE-ACTION [rule]

Return action

UPDATE-STATE: for creating the new internal state description.

Goal-based agents
Here, along with current-state description, the agent needs some sort of goal information
that describes situations that are desirable – for eg, being at the passenger’s destination.

Goal –based agents structure is shown below:

Utility-based agents
Goals alone are not enough to generate high-quality behavior in most environments. A more
general performance measure should allow a comparison of different world states according
to exactly how happy they would make the agent if they could be achieved.

25
A utility function maps a state onto a real number, which describes the associated degree of
happiness. The utility-based agent structure appears in the following figure.

Learning agents
It allows the agent to operate in initially unknown environments and to become more
competent than its initial knowledge alone might allow. A learning agent can be divided into
four conceptual components, as shown in figure:

Learning element: responsible for making improvement

Performance element: responsible for selecting external actions

The learning element uses feedback from the critic on how the agent is doing and determines
how the performance element should be modified to do better in the future. The critic tells
the learning element how well the agent is doing with respect to a fixed performance
standard. The critic is necessary because the percepts themselves provide no indication of
the agent’s success. The last component of the learning agent is the problem generator. It is
responsible for suggesting actions that will lead to new and informative experiences.

26
5. Discuss Problem spaces and search (Apr – May’14)(Nov’15)
Solving problems by searching
 Problem-solving agents
 Problem types
 Problem formulation
 Example problems
 Basic search algorithms
PROBLEM-SOLVING AGENTS
Problem solving agent is a goal-based agent decides what to do by finding sequences
of actions that lead to desirable states. Let us take for an example, an agent in the city of Arad,
Romania, enjoying a touring holiday. Goal formulation, based on the current situation and
the agent’s performance measure, is the first step in problem solving. We will consider a goal
to be a set of world states- exactly those states in which the goal is satisfied.

Problem formulation is the process of deciding what actions and states to consider,
given a goal. Let us assume that the agent will consider actions at the level of driving from
one major town to another. Our agent has now adopted the goal of driving to Bucharest, and
is considering where to go from Arad. There are three roads out of Arad. The agent will not
know which of its possible actions is best, because it does not know enough about the state
that results from taking each action. If the agent has a map, it provides the agent with
information about the states it might get itself into, and the actions it can take.

An agent with several immediate options of unknown value can decide what to do by
first examining different possible sequences of actions that lead to states of known value, and
then choosing the best sequence. The process of looking for such a sequence is called a
search. A search algorithm takes a problem as input and returns a solution in the form of an
action sequence. Once a solution is found, the actions it recommends can be carried out. This
is called the execution phase. The design for such an agent is shown in the following
function:

27
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

Single-state problem formulation


A problem is defined by four items:
– initial state e.g., "at Arad"
– actions or successor function S(x) = set of action–state pairs

e.g., S(Arad) = {<Arad
 Zerind, Zerind>, … }
– goal test, can be
 explicit, e.g., x = "at Bucharest"
 implicit, e.g., Checkmate(x)
– path cost (additive)
 e.g., sum of distances, number of actions executed, etc.
 c(x,a,y) is the step cost, assumed to be ¡Ã 0
– A solution is a sequence of actions leading from the initial state to a goal state
Selecting a state space
– Real world is absurdly complex

state space must be abstracted for problem solving
– (Abstract) state = set of real states
28
– (Abstract) action = complex combination of real actions

 e.g., "Arad Zerind" represents a complex set of possible routes, detours, rest stops,
etc.
– For guaranteed realizability, any real state "in Arad“ must get to some real state "in
Zerind"
– (Abstract) solution =
 set of real paths that are solutions in the real world

– Each abstract action should be "easier" than the original problem


Vacuum world state space graph

 states?
 actions?
 goal test?
 path cost?
Vacuum world state space graph

– states? integer dirt and robot location


– actions? Left, Right, Suck
– goal test? no dirt at all locations
– path cost? 1 per action

29
Example: The 8-puzzle

 states? locations of tiles


 actions? move blank left, right, up, down
 goal test? = goal state (given)
 path cost? 1 per move

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

SEARCHING FOR SOLUTIONS:


Solving the formulated problem can be done by a search through the state space. One of the
search technique is an explicit search tree that is generated by the initial state and the
successor function that together define the state space.

Tree search algorithms


Basic idea
– Offline, simulated exploration of state space by generating successors of already-
explored states (a.k.a.~expanding states)

30
The following figure shows some of the expansions in the search tree for finding a
route from Arad to Bucharest. The root of the search tree is a search node corresponding to
the initial state, Arad. The first step is to test whether this is a goal state. If this is not the goal
state, expand the current state by applying the successor function to the current state,
thereby generating a new set of states.

Tree search example

The choice of which state to expand is determined by the search strategy. The general tree-
search algorithm is given below:

31
Assume that a node is a data structure with five components:
 STATE: the state in the state space to which the node corresponds
 PARENT-NODE: the node in the search tree that generated this node
 ACTION: the action that was applied to the parent to generate the node

 PATH-COST: the cost, traditionally denoted by g(n), of the path from the initial state
to the node, as indicated by the parent pointers; and
 DEPTH: the number of steps along the path from the initial state.

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 node data structure is depicted in the following figure:

The collection of nodes is implemented as a queue. The operations on a queue are as follows:
 MAKE-QUEUE(element….) creates a queue with the given element(s)
 EMPTY?(queue)returns true only if there are no more elements in the queue
 FIRST(queue) returns the first element of the queue
 REMOVE-FIRST (queue) returns FIRST (queue) and removes it from the queue.

 INSERT (element, queue) inserts an element into the queue and returns the resulting
queue.
 INSERT-ALL (elements, queue) inserts a set of elements into the queue and returns
the resulting queue.
With these definitions, the more formal version of the general tree search algorithm is
shown below:

32
– The Expand function creates new nodes, filling in the various fields and using the
Successor Fn of the problem to create the corresponding states.
Measuring problem-solving performance
– 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 •‡)

6. WHAT IS UNINFORMED SEARCH(OR)HEURISTIC SEARCH STRATEGIES?


EXPLAIN(NOV-DEC’14)(NOV’15)
– Uninformed or blind search strategies use only the information available in the
problem definition. Strategies that know whether one non-goal state is “more
promising” than another are called informed search or heuristic search strategies.
– Breadth-first search
– Uniform-cost search
– Depth-first search
– Depth-limited search
– Iterative deepening search
33
Breadth-first search
Breadth first search is a simple strategy in which the root node is expanded first, then
all the successors of the root node are expanded next, then their successors, and so on. All the
nodes are expanded at a given depth in the search tree before any nodes at the next level are
expanded.

Algorithm:

1. Place the starting node s on the queue.


2. If the queue is empty, return failure and stop.
3. If the first element on the queue is a goal node g, return success and stop. Otherwise,
4. Remove and expand the first element from the queue and place all the children at the
end of the queue in any order.
5. Return to step 2.
– Implementation:
 By calling TREE-SEARCH with an empty fringe

fringe is a FIFO queue, i.e., new successors go at end
The following figure shows the progress of the search on a simple binary tree.

Figure: Breadth first search on a simple binary tree. At each state, the node to be expanded
next is indicated by a marker.

Properties of breadth-first search


– Complete? Yes (if b is finite)
– If the shallowest goal node is at some finite depth d, BFS will eventually find it after
expanding all shallower nodes (b is a branching factor)

– Time? 1+b+b2+b3+… +bd + b(bd-1) = O(bd+1)


– Space? O(bd+1) (keeps every node in memory)
– We consider a hypothetical state space where every state has b successors. The
root of the search tree generates b nodes at the first level, each of which generates

34
2
b more nodes, for a total of b at the second level, and so on. Now suppose that the
solution is at depth d.

– Optimal? Yes (if cost = 1 per step)


– BFS is optimal if the path cost is a nondecreasing function of the depth of the node.
– Space is the bigger problem (more than time)
Uniform-cost search
BFS is optimal when all step costs are equal, because it always expands the shallowest
unexpanded node. Instead of expanding the shallowest node, Uniform-cost search expands
the node n with the lowest path cost.

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
– Implementation:
– fringe = LIFO queue, i.e., put successors at front

Algorithm:

1. Place the starting node s on the queue.


2. If the queue is empty, return failure and stop.
3. If the first element on the queue is a goal node g, return success and stop. Otherwise,
4. Remove and expand the first element, and place the children at the front of the queue
(in any order).
5. Return to step 2.
The progress of the search is illustrated in the following figure:

35
Figure: DFS on a binary tree. Nodes that have been expanded and have no descendants in
the fringe can be removed from memory; these are shown in black. Nodes at depth 3 are
assumed to have no successors and M is the only goal node.

Properties of depth-first search


– Complete? No: fails in infinite-depth spaces, spaces with loops
– Modify to avoid repeated states along path
36

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
The problem of unbounded trees can be alleviated by supplying DFS with a pre-determined
depth limit.

= depth-first search with depth limit l, i.e., nodes at depth l have no successors

l
Depth-limited search will also be nonoptimal if we choose l<d. Its time complexity is O(b )
and its space complexity is O(bl).

Recursive implementation:

Depth-limited search can terminate with two kinds of failure: the standard failure
value indicates no solution; the cutoff value indicates no solution within the depth limit.

Iterative deepening search


Iterative deepening search is a strategy used in combination with DFS that finds the best
depth limit. It does this by gradually increasing the limit - first 0, then 1, then 2 and so on;
until a goal is found. This will occur when the depth limit reaches d, the depth of the
shallowest goal node. The algorithm is shown below:

37
Iterative deepening combines the benefits of DFS and BFS. Like DFS, its memory
requirements are very modest: O(bd). Like BFS, it is complete when the branching factor is
finite and optimal when the path cost is a non-decreasing function of the depth of the node.

The following figure shows four iterations of ITERATIVE-DEEPENING SEARCH on a binary


search tree, where the solution is found on the fourth iteration.

38
 Number of nodes generated in a depth-limited search to depth d with branching factor b:
0 1 2 d-2 d-1 d
NDLS = b + b + b + … + b + b + b
 Number of nodes generated in an iterative deepening search to depth d with branching
factor b:
0 1 2 d-2 d-1 d
NIDS = (d+1)b + d b^ + (d-1)b^ + … + 3b +2b + 1b

For b = 10, d = 5,

NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111

 NIDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456


 Overhead = (123,456 - 111,111)/111,111 = 11%

Properties of iterative deepening search


– Complete? Yes
– Time? (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd)
– Space? O(bd)
– Optimal? Yes, if step cost = 1

39
Summary of algorithms

Bidirectional Search

The idea behind bi-directional search is to run two simultaneous searches – one forward
from the initial state and the other backward from the goal, stopping when the two searches
meet in the middle.

Bidirectional search is implemented by having one or both of the searches check each node
before it is expanded to see if it is in the fringe of the other search tree; if so, a solution has
been found. Checking a node for membership in the other search tree can be done in constant
d/2
time with a hash table, so the time complexity of bi-directional search is O(b ). At least one
of the search trees must be kept in memory so that the membership check can be done, hence
d/2
the space complexity is O(b ) which is the weakness of the algorithm. The algorithm is
complete and optimal if both searches are breadth-first;

7. Discuss Heuristic Search techniques - Best-first search (Nov’13)(Nov’15)

INFORMED SEARCH ALGORITHMS


Strategies that know whether one non-goal state is “more promising” than another are called
informed search or heuristic search strategies informed search strategy is the one that
uses problem-specific knowledge beyond the definition of the problem itself.

– Best-first search
– Greedy best-first search
– A* search
– Heuristics
– Local search algorithms
– Hill-climbing search

40
– Simulated annealing search
– Local beam search
– Genetic algorithms

Review: Tree search


 A search strategy is defined by picking the order of node expansion

Best-first search
Best first search is an instance of the general TREE-SEARCH or GRAPH-SEARCH algorithm in
which a node is selected for expansion based on an evaluation function f (n). The node with
the lowest evaluation is selected for expansion, because the evaluation measures distance to
the goal. It can be implemented using a priority queue, a data structure that will maintain the
fringe in ascending order of f – values.

Algorithm:

1. Place the starting node s on the queue.


2. If the queue is empty, return failure and stop.
3. If the first element on the queue is a goal node g, return success and stop. Otherwise,
4. Remove the first element from the queue, expand it and compute the estimated goal
distances for each child. Place the children on the queue (at either end) and arrange
all queue elements in ascending order corresponding to goal distance from the front
of the queue.
5. Return to step 2.
Best-first search uses different evaluation functions. A key component of these algorithms is
a heuristic function, denoted h (n)

h (n)= estimated cost of the cheapest path from node n to a goal node.

For example, in Romania, one might estimate the cost of the cheapest path from Arad to
Bucharest via the straight-line distance from Arad to Bucharest which is shown below:

41
Romania with step costs in km

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

The progress of a greedy best-first search using hSLD to find a path from Arad to Bucharest is
shown in the following figure:

42
The first node to be expanded from Arad will be Sibiu, because it is closer to
Bucharest than either Zerind or Timisoara. The next node to be expanded will be Fagaras,
because it is closest. Fagaras in turn generates Bucharest, which is the goal. Greedy best-first
search using hSLD finds a solution without ever expanding a node that is not on the solution
path; hence its search cost is minimal.

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

*
A search: Minimizing the total estimated solution cost
– Idea: avoid expanding paths that are already expensive
– Evaluation function f(n) = g(n) + h(n)
– g(n) = cost so far to reach n
– h(n) = estimated cost from n to goal
– f(n) = estimated total cost of path through n to goal
Algorithm:

1. Place the starting node s on open.


2. If open is empty, stop and return failure.
*
3. Remove from open the node n that has the smallest value of f (n). If the node is a goal
node, return success and stop. Otherwise,

43

4. Expand n, generating all of its successors n and place n on closed. For every successor
’ ’ * ’
n , if n is not already on open or closed attach a back-pointer to n, compute f (n ) and
place it on open.

5. Each n that is already on open or closed should be attached to back-pointers which
* ’
reflect the lowest g (n’) path. If n was on closed and its pointer was changed, remove
it and place it on open.
6. Return to step 2.
*
The following figure shows an A tree search for Bucharest.

44
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: hSLD(n) (never overestimates the actual road distance)
– Theorem: If h(n) is admissible, A* using TREE-SEARCH is optimal

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

45
• 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
• 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) > f(G) from above


• h(n) <= h^*(n) since h is admissible
*
• g(n) + h(n) <= g(n) + h (n)
• f(n) <= f(G)

*
Hence f(G2) > f(n), and A will never select G2 for expansion

Consistent heuristics
– 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

46
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

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

Heuristic Functions

47
E.g., for the 8-puzzle:
– h1(n) = number of misplaced tiles
– h2(n) = the sum of the distances of the tiles from their goal positions. This is sometimes
called the city block distance or Manhattan distance
(i.e., no. of squares from desired location of each tile)

• h1(S) = ? 8, 8 tiles are out of position, so the start state would have h 1=8. h1 is an
admissible heuristic, because it is clear that any tile that is out of place must be moved at
least once.
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18 . h2 is also admissible, because all any move can do is
move one tile one step closer to the goal.

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

Local search algorithms


– 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
48
– 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

To understand local search, we will find it very useful to consider the state space landscape
as shown in the following figure:

A landscape has both “location” and “elevation”. If elevation corresponds to an objective


function, then the aim is to find the highest peak - a global maximum. A complete local search
algorithm always finds a goal if one exists; an optimal algorithm always finds a global
minimum/maximum.

Hill-climbing search
– "Like climbing Everest in thick fog with amnesia"
The hill-climbing search algorithm is shown in the following function. It is simply a loop that
continually moves in the direction of increasing value- that is, uphill. It terminates when it
reaches a “peak” where no neighbor has a higher value.

49
Problem: depending on initial state, can get stuck in local maxima

Hill-climbing search: 8-queens problem

• h = number of pairs of queens that are attacking each other, either directly or
indirectly
• h = 17 for the above state

A local minimum in the 8-queens state space; the state has h=1 but every successor has a
higher cost.

50
Hill climbing is sometimes called greedy local search because it grabs a good neighbour state
without thinking ahead about where to go next. Hill climbing often gets stuck for the
following reasons:

 Local Maxima: a local maximum is a peak that is higher than each of its neighboring
states, but lower than the global maximum.

 Ridges: Ridges result in a sequence of local maxima that is very difficult for greedy
algorithms to navigate.

 Plateaux: a plateau is an area of the state space landscape where the evaluation
function is flat. It can be a flat local maximum, from which no uphill exit exists, or a
shoulder, from which it is possible to make progress.
Simulated annealing search
– Idea: escape local maxima by allowing some "bad" moves but gradually decrease their
frequency
A hill climbing algorithm that never makes “downhill” moves towards states with lower
value is guaranteed to be incomplete, because it can get stuck on a local maximum. In
contrast, a purely random walk – that is, moving to a successor chosen uniformly at random
from the set of successors – is complete, but extremely inefficient. Simulated annealing is the
combination of hill climbing with a random walk.

The innermost loop of the simulated-annealing algorithm shown below is quite similar to hill
climbing.

Instead of picking the best move, however, it picks a random move.


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

51
– Widely used in VLSI layout, airline scheduling, etc.

8. What is Problem Reduction? Explain it with AO* Algorithm. (Apr- May’14)

When a problem can be divided into a set of sub problems, where each sub problem
can be solved separately and a combination of these will be a solution, AND-OR graphs or
AND - OR trees are used for representing the solution. The decomposition of the problem or
problem reduction generates AND arcs. One AND are may point to any number of successor
nodes. All these must be solved so that the arc will rise to many arcs, indicating several
possible solutions. Hence the graph is known as AND - OR instead of AND. Figure shows an
AND - OR graph.

An algorithm to find a solution in an AND - OR graph must handle AND area


appropriately. A* algorithm cannot search AND - OR graphs efficiently. This can be
understand from the give figure.

FIGURE : AND - OR graph

In figure (a) the top node A has been expanded producing two area one leading to B
and leading to C-D. The numbers at each node represent the value of f ' at that node (cost of
getting to the goal state from current state). For simplicity, it is assumed that every operation
(i.e. applying a rule) has unit cost, i.e., each are with single successor will have a cost of 1 and
each of its components. With the available information till now, it appears that C is the most
52
promising node to expand since its f ' = 3 , the lowest but going through B would be better
since to use C we must also use D' and the cost would be 9(3+4+1+1). Through B it would be
6(5+1).

Thus the choice of the next node to expand depends not only n a value but also on whether
that node is part of the current best path form the initial mode. Figure (b) makes this clearer.
In figure the node G appears to be the most promising node, with the least f ' value. But G is
not on the current beat path, since to use G we must use GH with a cost of 9 and again this
demands that arcs be used (with a cost of 27). The path from A through B, E-F is better with a
total cost of (17+1=18). Thus we can see that to search an AND-OR graph, the following three
things must be done.

1. Traverse the graph starting at the initial node and following the current best path, and
accumulate the set of nodes that are on the path and have not yet been expanded.

2. Pick one of these unexpanded nodes and expand it. Add its successors to the graph and
computer f ' (cost of the remaining distance) for each of them.

3. Change the f ' estimate of the newly expanded node to reflect the new information
produced by its successors. Propagate this change backward through the graph. Decide
which of the current best path.

The propagation of revised cost estimation backward is in the tree is not necessary in
A* algorithm. This is because in AO* algorithm expanded nodes are re-examined so that the
current best path can be selected. The working of AO* algorithm is illustrated in figure as
follows:

53
Referring the figure. The initial node is expanded and D is marked initially as promising node.
D is expanded producing an AND arc E-F. f ' value of D is updated to 10. Going backwards we
can see that the AND arc B-C is better. It is now marked as current best path. B and C have to
be expanded next. This process continues until a solution is found or all paths have led to
dead ends, indicating that there is no solution. An A* algorithm the path from one node to the
other is always that of the lowest cost and it is independent of the paths through other nodes.

The algorithm for performing a heuristic search of an AND - OR graph is given below.
Unlike A* algorithm which used two lists OPEN and CLOSED, the AO* algorithm uses a single
structure G. G represents the part of the search graph generated so far. Each node in G points
down to its immediate successors and up to its immediate predecessors, and also has with it
the value of h' cost of a path from itself to a set of solution nodes. The cost of getting from the
start nodes to the current node "g" is not stored as in the A* algorithm. This is because it is
not possible to compute a single such value since there may be many paths to the same state.
In AO* algorithm serves as the estimate of goodness of a node. Also a there should value
called FUTILITY is used. The estimated cost of a solution is greater than FUTILITY then the
search is abandoned as too expansive to be practical.

For representing above graphs AO* algorithm is as follows

AO* ALGORITHM:

1. Let G consists only to the node representing the initial state call this node INTT. Compute
h' (INIT).

2. Until INIT is labeled SOLVED or hi (INIT) becomes greater than FUTILITY, repeat the
following procedure.

(I) Trace the marked arcs from INIT and select an unbounded node NODE.

(II) Generate the successors of NODE. If there are no successors then assign FUTILITY as h'
(NODE). This means that NODE is not solvable. If there are successors then for each
one
called SUCCESSOR, that is not also an ancestor of NODE do the following

(a) add SUCCESSOR to graph G

54
(b) if successor is not a terminal node, mark it solved and assign zero to its h '
value.

(c) If successor is not a terminal node, compute it h' value.

(III) Propagate the newly discovered information up the graph by doing the following. Let S
be a
set of nodes that have been marked SOLVED. Initialize S to NODE. Until S is empty repeat
the following procedure;

(a) Select a node from S call if CURRENT and remove it from S.

(b) Compute h' of each of the arcs emerging from CURRENT, Assign minimum h'
to CURRENT.

(c) Mark the minimum cost path an s the best out of CURRENT.

(d) Mark CURRENT SOLVED if all of the nodes connected to it through the new
marked are have been labeled SOLVED.

(e) If CURRENT has been marked SOLVED or its h ' has just changed, its new status
must be propagate backwards up the graph. Hence all the ancestors of CURRENT are
added to S.

9. What is Constraint satisfaction? Explain (Nov’13)

A Constraint Satisfaction Problem (or CSP) is defined by a set of variables, X1, X2,
….Xn, and a set of constraints C1,C2,…,Cm. Each variable Xi has a nonempty domain D, of
possible values. Each constraint Ci involves some subset of variables and specifies the
allowable combinations of values for that subset.

A State of the problem is defined by an assignment of values to some or all of the


variables, {Xi = vi, Xj = vj,…}. An assignment that does not violate any constraints is called a
consistent or legal assignment. A complete assignment is one in which every variable is
mentioned, and a solution to a CSP is a complete assignment that satisfies all the constraints.

Some CSPs also require a solution that maximizes an objective function.

55
Example for Constraint Satisfaction Problem:

The below Figure shows the map of Australia showing each of its states and territories. We
are given the task of coloring each region either red, green, or blue in such a way that the
neighboring regions have the same color. To formulate this as CSP, we define the variable to
be the regions: WA, NT, Q, NSW, V, SA, and T. The domain of each variable is the set {red,
green, blue}.The constraints require neighboring regions to have distinct colors; for example,
the allowable combinations for WA and NT are the pairs

{(red,green),(red,blue),(green,red),(green,blue),(blue,red),(blue,green)}.

The constraint can also be represented more succinctly as the inequality WA not = NT,
provided the constraint satisfaction algorithm has some way to evaluate such expressions.)
There are many possible solutions such as

{ WA = red, NT = green = red, NSW = green, V = red ,SA = blue, T = red}.

Figure: The map coloring problem represented as a constraint graph.

CSP can be viewed as a standard search problem as follows:


 Initial state: the empty assignment {}, in which all variables are unassigned.

 Successor function: a value can be assigned to any unassigned variable, provided


that it does not conflict with previously assigned variables.
 Goal test: the current assignment is complete.
 Path cost: a constant cost (E.g., 1) for every step.

56
Every solution must be a complete assignment and therefore appears at depth n if there are
n variables.

Depth first search algorithms are popular for CSPs

Varieties of CSPs

(i) Discrete variables

Finite domains

The simplest kind of CSP involves variables that are discrete and have finite domains.
Map coloring problems are of this kind. The 8-queens problem can also be viewed as finite-
domain CSP, where the variables Q1,Q2,…..Q8 are the positions each queen in columns 1,….8
and each variable has the domain {1,2,3,4,5,6,7,8}. If the maximum domain size of any
n
variable in a CSP is d, then the number of possible complete assignments is O(d ) – that is,
exponential in the number of variables. Finite domain CSPs include Boolean CSPs, whose
variables can be either true or false.

Infinite domains

Discrete variables can also have infinite domains – for example, the set of integers or the set
of strings. With infinite domains, it is no longer possible to describe constraints by
enumerating all allowed combination of values. Instead a constraint language of algebraic
inequalities such as

Startjob1 + 5 <= Startjob3.

(ii) CSPs with continuous domains

CSPs with continuous domains are very common in real world. For example, in operation
research field, the scheduling of experiments on the Hubble Telescope requires very precise
timing of observations; the start and finish of each observation and maneuver are
continuous-valued variables that must obey a variety of astronomical, precedence and power
constraints. The best known category of continuous-domain CSPs is that of linear
programming problems, where the constraints must be linear inequalities forming a convex
region. Linear programming problems can be solved in time polynomial in the number of
variables.

57
Varieties of constraints:

(i) Unary constraints involve a single variable.

Example: SA # green

(ii) Binary constraints involve paris of variables.

Example: SA # WA

(iii) Higher order constraints involve 3 or more variables.

Example: crypt arithmetic puzzles.

Backtracking Search for CSPs


The term backtracking search is used for depth-first search that chooses values for one
variable at a time and backtracks when a variable has no legal values left to assign. The
algorithm is shown in figure 2.17.

Figure. A simple backtracking algorithm for constraint satisfaction problem. The algorithm is
modeled on the recursive depth-first search

10. What is Means Ends Analysis? Explain

Most of the search strategies either reason forward or backward however, often a
mixture of the two directions is appropriate. Such mixed strategy would make it possible to
solve the major parts of problem first and solve the smaller problems the arise when
combining them together. Such a technique is called "Means - Ends Analysis".

58
The means ends analysis process centers around finding the difference between
current state and goal state. The problem space of means - ends analysis has an initial state
and one or more goal state, a set of operate with a set of preconditions their application and
difference functions that computes the difference between two state a(i) and s(j). A problem
is solved using means - ends analysis by

1. Computing the current state s1 to a goal state s2 and computing their difference D12.

2. Satisfy the preconditions for some recommended operator op is selected, then to reduce
the difference D12.

3. The operator OP is applied if possible. If not the current state is solved a goal is created
and means- ends analysis is applied recursively to reduce the sub goal.

4. If the sub goal is solved state is restored and work resumed on the original problem.

Means- ends analysis I useful for many human planning activities. Consider the example of
planning for an office worker. Suppose we have a different table of three rules:

1. If in our current state we are hungry, and in our goal state we are not hungry, then either
the "visit hotel" or "visit Canteen” operator is recommended.

2. If our current state we do not have money, and if in your goal state we have money, then
the "Visit our bank" operator or the "Visit secretary" operator is recommended.

3. If our current state we do not know where something is , need in our goal state we do
know, then either the "visit office enquiry" , "visit secretary" or "visit coworker " operator is
recommended.

59
QUESTION BANK & UNIVERSITY QUESTIONS

11 MARKS

1. What is an AI technique? Discuss the problems coming under the purview of AI.
2. Explain the heuristic search techniques in detail.
3. (a) What are the four basic types of agent program in any intelligent system?
(b) Explain how did you convert them into learning agents]
4. Explain the following uninformed search strategies with examples.(Nov-Dec’14)
(Nov’15)( Q. No. 6)
a. Breadth First Search (Nov’13)
b. Uniform Cost Search
c. Depth First Search
d. Depth Limited Search
5. (a) Explain A* algorithm in detail.
(b) Discuss eight queens problem in detail.
6. (a) Discuss in detail about DFS and BFS with suitable example. (Nov’13)( Q.
No. 7)
(b) Write in detail about History of AI.
7. Define AI. Explain foundations of AI in detail
8. Explain the structure of agents in detail.
9. Discuss the structure of AI agents and their functions. (Nov’13)(Nov-Dec’14)(Nov’15)
( Q. No. 4)
10. Explain in detail about Best-First search technique.(Nov’15)( Q. No. 7)
11. State AO* algorithm and describe in detail. (Apr-May’14)( Q. No. 8)
12. How do you define a problem as a state space search? Explain in detail with an example.
(Apr-May’14)(Nov’15)( Q. No. 5)
13. Explain constraint satisfaction in detail.(Nov’13)( Q. No. 9)

60

You might also like