Clean, runnable code for:
- PF dataset generation on IEEE 33-bus
- PF surrogate training
- LinDistFlow
- linear regression
- 1-hidden-layer nonlinear NN
- VVC with AC-truth evaluation
- VVO with AC-truth evaluation
- repeated runs with mean +- std aggregation
- DEQ vs unrolled memory / speed / AC-truth tradeoff studies
This repo should be the single source of truth for the runnable workflows.
Large generated files are not tracked in Git.
src/neogrid/scripts/configs/docs/VALIDATION.mdREADME.mdrequirements.txtpyproject.toml.gitignore
data/results/artifacts/.venv/- logs / zips / temporary files
Windows PowerShell:
cd C:\Users\moham\Downloads\neogrid_refactored_phase5
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -e .This regenerates hard PF data, retrains PF models, re-mines hard cases, then runs AC-truth VVC and AC-truth VVO.
python scripts\generate_multianchor_hard_pf.py --num-anchors 20 --samples-per-anchor 1200 --output-dir data\hard_pf_multianchor_big
python scripts\train_pf_models_from_dataset.py --dataset-csv data\hard_pf_multianchor_big\augmented_pf_multianchor.csv --epochs 50000 --device cuda
python scripts\mine_lindistflow_hard_cases.py --num-candidates 30000 --keep-full 500 --keep-tail 100 --device cuda --output-dir data\stress\lindistflow_hard_retrained_big
python scripts\dedup_ranked_cases.py --ranked-csv data\stress\lindistflow_hard_retrained_big\ranked_candidates.csv --keep-full 500 --keep-tail 100 --output-dir data\stress\lindistflow_hard_retrained_big_unique
python scripts\make_fixed_split_dataset.py --input-csv data\stress\lindistflow_hard_retrained_big_unique\hard_full_unique.csv --total-size 500 --train-size 400 --test-size 100 --seed 42 --output-dir data\stress\lindistflow_hard_retrained_big_unique\shared_split
python scripts\evaluate_vvc_actruth_fixedsplit_thresholds.py --train-csv data\stress\lindistflow_hard_retrained_big_unique\shared_split\train_400.csv --test-csv data\stress\lindistflow_hard_retrained_big_unique\shared_split\test_100.csv --epochs 500 --device cuda --output-dir results\vvc_big
python scripts\reexport_pf_onnx_flat_v2.py
python scripts\run_vvo_on_dataset.py --variant linear_regression --scenario-csv data\stress\lindistflow_hard_retrained_big_unique\shared_split\test_100.csv --qg-lb -0.6 --qg-ub 2.0 --output-dir results\vvo_big\linear_regression --solver cbc --tee
python scripts\run_vvo_on_dataset.py --variant lindistflow --scenario-csv data\stress\lindistflow_hard_retrained_big_unique\shared_split\test_100.csv --qg-lb -0.6 --qg-ub 2.0 --output-dir results\vvo_big\lindistflow --solver cbc --tee
python scripts\run_vvo_on_dataset.py --variant nonlinear --scenario-csv data\stress\lindistflow_hard_retrained_big_unique\shared_split\test_100.csv --qg-lb -0.6 --qg-ub 2.0 --output-dir results\vvo_big\nonlinear --solver bonmin --tee
python scripts\evaluate_vvo_ac_truth_thresholds.py --optimized-csv results\vvo_big\linear_regression\optimized_qg_dataset_full_linear.csv --output-json results\vvo_big\linear_regression\ac_truth_thresholds.json
python scripts\evaluate_vvo_ac_truth_thresholds.py --optimized-csv results\vvo_big\lindistflow\optimized_qg_dataset_full_linear_new.csv --output-json results\vvo_big\lindistflow\ac_truth_thresholds.json
python scripts\evaluate_vvo_ac_truth_thresholds.py --optimized-csv results\vvo_big\nonlinear\optimized_qg_dataset_full_voltage.csv --output-json results\vvo_big\nonlinear\ac_truth_thresholds.jsonThis repeats the entire process from dataset generation onward.
Get-Content .\phase5_5runs_meanstd_pipeline.txtMain outputs:
results\multi_run5\aggregate\vvc_mean_std.csv
results\multi_run5\aggregate\vvo_mean_std.csv
Uses existing VVC data only. No dataset regeneration.
Get-Content .\phase5_vvc_memory_accuracy_tradeoff.txtMain output:
results\memory_vvc_deq_vs_unrolled_tradeoff\memory_accuracy_mean_std.csv
This reports:
- GPU memory allocated / reserved
- step time
- surrogate loss
- AC-truth mean absolute voltage deviation
- AC-truth squared voltage-error objective
for:
- DEQ
- unrolled K = 10, 20, 50, 100, 200
across 5 seeds.
For both VVC and VVO, the results that matter are:
- AC-truth evaluation
- not surrogate-only evaluation
Main evaluators:
scripts/evaluate_vvc_actruth_fixedsplit_thresholds.pyscripts/evaluate_vvo_ac_truth_thresholds.py
Recommended keep list in scripts/:
generate_multianchor_hard_pf.pytrain_pf_models_from_dataset.pymine_lindistflow_hard_cases.pydedup_ranked_cases.pymake_fixed_split_dataset.pyreexport_pf_onnx_flat_v2.pyrun_vvo_on_dataset.pyevaluate_vvc_actruth_fixedsplit_thresholds.pyevaluate_vvo_ac_truth_thresholds.pyanalyze_qg_bound_activity.pyaggregate_meanstd_from_runs.pybenchmark_vvc_memory_accuracy_tradeoff.py
Everything else should be treated as legacy, debug, or superseded unless you still actively use it.
configs/
docs/
scripts/
src/
README.md
requirements.txt
pyproject.toml
.gitignore
See:
docs/VALIDATION.md