bcs3 m3m3
bcs3 m3m3
bcs3 m3m3
➢ Chapter 7-7.1,7.2,7.3,7.4
Reference:
Textbooks 1. Stuart J. Russell and Peter Norvig, Artificial Intelligence, 3rd Edition,
Pearson,2015.
Module 3
3.5 INFORMED SEARCH STRATEGIES
Informed search strategy is one that uses problem-specific knowledge beyond the definition of the
problem itself—can find solutions more efficiently than can an uninformed strategy. The general approach
we consider is called best-first search. Best-first search is an instance of the general algorithm in which
a node is selected for expansion based on an evaluation function, f(n). The evaluation function is
construed as a cost estimate, so the node with the lowest evaluation is expanded first. The implementation
of best-first graph search is identical to that for uniform-cost search except for the use of f instead of g to
order the priority queue.
The choice of f determines the search strategy. Most best-first algorithms include as a component of a
heuristic function, denoted h(n): h(n) = estimated cost of the cheapest path from the state at node n to a
goal state.
• A search strategy that uses problem-specific knowledge can find solutions more efficientlythan an
uninformed strategy. We use best-first search as general approach. A node is selected for expansion based
on an evaluation function f(n).
• Informed search algorithms include a heuristic function h(n) as part of f(n).
• Often f(n) = g(n) + h(n)
• h(n) = estimate of the cheapest cost from the state at node n to a goal state; h(goal) = 0.
2.Whenever A* selects a node n for expansion, the optimal path to that node has been
found. otherwise there must be another frontier node n’ on the optimal path from start
node to n; as f is nondecreasing along any path, n’ would have lower f-cost than n and
would have been selected first.
Contours in State Space:
• As f-costs are nondecreasing along any path we can draw contours in the state space.
• See figure 3.25 on the following page
• With uniform-cost search (A* with h(n) = 0), contours are circular around the start state.
• With more accurate heuristics, the bands will stretch towards the goal state and become more narrow
• If C* is the cost of the optimal solution path, then
• A* expands all nodes with f(n) < C*
• A* may expand some nodes with f(n) = C* before finding the goal state.
• Completeness requires that there are only finitely many nodes with cost less than or equal to C*, which is
true if all step costs exceed some finite ε and if b is finite.
A* is Optimally Efficient
• A* is optimally efficient for any given consistent heuristic, i.e. no other optimal algorithm is
guaranteed to expand fewer nodes than A* (except possibly for nodes with f(n) = C*).
• This is because any algorithm that does not expand all nodes with f(n) < C* may miss the optimal
solution.
• So A* is complete, optimal and optimally efficient, but it still is not the solution to all search
problems:
• As A* keeps all generated solutions in memory it runs out of space long before it runs out of time.
•Simple recursive algorithm that tries to mimic the operation of standard best-first search in linear space .
• It is similar to recursive DFS, but uses a variable f_limit to keep track of the best alternative path available
from any ancestor of the current node.
• If the current node exceeds f_limit, the recursion unwinds back to the alternative path. Then, RBFS
replaces the f-value of each node on the path with a backed-up value, the best value of its children.
• In this way, RBFS remembers the f-value of the best leaf in the forgotten subtree and may decide to re-
expand it later.
Simplified Memory-bounded A* (SMA*)
•IDA* and RBFS use too little memory
• IDA* retains only 1 number between iterations (f-cost limit)
• RBFS retains more information, but uses only linear space
• SMA* proceeds just like A*, expanding the best leaf until memory is full. Then it must drop an old node.
• SMA* always drops the worst leaf node (highest fvalue). (In case of ties with same f-value, SMA* expands
the newest leaf and deletes the oldest leaf)
• Like RBFS, SMA* then backs up the value of the forgotten node to its parent. In this way the ancestor of
a forgotten subtree knows the quality of the best path in that subtree.
• The performance of heuristic search algorithms depends on the quality of their heuristic function.
• Methods to construct good heuristics are: relaxing the problem definition, using a pattern DB with
precomputed solution costs, or automated learning from experience.
7.1 KNOWLEDGE-BASED AGENTS
Logical agents are always definite. each proposition is either true/false or unknown (agnostic).
Knowledge representation language - a language used to express knowledge about the world.
• Declarative approach - language is designed to be able to easily express knowledge for the
world the language is being implemented for.
• Procedural approach - encodes desired behaviours directly in program code.
• Sentence - a statement expressing a truth about the world in the knowledge representation
language
Knowledge Base (KB) - a set of sentences describing the world
• Background knowledge - initial knowledge in KB
• Knowledge level -we only need to specify what the agent knows and what its goals are in order to
specify its behaviour
• Tell(P) - function that adds knowledge P to the KB
• Ask(P) - function that queries the agent about the truth of P.
• Inference -the process of deriving new sentences from the knowledge base
✓ When the agent draws a conclusion from available information, it is guaranteed to be
correct if the available information is correct.
The KB is false in models that contradict what the agent knows— for example, the KB is false in any model
in which [1,2] contains a pit, because there is no breeze in [1,1]. There are in fact just three models in which
the KB is true, and these are shown surrounded by a solid line in Figure 7.5. Now let us consider two
possible conclusions.
If KB is true in the real world then any sentence α derived from KB by a sound inference procedure is also
true in the real world. So, while an inference process operates on “syntax”—internal physical configurations
such as bits in registers or patterns of electrical blips in brains—the process corresponds to the real-world
relationship whereby some aspect of the real world is the case6 by virtue of other aspects of the real world
being the case. This correspondence between world and representation is illustrated in Figure 7.6.
7.4 PROPOSITIONAL LOGIC: A VERY SIMPLE LOGIC
7.4.1 Syntax
7.4.2 Semantics
7.4.3 A simple knowledge base
Now that we have defined the semantics for propositional logic, we can construct a knowledge base for the wumpus
world. We focus first on the immutable aspects of the wumpus world, leaving the mutable aspects for a later section.
For now, we need the following symbols for each [x, y] location: