Artificial Intelligence
Artificial Intelligence
applications Problem Solving, Search and Control Strategies General Problem solving; Production
systems; Control strategies: forward and backward chaining Exhaustive searches: Depth first Breadth
first search.
Artificial intelligence is usually defined as the science of making computers do things that require
intelligence when done by humans.
AI has the following features:
• Systems that think and act like humans
• Systems that think and act rationally
GOALS OF AI
• Create an expert system.
• Implement human intelligence in machines especially intelligent computer programs.
-It is related to the similar task of using computers to understand human intelligence.
-The inability to distinguish computer responses from human responses
is called the Turing test.
• Store large amount of information and process it at very high speed.
• The ability to solve problems by using several techniques.
Overview of turning test
To conduct this test, we need two people and one machine. One person will be a interrogator and will
be asking questions to one person and the machine. Three of them will be in a separate room. The
interrogator knows them just as A and B, so it has to identify which is the person and machine.
The goal of the machine is to make interrogator believe that is the person’s answer. If machine succeeds
by fooling interrogator, the machine acts like human. The computer should have the following
capabilities in order to pass the turing test:
1. Natural Language Processing is the technology used to aid computers to understand the
human’s natural language
Applications of NLP
• Language translation applications such as Google Translate
• Word Processors such as Microsoft Word and Grammarly that employ NLP to check
grammatical accuracy of texts.
• Interactive Voice Response (IVR) applications used in call centres to respond to certain users’
requests.
• Personal assistant applications such as OK Google, Siri, Cortana, and Alexa.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
2. Knowledge representation is responsible for representing information about the real world so
that a computer can understand and can utilize this knowledge to solve the complex real-world
problems such as diagnosis a medical condition or communicating with humans in natural
language. It is also a way which describes how we can represent knowledge in artificial
intelligence. Knowledge representation is not just storing data into some database, but it also
enables an intelligent machine to learn from that knowledge and experiences so that it can
behave intelligently like a human. The kind of knowledge represented in AI systems:
i. Object
ii. Events
iii. Performance
iv. Meta-knowledge
v. Facts
vi. Knowledge-Base
TYPES OF KNOWLEDGE
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
AI KNOWLEDGE CYCLE
3. Machine learning. This is the science of getting a computer to act without programming. Deep
learning is a subset of machine learning that, in very simple terms, can be thought of as the
automation of predictive analytics. There are three types of machine learning algorithms:
i. Supervised learning: Data sets are labelled so that patterns can be detected and used
to label new data sets.
ii. Unsupervised learning: Data sets aren't labelled and are sorted according to
similarities or differences.
iii. Reinforcement learning: Data sets aren't labelled but, after performing an action or
several actions, the AI system is given feedback.
4. Automated reasoning: This makes a system or process function automatically. For
example, robotic process automation (RPA) can be programmed to perform high-volume,
repeatable tasks that humans normally performed. RPA is different from IT automation in that
it can adapt to changing circumstances.
Total turing test avoids physical interaction between the questioner and the computer because physical
simulation is unnecessary for intelligence, in order for the computer to pass the total turing test it should
have the following capabilities:
1. Computer vision make computers or machines visually enabled so they can analyse and
understand an image.” Human vision starts at the biological camera’s “eyes,” which takes one
picture about every 200 milliseconds, while computer vision starts by providing input to the
machine
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
APPLICATIONS OF COMPUTER VISION
• Automatic inspection (image-based automated inspection), e.g., in manufacturing
applications
• Assisting humans in identification tasks (to identify object/species using their properties),
e.g., a species identification system
• Controlling processes (in a way of monitoring robots), e.g., an industrial robot
• Detecting events, e.g., for visual surveillance or people counting
• Modelling objects or environments (using drones can analyses about climatic factors that
leads to change in vegetation, etc.), e.g., medical image analysis or topographical modelling
• Navigation, e.g., by an autonomous vehicle or mobile robot
• Organizing information, e.g., for indexing databases of images and image sequences
2. Robotics: This field of engineering focuses on the design and manufacturing of robots. Robots
are often used to perform tasks that are difficult for humans to perform or perform consistently.
They are used in assembly lines for car production or by NASA to move large objects in space.
Researchers are also using machine learning to build robots that can interact in social settings.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
HISTORY OF AI
YEAR OPERATIONS
1943 McCulloch& Pitts: Boolean circuit model of brain
1950 Turing’s “computing machinery and intelligence”
Early AI programs, including Samuel’s checkers program, Newell and Simon’s
logic theorist, Gelernter’s Geometry Engine.
1956 Dartmouth meeting: “Artificial Intelligence” adopted
1965 Robinson’s complete algorithm for logical reasoning
1960-1974 AI discovers computational complexity
Neural network research almost disappears
1969-1979 Early development of knowledge-based systems
1980-1988 Expert systems industry booms
1988-1993 Expert systems industry busts: ‘AI Winter”
1985-1995 Neural networks return to popularity
1988 Resurgence of probability; general increase in technical depth” Nouvelle AI”:
Alife, Gas, soft computing
1995 Agents, agents, everywhere:
2003-PRESENT Human-level AI back on the agenda
AI TECHNIQUES
AI techniques are helpful in choosing the best problem-solving techniques by organizing and using the
knowledge derived such that it can be easily modified to correct errors. These are models made from
advanced forms of a statistical and mathematical model. These models make it possible for a computer
or machine to compute tasks that are supposed to be done by humans.
1. FUZZY MODELS
Fuzzy models use the fuzzy logic which is a rule-based system that can rely on the practical experience
of an operator, particularly useful to capture experienced operator knowledge. Fuzzy logic is a form of
artificial intelligence software; therefore, it would be considered a subset of AI. Since it is performing
a form of decision making, it can be loosely included as a member of the AI software toolkit.
The design of a fuzzy logic system starts with a set of membership functions for each input and a set
for each output. A set of rules is then applied to the membership functions to yield a “crisp” output
value. For this process control explanation of fuzzy logic, TEMPERATURE is the input and FAN
SPEED is the output. Create a set of membership functions for each input. A membership function is
simply a graphical representation of the fuzzy variable sets. For this example, use three fuzzy sets,
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
COLD, WARM, and HOT. We will then create a membership function for each of three sets of
temperature as shown in the cold-normal-hot graphic
a. Automotive Systems
b. Consumer Electronic Goods
c. Domestic Goods
d. Environment Control
2. BAYESIAN NETWORKS
A Bayesian network is a directed acyclic graph in which each edge corresponds to a conditional
dependency, and each node corresponds to a unique random variable. It is a type of probabilistic
graphical model that uses Bayesian inference for probability computations.
3. DATA MINING
It is the process of extracting nontrivial and potentially useful information, or knowledge, from the
numerous data sets available in experimental sciences and provides explicit information that has a
readable form and can be used to solve diagnosis, classification or forecasting problems.
4. HEURISTICS
It is implemented to solve problems faster than the classic methods and it reduces the total number
of alternatives for the results. Heuristics is one of the best options for solving difficult problems.
For instance, to know the shorter route for any destination, the best way is to identify all the
possible routes and then to identify the shortest one.
5. SUPPORT VECTOR MACHINES
Support Vector Machine is a supervised machine learning algorithm used for regression challenges or
classification problems. However, in the majority of cases, it is used for classification only, for
instance, email systems use vector machines for email classification. It categorizes each mail according
to the respective categories. This technique is widely used for face recognition, text recognition and
image recognition systems.
6. ARTIFICIAL NEURAL NETWORK
The natural neural networks have inspired the design of an Artificial Neural Network. Instead of
Neurons, Artificial Neural Networks are composed of Nodes. These networks help in identifying
patterns from the data and then learns from it. For this purpose, it uses different learning method
such as supervised learning, unsupervised learning and reinforced learning. From an application
perspective, it is used in machine learning, deep learning and pattern recognition.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
7. MARKOV DECISION PROCESS
A Markov Decision Process (MDP) is a framework for decision-making modelling where in some
situations the outcome is partly random and partly based on the input of the decision maker. It is
used is optimized planning and it has a goal to find a policy for the decision maker, indicating
what particular action should be taken at what state. An MDP model consists of the following
parts:
• A set of possible states
• A set of possible actions
• Transition probabilities
• Rewards
8. NATURAL LANGUAGE PROCESSING
• It is a technique used by computers to understand, interpret and manipulate human
language in operations such as speech recognition and speech synthesis.
• It is also used for parsing techniques, part-of-speech tagging, and text recognition.
CHARACTERISTICS OF AI APPLICATIONS
• Natural Interactivity
• Knowledge Representation & Reasoning
• Algorithmic Intelligence & Hypothesis
• Continuous learning
• Variety Data Handling
AGENTS
An agent is anything that can be viewed as perceiving or understanding its environment through sensors
and acting upon that environment through actuators e.g. Human agents, robotic agent, software agent.
Agent
Sensors
Environment
Percepts
Actions
Actuators
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
PROPERTIES OF ENVIRONMENTS
• Accessible vs inaccessible
• Deterministic vs non deterministic
• Episodic vs non episodic
• Static vs dynamic
• Discrete vs continuous
TYPES OF AGENTS
• Human agent: A human agent has sensors such as eyes and effectors such as legs.
• Robotic agent: A robotic agent has cameras and infrared range finders for the sensors and
various motors for the effectors.
• Software agent: A software agent has encoded bit strings as its percepts and actions.
• Generic agent: A general structure of an agent who interacts with the environment.
Structure of agent:
Agent= Architecture +program
Agent program take the current percept as input from the sensors and return an action to the actuators,
and we have two types of agent programs:
• A skeleton agent which receives only a single percept as its input. If the percept is new input
then the agent updates the memory with a new percept.
• A table-driven agent which has a table consisting of indexed percept sequences with its
corresponding action, the input percept checks the table for the same percept and performs its
corresponding action.
In order to implement the mapping from percepts to actions, to perform the mapping task these agent
programs are used:
• Simple reflex agents
It selects actions on the basis of the current percept, by ignoring the rest of the percept history
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
Simple rflex agents algorithm
• Model based reflex agents
Agents maintain some internal state that depends on the percept history and it has some of the
unobserved aspects of the current state.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
A general problem solver (GPS) was done by Newell and Simon and is used to perform symbolic
manipulations of logical expressions and is applied in several common sense tasks based on reasoning.
It imitates human problem-solving protocols that established the thinking human approach
STEPS PERFORMED BY PROBLEM-SOLVING AGENT
• Goal Formulation: It is the first and simplest step in problem-solving. It organizes the
steps/sequence required to formulate one goal out of multiple goals as well as actions to
achieve that goal. The agent’s performance measure is based on the following:
• Completeness
• Optimality
• Time complexity
• Space complexity
Note: Effectiveness of search algorithm is based on search cost and total cost
Time and space complexity are expressed using the following quantities:
• Branching factor(b)
• Depth(d)
• Maximum length(m)
• Problem Formulation: It is the most important step of problem-solving which decides what
actions should be taken to achieve the formulated goal. There are following five components
involved in problem formulation:
• Initial State: It is the starting state or initial step of the agent towards its goal.
• Actions: It is the description of the possible actions available to the agent.
• Transition Model: It describes what each action does.
• Goal Test: It determines if the given state is a goal state.
• Path cost: It assigns a numeric cost to each path that follows the goal. The problem-solving
agent selects a cost function, which reflects its performance measure. Remember, an optimal
solution has the lowest path cost among all the solutions.
PROBLEM SOLVING AGENT ALGORITHM
Function SIMPLE-PROBLEM -SOLVING-AGENT(Percept) returns an Action
Inputs: percept, a percept
Static: seq, an action sequence, initially empty
State, some description of the current world state goal,
A goal, initially null
Problem, a problem formulation
State<- UPDATE-STATE (State, percept)
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
If seq is empty then do
Goal <-FORMULATE-GOAL (state)
Problem<-FORMULATE-PROBLEM (state, goal)
Seq<-SEARCH (problem)
Action<-FIRST (seq)
Set<-RESET (seq)
Return action
Note: Initial state, actions, and transition model together define the state-space of the problem
implicitly. State-space of a problem is a set of all states which can be reached from the initial state
followed by any sequence of actions. The state-space forms a directed map or graph where nodes are
the states, links between the nodes are actions, and the path is a sequence of states connected by the
sequence of actions.
• Search: It identifies all the best possible sequence of actions to reach the goal state from the
current state. It takes a problem as an input and returns solution as its output.
• Solution: It finds the best algorithm out of various algorithms, which may be proven as the
best optimal solution.
• Execution: It executes the best optimal solution from the searching algorithms to reach the
goal state from the current state.
TYPES OF PROBLEMS
• Single state problem
• Multiple state problem
• Contigency problem
• Exploration problem
EXAMPLE PROBLEMS
• Toy Problem: It is a concise and exact description of the problem which is used by the
researchers to compare the performance of algorithms.
• Real-world Problem: It is real-world based problems which require solutions. Unlike a toy
problem, it does not depend on descriptions, but we can have a general formulation of the
problem.
TOY PROBLEMS
1. 8 PUZZLE PROBLEM
Here, we have a 3×3 matrix with movable tiles numbered from 1 to 8 with a blank space. The tile
adjacent to the blank space can slide into that space. The objective is to reach a specified goal state
similar to the goal state, as shown in the below figure.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
THE PROBLEM FORMULATION
• States: It describes the location of each numbered tiles and the blank tile.
• Initial State: We can start from any state as the initial state.
• Actions: Here, actions of the blank space is defined, i.e., either left, right, up or down
• Transition Model: It returns the resulting state as per the given state and actions.
• Goal test: It identifies whether we have reached the correct goal-state.
• Path cost: The path cost is the number of steps in the path where the cost of each step is 1.
Note: The 8-puzzle problem is a type of sliding-block problem which is used for testing new search
algorithms in artificial intelligence.
2. 8-QUEENS PROBLEM
The aim of this problem is to place eight queens on a chessboard in an order where no queen may
attack another. A queen can attack other queens either diagonally or in same row and column.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
It is noticed from the above figure that each queen is set into the chessboard in a position where no
other queen is placed diagonally, in same row or column. Therefore, it is one right approach to the 8-
queens problem.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
• Cell layout: Here, the primitive components of the circuit are grouped into cells,
each performing its specific function. Each cell has a fixed shape and size. The
task is to place the cells on the chip without overlapping each other.
• Channel routing: It finds a specific route for each wire through the gaps between
the cells.
Additional real-world problems
• Airline travel problem
• Robot navigation
• Automated assembly sequencing
• Internet searching
• Routing based applications: Airline travel planning systems
Military operations planning
Routing in computer networks
SEARCH STRATEGIES
For solving different kinds of problem, an agent makes use of different strategies to reach the goal by
searching the best possible algorithms. This process of searching is known as search strategy.
Uniformed and informed search are the strategies used to describe a solution given for a problem
UNINFORMED SEARCH (BLIND SEARCH)
This type of search strategy does not have any additional information about the states except the
information provided in the problem definition. They can only generate the successors and distinguish
a goal state from a non-goal state. These type of search does not maintain any internal state, that’s why
it is also known as Blind search.
There are following types of uninformed searches:
I. Depth-First Search (DFS)
Depth first search is an edge-based technique and expands the deepest mode in the current fringe of
the search tree. The collection of nodes that have been generated but not yet expanded is called
fringe. Performance measures are based on time and space complexity where it stores only a single
path from the root to a leaf node and also unexpanded sibling nodes, once the node is expanded, it
can be removed from memory as soon as all descendants fully explored. State space with branching
factor b and maximum depth m, DFS requires storage of only b ^m+1 node(s). DFS is not optimal
and complete due to the fact that if the left subtree is of unbounded depth but has no solutions it will
never terminate,
• Uses the last in first out (LIFO) in tree search.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
• Uses the recursive function that calls itself on each of its children in turn.
B C
A A
C B C
B
D E
D E
F G
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
• It is slower than DFS
A A
B C
A A
C B C
B
D E D E F G
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
the node that is closest to the goal, on the grounds that that is likely to lead to a solution quickly. For
example, it evaluates nodes by using just the heuristic function: f(n) = h(n)
II. A* search
A* search is the most widely-known form of best-first search. It evaluates the nodes by combining
g(n), the cost to reach the node, and h(n), the cost to get from the node to the goal:
PRODUCTION SYSTEMS
Production systems can be defined as a kind of cognitive architecture, in which knowledge is
represented in the form of rules. So, a system that uses this form of knowledge representation is called
a production system. To simply put, production systems consists of rules and factors. Knowledge is
usually encoded in a declarative from which comprises of a set of rules of the form.
COMPONENTS OF AN AI PRODUCTION SYSTEM
• A global database
• A set of production rules
• A control system
The global database is the central data structure which used by an AI production system. The
production system. The production rules operate on the global database. Each rule usually has a
precondition that is either satisfied or not by the global database. If the precondition is satisfied, the
rule is usually be applied. Application of the rule changes the database. The control system then
chooses which applicable rule should be applied and ceases computation when a termination condition
on the database is satisfied. If multiple rules are to fire at the same time, the control system resolves
the conflicts.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
ARCHITECTURAL REPRESENTATION
Non-Monotonic Production Systems: These systems are important for man implementation
standpoint because they can be implemented without the ability to backtrack to previous states when it
is discovered that an incorrect path was followed. This production system increases the efficiency since
it is not necessary to keep track of the changes made in the search process.
Commutative Systems: These are useful for problems in which changes occur but can be reversed
and in which the order of operation is not critical for example the, 8 puzzle problem. Production
systems that are not usually not partially commutative are useful for many problems in which
irreversible changes occur, such as chemical analysis. When dealing with such systems, the order in
which operations are performed is very important and hence correct decisions must be made at the first
time itself.
Partially Commutative Production System: It’s a type of production system in which the application
of a sequence of rules transforms state X into state Y, then any permutation of those rules that is
allowable also transforms state x into state Y. Theorem proving falls under the monotonic partially
communicative system.
1. Blocks world and 8 puzzle problems like chemical analysis and synthesis come under
monotonic, not partially commutative systems.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
2. Although, playing the game of bridge comes under non-monotonic, not partially commutative
system. For any problem, several production systems do exist. Some will be efficient than others.
INFERENCE RULES
1. Deductive Inference Rule
• Modus Ponens
Given “A” and “A implies B”, we can
conclude “B”:
A
A -> B
B
Example:
It is raining
If it is raining, the street is wet
The street is wet
2. Abductive Inference Rule
• Abduction
Given “B” and “A implies B”, it might
be reasonable to expect “A”:
B
AÞB
A
Example:
The street is wet
If it is raining, the street is wet
It is raining
RECOGNIZE-ACT CYCLE
Typically, our production systems will have a rule interpreter that takes the form of a Recognize-Act
Cycle. This cycle has four stages:
1. Match the condition/premise patterns in the rules against the elements in the working memory to
identify the set of applicable rules.
2. If there is more than one rule that can be ‘fired’ (i.e. that can be applied), then use a Conflict
Resolution strategy to choose which one to apply. If no rules are applicable, then stop.
3. Apply the chosen rule, which may result in adding new items to the working memory, or in
deleting old ones.
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
4. Check if the terminating condition is fulfilled. If it is, then stop. Otherwise, return to stage 1. The
termination condition can either be defined by a goal state, or by some kind of resource/time
limitation (e.g. a maximum number of cycles).
FORWARD CHAINING
Forward chaining or data-driven inference works by repeatedly: starting from the current state,
matching the premises of the rules (the IF parts), and performing the corresponding actions (the
THEN parts) that usually update the knowledge base or working memory. The process continues
until no more rules can be applied, or some cycle limit is met.
BACKWARD CHAINING
Backward chaining or goal-driven inference works towards a final state by looking at the working
memory to see if the sub-goal states already exist there. If not, the actions (the THEN parts) of the
rules that will establish the sub-goals are identified, and new sub-goals are set up for achieving the
premises of those rules (the IF parts).
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems
ADVANTAGES OF PRODUCTION SYSTEMS IN AI
• The system is highly modular because individual rules can be added, removed or modified
independently
• Separation of knowledge and Control – Recognises Act Cycle
• A natural mapping onto state space research – data or goal-driven
• The system uses pattern directed control which is more flexible than algorithmic control
• Provides opportunities for heuristic control of search
• Tracing and Explanation – Simple Control, Informative rules
DMISJBU- Lilongwe Campus. Ms. Tawonga Mkandawire (BE(CS)) Artificial Intelligence &Expert Systems