SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1910.09658 · 2019

Optimal Power Flow Using Graph Neural Networks

arXiv · PDF · Open in the Atlas

Code that ran

15 of 20 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 15 have no contract verdict; 0 failures of our instrument; 5 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1910.09658.json · badge: /api/ran/1910.09658.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
tomyvazquez/doraa-uy community (classifier label)
classifier basis not recorded on the link
15 ran · 5 no recorded run
FunctionStatusWhere it lives
absolute_feas_error Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/metric.py
code served (permissive licence) · get_code("9684c22eafd4c345")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct arguments for absolute_feas_error
# The function checks feasibility by comparing x against bounds [x_min, x_max]
# It counts violations where x exceeds x_max or falls below x_min by more than tolerance

x = torch.randn(2, 4)  # batch of 2, dimension 4
x_min = torch.full((2, 4), -1.0)  # lower bounds
x_max = torch.full((2, 4), 1.0)   # upper bounds
tol = 0.0001

ARGS = {
    "x": x,
    "x_min": x_min,
    "x_max": x_max,
    "tol": tol
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
bus_pos Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/URU/entrenamiento/src/Loss.py
code served (permissive licence) · get_code("8ffd20070371caaf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd

class MockNet:
    def __init__(self):
        self.bus = pd.DataFrame(index=['bus_0', 'bus_1', 'bus_2', 'bus_3'])

net = MockNet()
buses = ['bus_0', 'bus_2']

ARGS = {
    'buses': buses,
    'net': net
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
constraint_violation_power_flow Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/Loss.py
code served (permissive licence) · get_code("0bc49f272d48aac8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze function usage:
# - V_mag: used in multiplication and indexing, needs shape (batch, nodes)
# - V_ang: used in cos/sin, needs shape (batch, nodes)
# - p: used in addition with complex number, needs shape (batch, nodes)
# - q: used in multiplication by 1j, needs shape (batch, nodes)
# - Y_bus: used with repeat(V.shape[0], 1, 1) and bmm, needs shape (nodes, nodes)

batch_size = 2
num_nodes = 4

# V_mag: voltage magnitudes, shape (batch, nodes)
V_mag = torch.ones(batch_size, num_nodes) * 1.0

# V_ang: voltage angles, shape (batch, nodes)
V_ang = torch.zeros(batch_size, num_nodes)

# p: active power, shape (batch, nodes)
p = torch.randn(batch_size, num_nodes)

# q: reactive power, shape (batch, nodes)
q = torch.randn(batch_size, num_nodes)

# Y_bus: admittance matrix, shape (nodes, nodes), complex valued
Y_bus = torch.randn(num_nodes, num_nodes, dtype=torch.complex64)

ARGS = {
    "V_mag": V_mag,
    "V_ang": V_ang,
    "p": p,
    "q": q,
    "Y_bus": Y_bus
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluate Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/train_eval.py
code served (permissive licence) · get_code("348e4f04f679cb34")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from unittest.mock import Mock

torch.manual_seed(0)

# Minimal model that accepts data and produces output
class DummyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Minimal criterion that accepts the required arguments
class DummyCriterion(nn.Module):
    def forward(self, data, output, Y_line, Y_bus, max_ika, dual_variables, line_to, line_from, norm_x):
        return torch.tensor(0.5)

# Create data loader: list of (input, target) tuples
data_loader = [
    (torch.randn(2, 4), torch.randn(2, 3)),
    (torch.randn(2, 4), torch.randn(2, 3))
]

# Create model and criterion
model = DummyModel()
criterion = DummyCriterion()

# Create line tuple (line_to, line_from)
line = (torch.tensor([0, 1, 2]), torch.tensor([1, 2, 3]))
line_to, line_from = line

# Y_line: matrix for line admittances
Y_line = torch.randn(3, 3)

# Y_bus: bus admittance matrix
Y_bus = torch.randn(4, 4)

# max_ika: maximum current limits
max_ika = torch.randn(3)

# dual_variables: dual variables for optimization
dual_variables = torch.randn(4)

# norm_x: normalization constant
norm_x = 1.0

# epoch: training epoch number
epoch = 1

# writer: mock tensorboard writer
writer = Mock()
writer.add_scalar = Mock()

# test flag
test = False

ARGS = {
    'model': model,
    'data_loader': data_loader,
    'criterion': criterion,
    'Y_line': Y_line,
    'line': line,
    'Y_bus': Y_bus,
    'max_ika': max_ika,
    'dual_variables': dual_variables,
    'norm_x': norm_x,
    'epoch': epoch,
    'writer': writer,
    'test': test
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_best_run Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/find_best_run.py
code served (permissive licence) · get_code("20264dbd7cd72af0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned zip. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create sample training run directories with best_model_info.json files
run_names = ['run_1', 'run_2', 'run_3', 'run_4', 'run_5']
for i, run_name in enumerate(run_names):
    run_dir = os.path.join(temp_dir, run_name)
    os.makedirs(run_dir, exist_ok=True)
    
    # Create best_model_info.json with sample data
    info_data = {
        'val_loss': 0.5 + i * 0.1,
        'val_metric': 0.8 - i * 0.05,
        'val_p_loss': 0.3 + i * 0.02
    }
    
    with open(os.path.join(run_dir, 'best_model_info.json'), 'w') as f:
        json.dump(info_data, f)

ARGS = {
    'path': temp_dir,
    'k': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type zip — a zip output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a zip output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_best_run_from_tfevents Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/find_best_run.py
code served (permissive licence) · get_code("b1ea19e462a3c45f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil
from tensorboard.compat.proto import event_pb2
from tensorboard.compat.proto import summary_pb2


def create_mock_tfevents_file(filepath, value):
    """Create a minimal tfevents file with a summary value"""
    # Create a summary with a float_val tensor
    summary = summary_pb2.Summary()
    summary_value = summary.value.add()
    summary_value.tag = "loss"
    summary_value.tensor.dtype = 1  # DT_FLOAT
    summary_value.tensor.float_val.append(value)
    
    # Create an event with this summary
    event = event_pb2.Event()
    event.summary.CopyFrom(summary)
    
    # Write to file
    with open(filepath, 'wb') as f:
        f.write(event.SerializeToString())


# Create a temporary directory structure with mock tfevents files
temp_dir = tempfile.mkdtemp()

# Create subdirectories with mock tfevents files
run_names = ['run_0', 'run_1', 'run_2', 'run_3', 'run_4', 'run_5']
values = [0.5, 0.3, 0.8, 0.1, 0.6, 0.2]

for run_name, value in zip(run_names, values):
    run_dir = os.path.join(temp_dir, run_name)
    os.makedirs(run_dir, exist_ok=True)
    event_file = os.path.join(run_dir, 'events.out.tfevents.12345.hostname')
    create_mock_tfevents_file(event_file, value)

ARGS = {
    'path': temp_dir + '/',
    'k': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorboard — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_Ybus Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/utils.py
code served (permissive licence) · get_code("46f8c6740020e124")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from scipy.sparse import csr_matrix

torch.manual_seed(0)

# Create a minimal net object with the structure expected by get_Ybus
class MinimalNet:
    def __init__(self):
        # Create a small sparse matrix to represent Ybus
        # Shape: 4x4 complex matrix
        ybus_dense = np.array([
            [2+1j, -1+0j, 0+0j, -1+0j],
            [-1+0j, 3+1j, -1+0j, -1+0j],
            [0+0j, -1+0j, 2+1j, -1+0j],
            [-1+0j, -1+0j, -1+0j, 3+1j]
        ], dtype=np.complex128)
        
        ybus_sparse = csr_matrix(ybus_dense)
        
        # Build the nested dictionary structure that get_Ybus expects
        self._ppc = {
            'internal': {
                'Ybus': ybus_sparse
            }
        }

net = MinimalNet()
device = torch.device('cpu')

ARGS = {
    'net': net,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_Yline Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/utils.py
code served (permissive licence) · get_code("9a7ae36e45a95d92")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from scipy import sparse

torch.manual_seed(0)

class MockNet:
    def __init__(self):
        self._ppc = {
            'internal': {
                'Yf': sparse.csr_matrix(np.array([[1+2j, 3+4j, 0, 0],
                                                    [0, 1+1j, 2+2j, 0]], dtype=np.complex128)),
                'Yt': sparse.csr_matrix(np.array([[1+1j, 0, 3+3j, 0],
                                                   [0, 2+1j, 0, 4+4j]], dtype=np.complex128))
            }
        }

net = MockNet()
device = 'cpu'

ARGS = {
    'net': net,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_max_min_values Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/URU/entrenamiento/src/Loss.py
code served (permissive licence) · get_code("fd88df33831b6622")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import pandas as pd
import numpy as np

torch.manual_seed(0)

class MockNet:
    def __init__(self):
        # Create bus dataframe with 4 buses
        self.bus = pd.DataFrame({
            'min_vm_pu': [0.95, 0.95, 0.95, 0.95],
            'max_vm_pu': [1.05, 1.05, 1.05, 1.05],
        }, index=[0, 1, 2, 3])
        
        # Create gen dataframe with 2 generators
        self.gen = pd.DataFrame({
            'bus': [0, 1],
            'min_q_mvar': [-50.0, -40.0],
            'max_q_mvar': [50.0, 40.0],
        })
        
        # Create ext_grid dataframe with 1 external grid
        self.ext_grid = pd.DataFrame({
            'bus': [0],
            'min_q_mvar': [-100.0],
            'max_q_mvar': [100.0],
        })
        
        # Create sgen dataframe with controllable generators
        self.sgen = pd.DataFrame({
            'bus': [2, 3],
            'controllable': [True, True],
            'min_q_mvar': [-30.0, -20.0],
            'max_q_mvar': [30.0, 20.0],
        })
        
        self.sn_mva = 100.0

net = MockNet()
device = 'cpu'

ARGS = {
    'net': net,
    'device': device,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_max_q Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/URU/entrenamiento/src/Loss.py
code served (permissive licence) · get_code("57cf95c88ec0e901")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import pandas as pd

torch.manual_seed(0)

class MockNet:
    def __init__(self):
        # Create bus dataframe with 4 buses
        self.bus = pd.DataFrame({
            'name': ['bus_0', 'bus_1', 'bus_2', 'bus_3']
        }, index=[0, 1, 2, 3])
        
        # Create gen dataframe with 2 generators
        self.gen = pd.DataFrame({
            'bus': [0, 2],
            'min_q_mvar': [10.0, 20.0],
            'max_q_mvar': [100.0, 200.0]
        })
        
        # Create ext_grid dataframe with 1 external grid
        self.ext_grid = pd.DataFrame({
            'bus': [1],
            'min_q_mvar': [5.0],
            'max_q_mvar': [50.0]
        })
        
        # Base power rating
        self.sn_mva = 100.0

net = MockNet()

ARGS = {
    'net': net
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/Data_loader.py
code served (permissive licence) · get_code("792918ce2e8274a3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch
from torch.utils.data import DataLoader, TensorDataset
import tempfile
import os

torch.manual_seed(0)

# Create a temporary directory structure with mock data files
temp_dir = tempfile.mkdtemp()
red_val = 0
os.makedirs(f'{temp_dir}/red{red_val}/train', exist_ok=True)
os.makedirs(f'{temp_dir}/red{red_val}/val', exist_ok=True)
os.makedirs(f'{temp_dir}/red{red_val}/test', exist_ok=True)

# Create small mock numpy arrays (2 samples, 4 features)
train_data = np.random.rand(2, 4) * 100
val_data = np.random.rand(2, 4) * 100
test_data = np.random.rand(2, 4) * 100

np.save(f'{temp_dir}/red{red_val}/train/input.npy', train_data)
np.save(f'{temp_dir}/red{red_val}/val/input.npy', val_data)
np.save(f'{temp_dir}/red{red_val}/test/input.npy', test_data)

ARGS = {
    'data_path': temp_dir,
    'batch_size': 2,
    'normalize_X': True,
    'red': red_val,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/URU/entrenamiento/src/Data_loader.py
code served (permissive licence) · get_code("d840ef5583c37f36")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import torch
import os
import tempfile
from torch.utils.data import DataLoader, TensorDataset

torch.manual_seed(0)

# Create a temporary directory structure with dummy data files
temp_dir = tempfile.mkdtemp()
os.makedirs(os.path.join(temp_dir, 'train'), exist_ok=True)
os.makedirs(os.path.join(temp_dir, 'val'), exist_ok=True)
os.makedirs(os.path.join(temp_dir, 'test'), exist_ok=True)

# Create dummy numpy arrays with small dimensions
# Using distinct sizes: 2 samples, 4 features for train; 3 samples for val; 2 samples for test
np.save(os.path.join(temp_dir, 'train/input.npy'), np.random.randn(2, 4).astype(np.float32) * 100)
np.save(os.path.join(temp_dir, 'val/input.npy'), np.random.randn(3, 4).astype(np.float32) * 100)
np.save(os.path.join(temp_dir, 'test/input.npy'), np.random.randn(2, 4).astype(np.float32) * 100)

ARGS = {
    'data_path': temp_dir,
    'batch_size': 2,
    'normalize_X': True,
    'red': None,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
non_linearity Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/arquitecturas.py
code served (permissive licence) · get_code("02fafc337e3894cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# U is BxNx3 where B=batch_size, N=num_nodes, 3=(Qgen, V, angle)
# min and max are Nx3
B = 2  # batch size
N = 4  # number of nodes
U = torch.randn(B, N, 3)
min_vals = torch.randn(N, 3)
max_vals = min_vals + torch.abs(torch.randn(N, 3)) + 1  # ensure max > min

ARGS = {
    "U": U,
    "min": min_vals,
    "max": max_vals,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
relative_feas_error Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/metric.py
code served (permissive licence) · get_code("8b040a1c396bff89")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float32, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct valid arguments for relative_feas_error
# The function takes x, x_min, x_max as numpy arrays and computes feasibility error

# Create small numpy arrays with distinct shapes to allow probing
x = np.array([[1.5, 2.5, 3.5, 4.5],
              [0.5, 1.5, 2.5, 3.5]], dtype=np.float32)

x_min = np.array([[1.0, 2.0, 3.0, 4.0],
                  [0.0, 1.0, 2.0, 3.0]], dtype=np.float32)

x_max = np.array([[2.0, 3.0, 4.0, 5.0],
                  [1.0, 2.0, 3.0, 4.0]], dtype=np.float32)

ARGS = {
    'x': x,
    'x_min': x_min,
    'x_max': x_max
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
run_epoch Ran
ran on a synthesized input
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/train_eval.py
code served (permissive licence) · get_code("e7dc5d3011a0ef63")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.optim import Adam

torch.manual_seed(0)

# Build a minimal model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Build a minimal criterion that matches the function signature
class CustomLoss(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, data, output, Y_line, Y_bus, max_ika, dual_variables, line_to, line_from, norm_x):
        # Return a scalar loss
        return torch.tensor(0.5, requires_grad=True)

# Build a minimal writer
class TensorBoardWriter:
    def __init__(self):
        self.scalars = {}
    
    def add_scalar(self, tag, value, step):
        if tag not in self.scalars:
            self.scalars[tag] = []
        self.scalars[tag].append((value, step))

# Create model and optimizer
model = SimpleModel()
optimizer = Adam(model.parameters(), lr=0.001)

# Create criterion
criterion = CustomLoss()

# Create train_loader (list of batches with input and target)
train_loader = [
    (torch.randn(2, 4), torch.randn(2, 3)) for _ in range(3)
]

# Create Y_line and Y_bus tensors
Y_line = torch.randn(5, 5)
Y_bus = torch.randn(6, 6)

# Create line tuple
line_to = torch.tensor([0, 1, 2])
line_from = torch.tensor([1, 2, 3])
line = (line_to, line_from)

# Create max_ika
max_ika = torch.tensor([1.5, 2.0, 2.5])

# Create dual_variables
dual_variables = torch.randn(3, 2)

# Create norm_x
norm_x = torch.tensor([1.0])

# Create epoch
epoch = 0

# Create writer
writer = TensorBoardWriter()

ARGS = {
    'model': model,
    'train_loader': train_loader,
    'optimizer': optimizer,
    'criterion': criterion,
    'Y_line': Y_line,
    'line': line,
    'Y_bus': Y_bus,
    'max_ika': max_ika,
    'dual_variables': dual_variables,
    'norm_x': norm_x,
    'epoch': epoch,
    'writer': writer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
check_AC_flow Not yet run
unverified (harvested, no recorded run)
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/utils.py
code served (permissive licence) · get_code("c20cfc00778112ae")
How it ran

no invocation recorded.

get_max_min_values Not yet run
unverified (harvested, no recorded run)
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/Loss.py
code served (permissive licence) · get_code("932c634b3d93be5c")
How it ran

no invocation recorded.

get_max_q Not yet run
unverified (harvested, no recorded run)
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/Loss.py
code served (permissive licence) · get_code("7f01ad9b482422c0")
How it ran

no invocation recorded.

get_stats Not yet run
unverified (harvested, no recorded run)
tomyvazquez/doraa-uy/no-supervisado/IEEE/entrenamiento/src/metric.py
code served (permissive licence) · get_code("77dc409702e10352")
How it ran

no invocation recorded.

get_stats Not yet run
unverified (harvested, no recorded run)
tomyvazquez/doraa-uy/no-supervisado/URU/entrenamiento/src/metric.py
code served (permissive licence) · get_code("19a1e8e969cd43fe")
How it ran

no invocation recorded.

Also present in other papers' code

Of 20 samples lifted from this paper's linked repositories, 20 carry a function identity and 0 do not. Of the 20 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 20 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Optimal power flow (OPF) is one of the most important optimization problems in the energy industry. In its simplest form, OPF attempts to find the optimal power that the generators within the grid have to produce to satisfy a given demand. Optimality is measured with respect to the cost that each generator incurs in producing this power. The OPF problem is non-convex due to the sinusoidal nature of electrical generation and thus is difficult to solve. Using small angle approximations leads to a convex problem known as DC OPF, but this approximation is no longer valid when power grids are heavily loaded. Many approximate solutions have been since put forward, but these do not scale to large power networks. In this paper, we propose using graph neural networks (which are localized, scalable parametrizations of network data) trained under the imitation learning framework to approximate a given optimal solution. While the optimal solution is costly, it is only required to be computed for network states in the training set. During test time, the GNN adequately learns how to compute the OPF solution. Numerical experiments are run on the IEEE-30 and IEEE-118 test cases.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1910.09658")
get_code_for_paper("1910.09658")
have("1910.09658")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1910.09658.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1910.09658.svg)](https://syntology.ai/paper/1910.09658)

Connect an agent — have() is free.