diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6c80a65 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,23 @@ +name: Numerical checks +on: [push, pull_request] +permissions: + contents: read +jobs: + test: + runs-on: ubuntu-24.04 + env: + MPLBACKEND: Agg + OMP_NUM_THREADS: '1' + MKL_NUM_THREADS: '1' + steps: + - uses: actions/checkout@v7.0.1 + - uses: actions/setup-python@v7.0.0 + with: + python-version: '3.12' + cache: pip + - run: python -m pip install --index-url https://download.pytorch.org/whl/cpu torch==2.14.1 + - run: python -m pip install -r requirements-tested.txt + - run: python -m pip install --no-deps -e . + - run: python -m pytest + - run: python e1_kuramoto.py --smoke --no-plots --no-mirror --out-root smoke-results + - run: python e2_bc.py --smoke --no-plots --no-mirror --out-root smoke-results diff --git a/README.md b/README.md index 8b1d114..9df3ad6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A PyTorch research implementation that learns how agents influence one another over time. It combines neural interaction kernels, differentiable simulation, and stochastic optimization. -Companion code for *Graphon Controlled Opinion Dynamics*, by **Joseph K. Miller and Brandon Su**. +Companion code for *Optimal Graphon Control of Collective Dynamics*, by **Joseph K. Miller and Brandon Su**. ## Experiments @@ -26,22 +26,23 @@ From the repository root: ```bash python3 -m venv .venv source .venv/bin/activate -python -m pip install torch numpy matplotlib tqdm pillow +python -m pip install -e . python e1_kuramoto.py --smoke --device cpu --no-mirror ``` -This runs a 20-iteration workflow check. Results appear under `out_1/`, including `untwist.gif`, `kernel_time.gif`, and `metrics.json`. +This runs a 20-iteration workflow check on a small grid and network. Results appear under `out_1/`, including `untwist.gif`, `kernel_time.gif`, and `metrics.json`. ## Code | File | Contents | | --- | --- | -| `model_1.py` | Neural controller, simulation, and training | +| `graphon_control/` | Reusable controller, dynamics, objectives, and training | +| `model_1.py` | General experiment entry point | | `e1_kuramoto.py` | Oscillator experiment | | `e2_bc.py` | Opinion dynamics experiment | | `model_1_viz.py` | Visualization utilities | -Use `python