







































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Informed Search, Uninformed Search, heuristic Search, Local Optimization algorithm
Typology: Lecture notes
1 / 47
This page cannot be seen from the preview
Don't miss anything!








































CS6659 – ARTIFICIAL INTELLIGENCE
The capacity to learn and solve problems. In particular,
the ability to solve novel problems (i.e solve new problems) the ability to act rationally (i.e act based on reason) the ability to act like humans
1.1 What is involved in intelligence?
- Ability to interact with the real world - to perceive, understand, and act - e.g., speech recognition and understanding and synthesis - e.g., image understanding - e.g., ability to take actions, have an effect - Reasoning and Planning - modeling the external world, given input - solving new problems, planning, and making decisions - ability to deal with unexpected problems, uncertainties - Learning and Adaptation - we are continuously learning and adapting - our internal models are always being ―updated‖ - e.g., a baby learning to categorize and recognize animals 2. ARTIFICIAL INTELLIGENCE
It is the study of how to make computers do things at which, at the moment, people are better.
The term AI is defined by each author in own ways which falls into 4 categories
CS6659 – ARTIFICIAL INTELLIGENCE
Building systems that think like humans ―The exciting new effort to make computers think … machines with minds, in the full and literal sense‖ -- Haugeland, 1985 ―The automation of activities that we associate with human thinking, … such as decision-making, problem solving, learning, …‖ -- Bellman, 1978
Building systems that act like humans ―The art of creating machines that perform functions that require intelligence when performed by people‖ -- Kurzweil, 1990 ―The study of how to make computers do things at which, at the moment, people are better‖ -- Rich and Knight, 1991
Building systems that think rationally ―The study of mental faculties through the use of computational models‖ -- Charniak and McDermott, 1985 ―The study of the computations that make it possible to perceive, reason, and act‖ -Winston, 1992
Building systems that act rationally ―A field of study that seeks to explain and emulate intelligent behavior in terms of computational processes‖ -- Schalkoff, 1990 ―The branch of computer science that is concerned with the automation of intelligent behavior‖ -- Luger and Stubblefield, 1993
2.1.1. Acting Humanly: The Turing Test Approach
Test proposed by Alan Turing in 1950 The computer is asked questions by a human interrogator.
The computer passes the test if a human interrogator, after posing some written questions, cannot tell whether the written responses come from a person or not. Programming a computer to pass, the computer need to possess the following capabilities:
Natural language processing to enable it to communicate successfully in English.
Knowledge representation to store what it knows or hears
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.
To pass the complete Turing Test, the computer will need
Computer vision to perceive the objects, and
Robotics to manipulate objects and move about.
CS6659 – ARTIFICIAL INTELLIGENCE
3.1 AI Technique
AI technique is a method that exploits knowledge that should be represented in such a way that:
CS6659 – ARTIFICIAL INTELLIGENCE
instruments), in many AI domains, most of the knowledge a program has must ultimately be provided by people in terms they understand.
- It can easily be modified to correct errors and to reflect changes in the world and in our world view.
Although AI techniques must be designed in keeping with these constraints imposed by AI problems, there is some degree of independence between problems and problem-solving techniques. It is possible to solve AI problems without using AI techniques (although, as we suggested above, those solutions are not likely to be very good).
Tic-Tac-Toe
Solution 1
Data Structure:
Elements of vector:
0 : Empty
1 : X 2: O
The vector is a ternary number
Store inside the program a move-table (lookup table):
#Elements in the table: 19683 (=3^9 )
Element = A vector which describes the most suitable move from the current game-board
CS6659 – ARTIFICIAL INTELLIGENCE
Function Library:
Return a location on a game-board.
IF (board[5] = 2)
RETURN 5; //the center cell.
ELSE
RETURN any cell that is not at the board‘s corner;
// (cell: 2,4,6,8)
Let P represent for X or O
can_win(P) :
P has filled already at least two cells on a straight line (horizontal, vertical, or diagonal) cannot_win(P) = NOT(can_win(P))
IF (cannot_win(P))
RETURN 0;
ELSE
RETURN index to the empty cell on the line of
can_win(P)
Let odd numbers are turns of X
Let even numbers are turns of O
CS6659 – ARTIFICIAL INTELLIGENCE
IF odd(turn) THEN // for X
Board[n] = 3 ELSE // for O
Board[n] = 5
turn = turn + 1
Algorithm:
Go(1) //make a move at the left-top cell
IF board[5] is empty THEN
Go(5)
ELSE Go(1)
IF board[9] is empty THEN
Go(9)
ELSE
Go(3).
IF Posswin(X) <> 0 THEN
Go(Posswin(X))
//Prevent the opponent to win ELSE Go(Make2)
IF Posswin(X) <> 0 THEN
Go(Posswin(X))
//Win for X.
ELSE IF Posswin(O) <> THEN
CS6659 – ARTIFICIAL INTELLIGENCE
Comments:
Problem formulation is the process of deciding what actions and states to consider, given a goal
Formulate Goal, Formulate problem
Search
Execute
CS6659 – ARTIFICIAL INTELLIGENCE
A problem can be defined formally by four components:
The starting state which agent knows itself.
1. Successor Function
A description of the possible actions available to the agent.
State x, successor – FN (x) returns a set of < action, successor> ordered pairs, where each action is a legal action in a state x and each successor is a state that can be reached from x by applying that action.
2.1 State Space
The set of all possible states reachable from the initial state by any sequence of actions. The initial state and successor function defines the state space. The state space forms a graph in which nodes are state and axis between the nodes are action.
2.2 Path
A path in the state space is a sequence of state connected by a sequence of actions.
2. Goal Test
Test to determine whether the given state is the goal state. If there is an explicit set of possible goal states, then we can whether any one of the goal state is reached or not.
Example : In chess, the goal is to reach a state called ―checkmate‖ where the opponent‘s king is under attack and can‘t escape.
3. Path cost
A function that assigns a numeric cost to each path. The cost of a path can be described as the sum of the costs of the individual actions along that path.
Step cost of taking an action ‗a‘ to go from one state ‗x‘ to state ‗y‘ is denoted by C(x,a,y)
C-Cost , x,y- states , Action , Step costs are non-negative
These 4 elements are gathered into a data structure that is given as input to problem solving algorithm. A solution quality is measured by path cost function. An optimal solution has lowest path cost among all solutions.
CS6659 – ARTIFICIAL INTELLIGENCE
Fig 1.2 Vacuum World
CS6659 – ARTIFICIAL INTELLIGENCE
Fig: 1.3 State Space for the Vacuum World
State Space for the Vacuum World
Labels on Arcs denote L: Left, R: Right, S: Suck
Example 2: Playing chess
Initial State: Described as an 8 X 8 array where each positions contains a symbol standing for the appropriate piece in the official chess position.
Successor function: The legal states that results from set of rules.
They can be described easily by as a set of rules consisting of two parts: a left side that serves as a pattern to be matched against the current board position and a right side that describes the changes to be made to the board position to reflect the move. An example is shown in the following figure.
Fig 1.4:The legal states that results from set of rules
However if we write rules like the one above, we have to write a very large number of them since there has to be a separate set of rule for each of them roughly 10^120 possible board positions.
Practical difficulties to implement large number of rules,
CS6659 – ARTIFICIAL INTELLIGENCE
If x >0 ground
If x +y ≥4,y >0 into the 4-gallon jug until the
4-gallon jug is full
If x +y ≥3,x >0 into the 3-gallon jug until the 3-gallon jug is full
If x +y ≤4,y >0 jug into the 4-gallon jug
If x +y ≤3,x >0 jug into the 3-gallon jug
Jug into the 4-gallon jug
Jug on the ground
Production rules for the water jug problem
Trace of steps involved in solving the water jug problem First solution
Number of Steps Rules applied 4-g jug 3-g jug
1 Initial state 0 0 2 R2 {Fill 3-g jug} 0 3 3 R7 {Pour all water from 3 to 4-g jug} 3 0 4 R2 {Fill 3-g jug} 3 3 5 R5 {Pour from 3 to 4-g jug until it is full} 4 2 6 R3 {Empty 4-gallon jug} 0 2 7 R7 {Pour all water from 3 to 4-g jug} 2 0
Goal State
CS6659 – ARTIFICIAL INTELLIGENCE
Second Solution
Number of Steps Rules applied 4-g jug 3-g jug
1 Initial state 0 0 2 R1 {Fill 4-gallon jug} 4 0 3 R6 {Pour from 4 to 3-g jug until it is full} 1 3 4 R4 {Empty 3-gallon jug} 1 0 5 R8 {Pour all water from 4 to 3-gallon jug} 0 1 6 R1 {Fill 4-gallon jug} 4 1 7 R6 {Pour from 4 to 3-g jug until it is full} 2 3 8 R4 {Empty 3-gallon jug} 2 0
Goal State
Example - 5 8-puzzle Problem
The 8-puzzle problem consists of a 3 x 3 board with eight numbered tiles and a blank space. A tile adjacent to the blank space can slide into the space. The object is to reach a specified goal state.
States: A state description specifies the location of each of the eight tiles and the blank in one of the nine squares.
Initial state: Any state can be designated as the initial state.
Successor function: This generates the legal states that result from trying the four actions (blank moves Left, Right, Up, or Down).
Goal test: This checks whether the state matches the goal configuration (Other goal configurations are possible.)
Path cost: Each step costs 1, so the path cost is the number of steps in the path.
Fig 1.5 8 Puzzle Problem
CS6659 – ARTIFICIAL INTELLIGENCE
In order to solve a problem
We must first reduce it to one for which a precise statement can be given. This can be done by defining the problem‘s state space (start and goal states) and a set of operators for moving that space.
The problem can be solved by searching for a path through the space from the initial state to a goal state.
The process of solving the problem can be usefully modeled as a production system.
2.3.1 Control strategies
By considering control strategies we can decide which rule to apply next during the process of searching for a solution to problem.
The two requirements of good control strategy are that
It should cause motion : consider water jug problem, if we implement control strategy of starting each time at the top of the list of rules, it will never leads to solution. So we need to consider control strategy that leads to solution.
It should be systematic: choose at random from among the applicable rules. This strategy is better than the first. It causes the motion. It will lead to the solution eventually. Doing like this is not a systematic approach and it leads to useless sequence of operators several times before finding final solution.
2.3.1.1 Systematic control strategy for the water jug problem
2.3.1.1.1 Breadth First Search (Blind Search)
Let us discuss these strategies using water jug problem. These may be applied to any search problem.
Construct a tree with the initial state as its root.
Generate all the offspring of the root by applying each of the applicable rules to the initial state.
(0, 0)
Now for each leaf node, generate all its successors by applying all the rules that are appropriate.
CS6659 – ARTIFICIAL INTELLIGENCE
Continue this process until some rule produces a goal state.
Algorithm
a. Remove the first element from NODE-LIST and call it E. if NODE-LIST is empty, quit.
b. For each way that each rule can match the state described in E do:
i. Apply the rule to generate a new state.
ii. If the new state is a goal state, quit and return this state.
iii. Otherwise, add the new state to the end of NODE-LIST.
2.3.1.1.2 Depth First Search
Algorithm
1.If the initial state is the goal state, quit and return success.
2.Otherwise do the following until success or failure is signaled:
a. Generate a successor, E, of initial state. If there are no more successor, signal failure. b. Call depth first search, with E as the initial state.
c. If the success is returned, signal success. Otherwise continue in this loop.
Backtracking
In this search, we pursue a single branch of the tree until it yields a solution or until a decision to terminate the path is made.
It makes sense to terminate a path if it reaches dead-end, produces a previous state. In such a state backtracking occurs.