Skip to content

About

Artificial Intelligence in Python coursework for COMP3702. Includes A1 (Search: UCS and A*), A2 (Planning: Value Iteration, Policy Iteration, Q-Learning), and A3 (Reinforcement Learning: DQN variants on Gymnasium environments).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

228 Commits

Folders and files

Repository files navigation

Artificial Intelligence in Python

This repository contains my COMP3702 coursework implementations across three major AI topics:

  • Search (Assignment 1): Uniform Cost Search and A*
  • Planning (Assignment 2): Value Iteration, Policy Iteration, and Q-Learning
  • Reinforcement Learning (Assignment 3): DQN variants on Gymnasium environments

The codebase is organized as three independent project folders, each with its own environment logic, solver/training scripts, and report artifacts.


Repository Structure

  • comp3702-search/

    • Assignment 1 (Cheese Hunter search)
    • Key file: solution.py
    • Includes local tester, testcases, and autograder result snapshots
  • comp3702-planning/

    • Assignment 2 (Cheese Hunter planning)
    • Key file: solution.py
    • Includes VI/PI/QL tester and additional experiment scripts
  • comp3702-reinforcement-learning/

    • Assignment 3 (DQN / Duelling DQN)
    • Key files: dqn_gym.py, dqn_cartpole.py, run_model.py
    • Includes experiment plots and reusable config in config/dqn.yaml

Quick Navigation

  • Assignment 1 README: comp3702-search/README.md
  • Assignment 2 README: comp3702-planning/README.md
  • Assignment 3 README: comp3702-reinforcement-learning/README.md

Environment Setup

The search/planning projects run with standard Python.

For the RL project, create the conda environment from the provided YAML file:

cd comp3702-reinforcement-learning
conda env create -f environment.yml
conda activate basic-dqn

If your conda environment name differs on your machine, activate the created environment name shown by conda.


How to Run

1) Assignment 1: Search

cd comp3702-search
python tester.py ucs testcases/level_1.txt
python tester.py a_star testcases/level_3.txt
python play_game.py testcases/level_1.txt

Notes:

  • tester.py currently defaults to batch execution via run_all_levels() in this repo version.
  • Core implementation is in comp3702-search/solution.py.

2) Assignment 2: Planning

cd comp3702-planning
python tester.py vi testcases/level_1.txt
python tester.py pi testcases/level_1.txt
python tester.py ql testcases/level_1.txt
python play_game.py testcases/level_1.txt

Planning modes:

  • vi: Value Iteration
  • pi: Policy Iteration
  • ql: Q-Learning

Core implementation is in comp3702-planning/solution.py.

3) Assignment 3: Reinforcement Learning

cd comp3702-reinforcement-learning
python dqn_cartpole.py
python dqn_gym.py -e CartPole-v1 -n single-hidden
python dqn_gym.py -e CartPole-v1 -n two-hidden
python dqn_gym.py -e CartPole-v1 -n duelling-dqn

Run a saved model:

python run_model.py -e CartPole-v1 -n single-hidden -m saved_models/<model-file>.dat

Hyperparameters are managed in comp3702-reinforcement-learning/config/dqn.yaml.


Results and Artifacts

  • Assignment 1 autograder snapshots: comp3702-search/1_Result/
  • Assignment 2 report material: comp3702-planning/Part2/
  • Assignment 3 report material: comp3702-reinforcement-learning/Part2/
  • Assignment 3 plots and experiment scripts: comp3702-reinforcement-learning/plots/

The repository also includes many generated figures showing training curves (episode reward, R100, epsilon decay, and hyperparameter comparisons).


Notes

  • This repository mixes support-code files (provided by the course) and my implementation/experiment files.
  • Some scripts were created for local experimentation and may assume relative working directories.
  • For reproducibility, run commands from inside the relevant project folder.

License and Academic Use

This repository is coursework-oriented. If you are a student taking a similar course, use it for learning and reference only, and follow your institution's academic integrity policy.

About

Artificial Intelligence in Python coursework for COMP3702. Includes A1 (Search: UCS and A*), A2 (Planning: Value Iteration, Policy Iteration, Q-Learning), and A3 (Reinforcement Learning: DQN variants on Gymnasium environments).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages