martinandersen / opfsdr

Semidefinite relaxation of optimal power flow problems
GNU General Public License v3.0
20 stars 6 forks source link

Infeasible solution for case300 #1

Closed JulieSliwak closed 5 years ago

JulieSliwak commented 5 years ago

Hello,

I'm trying to use your code but I get an infeasible solution for the example you give (case300) :

Downloading case file: https://raw.githubusercontent.com/MATPOWER/matpower/master/data/case300.m.
Extracting data from case file.
Building cone LP.
Applying chordal conversion to cone LP.
Converting to real-valued cone LP.
Problem
  Name                   :
  Objective sense        : max
  Type                   : CONIC (conic optimization problem)
  Constraints            : 3070
  Cones                  : 69
  Scalar variables       : 1152
  Matrix variables       : 278
  Integer variables      : 0

Optimizer started.
Presolve started.
Eliminator - tries                  : 0                 time                   : 0.00
Lin. dep.  - tries                  : 0                 time                   : 0.00
Lin. dep.  - number                 : 0
Presolve terminated. Time: 0.00
Optimizer terminated. Time: 0.11

Interior-point solution summary
  Problem status  : PRIMAL_INFEASIBLE
  Solution status : PRIMAL_INFEASIBLE_CER
  Dual.    obj: -1.5300000000e+00   nrm: 1e+00    Viol.  con: 0e+00    var: 0e+00    barvar: 0e+00    cones: 0e+00
Traceback (most recent call last):
  File "opfsdr.py", line 1038, in <module>
    sol = prob.solve(solver="mosek")
  File "opfsdr.py", line 823, in solve
    sol['eigratio'].append(ev[0]/ev[1])
ZeroDivisionError: float division by zero 

Do you have any idea of what can be wrong?

Thanks in advance,

Julie

martinandersen commented 5 years ago

I cannot reproduce the error on my system—perhaps something related to versions? Which OS/Python distribution are you using? Which version of MOSEK are you using?

JulieSliwak commented 5 years ago

I'm using Python 3.6.8 with Windows 10 and MOSEK Version 8.1.0.72.

martinandersen commented 5 years ago

Can you check if you have CVXOPT v1.2.2 (and if not, try upgrading)?

JulieSliwak commented 5 years ago

I just checked out, I have CVXOPT v1.2.2.

martinandersen commented 5 years ago

We have had to jump through quite a few hoops to add Windows support to CVXOPT because Microsoft's C compiler isn't fully C99 compliant. I am thinking that this could be a Windows-specific bug in CVXOPT. I'll try to investigate this.

Just to be sure, this issue arises when you run examples/example1.py?

JulieSliwak commented 5 years ago

I did not install your package so I am running opfsdr.py with the lines in example1.py at the end of the file. Plus, I had some issues with CVXOPT so I need to import numpy before importing CVXOPT (I have added this at the beginning of opfsdr.py). Is it supposed to work like this?

Thanks for your help!

martinandersen commented 5 years ago

CVXOPT is not supposed to depend on Numpy being loaded first; this is a CVXOPT/Windows-related issue that is specific to the official Python distribution (ref: cvxopt/cvxopt#127). This should not be an issue if you use Anaconda's Python distribution.

JulieSliwak commented 5 years ago

I'm going to try with Anaconda's Python distribution, I'll let you know if I have the same mistake.

martinandersen commented 5 years ago

OK, I can reproduce the issue on Windows with Anaconda's Python distribution—I will look into it.

JulieSliwak commented 5 years ago

Thank you very much.

martinandersen commented 5 years ago

It appears to work if you disable conversion (options = {'conversion': False, 'verbose':1}), so it is most likely a Windows-specific bug in Chompack.

JulieSliwak commented 5 years ago

Indeed, thanks for your help.

martinandersen commented 5 years ago

I fixed a bug in the Windows version of CVXOPT—it should work if you install CVXOPT v1.2.3. Thanks for reporting this.

xref: cvxopt/cvxopt#138

JulieSliwak commented 5 years ago

Thanks, I can use the option conversion now.