power-grid-lib / pglib-opf

Benchmarks for the Optimal Power Flow Problem
Other
306 stars 84 forks source link

DCOPF - Problem Formulation & Optimal solutions #40

Closed hjaleta closed 1 year ago

hjaleta commented 1 year ago

Dear maintainers,

I am currently working on a project where we try to approach DCOTS ( Direct Current Transmission Switching ) with a new approach.

The algorithm I try to implement uses the classical DCOPF as a building block, and hence I have been coding it up in CVXPY in Python. However, I have been encountering some strange phenomena when trying my code out on the dataset, and comparing with the baseline values found in BASELINE.md. For the smaller systems, I seem to find the same optimal values, but for bigger systems they seem to differ a little bit. In general, I find slightly better solutions to the DC problem than what is presented in this repository.

For example ( All cases presented are the standard ones, not SAD or API)

case300_ieee: 5.1785e+05 vs 51780e+05 ( -0.01 % ) case2848_rte: 1.2677e+06 vs 1.2298e+06 ( -3.0 % ) case8387_pegase: 2.5028e+06 vs 2.5010 ( -0.07 % )

To clarify, these are not implemented the switching problem yet, but only the normal DCOPF.

So far, I have 3 possible theories to why this might happen:

  1. Could it be that the solutions presented in BASELINE.md are sometimes not global, but local optima? According to BASELINE.md, the solver being used is IPOPT. When reading the documentation of IPOPT, they state that the solver finds local optima to problems.
  2. I am using a different formulation of the DCOPF than you. I could not find any reference in the repository to the DCOPF which you have implemented. Could it be that I am using a slightly different formulation, which somehow results in small variations in the final solution?
  3. I have made a mistake in my code implementation...

What do you think?

A big thanks for a great repository and dataset 👍

ccoffrin commented 1 year ago

Hi @hjaleta, thanks for your interest in these datasets.

My first remark is that I would not put too much thought into differences in the objective value that are less than 0.1%. This can often be due to how data is handled (small differences in floating point arithmetic) or some specific solver parameters (e.g., constraint and convergence tolerances).

You are correct in that Ipopt will only find local optimal solutions. However, because DCOPF is a convex problem (a QP to be precise) then local optimal solutions are also global optimal solutions. So there should be no difference in the objective, up to the previously mentioned numerical details.

My bet would be on theory 2 being the culprit. There are a few choices in how one converts the AC data into data for the DC power flow model, and I would guess there is a small difference here that is only perceivable on the large datasets.

The PowerModels implementation is the best reference for the specific DCOPF variant that is used here. Those docs can be found here,

ccoffrin commented 1 year ago

closing due to no further action on pglib datasets is required