Professional Documents
Culture Documents
Artificial Intelligence and Machine Learning (18Cs71) : Dr. Venkatesh Shankar Be.,M.Tech., Phd. Yit, Mangalore
Artificial Intelligence and Machine Learning (18Cs71) : Dr. Venkatesh Shankar Be.,M.Tech., Phd. Yit, Mangalore
Module 1
• Examples
• Both questions 1 and 2 generate answers via a new coat and a red
coat respectively.
• Question 3 cannot be answered, because there is no direct response.
• Method 3-------- Data Structures
• World model contains knowledge about objects, actions and
situations that are described in the input text. This structure is
used to create integrated text from input text.
• The diagram shows how the system’s knowledge of shopping
might be represented and stored. This information is known as a
script and in this case is a shopping script figure 1.1
• Convert the question to a structured form using both the
knowledge contained in Method 2 and the World model,
generating even more possible structures, since even more
knowledge is being used. Sometimes filters are introduced to
prune the possible answers.
• To answer a question, the scheme followed is: Convert the
question to a structured form as before but use the world model
to resolve any ambiguities that may occur. The structured form is
matched against the text and the requested segments of the
question are returned.
• Both questions 1 and 2 generate answers, as in the previous
program. Question 3 can now be answered. The shopping
script is instantiated and from the last sentence the path the
one used to form the representation. ‘M’ is bound to the red
coat-got home. ‘Rani buys a red coat’ comes from the
integrated text generates that she bought a red coat.
PROBLEMS, PROBLEM SPACES AND SEARCH
• To solve the problem of building a system you should take the following steps:
1. Define the problem accurately including detailed specifications and what
constitutes a suitable solution.
2. Scrutinize the problem carefully, for some features may have a central affect on
the chosen method of solution.
3. Segregate and represent the background knowledge needed in the solution of
the problem.
4. Choose the best solving techniques for the problem to solve a solution.
• Problem solving is a process of generating solutions from observed data.
• a ‘problem’ is characterized by a set of goals,
• a set of objects, and
• a set of operations.
• These could be ill-defined and may evolve during problem solving.
• • A ‘problem space’ is an abstract space.
A problem space encompasses all valid states that can be generated
by the
application of any combination of operators on any combination of
objects.
The problem space may contain one or more solutions. A solution is a
combination of operations and objects that achieve the goals.
• A ‘search’ refers to the search for a solution in a problem space.
Search proceeds with different types of ‘search control strategies’.
The depth-first search and breadth-first search are the two common
search
strategies.
AI - General Problem Solving
• Problem solving has been the key area of concern for Artificial Intelligence.
Problem solving is a process of generating solutions from observed or given data.
It is however not always possible to use direct methods (i.e. go directly from data
to solution). Instead, problem solving often needs to use indirect or model based
methods.
• General Problem Solver (GPS) was a computer program created in 1957 by
Simon and Newell to build a universal problem solver machine. GPS was based on
Simon and Newell’s theoretical work on logic machines. GPS
• To build a system to solve a particular problem, we need to:
Define the problem precisely – find input situations as well as final situations for
an acceptable solution to the problem
Analyze the problem
Isolate and represent task knowledge necessary to solve the problem
Choose the best problem-solving technique(s) and apply to the particular problem
Problem definitions
• A problem is defined by its ‘elements’ and their ‘relations’. To provide a
formal description of a problem, we need to do the following:
a. Define a state space that contains all the possible configurations of the
relevant objects, including some impossible ones.
b. Specify one or more states that describe possible situations, from which
the problem solving process may start. These states are called initial
states.
c. Specify one or more states that would be acceptable solution to the
problem.
These states are called goal states.
• To simplify search algorithms, it is often convenient to logically and
programmatically represent a problem space as a tree. A tree usually
decreases the complexity of a search at a cost. Here, the cost is due to
duplicating some nodes on the tree that were linked numerous times in the
graph, e.g. node B and node D.
• A tree is a graph in which any two vertices are connected by exactly one
path. Alternatively, any connected graph with no cycles is a tree.
• Problem solving:
• The term, Problem Solving relates to analysis in AI. Problem solving may
be characterized as a systematic search through a range of possible
actions to reach some predefined goal or solution. Problem-solving
methods are categorized as special purpose and general purpose.
f=g+h
• Traditionally this has been represented by the letters f, g and h. 'g' is the sum of
all the costs it took to get here, 'h' is our heuristic function, the estimate of what
it will take to get to the goal. 'f' is the sum of these two. We will store each of
these in our nodes.
• Using the f, g and h values the A* algorithm will be directed, subject to
conditions we will look at further on, towards the goal and will find it in the
shortest route possible.
• So far we have looked at the components of the A*, let's see how they all fit
together to make the algorithm :
Advantages:
• It is complete and optimal.
• It is the best one from other techniques. It is used to solve very complex
problems.
• It is optimally efficient, i.e. there is no other optimal algorithm guaranteed to
expand fewer nodes than A*.
Disadvantages:
• This algorithm is complete if the branching factor is finite and every action has
fixed cost.
• The speed execution of A* search is highly dependant on the accuracy of the
heuristic algorithm that is used to compute h (n).
AO* Search: (And-Or) Graph
• AO* is best algorithm for solving cyclic AND-OR Graph
• The Depth first search and Breadth first search given earlier for OR trees
or graphs can be easily adopted by AND-OR graph. The main difference
lies in the way termination conditions are determined, since all goals
following an AND nodes must be realized; where as a single goal node
following an OR node will do. So for this purpose we are using AO*
algorithm.
Like A* algorithm here we will use two arrays and one heuristic function.
OPEN:
• It contains the nodes that has been traversed but yet not been marked
solvable or unsolvable. CLOSE:
• It contains the nodes that have already been processed
• Algorithm:
• Step 1: Place the starting node into OPEN.
• Step 2: Compute the most promising solution tree say T0.
• Step 3: Select a node n that is both on OPEN and a member of T0.
Remove it from OPEN and place it in CLOSE
• Step 4: If n is the terminal goal node then leveled n as solved and
leveled all the ancestors of n as solved. If the starting node is
marked as solved then success and exit.
• Step 5: If n is not a solvable node, then mark n as unsolvable. If
starting node is marked as unsolvable, then return failure and exit.
• Step 6: Expand n. Find all its successors and find their h (n) value,
push them into OPEN.
• Step 7: Return to Step 2.
• Step 8: Exit.
• Advantages:
• It is an optimal algorithm.
• If traverse according to the ordering of nodes. It can be used for both OR and AND
graph.
• Disadvantages:
• Sometimes for unsolvable nodes, it can’t find the optimal path. Its complexity is
than other algorithms.
• PROBLEM REDUCTION
• Problem Reduction with AO* Algorithm.
• 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.
• 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
(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
• AO* Search Procedure.
• 1. Place the start node on open.
• 2. Using the search tree, compute the most promising solution tree TP .
• 3. Select node n that is both on open and a part of tp, remove n from
open and place it no closed.
• 4. If n is a goal node, label n as solved. If the start node is solved, exit with
success where tp is the solution tree, remove all nodes from open with a
solved ancestor.
• 5. If n is not solvable node, label n as unsolvable. If the start node is
labeled as unsolvable, exit with failure. Remove all nodes from open ,with
unsolvable ancestors.
• 6. Otherwise, expand node n generating all of its successor compute the
cost of for each newly generated node and place all such nodes on open.
• 7. Go back to step(2)
Note: AO* will always find minimum cost solution
MEANS - ENDS ANALYSIS
• Most of the search strategies either reason forward of backward however,
often a mixture o 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".
• 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 .
2. Satisfy the preconditions for some recommended operator op is selected,
then to reduce the difference .
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 planing for an office worker. Suppose we have a different
table of three rules:
• 1. If in out 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 co worker " operator is recommended.