How andreaskuhnle/simrlfab works
Project Type and Purpose
• SimPyRLFab is a domain‐specific simulation & reinforcement‐learning framework for production planning and control in complex job‐shop manufacturing systems.
• It combines a SimPy‐based discrete‐event simulator (the “environment”) with a Tensorforce‐based RL agent.
File Structure
• Top‐level entry points:
• run.py – orchestrates a single training experiment (loads configs, kicks off env & agent loop).
• hyper_tuner.py – wraps multiple run experiments to perform hyperparameter search.
• Config directory: JSON files for agent (agent.json), environment parameters (environment.json), memory and network architecture, plus algorithm presets (ppo1.json, trpo1.json).
• production/envs: Python modules implementing the SimPy environment (initialize_env.py), resources (machines, sources, sinks), transport, reward functions, and dispatching heuristics.
• logger.py + log/ directory: performance‐metric collection and log export.
• docu/: static documentation (e.g., layout.png).
README for Key Insights
• Technologies: Python 3.6, SimPy for simulation model, Tensorforce for RL.
• Components: parametrizable environment, benchmark heuristics (FIFO, NJF, EMPTY), RL agent configurations, logging of performance indicators.
• Workflow: configure JSON → run.py → initialize_env.py → training loop → log outputs.
Main Components
a. Orchestration Layer
• run.py (entry point)
• hyper_tuner.py (optional wrapper)
• Configuration Manager (reads JSON files from config/)
b. Simulation Environment (SimPy)
• initialize_env.py
• production/envs modules (machines, sources, sinks, transport, reward_functions, heuristics)
c. Reinforcement Learning Agent (Tensorforce)
• agent builder (consumes agent.json, memory.json, network.json)
• action selection & policy update
d. Logger & Data Sink
• logger.py → writes metrics to log/
• log files for post‐run analysis
Relationships and Data Flow
• run.py → loads all config JSON → passes env parameters to initialize_env
• run.py → passes agent parameters to Tensorforce agent
• Training loop:
[Environment] --(state)--> [RL Agent] --(action)--> [Environment]
[Environment] --(reward, next state)--> [RL Agent]
[Logger] subscribes to state, action, reward, episode metrics
• hyper_tuner.py invokes run.py repeatedly with varied config files
• config files feed both env and agent components
Architectural Patterns and Design Principles
• Modular, configuration‐driven design: clear separation between code and parameters
• Observer pattern for logging: logger.py listens to events from both env and agent
Technologies & Frameworks
• Python 3.6
• SimPy (for discrete‐event simulation)
• Tensorforce (for deep RL)
• JSON for configuration
• Standard Python logging or custom logger.py
Final Checklist
• [ ] Clear, descriptive labels for each component and sub‐module
• [ ] Call out key technologies on each component (e.g., “SimPy”, “Tensorforce”, “JSON Config”)