IT228 Artificial Intelligence

Artificial IntelligenceUnit 210 min read

Intelligent Agents: Types, Environments & Rationality

Unit 2 of Artificial Intelligence explores intelligent agents—autonomous entities that perceive and act in environments—covering agent types (reflex, model-based, goal-based), environments (accessible vs. unobservable, deterministic vs. stochastic), rationality, and performance measures.

TAKEAWAYS:

  • An intelligent agent is an entity that perceives its environment through sensors and acts via actuators to achieve goals.
  • Agents are classified by perception, memory, and decision-making (e.g., reflex vs. model-based).
  • Environment properties (accessibility, determinism, dynamics, observability) dictate agent complexity.
  • Rationality means an agent’s actions maximize expected utility given its knowledge.
  • Performance measures (e.g., efficiency, optimality) evaluate agent success in tasks.
  • Real-world agents (e.g., Khalti’s fraud detection, Pathao’s route optimization) use these principles daily.

1. What is an Intelligent Agent?

An intelligent agent is a system that perceives its environment through sensors and acts on it via actuators to achieve goals. It operates autonomously, adapting to changes.

Key Components of an Agent

classDiagram
    class Agent {
        +perceive() Environment
        +think() Decision
        +act() Action
        -program
        -memory
    }
    class Environment {
        +state()
        +experience()
    }
    Agent --> Environment : perceives
    Environment --> Agent : acts upon
  • Program: The agent’s logic (e.g., rules, neural networks).
  • Memory: Stores past perceptions (e.g., a robot’s map of a warehouse).
  • Actuators: Physical actions (e.g., a drone’s motors, a chatbot’s text responses).
  • Sensors: Inputs (e.g., cameras, GPS, user clicks).

Example: A Self-Driving Car Agent

  • Sensors: Cameras, LiDAR, speedometer.
  • Actuators: Steering, brakes, accelerator.
  • Environment: Roads, traffic, pedestrians.
  • Goal: Safely reach destination.

2. Types of Intelligent Agents

Agents differ by perception, memory, and decision-making. Here’s a comparison:

Agent Type Memory Perception Decision-Making Example
Simple Reflex None Current state only Rule-based (if-then) Traffic light controller
Model-Based Internal model Current + past states Uses environment model Weather prediction AI
Goal-Based Goals + model Full history Optimizes for goals Khalti’s fraud detection
Utility-Based Goals + utilities Full history Maximizes expected utility Pathao’s route optimization
Learning Agent Improves over time Adaptive Learns from experience YouTube’s recommendation system

Worked Example: Reflex vs. Model-Based Agent

Scenario: A robot vacuum in a room with obstacles.

  • Reflex Agent:
    • Rule: "If sensor detects wall → turn left."
    • Problem: Gets stuck in loops if no global map.
  • Model-Based Agent:
    • Memory: Builds a map of the room.
    • Action: Plans path to cover all areas efficiently.

3. Agent Environments

Environments define how agents interact with the world. Key properties:

Property Description Example
Accessible Agent can sense full state Chess game (board visible)
Unobservable Agent gets partial info Stock market (prices fluctuate)
Deterministic Same action → same outcome Robot arm moving a block
Stochastic Random outcomes possible Weather forecast
Episodic No history between steps ATM transaction
Sequential Actions affect future states Traffic control system
Static Doesn’t change while agent acts Crossword puzzle
Dynamic Changes while agent acts Stock prices
Discrete Finite states/actions Tic-tac-toe
Continuous Infinite states/actions Self-driving car

Visual: Environment Types

mindmap
  root((Agent Environments))
    Accessible
    Unobservable
    Deterministic
    Stochastic
    Episodic
    Sequential
    Static
    Dynamic
    Discrete
    Continuous

Real-World Example: Ncell’s Network Agent

  • Environment: Mobile network (dynamic, stochastic).
  • Agent Type: Utility-based (balances call quality, battery life, cost).
  • Challenge: Predicts congestion to reroute calls efficiently.

4. Rationality and Performance

An agent is rational if it acts to maximize its expected utility given its knowledge.

Performance Measures

Measure Definition Example
Optimality Best possible outcome Shortest path in Google Maps
Efficiency Computational cost Fast fraud detection in Khalti
Correctness Achieves goal Daraz’s order fulfillment
Robustness Handles unexpected changes Self-driving car in rain

Worked Example: Rationality in Loan Approval

Bank Agent Goal: Approve loans while minimizing default risk.

  • Perception: Customer credit score, income, past loans.
  • Rational Action: Use a utility function to balance profit vs. risk.
    • High utility = Approve if probability(default) < threshold.
    • Real Data: If a customer has a 700+ score, approve (low risk).

5. Agent Architectures

Agents use different architectures based on complexity:

A. Simple Reflex Agent

flowchart LR
    A["Sensor Input"] --> B["Condition Check"]
    B -->|"True"| C["Action 1"]
    B -->|"False"| D["Action 2"]

Example: A thermostat turning on/off based on temperature.

B. Model-Based Agent

flowchart LR
    A["Sensor Input"] --> B["Update Internal Model"]
    B --> C["Plan Action Based on Model"]
    C --> D["Act"]

Example: A chess AI predicting opponent moves.

C. Goal-Based Agent

flowchart LR
    A["Sensor Input"] --> B["Check Goals"]
    B -->|"Goal Achievable"| C["Plan"]
    B -->|"Not Achievable"| D["Replan"]

Example: Pathao’s driver finding the fastest route to a passenger.

D. Learning Agent

flowchart LR
    A["Perceive"] --> B["Learn from Experience"]
    B --> C["Update Model"]
    C --> D["Act"]

Example: YouTube’s recommendation system improving over time.


6. Real-World Applications in Nepal

Company/Product Agent Type How It Uses Intelligent Agents
Khalti Utility-based Detects fraud by analyzing transaction patterns.
Pathao Goal-based Optimizes driver routes using real-time traffic data.
Daraz Model-based Predicts inventory needs using sales trends.
NTC Sequential Manages network traffic by rerouting calls during peaks.
Nepse Stocks Learning Algorithmic trading bots adjust bids based on market trends.

Worked Example: Khalti’s Fraud Detection

  1. Perception: Transaction amount, user location, time.
  2. Model: Machine learning detects anomalies (e.g., sudden large transfer).
  3. Action: Flags or blocks suspicious transactions.
    • Rationality: Minimizes fraud loss while allowing legitimate transactions.

7. Exam Tips

  1. Define Clearly:
    • Differentiate reflex, model-based, and goal-based agents with examples.
  2. Environment Properties:
    • Memorize the table (accessible vs. unobservable, deterministic vs. stochastic).
  3. Rationality:
    • Explain how an agent’s utility function drives decisions (use loan approval as an example).
  4. Diagrams:
    • Draw agent architectures (e.g., simple reflex vs. learning agent).
  5. Real-World Links:
    • Connect theories to Khalti, Pathao, or NTC in exam answers.
  6. Performance Measures:
    • Know when to use optimality vs. efficiency (e.g., Google Maps vs. a robot vacuum).

8. Common Pitfalls

  • Confusing environments: A stock market is unobservable, stochastic, sequential.
  • Overlooking memory: A reflex agent has no memory; a model-based one does.
  • Ignoring rationality: An agent isn’t "smart" just because it acts—it must act rationally for its goals.

9. Practice Questions

  1. Compare a simple reflex agent and a goal-based agent using a traffic light system as an example.
  2. Why is Ncell’s network agent considered sequential and dynamic?
  3. Design a utility function for a bank loan approval agent.
  4. Draw the architecture of a learning agent used in YouTube recommendations.

10. Key Formulas (If Applicable)

For utility-based agents, the decision rule is: Where:

  • = Probability of state ,
  • = Utility of action in state .

11. Summary Table

Concept Key Idea Example
Agent Perceives → Acts → Achieves Goals Self-driving car
Environment Defines agent complexity Stock market (stochastic, sequential)
Rationality Maximizes expected utility Khalti’s fraud detection
Agent Types Reflex → Model-Based → Goal-Based Traffic light → Chess AI → Pathao
Performance Optimality, efficiency, correctness Google Maps (optimal path)

12. Visual Recap

mindmap
  root((Intelligent Agents))
    Definition
    Components
      Sensors
      Actuators
      Program
      Memory
    Types
      Simple Reflex
      Model-Based
      Goal-Based
      Utility-Based
      Learning
    Environments
      Accessible/Unobservable
      Deterministic/Stochastic
      Static/Dynamic
    Rationality
      Utility Maximization
    Applications
      Khalti
      Pathao
      Ncell

Based on the TU BIM syllabus for Artificial Intelligence (IT228), unit 2.

Discussion

Loading…