Date post: | 16-Apr-2017 |
Category: |
Education |
Upload: | jessore-university-of-science-technology-jessore |
View: | 60 times |
Download: | 0 times |
2
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
1(a) Defne Artificial Intelligence.
According to the father of Artificial Intelligence, John McCarthy, it is ―The science and engineering of
making intelligent machines, especially intelligent computer programs‖.
Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a software think
intelligently, in the similar manner the intelligent humans think. A robot with artificial intelligence they are
organized into four categories:
Systems that think like humans.
Systems that act like humans .
Systems that think rationally.
Systems that act rationally.
1(a) Shortly explain the Turing Test of intelligence.
Turing test, in artificial intelligence, a test proposed (1950) by the English mathematician Alan M. Turing to
determine whether a computer can ―think.‖
Turing defined intelligent behavioras the ability to achieve human level performance in all cognitive tasks,
sufficient to fool an interrogator. The computer would need to possess th e 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.
Turing‘s test deliberately avoided direct physical interaction between the interrogator and the computer,
because physical simulation of a person is unnecessary for intelligence.
Systems that act like humans
You enter a room which has a computer terminal. You have a fixed period of time to type what you
want into the terminal, and study the replies. At the other end of the line is either a human being or a
computer system.
If it is a computer system, and at the end of the period you cannot reliably determine whether it is a
system or a human, then the system is deemed to be intelligent.
The Turing Test approach
a human questioner cannot tell if, there is a computer or a human answering his question, via
teletype (remote communication)
The computer must behave intelligently
Intelligent behavior
to achieve human-level performance in all cognitive tasks
These cognitive tasks include:
Natural language processing, for communication with human.
3
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Knowledge representation
to store information effectively & efficiently
Automated reasoning
to retrieve & answer questions using the stored information
Machine learning
to adapt to new circumstances
1(b) Define Agent. Describe how agents interact with environments.
Agent: An agent is anything that can perceive its environment through sensors and acts upon that
environment through effectors.
A human agent has sensory organs such as eyes, ears, nose, tongue and skin parallel to the sensors,
and other organs such as hands, legs, mouth, for effectors.
A robotic agent replaces cameras and infrared range finders for the sensors, and various motors and
actuators for effectors.
A software agent has encoded bit strings as its programs and actions.
1(c) Define rational agent. Explain the general agent program.
Rational agent: A rational agent always performs right action, where the right action means the action that
causes the agent to be most successful in the given percept sequence. The problem the agent solves is
characterized by Performance Measure, Environment, Actuators, and Sensors (PEAS).
There are four types of agent program-
(i) Simplex reflex agents
(ii) Model based reflex agents
(iii) Goal-based agents
(iv) Utility-based agents.
Simplex reflex agents: They choose actions only based on the current percept. Their environment is
completely observable.
Model based reflex agents: They use a model of the world to choose their actions. They maintain an
internal state.
4
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Goal-based agents: They choose their actions in order to achieve goals. Goal-based approach is more
flexible than reflex agent since the knowledge supporting a decision is explicitly modeled, thereby allowing
for modifications.
Utility Based Agents: They choose actions based on a preference (utility) for each state. Goals are
inadequate when −
There are conflicting goals, out of which only few can be achieved.
Goals have some uncertainty of being achieved and you need to weigh likelihood of success against
the importance of a goal.
2(b) Describe the Model based reflex agents.
Model based reflex agents: They use a model of the world to choose their actions. They maintain an
internal state.
Model − the knowledge about how the things happen in the world.
Internal State − It is a representation of unobserved aspects of current state depending on percept history.
Updating the state requires the information about −
How the world evolves.
How the agent‘s actions affect the world.
3(a) Define Knowledge.
Knowledge representation and reasoning (KR) is the field of artificial intelligence (AI) dedicated to
representing information about the world in a form that a computer system can utilize to solve complex
tasks such as diagnosing a medical condition or having a dialog in a natural language.
The total Turing Test
Turing‘s test deliberately avoided direct physical interaction between the interrogator and the computer,
because physical simulation of aperson is unnecessary for intelligence. However, theso-called total Turing
Test includes a video signal so that the interrogator can test the subject‘s perceptual abilities, as well as the
opportunity for the interrogator to pass physical objects" through the hatch." To pass the total Turing Test,
the computer will need
computer vision to perceive objects, and
robotics to move them about.
Systems that think like humans: cognitive modeling
If we are going to 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
5
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
this: through introspection—trying to catch our own thoughts as they go by—or through psychological
experiments.
Cognitive Science
―The exciting new effort to make computers think … machines with minds in the full and literal
sense‖ (Haugeland)
―[The automation of] activities that we associate with human thinking, activities such as decision-
making, problem solving, learning …‖ (Bellman)
Thinking rationally: The laws of thought approach
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 aman; all men are mortal; there fore
Socrates is mortal." These laws of thought were supposed to govern the operation of the mind, and initiated
the field of logic.
―The study of mental facilities through the use of computational models‖ (Charniak and McDermott)
―The study of the computations that make it possible to perceive, reason, and act‖ (Winston)
Systems that act rationally: “Rational agent”
Acting rationally means acting so as to achieve one‘s goals, given one's beliefs. An agent is just something
that perceives and acts.
Rational behavior: doing the right thing
The right thing: that which is expected to maximize goal achievement, given the available
information
Giving answers to questions is ‗acting‘.
I don't care whether a system:
replicates human thought processes
makes the same decisions as humans
uses purely logical reasoning
Study AI as rational agent –
2 advantages:
It is more general than using logic only
Because: LOGIC + Domain knowledge
It allows extension of the approach with more scientific methodologies
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]
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
6
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
From the above two definitions, we can see that AI has two major roles:
Study the intelligent part concerned with humans.
Represent those actions using computers.
Goals of AI
To Create Expert Systems − the systems which exhibit intelligent behavior, learn, demonstrate,
explain, and advice its users.
To Implement Human Intelligence in Machines − Creating systems that understand, think, learn,
and behave like humans. Or,
build and understand intelligent systems/agents
synergy between
philosophy,
psychology and cognitive science
computer science and engineering
mathematics and physics
The Foundation of AI
Philosophy
At that time, the study of human intelligence began with no formal expression
Initiate the idea of mind as a machine and its internal operations
Mathematics formalizes the three main area of AI: computation, logic, and probability
Computation leads to analysis of the problems that can be computed
complexity theory
Probability contributes the “degree of belief” to handle uncertainty in AI
Decision theory combines probability theory and utility theory (bias)
Psychology
How do humans think and act?
The study of human reasoning and acting
Provides reasoning models for AI
Strengthen the ideas
humans and other animals can be considered as information processing machines
Computer Engineering
How to build an efficient computer?
Provides the artifact that makes AI application possible
The power of computer makes computation of large and difficult problems more easily
AI has also contributed its own work to computer science, including: time-sharing, the linked
list data type, OOP, etc.
Some Advantages of Artificial Intelligence
more powerful and more useful computers
new and improved interfaces
solving new problems
7
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
better handling of information
relieves information overload
conversion of information into knowledge
The Disadvantages
increased costs
difficulty with software development - slow and expensive
few experienced programmers
Few practical products have reached the market as yet.
What Contributes to AI?
Artificial intelligence is a science and technology based on disciplines such as Computer Science, Biology,
Psychology, Linguistics, Mathematics, and Engineering. A major thrust of AI is in the development of
computer functions associated with human intelligence, such as reasoning, learning, and problem solving.
Search
Search is the fundamental technique of AI.
Possible answers, decisions or courses of action are structured into an abstract space, which
we then search. Search is the systematic examination of states to find path from the start/root
state to the goal state.
Search is either "blind" or ―uninformed":
blind
we move through the space without worrying about what is coming next, but
recognising the answer if we see it
informed
We guess what is ahead, and use that information to decide where to look
next.
We may want to search for the first answer that satisfies our goal, or we may want to keep searching
until we find the best answer.
Knowledge Representation & Reasoning
The second most important concept in AI
If we are going to act rationally in our environment, then we must have some way of describing that
environment and drawing inferences from that representation.
Knowledge representation and reasoning also incorporates findings from logic to automate various kinds of
reasoning, such as the application of rules or the relations of sets and subsets.
8
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Reasoning
It is the set of processes that enables us to provide basis for judgment, making decisions, and prediction.
There are broadly two types −
Planning
Given a set of goals, construct a sequence of actions that achieves those goals:
often very large search space
but most parts of the world are independent of most other parts
often start with goals and connect them to actions
no necessary connection between order of planning and order of execution
What happens if the world changes as we execute the plan and/or our actions don‘t produce
the expected results?
Decide what actions to use to achieve some set of objectives
Learning
It is the activity of gaining knowledge or skill by studying, practicing, being taught, or experiencing
something. Learning enhances the awareness of the subjects of the study. The ability of learning is
possessed by humans, some animals, and AI-enabled systems. Learning is categorized as −
Auditory Learning − It is learning by listening and hearing. For example, students listening to
recorded audio lectures.
Episodic Learning – To learn by remembering sequences of events that one has witnessed or
experienced. This is linear and orderly.
Motor Learning − It is learning by precise movement of muscles. For example, picking objects,
Writing, etc.
Observational Learning – To learn by watching and imitating others. For example, child tries to
learn by mimicking her parent.
Perceptual Learning − It is learning to recognize stimuli that one has seen before. For example,
identifying and classifying objects and situations.
Relational Learning − It involves learning to differentiate among various stimuli on the basis of
relational properties, rather than absolute properties. For Example, Adding ‗little less‘ salt at the time
of cooking potatoes that came up salty last time, when cooked with adding say a tablespoon of salt.
Spatial Learning − It is learning through visual stimuli such as images, colors, maps, etc. For
Example, A person can create roadmap in mind before actually following the road.
Stimulus-Response Learning − It is learning to perform a particular behavior when a certain
stimulus is present. For example, a dog raises its ear on hearing doorbell.
Interacting with the Environment
In order to enable intelligent behaviour, we will have to interact with our environment.
Properly intelligent systems may be expected to:
accept sensory input
vision, sound, …
(i) Inductive Reasoning
(ii) Deductive Reasoning
9
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
interact with humans
Understand language, recognise speech, and generate text, speech and graphics.
modify the environment
robotics
History of AI
Year Milestone / Innovation
1923 Karel Čapek play named ―Rossum's Universal Robots‖ (RUR) opens in London, first use of the
word "robot" in English.
1943 Foundations for neural networks laid.
1945 Isaac Asimov, Columbia University alumni, coined the term Robotics.
1950 Alan Turing introduced Turing Test for evaluation of intelligence and published Computing
Machinery and Intelligence.
1956 Demonstration of the first running AI program at Carnegie Mellon University.
1958 John McCarthy invents LISP programming language for AI.
1964 Danny Bobrow's dissertation at MIT showed that computers can understand natural language well
enough to solve algebra word problems correctly.
1965 Joseph Weizenbaum at MIT built ELIZA, an interactive problem that carries on a dialogue in
English.
1969 Scientists at Stanford Research Institute Developed Shakey, a robot, equipped with locomotion,
perception, and problem solving.
1973 The Assembly Robotics group at Edinburgh University built Freddy, the Famous Scottish Robot,
capable of using vision to locate and assemble models.
1979 The first computer-controlled autonomous vehicle, Stanford Cart, was built.
1985 Harold Cohen created and demonstrated the drawing program, Aaron.
1990 Major advances in all areas of AI −
Significant demonstrations in machine learning
Case-based reasoning
Multi-agent planning
Scheduling
Data mining, Web Crawler
natural language understanding and translation
Vision, Virtual Reality
Games
1997 The Deep Blue Chess Program beats the then world chess champion, Garry Kasparov.
2000 Interactive robot pets become commercially available. MIT displays Kismet, a robot with a face
that expresses emotions. The robot Nomad explores remote regions of Antarctica and locates
meteorites.
10
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
The „von Neuman‟ Architecture
Problem Solving
Problem solving also includes decision making, which is the process of selecting the best suitable alternative
out of multiple alternatives to reach the desired goal are available.
Perception
It is the process of acquiring, interpreting, selecting, and organizing sensory information.
Linguistic Intelligence
It is one‘s ability to use, comprehend, speak, and write the verbal and written language. It is important in
interpersonal communication.
Symbolic and Sub-symbolic AI
Symbolic AI is concerned with describing and manipulating our knowledge of the world as explicit
symbols, where these symbols have clear relationships to entities in the real world.
Sub-symbolic AI (e.g. neural-nets) is more concerned with obtaining the correct response to an input
stimulus without ‗looking inside the box‘ to see if parts of the mechanism can be associated with
discrete real world objects.
This course is concerned with symbolic AI.
AI Applications
AI has been dominant in various fields such as −
Gaming − AI plays crucial role in strategic games such as chess, poker, tic-tac-toe, etc., where
machine can think of large number of possible positions based on heuristic knowledge.
Natural Language Processing − It is possible to interact with the computer that understands natural
language spoken by humans.
11
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Expert Systems − There are some applications which integrate machine, software, and special
information to impart reasoning and advising. They provide explanation and advice to the users.
Vision Systems − these systems understand, interpret, and comprehend visual input on the
computer. For example,
o A spying aero plane takes photographs, which are used to figure out spatial information or
map of the areas.
o Doctors use clinical expert system to diagnose the patient.
o Police use computer software that can recognize the face of criminal with the stored portrait
made by forensic artist.
Speech Recognition − Some intelligent systems are capable of hearing and comprehending the
language in terms of sentences and their meanings while a human talks to it. It can handle different
accents, slang words, noise in the background, change in human‘s noise due to cold, etc.
Handwriting Recognition − the handwriting recognition software reads the text written on paper by
a pen or on screen by a stylus. It can recognize the shapes of the letters and convert it into editable
text.
Intelligent Robots − Robots are able to perform the tasks given by a human. They have sensors to
detect physical data from the real world such as light, heat, temperature, movement, sound, bump,
and pressure. They have efficient processors, multiple sensors and huge memory, to exhibit
intelligence. In addition, they are capable of learning from their mistakes and they can adapt to the
new environment
Other application areas:
Bioinformatics:
Gene expression data analysis
Prediction of protein structure
Text classification, document sorting:
Web pages, e-mails
Articles in the news
Video, image classification
Music composition, picture drawing
Natural Language Processing.
Perception.
What is Intelligence composed of?
The intelligence is intangible. It is composed of −
Reasoning
Learning
Problem Solving
Perception
Linguistic Intelligence
12
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Logic
First-order logic
First-order logic is symbolized reasoning in which each sentence, or statement, is broken down into a
subject and a predicate. The predicate modifies or defines the properties of the subject. In first-order logic, a
predicate can only refer to a single subject. First-order logic is also known as first-order predicate calculus
or first-order functional calculus.
A sentence in first-order logic is written in the form Px or P(x), where P is the predicate and x is the subject,
represented as a variable. Complete sentences are logically combined and manipulated according to the
same rules as those used in Boolean algebra.
– Connectives: ∧, ∨, ¬, ⇒, ⇔
– Quantifiers:
• Universal: ∀ x: ( is_Man(x) ⇒ is_Mortal(x) )
• Existential: ∃ y: ( is_Father(y, fred) )
Example: Representing Facts in First-Order Logic
1. Lucy* is a professor
2. All professors are people.
3. Johan is the dean.
4. Deans are professors.
5. All professors consider the dean a friend or don‘t know him.
6. Everyone is a friend of someone.
7. People only criticize people that are not their friends.
8. Lucy criticized Johan.
Proof: Knowledge base
Knowledge Engineering
1. Identify the task.
2. Assemble the relevant knowledge.
3. Decide on a vocabulary of predicates, functions, and constants.
4. Encode general knowledge about the domain.
5. Encode a description of the specific problem instance.
13
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
6. Pose queries to the inference procedure and get answers.
7. Debug the knowledge base
Inference Procedures: Theoretical Results
• There exist complete and sound proof procedures for propositional and FOL.
Propositional logic
• Use the definition of entailment directly. Proof procedure is exponential in n, the number of symbols.
• In practice, can be much faster…
• Polynomial-time inference procedure exists when KB is expressed as Horn clauses: P1 ˄ P2 ˄ ........ ˄ Pn
Q where the Pi and Q are non-negated atoms.
First-Order logic
• Godel‘s completeness theorem showed that a proof procedure exists…
• But none was demonstrated until Robinson‘s 1965 resolution algorithm.
• Entailment in first-order logic is semidecidable.
Resolution Rule of Inference
Algorithm: Resolution Proof
Negate the original theorem to be proved, and add the result to the knowledge base.
Bring knowledge base into conjunctive normal form (CNF)
– CNF: conjunctions of disjunctions
– Each disjunction is called a clause.
Repeat until there is no resolvable pair of clauses:
– Find resolvable clauses and resolve them.
– Add the results of resolution to the knowledge base.
14
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
– If NIL (empty clause) is produced, stop and report that the (original) theorem is true.
Report that the (original) theorem is false.
Resolution Example: Propositional Logic
Resolution Example: FOL
Axioms: Regular CNF
Resolution Theorem Proving
Properties of Resolution Theorem Proving:
– sound (for propositional and FOL)
– (refutation) complete (for propositional and FOL)
Procedure may seem cumbersome but note that can be easily automated. Just ―smash‖ clauses until empty
clause or no more new clauses
15
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Unification
Unify procedure: Unify (P, Q) takes two atomic (i.e. single predicates) sentences P and Q and returns a
substitution that makes P and Q identical.
Unifier: a substitution that makes two clauses resolvable
Rules for substitutions:
– Can replace a variable by a constant.
– Can replace a variable by a variable.
– Can replace a variable by a function expression, as long as the function expression does not contain the
variable.
Unification – Purpose
Unification (example)
Who does John hate? ∃ X: Hates (John, x)
Knowledge base (in clause form):
1. ¬ Knows (John, v) ∨ Hates (John, v)
2. Knows (John, Jim)
3. Knows (y, Leo)
4. Knows (z, Mother (z))
5. ¬ Hates (John, x) (since ¬ ∃ x: Hates (John, x) Ù∀ x: ¬Hates (John,x))
Resolution with 5 and 1:
unify(Hates(John, x), Hates(John, v)) = {x/v}
6. ¬ Knows (John, v)
Resolution with 6 and 2:
unify(Knows(John, v), Knows(John, Jim))= {v/Jim}
or resolution with 6 and 3:
unify(Knows (John, v), Knows (y, Leo)) = {y/John, v/Leo}
16
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
or Resolution with 6 and 4:
unify(Knows (John, v), Knows (z, Mother(z))) = {z/John, v/Mother(z)}
Answers:
1. Hates(John,x) with {x/v, v/Jim} (i.e. John hates Jim)
2. Hates(John,x) with {x/v, y/John, v/Leo} (i.e. John hates Leo)
3. Hates(John,x) with {x/v, v/Mother(z), z/John} (i.e. John hates his mother
Converting More Complicated Sentences to CNF
1. Eliminate Implications
2. Move negations down to the atomic formulas
17
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
3. Eliminâtes Existential Quantifier: Skolemization
4. Rename variables as necessary
We want no two variables of the same name.
5. Move the universal quantifiers to the left
This works because each quantifier uses a unique variable name.
What is state-space representation?
In control engineering, a state-space representation is a mathematical model of a physical system as a set of
input, output and state variables related by first-order differential equations. "State space" refers to the space
whose axes are the state variables.
18
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
CT-01 Using state space problem solve 8-puzzle problem.
8-Puzzle:
The 8-Puzzle involves moving the tiles on the board above into a particular configuration. The black square
on the board represents a space. The player can move a tile into the space, freeing that position for another
tile to be moved into and so on.
For example, given the initial state above we may want the tiles to be moved so that the following goal state
may be attained.
Figure 3.2: Eight-Puzzle Problem state space representation
19
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Blind Search: A blind search (also called an uninformed search) is a search that has no information about
its domain. The only thing that a blind search can do is distinguish a non-goal state from a goal state.
BLIND Search Methods: (i) Depth-first (ii) Breadth-first (iii) Non-deterministic search (iv)
Iterative deepening (v) Bi-directional search
Breadth-first search: Breadth-first search goes through the tree level by level, visiting all of the nodes on
the top level first, then all the nodes on the second level, and so on.
It starts from the root node, explores the neighboring nodes first and moves towards the next level
neighbors. It generates one tree at a time until the solution is found. It can be implemented using FIFO
queue data structure. In breadth-first search the frontier is implemented as a FIFO (first-in, first-out)
queue.
Advantages:
(i) Optimal solutions are always found
(ii) Multiple solutions found early
Disadvantages
(i) If solution path is long, the whole tree must be searched up to that depth
(ii) All of the tree generated must be stored in memory
Breadth-first algorithm:
20
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Trace of breadth -first for running example:
Speed (breadth-first)
If a goal node is found on depth m of the tree, all nodes up till that depth are created.
Thus: O (bm
)
Note: depth-first would also visit deeper nodes.
21
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Depth-First Search: Depth-first search goes through the tree branch by branch, going all the way down to
the leaf nodes at the bottom of the tree before trying the next branch over.
It is implemented in recursion with LIFO stack data structure. It creates the same set of nodes as Breadth-
First method, only in the different order.
Advantages:
May arrive at solutions without examining much of search space
Needs little memory (only node in current path needs to be stored)
Disadvantages:
May settle for non-optimal solution
May explore single unfruitful path for a long time
Depth-first algorithm:
22
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Trace of depth-first for running example:
Speed (depth-first):
In the worst case: the (only) goal node may be on the right-most branch,
Time complexities == bd +
b
d-1 + … + 1 = b
d+1 -1 /b-1
Thus: O (bd)
23
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Non-deterministic search:
Depth-limited search:
Iterative deepening: the best „blind‟ search.
24
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Bi-directional algorithm:
Properties (Bi-directional):
Complete: Yes.
Speed: If the test on common state can be done in constant time (hashing):
2 * O(bm/2
) = O(bm/2
)
Memory: similarly: O(bm/2
)
4 (a) Define Heuristic search.
Heuristic search: In computer science, artificial intelligence, and mathematical optimization, a heuristic is
a technique designed for solving a problem more quickly when classic methods are too slow or for finding
an approximate solution when classic methods fail to find any exact solution.
Heuristic or informed search exploits additional knowledge about the problem that helps direct search to
more promising paths.
A heuristic function, h (n), provides an estimate of the cost of the path from a given node to the closest goal
state. Must be zero if node represents a goal state. Example: Straight-line distance from current location to
the goal location in a road navigation problem.
Hill climbing
In computer science, hill climbing is a mathematical optimization technique which belongs to the family of
local search. It is an iterative algorithm that starts with an arbitrary solution to a problem, then attempts to
find a better solution by incrementally changing a single element of the solution. If the change produces a
better solution, an incremental change is made to the new solution, repeating until no further improvements
can be found. For example, hill climbing can be applied to the travelling salesman problem.
25
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Hill climbing_1 algorithm:
Beam Search
In computer science, beam search is a heuristic search algorithm that explores a graph by expanding the
most promising node in a limited set. Beam search is an optimization of best-first search that reduces its
memory requirements. Best-first search is a graph search which orders all partial solutions (states) according
to some heuristic which attempts to predict how close a partial solution is to a complete solution (goal state).
But in beam search, only a predetermined number of best partial solutions are kept as candidates.
Beam search is the de facto method for translation decoding
very fast even in the worst-case
accurate in practice
implemented in many real-world systems
Goal: fast, optimal translation decoding
better understand what makes translation hard
quantify search error from beam search
(at some point) improve translation accuracy
26
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Greedy search algorithm
A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal
choice at each stage with the hope of finding a global optimum. In many problems, a greedy strategy does
not in general produce an optimal solution, but nonetheless a greedy heuristic may yield locally optimal
solutions that approximate a global optimal solution in a reasonable time.
In general, greedy algorithms have five components:
1. A candidate set, from which a solution is created
2. A selection function, which chooses the best candidate to be added to the solution
3. A feasibility function, that is used to determine if a candidate can be used to contribute to a solution
4. An objective function, which assigns a value to a solution, or a partial solution, and
5. A solution function, which will indicate when we have discovered a complete solution
There are a few variations to the greedy algorithm:
Pure greedy algorithms
Orthogonal greedy algorithms
Relaxed greedy algorithms
Applications
Greedy algorithms mostly (but not always) fail to find the globally optimal solution, because they usually do
not operate exhaustively on all the data. They can make commitments to certain choices too early which
prevent them from finding the best overall solution later.
With a goal of reaching the largest-sum, at each step, the greedy algorithm will choose what appears to be
the optimal immediate choice, so it will choose 12 instead of 3 at the second step, and will not reach the best
solution, which contains 99.
Greedy search algorithm:
27
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Optimal Search
In computer science, an optimal binary search tree (BST), sometimes called a weight-balanced binary tree,
is a binary search tree which provides the smallest possible search time (or expected search time) for a given
sequence of accesses (or access probabilities).
Re-introduce the costs of arcs in the NET
At each step, select the node with the lowest accumulated cost.
28
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Uniform cost algorithm
Branch and bound
Branch and bound (BB, B&B, or BnB) is an algorithm design paradigm for discrete and combinatorial
optimization problems, as well as general real valued problems. A branch-and-bound algorithm consists of a
systematic enumeration of candidate solutions by means of state space search.
The goal of a branch-and-bound algorithm is to find a value x that maximizes or minimizes the value of a
real-valued function f(x), called an objective function, among some set S of admissible, or candidate
solutions.
Optimal Uniform cost version
29
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Extension with heuristic estimates:
Replace the ‗accumulated cost‘ in the ‗extended uniform cost‘ algorithm by a function:
Where, cost (path) = the accumulated cost of the partial path h (T) = a heuristic estimate of the cost
remaining from T to a goal node. f (path) = an estimate of the cost of a path extending the current path to
reach a goal.
Example: Reconsider the straight-line distance:
h(T) = the straight-line distance from T to G
30
@ Ashek Mahmud Khan; Dept. of CSE (JUST); 01725-402592
Estimate-extended Uniform cost algorithm:
A* search
IS: Branch and bound extended, Heuristic Underestimate extended, redundant path deletion
extended, Uniform Cost Search.
Note that redundant path deletion is based on the accumulated costs only, so that there is no problem
combining it with heuristic underestimates.
A* algorithm: