Unit 1 - Ai - KCS071

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

Artificial Intelligence (KCS

071)
Course Instructor : Dr. Deepak Sethi
Learning Outcomes
By the end of this course, you will be able to :
• explain search strategies and solve problems by applying a suitable
search method
• analyse and apply knowledge representation
• describe and list the key aspects of planning in artificial intelligence
• analyse and apply probability theorem and Bayesian networks
• describe the key aspects of intelligent agents
• differentiate the key aspects of evolutionary computation, including
genetic algorithms and genetic programming
• describe the key aspects of machine learning
Introduction to Artificial Intelligence (AI)

• Artificial intelligence is the simulation of human intelligence processes


by machines, especially computer systems.
• AI can also be defined as:
"It is a branch of computer science by which we can create intelligent machines which can
behave like a human, think like humans, and be able to make decisions."
History of Artificial Intelligence
Turing Test in AI
Turing Test was introduced by Turing in his 1950 paper,
"Computing Machinery and Intelligence," which considered the
question, "Can Machine think?"

This game involves three players in which one player is


Computer, another player is human responder, and the third
player is a human Interrogator, who is isolated from other two
players and his job is to find that which player is machine
among two of them
Turing Test in AI
Features required for a machine to pass the Turing test:
• Natural language processing: NLP is required to communicate with
Interrogator in general human language like English.
• Knowledge representation: To store and retrieve information during the test.
• Automated reasoning: To use the previously stored information for
answering the questions.
• Machine learning: To adapt new changes and can detect generalized patterns.
• Vision (For total Turing test): To recognize the interrogator actions and other
objects during a test.
• Motor Control (For total Turing test): To act upon objects if requested.
Applications of AI
AI in Automobile (Driverless Car)
Recent Trends in AI
Intelligent Agents
Agent
An agent is anything that can be viewed as :
• perceiving its environment through sensors and
• acting upon that environment through actuators

Sensor: Sensor is a device which detects the change in the environment and
sends the information to other electronic devices. An agent observes its
environment through sensors.
Actuators: Actuators are the component of machines that converts energy
into motion. The actuators are only responsible for moving and controlling
a system. An actuator can be an electric motor, gears, rails, etc.
Intelligent Agents
An Agent runs in the cycle of perceiving, thinking, and acting. An
agent can be:
• Human-Agent: A human agent has eyes, ears, and other organs which
work for sensors and hand, legs, vocal tract work for actuators.
• Robotic Agent: A robotic agent can have cameras, infrared range
finder, NLP for sensors and various motors for actuators.
• Software Agent: Software agent can have keystrokes, file contents as
sensory input and act on those inputs and display output on the screen.
Intelligent Agent
An intelligent agent is an autonomous entity which act upon an environment using sensors and actuators
for achieving goals. An intelligent agent may learn from the environment to achieve their goals.

Following are the main four rules for an AI agent:


• Rule 1: An AI agent must have the ability to perceive the environment.
• Rule 2: The observation must be used to make decisions.
• Rule 3: Decision should result in an action.
• Rule 4: The action taken by an AI agent must be a rational action.

Examples
AI assistants, like Alexa and Siri, are examples of intelligent agents as they use sensors to perceive a
request made by the user and the automatically collect data from the internet without the user's
help. They can be used to gather information about its perceived environment such as weather and time.
Structure of AI Agent
Agent = Architecture + Agent program
• Architecture: Architecture is machinery that an AI agent executes on.
• Agent Function: Agent function is used to map a percept to an action.
f:P* → A
• Agent program: Agent program is an implementation of agent
function. An agent program executes on the physical architecture to
produce function f.
PEAS Representation
PEAS is a type of model on which an AI agent works upon.
• P: Performance measure
• E: Environment
• A: Actuators
• S: Sensors

Let's suppose a self-driving car then PEAS representation will be:


• Performance: Safety, time, legal drive, comfort
• Environment: Roads, other vehicles, road signs, pedestrian
• Actuators: Steering, accelerator, brake, signal, horn
• Sensors: Camera, GPS, speedometer, odometer, accelerometer, sonar.
Steps in Problem-solving
• Goal Formulation: This one is the first and simple step in problem-solving. It organizes finite
steps to formulate a target/goals which require some action to achieve the goal. Today the
formulation of the goal is based on AI agents.
• Problem formulation: It is one of the core steps of problem-solving which decides what action
should be taken to achieve the formulated goal.
Problem formulation
Components to formulate the associated problem:
• Initial State: This state requires an initial state for the problem which starts the AI agent
towards a specified goal. In this state new methods also initialize problem domain solving
by a specific class.
• Action: This stage of problem formulation works with function with a specific class taken
from the initial state and all possible actions done in this stage.
• Transition: This stage of problem formulation integrates the actual action done by the
previous action stage and collects the final stage to forward it to their next stage.
• Goal test: This stage determines that the specified goal achieved by the integrated
transition model or not, whenever the goal achieves stop the action and forward into the
next stage to determines the cost to achieve the goal.
• Path costing: This component of problem-solving numerical assigned what will be the
cost to achieve the goal.
8-Queens Problem
• The eight queens problem is the problem of placing eight queens on an
8×8 chessboard such that none of them attack one another (no two are
in the same row, column, or diagonal).
• More generally, the n queens problem places n queens on an n×n
chessboard.
8-Queens Problem
• Backtracking Algorithm
The idea is to place queens one by one in different columns, starting
from the leftmost column. When we place a queen in a column, we
check for clashes with already placed queens.
• In the current column, if we find a row for which there is no clash, we
mark this row and column as part of the solution.
• If we do not find such a row due to clashes then we backtrack and
return false.
Backtracking Algorithm
• 1) Start in the leftmost column
• 2) If all queens are placed
• return true
• 3) Try all rows in the current column.
• Do following for every tried row.
• a) If the queen can be placed safely in this row
• then mark this [row, column] as part of the
• solution and recursively check if placing
• queen here leads to a solution.
• b) If placing the queen in [row, column] leads to
• a solution then return true.
• c) If placing queen doesn't lead to a solution then
• unmark this [row, column] (Backtrack) and go to
• step (a) to try other rows.
• 3) If all rows have been tried and nothing worked,
• return false to trigger backtracking.
Water-jug Problem
• Problem: You are given two jugs, a 4-gallon one and a 3-gallon one.Neither has any
measuring mark on it.There is a pump that can be used to fill the jugs with water.How
can you get exactly 2 gallons of water into the 4-gallon jug.

• Solution:
• The state space for this problem can be described as the set of ordered pairs of
integers (x,y)
Where,
• X represents the quantity of water in the 4-gallon jug X= 0,1,2,3,4
• Y represents the quantity of water in 3-gallon jug Y=0,1,2,3
• Start State: (0,0)
• Goal State: (2,0)
Production Rules
State Space Tree
Production Rules
Rule State Process
1 (X,Y | X<4) (4,Y)
{Fill 4-gallon jug}
2 (X,Y |Y<3) (X,3)
{Fill 3-gallon jug}
3 (X,Y |X>0) (0,Y)
{Empty 4-gallon jug}
4 (X,Y | Y>0) (X,0)
{Empty 3-gallon jug}
5 (X,Y | X+Y>=4 (4,Y-(4-X))
and Y>0) {Pour water from 3-gallon jug into 4-gallon
jug until 4-gallon jug is full}

6 (X,Y | X+Y>=3 (X-(3-Y),3)


and X>0) {Pour water from 4-gallon jug into 3-gallon
jug until 3-gallon jug is full}

7 (X,Y | X+Y<=4 (X+Y,0)


and Y>0) {Pour all water from 3-gallon jug into 4-
gallon jug}

8 (X,Y | X+Y (0,X+Y)


<=3 and X>0) {Pour all water from 4-gallon jug into 3-
gallon jug}

9 (0,2) (2,0)
{Pour 2 gallon water from 3 gallon jug into 4
gallon jug}
• Initialization:
• Start State: (0,0)
• Apply Rule 2:
• (X,Y | Y<3) -> (X,3) {Fill 3-gallon jug}
• Now the state is (X,3) (0,0)->(0,3)->(3,0)->(3,3)->(4,2)->(0,2)->(2,0)

• Iteration 1:
• Current State: (X,3)
• Apply Rule 7:
• (X,Y | X+Y<=4 and Y>0)
• (X+Y,0) {Pour all water from 3-gallon jug into 4-gallon jug}
• Now the state is (3,0)

• Iteration 2:
• Current State : (3,0)
• Apply Rule 2:
• (X,Y | Y<3) -> (3,3) {Fill 3-gallon jug}
• Now the state is (3,3)
• Iteration 3:
• Current State:(3,3)
• Apply Rule 5:
• (X,Y | X+Y>=4 and Y>0)
• (4,Y-(4-X)) {Pour water from 3-gallon jug into 4-gallon jug until 4-gallon jug is full}
• Now the state is (4,2)
• Iteration 4:
• Current State : (4,2)
• Apply Rule 3:
• (X,Y | X>0)
• (0,Y) {Empty 4-gallon jug}
• Now state is (0,2)

• Iteration 5:
• Current State : (0,2)
• Apply Rule 9:
• (0,2)
• (2,0) {Pour 2 gallon water from 3 gallon jug into 4 gallon jug}
• Now the state is (2,0) // Goal Achieved.
Task : Monkey Banana Problem
References
• https://www.javatpoint.com/artificial-intelligence-tutorial
• http://asia.blog.terrapinn.com/edutech/2018/02/28/role-artificial-int
elligence-ai-education/
• https://www.geeksforgeeks.org/agents-artificial-intelligence/
• https://www.javatpoint.com/agents-in-ai
• https://www.tutorialspoint.com/artificial_intelligence/artificial_intelli
gence_natural_language_processing.htm

You might also like