Skip to content

lawun330/classical-ai-examples

Repository files navigation

Classical AI Examples

This repository provides practical examples illustrating key concepts in classical AI (also known as symbolic AI or knowledge-based AI), such as Markov Decision Processes, Constraint Satisfaction Problems, Rational Agents, and Propositional Logic.

📚 Topics covered include:

  • Reinforcement Learning – Markov Decision Processes and policy iteration
  • Constraint Satisfaction – Backtracking and constraint propagation
  • Rational Agents – Goal-directed behavior and resource management
  • Knowledge Representation – Propositional logic and inference

📁 Repository Contents

🤖 AgentMDP.java

  • Concept: Demonstrates how to find optimal policies for agents in uncertain environments
  • Algorithm: Policy iteration (alternating policy evaluation and improvement)
  • Environment: 3x3 grid world with obstacles, fire (negative reward), and goal (positive reward)

🤖 AgentMDP_with_GUI.py

  • Concept: Demonstrates how to find optimal policies for agents in uncertain environments with visual feedback
  • Algorithm: Value iteration (iteratively updating state values until convergence)
  • Environment: 4x4 grid world with obstacles, fire (negative reward), and goal (positive reward)
  • Visualization: Interactive turtle graphics showing the agent's path, grid states, and outcome messages

🎨 BacktrackingCSP.java

  • Concept: Solves the graph coloring problem using backtracking
  • Algorithm: Backtracking with constraint propagation
  • Problem: Assign colors to vertices such that adjacent vertices have different colors

🧹 rational_cleaner_agent.py

  • Concept: Demonstrates rational agent behavior in a cleaning environment
  • Model: PEAS (Performance, Environment, Actuators, Sensors) model
  • Environment: 4x4 grid with dirt locations, energy constraints, and bag capacity

🔍 WeatherLogicTruthTable.java

  • Concept: Demonstrates logical reasoning using truth tables
  • Operations: Conjunction (AND), Implication (IF-THEN)
  • Analysis: Evaluates complex logical expressions and knowledge bases

🔧 Customization

Modifying the MDP Environment

  • Change the grid layout in AgentMDP.java
  • Adjust rewards and discount factor
  • Add new obstacles or goals

Extending the CSP Solver

  • Modify color constraints
  • Add new constraint types
  • Implement different variable ordering heuristics

Enhancing the Rational Agent

  • Adjust energy consumption rates
  • Modify bag capacity constraints
  • Add new environmental obstacles

🧠 Classical AI vs. Modern AI

Classical AI differs significantly from modern AI that uses machine learning approaches:

Classical AI (This Repository):

  • Symbolic Reasoning: Uses logic, rules, and knowledge representation
  • Explicit Knowledge: Knowledge is explicitly programmed and interpretable
  • Deterministic: Predictable behavior based on logical rules
  • Problem-Solving: Focuses on search, planning, and constraint satisfaction
  • Interpretable: You can understand exactly how decisions are made

Modern AI (Machine Learning):

  • Statistical Learning: Learns patterns from data
  • Implicit Knowledge: Knowledge is learned and often not interpretable
  • Probabilistic: Makes decisions based on statistical patterns
  • Data-Driven: Requires large datasets for training
  • Black Box: Often difficult to understand how decisions are made

📖 References

📄 License

This project is part of coursework and is intended for educational purposes.

About

Examples of classical artificial intelligence concepts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors