What is Artificial Intelligence (AI)?
Artificial Intelligence (AI) is a branch of computer science focused on creating machines that can
perform tasks that typically require human intelligence. This includes tasks like learning from
experience, understanding language, recognizing patterns, solving problems, and making
decisions.
• Artificial intelligence concerned with not just understanding but also building intelligent
entities—machines that can compute how to act effectively and safely in a wide variety
of novel situations.
“The art of creating machines that perform functions that require intelligence when
performed by people” (Kurzweil, 1990).
Views of AI fall into four categories:
• Systems that think like humans – cognitive modeling
• Systems that act like humans – Turing test
• Systems that think rationally – Laws of Thought
• Systems that act rationally – Rational Agents
What Are Smart Agents?
A smart agent (also called an intelligent agent) is a software (or hardware) entity that:
• Perceives its environment through sensors (or input data),
• Reasons or makes decisions based on those perceptions,
• And acts upon the environment to achieve specific goals.
Smart agents are used in AI systems, automation, recommendation engines, game AIs, and
virtual assistants.
Characteristics of Smart Agents
Characteristic Explanation Example
Autonomy Operates without direct human A chatbot that learns to respond
intervention appropriately
Reactivity Perceives changes in the Stock trading bot responding to
environment and reacts market changes
accordingly
Proactiveness Takes initiative to achieve goals, A recommendation agent
(Goal-driven) not just react proactively suggests items
Adaptability Learns from experience to AI opponent in a game adapting
(Learning) improve future behavior to your strategy
Rationality Chooses the best action based on Pathfinding algorithm minimizing
expected outcomes cost
Smart Agents aspects:
1. Environment
2. Percepts
3. Actions
4. Goal
Smart Agents Types:
• Simple Reflex Agent: Acts only based on the current percepts
• Model-Based Reflex Agent: Keeps track of the previous state of the current situation
• Goal-Based Agent: Plans actions to achieve the goal efficiently
• Utility-Based Agent: Considers the best action to maximize performance.
Hands-on Lab Examples:
• Simple Reflex Agent & Model Based Reflex Agent → Vacuum Cleaner Agent
• Goal-Based Agent & Utility-Based Agent → Package Delivery Agent
• Extra Example: Missionaries & Cannibals Problem
Quick Intervention – Utility Function
What is utility function? A utility function is a mathematical function that assigns a "happiness"
score to each possible action
• Higher utility = Better action for the agent
• Lower utility = Worse action for the agent
Utility = Rewards - Costs
Rewards (Positive):
• Getting closer to goals
• Completing tasks
• Gaining resources
Costs (Negative):
• Energy consumption
• Time spent
• Opportunity costs
Package Delivery Agent Utilities:
Action / Situation Utility Value Defined In Meaning /
Rationale
move_left / Computed _utility_move(direction) Moving has a base
move_right dynamically in cost of -1 (energy
_utility_move() use). Utility is then
adjusted based on
distance to goal.
→ Invalid move -100 _utility_move() Very bad move —
(beyond world prevents the agent
bounds 0–10) from going outside
allowed positions.
→ Base -1 _utility_move() Small penalty for
movement cost each move to
simulate effort or
time spent.
→ Distance -distance_to_delivery _utility_move() The farther you are
penalty (carrying * 0.5 from delivery, the
package) worse your utility.
Encourages moving
closer to delivery
point.
→ Distance -distance_to_package _utility_move() The farther you are
penalty (not * 0.5 from the package,
carrying package) the worse your
utility. Encourages
moving closer to
pick-up location.
→ Reward for +2 _utility_move() Small bonus if the
moving closer to move reduces the
delivery distance to delivery.
Encourages progress
toward the goal.
→ Reward for +2 _utility_move() Small bonus if the
moving closer to move reduces the
package distance to package.
Encourages progress
toward package
location.
pickup_package +15 _utility_pickup() High reward for
(at correct correctly picking up
location) the package
(important task).
pickup_package -10 _utility_pickup() Penalty for trying to
(wrong location) pick up where no
package exists.
deliver_package +25 _utility_deliver() Very high reward for
(at correct completing delivery
location) — the main goal!
deliver_package -10 _utility_deliver() Penalty for
(wrong location) attempting to
deliver in the wrong
place.
wait -10 calculate_utility() Negative utility to
discourage doing
nothing.
Unknown or -100 calculate_utility() → Catch-all penalty for
undefined actions .get(action, -100) any action not
defined in the utility
dictionary (e.g.,
“fly”). Prevents
agent from taking
meaningless or
invalid actions.
Example Code: Check Lab1 Folder
Assignment:
Solve the river problem.
A farmer wishes to carry a wolf, a duck and corn across a river, from the south to the north
shore. The farmer is the proud owner of a small rowing boat called Bounty which he feels is
easily up to the job. Unfortunately, the boat is only large enough to carry at most the farmer
and one other item. Worse again, if left unattended the wolf will eat the duck and the duck will
eat the corn. Create an agent to solve the problem, what kind of agents would suit this kind of
problems?
Submission: Google Drive Folders
Note: Files must be .py file extension