This repository provides a Julia-based framework to benchmark the performance, accuracy, and AC feasibility of various Optimal Power Flow (OPF) relaxations against the full, non-convex AC-OPF problem.
It uses the PowerModels.jl library to evaluate several standard formulations (DCOPF, SOC-WR, QC, SDP) on test cases from the PGLib-OPF library under stochastic load conditions.
The script performs the following steps:
- Scenario Generation: For each test case, it generates multiple load scenarios by applying random scaling factors to the base loads.
- Model Evaluation: It solves each scenario using the full ACOPF model (as a baseline) and several common relaxations.
- Metrics Calculation: It calculates key performance indicators:
- Solver Runtime: How long the optimization takes.
- Optimality Gap: The percentage difference in objective value compared to the ACOPF solution.
- AC Feasibility: The degree to which the relaxation's solution violates voltage and branch limits when plugged back into the AC power flow equations.
- Reporting: It outputs a summary table to the console and generates a 2x2 plot visualizing the trade-offs between speed, quality, and feasibility.
- Julia (version 1.6 or later)
- The PGLib-OPF dataset. Download and extract it so that the
pglib-opf-masterdirectory is in the root of this project folder.
- Clone the repository:
git clone <your-repo-url> cd <your-repo-name>
- Instantiate the Julia Environment:
Open the Julia REPL in the project directory and run the following commands to install all required packages.
using Pkg Pkg.activate(".") Pkg.instantiate()
You can run the analysis directly from your terminal:
julia run_analysis.jl