Sunteți pe pagina 1din 38

AI Problems and Techniques

By: Prof. Hardik B. Nariya


Computer Engineering Department,
Shree Swami Atmanand Saraswati Institute of Technology Surat
AI Techniques
• Describe and match
• Goal Reduction
• Tree Searching
• Constraint Satisfaction
• Generate and Test
• Rule based system

• Behaves intelligently and can handle all limitations of knowledge


Biological Inspired AI Techniques
• Neural Networks
• Genetic Algorithms
• Reinforcement learning
Describe and Match
• Model
• is a description of a system’s behavior.
• Finite state model
• consists of a set of states, a set of input events and the relations between
them. Given a current state and an input event you can determine the next
current state of the model.
• Computation model
• is a finite state machine. It includes of a set of states, a set of start states, an
input alphabet, and a transition function which maps input symbols and
current states to a next state.
Describe and Match
• Representation of computational system
• include start and end state descriptions and a set of possible transition rules that might be applied.
Problem is to find the appropriate transition rules.
• Transition relation:
• If a pair of states (S, S') is such that one move takes the system from S to S', then the transition relation is
represented by S => S’
• State-transition system
• is called deterministic if every state has at most one successor; it is called non-deterministic if at
least one state has more than one successor.
• Examples of some possible transitions between states are shown for the Towers of Hanoi
puzzle.
Puzzle : Towers of Hanoi with only 2 disks
• Solve the puzzle
Initial state Goal state

• Move the disks from the leftmost post to the rightmost post while never putting a larger disk on top of a
smaller one;
• move one disk at a time, from one peg to another; middle post can be used for intermediate storage.
• Play the game in the smallest number of moves possible.
• Possible state transitions in the Towers of Hanoi puzzle with 2 disks.
Tree Searching
• Goal Reduction, Constraint Network
• Tree searched through many nodes to obtain goal node and it gives the path from source
node to destination node
• If each node of the entire tree is explored while search for the goal node, it is called as
exhaustive search.
• All Searching techniques broadly classified as
• Uninformed Searching
• Informed Searching
AI Searching Techniques Classification

Uninformed Searching Informed Searching


• Depth First Search • Hill Climbing
• Breadth First Search • Best First Search
• Uniform Cost Search • A* Search
• Depth Limited Search • Iterative Depending A*
• Iterative Deeping Search • Beam Search
• Bidirectional Search • AO* Search
Puzzle : Towers of Hanoi with only 2 disks
• Solve the puzzle

• Shortest solution is the sequence of transitions from the top state downward to the lower left.
Goal Reduction
• Goal-reduction procedures are a special case of the procedural representations of
knowledge in AI; an alternative to declarative, logic- based representations.
• The process involves the hierarchical sub-division of goals into sub- goals, until
the sub-goals which have an immediate solution are reached and said “goal has
been satisfied”.
• Goal-reduction process is illustrated in the form of AND/OR tree drawn upside-
down.
• Goal levels : Higher-level goals are higher in the tree, and lower- level goals are lower in the tree.
• Arcs are directed from a higher-to-lower level node represents the reduction of higher-level goal to lower-level sub-
goal.
• Nodes at the bottom of the tree represent irreducible action goals.
• An AND-OR tree/graph structure can represent relations between goals and sub-
goals, alternative sub-goals and conjoint sub-goals.
Example Goal Reduction
• AND-OR tree/graph structure to
represent facts such as
“enjoyment”, “earning/save
money”, “old age” etc.
• The above AND-OR tree/graph
structure describes
• Hierarchical relationships between
goals and sub goals
• Alternative ways of trying to solve
a goal
• Conjoint sub-goals
Constraint Satisfaction Techniques
is a logical relation among variables. e.g. “circle is inside
• Constraint
the square” – The constraints relate objects without precisely
specifying their positions; moving any one, the relation is still
maintained.
is a process of finding a solution to a set of
• Constraint satisfaction
constraints – the constraints express allowed values for variables and
finding solution is evaluation of these variables that satisfies all
constraints.
Constraint Satisfaction Problem (CSP) and its solution

• A Constraint Satisfaction Problem (CSP) consists of :


• Variables, a finite set X = {x1 , . . . , xn } ,
• Domain, a finite set Di of possible values which each variable xi can take,
• Constraints, a set of values that the variables can simultaneously satisfy the
constraint (e.g. D1 != D2)
• A solution to a CSP is an assignment of a value from its domain to
every variable satisfying every constraint; that could be :
• one solution, with no preference as to which one,
• all solutions,
• an optimal, or a good solution - Constraint Optimization Problem (COP).
Constraint Satisfaction Problem (CSP) and its solution

• Constraint satisfaction has application in Artificial Intelligence,


Programming Languages, Symbolic Computing, Computational Logic.
Applied Areas of AI
• Early work focused on
• Formal tasks like game playing, proving theorems
• Heuristic Search
• Computer Vision
• Adversarial Search (Games)
• Fuzzy Logic
• Natural Language Processing
• Knowledge Representation
• Planning
• Learning
Examples
• Playing chess • Recognizing speech
• Driving on the highway • Diagnosing diseases
• Mowing the lawn • Translating languages
• Answering questions • Data mining
Areas of AI and Some Dependencies
Knowledge
Search Logic Representation

Machine
Planning
Learning

Expert
NLP Vision Robotics Systems
Classic AI Search Problems
• 3*3*3 Rubik’s Cube Problem
Classic AI Search Problems
• 8 Puzzle
N-Queens problem Definition
• Place N queens on an N*N board so that
no queen is attacking another queen.
• A queen can move horizontally, vertically,
or diagonally.
• The problem can be solved with genetic
algorithm for a n queens problem. (n is
between 8 and 30)

Here N=8
Classic AI Search Problems
• River Problem
• On one bank of a river are three missionaries and three cannibals.
There is one boat available that can hold up to two people and that
they would like to use to cross the river. If the cannibals ever
outnumber the missionaries on either of the river’s banks, the
missionaries will get eaten.
How can the boat be used to safely carry all the missionaries and
cannibals across the river?
• The initial state is shown to the right here, where black triangles
represent missionaries and red circles represent cannibals.
Classic AI Search Problems
• River Problem
Classic AI Search Problems
• Research showed that intelligence requires knowledge and
knowledge holds some less desirable properties like
• It is enormous
• It is tough to characterize precisely
• It is dynamic
• It is structured in a way that matches to the ways it will be used
Heuristic Search
• Very large search space
• Large databases
• Image sequences
• Game playing
• Algorithms
• Guaranteed best answer
• Can be slow – literally years
• Heuristics
• “Rules of thumb”
• Very fast
• Good answer likely, but not guaranteed!
• Searching foreign intelligence for terrorist activity.
Computer Vision
• Computationally taxing
• Millions of bytes of data per frame
• Thirty frames per second
• Computers are scalar / Images are
multidimensional
• Image Enhancement vs. Image
Understanding
• Can you find the terrorist in this
picture?
Adversarial Search
• Game theory...
• Two player, zero sum – checkers, chess, etc.
• Minimax
• My side is MAX
• Opponent is MIN
• Alpha-Beta
• Evaluation function...”how good is board”
• Not reliable...play game (look ahead) as deep as possible and use minimax.
• Select “best” backed up value.
• Where will Al-Qaeda strike next?
Adversarial Search
1

X X O

MIN O

...
2 6

X X O X X O

MAX O O O O
X X

3 4 5 7 8 9

X X O X X O X X O X X O X X O X X O

O O X O O O O X O O O O O O

X X X X X X X X X X

1-0=1 1-2=-1 1-1=0 *91* 0 10


Example: Tic Tac Toe #1
• Precompiled move table.
move
• For each input board, a table

specific move (output board) encode look


up

• Perfect play, but is it AI?


Example: Tic Tac Toe #2
• Represent board as a magic square, one integer per square

• If 3 of my pieces sum to 15, I win

• Predefined strategy:
• 1. Win
• 2. Block
• 3. Take center
• 4. Take corner
• 5. Take any open square
Example: Tic Tac Toe #3
• Given a board, consider all possible moves (future boards) and pick the best one

• Look ahead (opponent’s best move, your best move…) until end of game

• Functions needed:
• Next move generator
• Board evaluation function

• Change these 2 functions (only) to play a different game!


Fuzzy Logic
• Basic logic is binary
• 0 or 1, true or false, black or white, on or off, etc...
• But in the real world there are of “shades”
• Light red or dark red
• 0.64756
• Membership functions
Fuzzy Logic
Linguistic
Appetite
Variable

Linguistic
Light Moderate Heavy Values

Membership
Grade

1000 2000 3000

Calories Eaten Per Day


Natural Language Processing
• Speech recognition vs. natural language processing
• NLP is after the words are recognized
• Ninety/Ten Rule
• Can do 90% of the translation with 10% time, but 10% work takes 90% time
• Easy for restricted domains
• Dilation
• Automatic translation
• Control your computer
• Say “Enter” or “one” or “open”
• Associative calculus
• Understand by doing
Natural Language Processing
Net for Basic Noun Group
adjective

determiner noun
“The big grey dog” S1 S2 S3

Net for Prepositional Group

preposition NOUNG
“by the table in the corner” S1 S2 S3

Net for Basic Noun Group


PREPG
adjective

determiner noun
“The big grey dog by the S1 S2 S3
table in the corner”
Knowledge Representation
• Predicate Logic
• On(table, lamp)
• In(corner, table)
• Near(table, dog)
• Prolog
• Graph Based
• Semantic Networks
• Frames
• Rule Based
• Expert Systems
Planning
• Robotics
• If a robot enters a room and sits
down, what is the “route”.

Table
• Closed world
• Rule based systems
Chair
• Blocks world
Planning
Robot
Hand
• Pickup(x)
• Ontable(x), clear(x), handempty(),
C
• Holding(x)
• Putdown(x) A B
• Holding(x) Clear(B) On(C, A) OnTable(A)
• Ontable(x), clear(x), handempty() Clear(C) Handempty OnTable(B)

• Stack(x, y)
• Holding(x), clear(y)
• Handempty(), on(x, y), clear(x) A
• Unstack(x, y)
B
• Handempty(), clear(x), on(x, y)
• Holding(x), clear(x) C
Goal: [On(B, C) ^ On(A, B)]
Learning
• Neural Networks
• Evolutionary Computing
• Knowledge in Learning
• Reinforcement Learning