How yess1ne/rl_based_pathfinding works
This is a self-running REINFORCE maze-training script. Its workflow is to sample episodes in an 8×8 GridWorld, compute discounted returns, update a policy network, then simulate and print a greedy path. The environment and policy are distinct runtime components; episode collection, return calculation, and updates are internal learning stages. The README documents the intended behavior, while the single source excerpt shows the implementation and call relationships.
Main entry points: pathfinding.py Training Loop
Components 8
Maze Environment
- GridWorld
pathfinding.py
Policy Learning
- Training Loop
pathfinding.py - Policy Network
pathfinding.py - Episode Sampling
pathfinding.py - Return Calculation
pathfinding.py - Policy Update
pathfinding.py
Path Visualization
- Greedy Path Display
pathfinding.py
Other components
- User
Connections 10
- User → Training Loop: runs script
pathfinding.py - Training Loop → Episode Sampling: collects episode
pathfinding.py - Episode Sampling → GridWorld: resets and steps
pathfinding.py - Episode Sampling → Policy Network: samples actions
pathfinding.py - Training Loop → Return Calculation: computes returns
pathfinding.py - Training Loop → Policy Update: updates policy
pathfinding.py - Policy Update → Policy Network: evaluates and trains
pathfinding.py - Training Loop → Greedy Path Display: renders after training
pathfinding.py - Greedy Path Display → Policy Network: selects greedy actions
pathfinding.py - Greedy Path Display → GridWorld: simulates path
pathfinding.py