Go with the Flow: Leveraging Physics-Informed Gradents to Solve Real-World Problems in Water Distribution Systems
Official Code for the paper "Go with the Flow: Leveraging Physics-Informed Gradents to Solve Real-World Problems in Water Distribution Systems".
All system and package requirements are listed in the document 'environment.yml'. A corresponding conda environment can be setup via conda env create -f environment.yml.
Data on heads, pressures, demands and flows for Water Distribution Systems (WDSs) can be generated for longer periods of time (Vrachimis et al. https://github.com/KIOS-Research/BattLeDIM) using:
python dataset_generator.pyThe simulation will produce an xlsx and multiple csv files in the folder 'Results-Clean' in the respective directories. The xlsx file will be used for training the models.
Models can be trained using
python run.pyA number of arguments can be passed to specify model types and hyperparameters: We include trained model files for all WDSs. Trained models can be used for evaluation using run.py by specifying the 'evaluate' mode and 'model_path'.
| File | What it's doing |
|---|---|
args_dg.json |
Default arguments for the data generator (s. dataset_generator.py) |
args.json |
Default arguments for the training script (s. run.py) |
dataset_generator.py |
Code that generates toy data and realistic data by running EPANET (Wntr) on either random or periodic demands |
generate_jacobians_dh_dd.py |
Generate Jacobians of heads w.r.t. demands ( |
planning_dia_gad.py |
Apply a genetic algorithm (NSGA-II) for network rehabilitation (Rehabilitation baseline) |
planning_dia.py |
Apply our physics-informed gradient method for network rehabilitation (our method) |
run.py |
Training script to train PI-GCN and the sparse-to-dense baseline model proposed by Ashraf et al. 2022 |
sensor_placement_ferreira.py |
Apply a genetic algorithm (NSGA-II) for sensor placement (Sensor placement baseline) |
sparse_to_dense_sensor_placement_eval.py |
Evaluation of sensor placements via sparse-to-dense method. |
train_test.py |
Train- and Testscript for PI-GCN and the sparse-to-dense baseline model proposed by Ashraf et al. 2022 |
notebooks/pigcn_results.ipynb |
Evaluation notebook for PI-GCN on both toy and realistic datasets |
notebooks/sensor_placement_spectral_random.ipynb |
Sensor placement baselines (random and spectral clustering) implementation. |
notebooks/SensorPlacement.ipynb |
Sensor placement algorithm using Jacobians ( |
notebooks/sparse_to_dense_comparison.ipynb |
Show evaluation for sparse-to-dense baseline model proposed by Ashraf et al. 2022. |
notebooks/sparse_to_dense_comparison ChebNet.ipynb |
Show evaluation for sparse-to-dense baseline model proposed by Hajgató et al. 2021. |
notebooks/sparse_to_dense_sensor_placement.ipynb |
Show evaluation for sensor placements via sparse-to-dense method. |