Julia packages for joint optimization of natural gas and power transmission networks



Build Status codecov

GasPowerModels.jl is a Julia/JuMP package for the joint optimization of steady state natural gas and power transmission networks. It provides utilities for modeling problems that combine elements of natural gas and electric power systems. It is designed to enable the computational evaluation of historical and emerging gas-power network optimization formulations and algorithms using a common platform. The code is engineered to decouple problem specifications (e.g., gas-power flow, network expansion planning) from network formulations (e.g., mixed-integer linear, mixed-integer nonlinear). This decoupling enables the definition of a variety of optimization formulations and their comparison on common problem specifications.

Core Problem Specifications

  • Gas-Power Flow (gpf)
  • Optimal Power Flow (opf)
  • Network Expansion Planning (ne)
  • Optimal Power Flow with Network Expansion Planning (opf_ne)

Core Network Formulations

  • Directed flow, mixed-integer nonconvex formulation (D)
  • Convexly relaxed, directed flow mixed-integer formulation (CRD)


The package documentation includes a quick start guide.


The latest stable release of GasPowerModels can be installed using the Julia package manager with

] add GasPowerModels

For the current development version, install the package using

] add GasPowerModels#master

Finally, test that the package works as expected by executing

] test GasPowerModels

Usage at a Glance

At least one optimization solver is required to run GasPowerModels. The solver selected typically depends on the type of problem formulation being employed. As an example, the mixed-integer nonlinear programming solver Juniper can be used for testing any of the problem formulations considered in this package. Juniper itself depends on the installation of a nonlinear programming solver (e.g., Ipopt) and a mixed-integer linear programming solver (e.g., CBC). Installation of the JuMP interfaces to Juniper, Ipopt, and Cbc can be performed via the Julia package manager, i.e.,

] add JuMP Juniper Ipopt Cbc

After installation of the required solvers, an example gas-power flow feasibility problem (whose file inputs can be found in the examples directory within the GasPowerModels repository) can be solved via

using JuMP, Juniper, Ipopt, Cbc
using GasPowerModels

# Set up the optimization solvers.
ipopt = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "print_level"=>0, "sb"=>"yes")
cbc = JuMP.optimizer_with_attributes(Cbc.Optimizer, "logLevel"=>0)
juniper = JuMP.optimizer_with_attributes(Juniper.Optimizer, "nl_solver"=>ipopt, "mip_solver"=>cbc)

# Specify paths to the gas and power network files.
g_file = "examples/data/matgas/belgian.m" # Gas network.
p_file = "examples/data/matpower/case14.m" # Power network.

# Specify the gas and power formulation types separately.
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the gas-power flow feasibility problem.
result = run_gpf(g_file, p_file, g_type, p_type, juniper;

After solving the problem, results can then be analyzed, e.g.,

# The termination status of the optimization solver.

# Generator 1's real power generation.

# Junction 1's pressure.


The primary developers are Russell Bent and Kaarthik Sundar. Significant contributions on the technical model were made by Conrado Borraz-Sanchez, Pascal van Hentenryck, and Seth Blumsack. Special thanks to Miles Lubin and Carleton Coffrin for their assistance in integrating with Julia/JuMP and PowerModels.jl.


This code is provided under a BSD license as part of the Multi-Infrastructure Control and Optimization Toolkit (MICOT) project, LA-CC-13-108.

First Commit


Last Touched

7 days ago


106 commits

Used By: