How aqasch/gadget_rl works
Project type and purpose
• This is a research-oriented Python project that implements two tightly coupled pipelines:
a. A “Gadget Discovery” pipeline (discover_gadgets/) that uses program synthesis (DreamCoder) and decomposition scripts to extract reusable quantum‐circuit gadgets.
b. A “Gadget-Enhanced Reinforcement Learning” pipeline (gadget_RL/) that trains classical RL agents (CRL) on raw gate sets and then gadget-augmented RL agents (GRL) on harder quantum control tasks (Transverse Field Ising Model).
File structure
Top-level:
• discover_gadgets/ – dreamcoder core, decomposition drivers, analytic scripts, example circuits
• gadget_RL/ – subfolders agents/, environments/, configuration_files/, ham_data/, utils/ plus entrypoints (main.py, main_synthesized_*.py)
• requirements.txt, README.md
Patterns & choices:
• Modular separation of “discovery” vs. “training”
• Config-driven design (all experiment parameters live in configuration_files)
• Agent–Environment RL loop (similar to Gym)
• Data‐artifact directories: ham_data/ (quantum Hamiltonians), results/ (pickled summaries)
README for additional insights
• Describes workflows for CRL vs. GRL, how to run discovery (run_decomposition.py) and how to launch training with/without gadgets.
• Defines key configuration parameters (qubit count, layers, decompose flag) and data outputs (summary_*.pickle).
Capturing essential details
• Break each sub-component into its folder or file group (e.g., list agents/, environments/).
• That the same environment codebase is reused for CRL and GRL, differing only in the action set (native gates vs. gadgets).