These projects are part of the Artificial Intelligence Fundamentals course at the University of Isfahan. The projects cover topics in Machine Learning, Reinforcement Learning, and First Order Logic, all developed under the supervision of Dr. Hossein Karshenas.
This project demonstrates the implementation of a graph data structure to apply Dijkstra's and A* (Astar) algorithms for finding the shortest path between nodes in a graph. In this implementation, the graph nodes represent airports, and the goal is to determine the shortest path between airports with the minimum cost.
To run this project, install the required dependencies by executing the following commands:
pip install numpy
pip install pandas
-
Algorithm Execution Results: The results of the Dijkstra and A* algorithm executions are saved as .txt files in the project's folder. These results showcase the shortest path and associated costs for any given origin and destination.
-
Algorithm Execution Results: On each program run, you provide an origin and destination as input. The program computes the shortest path and saves the results in two .txt files in the project's folder.
-
Default Example: The current output in the repository is based on the following:
- Origin: Imam Khomeini International Airport
- Destination: Raleigh-Durham International Airport
This project demonstrates the implementation of Linear Regression from scratch using the NumPy and Pandas libraries. The task involves predicting flight prices based on features such as duration, arrival time, departure time, and more.
- Read the Dataset: Load and preprocess the data.
- Handle Missing Values: Identify and address any NaN values in the dataset.
- Process Text Features: Transform text-based features into a usable format.
- Feature Scaling: Apply Min-Max Scaling (Normalization) to standardize feature values.
- Implement Linear Regression: Train the model using a custom implementation.
- Evaluate the Model: Use metrics like R²-score, Mean Squared Error (MSE), and Mean Absolute Error (MAE) to assess performance.
To run this project, install the required dependencies using the following commands:
pip install numpy
pip install pandas
pip install scikit-learn
pip install seaborn
This project implements an intelligent agent operating in a non-deterministic environment. The primary goal is to determine the optimal policy for the agent in this environment.
- The agent has access to the Transition Model of the environment.
- The Value Iteration algorithm is utilized to compute the optimal policy for the agent.
The agent operates in the "Cliff Walking" environment from the gymnasium library.
Below is an example of the environment:
- Implementation of the Value Iteration Algorithm:
- Algorithm Convergence Check: Ensures the Value Iteration process reaches stability.
- Calculation of Key Metrics:
- Q*: Optimal state-action values.
- V*: Optimal state values.
- Heatmap Visualization: Displays the scores of all states in a visually interpretable format.
- Convergence Plot: Visualizes the convergence process of the algorithm over iterations.
To run this project, install the required dependencies using the following commands:
pip install 'gymnasium[all]'
pip install numpy
pip install seaborn
This project demonstrates the implementation of an intelligent agent that operates in an unknown environment. The goal is to determine the optimal policy for the agent to maximize its performance in this environment
Below is an example of the gym-maze environment:
- Implementation of Q-Learning Algorithm: A classic reinforcement learning approach for policy determination.
- Deep Q-Learning (DQN): Utilizes Keras for building and training deep neural networks.
- Action Selection Strategies: Includes methods like:
- Epsilon-Greedy for balancing exploration and exploitation.
- Approximation Utility to suggest optimal actions based on learned policies.
To run this project, install the required dependencies using the following commands:
pip install tensorflow
pip install --upgrade keras
pip install seaborn
python setup.py install
This project focuses on creating an intelligent agent to play the Pacman game. The goal is to maximize the score by eating dots and strategically avoiding ghosts.
- The project uses the Pacman environment developed by UC Berkeley.
- In this environment, the agent navigates a maze, eating small dots and large dots to score points.
- The primary challenge is avoiding ghosts, but by eating large dots, the agent temporarily gains the ability to eat ghosts and earn additional points.
- Minimax Algorithm: Implemented to solve the multi-agent decision-making problem in the game.
- Heuristic Method: Developed to guide the agent towards achieving the maximum possible score and ultimately winning the game.
- The game is a multi-agent environment, requiring strategic planning to win with the highest score.
- Our heuristic method was rigorously tested, achieving 200 wins out of 200 games with a single directional ghost.
To run the game with intelligent ghosts, execute the following commands from the game's folder:
- Run with 1 directional ghost for 100 games:
python pacman.py -p AIAgent -k 1 -a depth=4 -g DirectionalGhost -n 100
- Run with 1 ghost with stochastic actions:
python pacman.py -p AIAgent -k 1 -a depth=4 -n 100
To view the implementation of the Minimax algorithm and the heuristic method, navigate to: Multi agent search game/multiAgents.py
This project focuses on creating a tourist tour recommendation system using First Order Logic (FOL). The system processes user-input text about their preferences and recommends a suitable tour. The recommendation is based on a Knowledge Base implemented with the Prolog language.
- Graph Representation: A graph is constructed from the input dataset using Prolog to represent tour connections.
- Neighbor Discovery: Identify the first and second-degree neighbors of any node in the graph using Prolog queries.
- Tour Recommendation:
- Process user input text about their preferences.
- Suggest a tour that matches their preferences based on the graph’s connected nodes and the knowledge base.
- Knowledge Base Design: Use Prolog rules and facts to store relationships and enable intelligent query processing.
To run this project, install the required dependencies using the following commands:
pip install numpy
pip install pandas
pip install pyswip