========================================
PARTICLE-BASED AMA FOR RTE
========================================

ENVIRONMENT SETUP
-----------------
1. Create conda environment from the yml file:
   conda env create -f environment.yml

2. Activate the environment:
   conda activate rte

3. Verify GPU availability:
   python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}')"


RUNNING THE PARTICLE OPTIMIZATION SCRIPT
-----------------------------------------
The main script particle_script.py accepts two command-line arguments:
- --ep_index: Epsilon index (integer, e.g. -3, -1, 3. Note that epsilon=1/(2^ep_index) in RTE)
- --N: Number of particles (integer, e.g., 12, 51, 102, 204, 408)

Example commands:
   python particle_script.py --ep_index 3 --N 50
   python particle_script.py --ep_index 1 --N 102

To run multiple experiments in parallel using GNU parallel:
   parallel python particle_script.py --ep_index {1} --N {2} ::: 1 2 3 4 ::: 12 51 102 204 408


OUTPUT FILES
------------
Results are saved in directories named:
   multi-trial_training_log_eps{1/2^ep_index}N{N}/

Each directory contains CSV files with training logs for each trial.


ANALYSIS NOTEBOOKS
------------------
Three Jupyter notebooks are provided for analyzing results:

1. PlotResults.ipynb
   - Plots relative OOD errors from all trials
   - Compares performance across different epsilon and N values
   - Generates confidence intervals

2. PlotTime.ipynb
   - Visualizes computation time for each iteration
   - Shows scaling behavior with different N values
   
3. RTEInputOutput.ipynb
   - Given scattering coefficient, visualizes spatial-domain density 


TYPICAL WORKFLOW
----------------
1. Set up environment using the yml file
2. Run experiments for desired ep_index and N combinations
3. Use PlotResults.ipynb to analyze OOD error performance
4. Use PlotTime.ipynb to analyze computational efficiency
5. Makes directories contain all raw data for further analysis


REQUIREMENTS
------------
- CUDA-capable GPU (tested with CUDA 11.8)
- Python 3.11
- All dependencies listed in environment.yml


NOTES
-----
- Each full run with 30 trials takes several hours depending on N
- GPU memory usage scales with N; monitor with nvidia-smi
- Ensure sufficient disk space for output directories