Skip to content
MFHChehadePublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Neo-Grid

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.

Keep in the repo

  • src/neogrid/
  • scripts/
  • configs/
  • docs/VALIDATION.md
  • README.md
  • requirements.txt
  • pyproject.toml
  • .gitignore

Do not track in Git

  • data/
  • results/
  • artifacts/
  • .venv/
  • logs / zips / temporary files

Setup

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 .

Main workflows

1) One full rerun from scratch

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.json

2) Five-run mean +- std study

This repeats the entire process from dataset generation onward.

Get-Content .\phase5_5runs_meanstd_pipeline.txt

Main outputs:

results\multi_run5\aggregate\vvc_mean_std.csv
results\multi_run5\aggregate\vvo_mean_std.csv

3) DEQ vs unrolled memory / speed / accuracy tradeoff

Uses existing VVC data only. No dataset regeneration.

Get-Content .\phase5_vvc_memory_accuracy_tradeoff.txt

Main 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.


Important evaluation rule

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.py
  • scripts/evaluate_vvo_ac_truth_thresholds.py

Minimal script set that should remain

Recommended keep list in scripts/:

  • generate_multianchor_hard_pf.py
  • train_pf_models_from_dataset.py
  • mine_lindistflow_hard_cases.py
  • dedup_ranked_cases.py
  • make_fixed_split_dataset.py
  • reexport_pf_onnx_flat_v2.py
  • run_vvo_on_dataset.py
  • evaluate_vvc_actruth_fixedsplit_thresholds.py
  • evaluate_vvo_ac_truth_thresholds.py
  • analyze_qg_bound_activity.py
  • aggregate_meanstd_from_runs.py
  • benchmark_vvc_memory_accuracy_tradeoff.py

Everything else should be treated as legacy, debug, or superseded unless you still actively use it.


Recommended clean top-level layout

configs/
docs/
scripts/
src/
README.md
requirements.txt
pyproject.toml
.gitignore

Validation

See:

docs/VALIDATION.md

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages