How yd-kwon/pomo works
Project Type & Purpose
• The project is a research and production-ready implementation of the POMO (Policy Optimization with Multiple Optima) method for solving combinatorial optimization problems – specifically the Capacitated Vehicle Routing Problem (CVRP) and the Travelling Salesman Problem (TSP).
• The repository contains both “OLD” interactive notebook-based prototypes (from 2020) and a “NEW” Python-based version (from 2021) that is structured for server-side execution.
Analyzing the File Structure
• Top-Level Separation: The project is split at the root into NEW_py_ver (the updated, production-oriented version) and OLD_ipynb_ver (the legacy, experimental notebooks).
• Under NEW_py_ver, there are directories for each problem type (CVRP and TSP). In each, there is a “POMO” subfolder that encapsulates the core RL pipeline components – environments (CVRPEnv.py, TSPEnv.py), models (CVRPModel.py, TSPModel.py), trainer and tester scripts, and result (checkpoint) folders.
• There is also a “utils” folder containing helper modules for logging styles and utility functions.
• The OLD_ipynb_ver mirrors a similar separation but uses Jupyter notebooks and an older, more exploratory structure that includes examples for other problems (like knapsack, under POMO_KP).
Interpreting the README
• The README explains that the OLD_ipynb_ver contents are the original, interactive versions used for the NeurIPS 2020 paper, while the NEW_py_ver directories offer a cleaner, scalable Python-based refactor.
a. Main Components:
• Problem Modules: Separate modules for CVRP and TSP.
▪ Each module includes a problem definition (e.g., CVRProblemDef.py, TSProblemDef.py).
• POMO Pipeline: For each problem type, structure under POMO includes:
▪ Environment components (CVRPEnv.py, TSPEnv.py) that simulate the problem.
▪ Model components (CVRPModel.py, TSPModel.py) that define the RL network.
▪ Trainer components (CVRPTrainer.py, TSPTrainer.py) that run training loops.
▪ Tester components (CVRPTester.py, TSPTester.py) for evaluation/inference.
▪ Result directories that hold saved checkpoints and logs.
• Utilities: The utils folder provides logging style configurations (JSON styles) and helper functions (utils.py) relevant to visualization or additional processes.
b. Relationships & Interactions:
• How the problem definition modules feed into the environment classes.
• Flow where the environment and model interact during training – for example, the Trainer receives data from the Environment and updates the Model based on the reinforcement learning algorithm.
• Tester to demonstrate the post-training evaluation phase, emphasizing how it uses saved checkpoints.
• That the “NEW_py_ver” structure is the main operational pipeline, with OLD_ipynb_ver illustrating the earlier, more exploratory versions for research validation.
c. Architectural Patterns & Design Principles:
• Separation of Concerns: Distinct modules for environment, model, training, and testing.
• Modularity: Each problem type (CVRP and TSP) is designed as an isolated component within its POMO framework.
• Reusability: Common utilities (e.g., logging style definitions and helper methods) are organized in the utils folder.
• Iterative Pipeline: The workflow follows a clear cycle – problem definition → environment simulation → model training → testing/inference → checkpoint saving.
d. Technologies and Frameworks:
• The system is developed with Python, with a focus on PyTorch (implied by model checkpoints and file naming such as “checkpoint-xxxx.pt”) for deep RL.
• The structure clearly emphasizes research reproducibility (shown by the legacy notebooks) along with formal deployment (Python scripts in NEW_py_ver).