DCOPFJ (Java): A Free Open-Source Solver for
Bid/Offer-Based DC Optimal Power Flow Problems

Last Updated: 6 January 2016

Site maintained by:
Leigh Tesfatsion
Professor of Economics and Mathematics
Iowa State University
Ames, Iowa 50011-1070
tesfatsi AT iastate.edu

Electricity Market Open-Source Software
AMES Market Package Homepage
Electric Energy Economics (E3) Group Homepage
DCOPFJ Schematic

Software Release Disclaimer:
All software provided below is unsupported and provided as-is, without warranty of any kind.

Table of Contents:

Software Overview

As elaborated in Sun and Tesfatsion (2007a) and Sun and Tesfatsion (2007b), the DCOPFJ package is a free open-source Java solver for bid/offer-based DC optimal power flow (DC-OPF) problems suitable for research, teaching, and training applications. The DCOPFJ package consists of two linked parts: an internal solver QuadProgJ for strictly convex quadratic programming problems, and an outer shell that automates input data preprocessing and output data display.


QuadProgJ is a stand-alone open-source Java solver for strictly convex quadratic programming (SCQP) problems. QuadProgJ implements the well-known dual active-set SCQP algorithm developed by Goldfarb and Idnani (1983).

As reported in detail in Sun and Tesfatsion (2007a), QuadProgJ has been successfully tested on small to medium-sized SCQP problems. In particular, QuadProgJ matched or exceeded the accuracy of the proprietary C-language QP solver BPMPD when tested on a public repository of SCQP problems with up to 1500 decision variables plus constraints. In use since 1998, BPMPD is highly recommended for power system applications in Appendix A of the MATPOWER User's Manual (2006). In particular, the following statement appears: "Of all of the packages tested, the bpmpd solver has been the only one which worked reliably for us. It has proven to be very robust and has exceptional performance."

Augmented DC Optimal Power Flow (OPF) Formulation:

Standard DC-OPF problems with fixed real-power demands (loads) can be equivalently represented in the numerically desirable form of an SCQP problem if the nodal balance constraints are used to eliminate voltage angles by substitution. However, this elimination prevents direct generation of solution values for locational marginal prices (LMPs) since, by definition, the LMP for any node k is the solution value for the Lagrangian multiplier (shadow price) for the kth nodal balance constraint.

For this reason, Sun and Tesfatsion (2007a) augment the standard DC-OPF objective function with a soft-penalty constraint on the sum of squared voltage angle differences. This augmentation is extended in Sun and Tesfatsion (2007c) to handle real power demand bids consisting of both fixed and price-sensitive parts.

The resulting augmented DC-OPF problem formulation provides three principal benefits based on both physical and mathematical considerations, as follows:

Solution of Augmented DC-OPF Problems via DCOPFJ:

As explained with care in Sun and Tesfatsion (2007a), augmented DC-OPF problems can be solved by means of the DCOPFJ package, a stand-alone Java DC-OPF solver consisting of QuadProgJ wrapped inside a data-processing shell.

The data-processing shell sequentially carries out the following four actions: (1) conversion of all input data from SI (International System of Units) to normalized pu (Per Unit) form; (2) formation of all needed matrices and vectors for expressing the augmented DC-OPF problem in matrix SCQP form; (3) invocation of QuadProgJ to determine a solution for the resulting matrix SCQP problem; and (4) conversion of all solution output data from pu to SI form. These four actions are illustrated in detail for a 5-node test case taken from power systems texts and ISO-NE/PJM training manuals.

Using DCOPFJ as a Stand-Alone DC-OPF Solver:

Test cases are included as text files in the "DATA" directory of the DCOPFJ package. The user can specify which of these test case files to run by changing an integer-valued flag in the main file DCOPFJ.java for the DCOPFJ package. The main file DCOPFJ.java can be found in the source code directory "src" of the DCOPFJ package. DCOPFJ automatically looks in the DATA directory for cases to be run.

Users can also use these test case files as templates for creating their own DC-OPF problems. To create a new DC-OPF problem, the user should copy a test case file into a new text file (e.g. MyCase.txt) in the DATA directory. Within MyCase.txt, the user should then substitute their own DC-OPF input data in place of the test case input data in the designated places using the designated formatting. The user should then add the new case file name MyCase.txt to the list of case file names in DCOPFJ.java (the list where the test case file names appear). Finally, right below the list of case file names in DCOPFJ.java the user should set the integer-valued flag accordingly (e.g., first case in list = 0, second case in list = 1, and so on).

The DCOPFJ package is already in the correct directory form of a standard Java package for use in Java Integrated Development Environments (IDEs) such as NetBeans and JBuilder. After setting up DCOPFJ as a standard Java package, with DCOPFJ.java designated as the main class, the DCOPFJ package can be compiled and run. The output appears in formatted text in the IDE output screen. The user can change the content and form of this output by modifying the output statements in DCOPFJ.java.

Incorporation of DCOPFJ Into Other Packages:

DCOPFJ can be incorporated as a DC-OPF solver within other Java applications under the terms of the GNU General Public License (see below). For example, as detailed in Sun and Tesfatsion (2007d), Sun and Tesfatsion (2007e), and Li, Sun, and Tesfatsion (2008), DCOPFJ has been incorporated into the AMES Wholesale Power Market Test Bed, an open-source Java-implemented model of a restructured wholesale power market with strategically-learning traders operating over an AC transmission grid subject to congestion effects.

Software Downloads and Supporting Materials

Version releases to date for the DCOPFJ package are as follows:

DCOPFJ--Version 1.1 (Sun and Tesfatsion):

DCOPFJ--Version 2.0 (Sun and Tesfatsion):

Licensing Terms

The DCOPFJ package is licensed by the copyright holders (Junjie Sun and Leigh Tesfatsion) as free open-source software under the terms of the GNU General Public License (GPL). Anyone who is interested is allowed to view, modify, and/or improve upon the code used to produce this package, but any software generated using all or part of this code must be released as free open-source software in turn. The GNU GPL can be viewed in its entirety here.

Publications and References


The work reported at this site has been supported in part by Grant NSF-0527460 awarded by the National Science Foundation and by grants awarded by the ISU Electric Power Research Center.