LOPF: Line expansion and numerical problem

186 views
Skip to first unread message

Anas Abuzayed

unread,
Jan 3, 2021, 6:07:12 PM1/3/21
to pypsa
Hello guys,

I hope you're doing well and safe. I have few questions regarding PyPSA and PyPSA-Eur, I hope I can find the answer here.

1. in the line/link expansion, what are the inputs and outputs? in the PyPSA-Eur model I found x,r,b and the type/length/num_parallel but I'm confused which one is being used and how is it used in the LOPF?

2. I'm doing an LOPF problem and faced this problem:

INFO:pypsa.linopf:Prepare linear problem
Load Shedding Feature is already activated
INFO:solve_network:Adding per carrier generation capacity constraints for individual countries
INFO:solve_network:Adding per generator carrier generation capacity constraints for individual countries
INFO:solve_network:Adding per storage carrier generation capacity constraints for individual countries
INFO:pypsa.linopf:Total preparation time: 5.17s
INFO:pypsa.linopf:Solve linear problem using Gurobi solver
Read LP format model from file C:\Users\anasi\AppData\Local\Temp\pypsa-problem-ilfx0u2g.lp
Reading time = 5.03 seconds
obj: 1061062 rows, 486289 columns, 2200279 nonzeros
Changed value of parameter threads to 4
   Prev: 0  Min: 0  Max: 1024  Default: 0
Changed value of parameter method to 2
   Prev: -1  Min: -1  Max: 5  Default: -1
Changed value of parameter crossover to 0
   Prev: -1  Min: -1  Max: 5  Default: -1
Changed value of parameter BarConvTol to 1e-05
   Prev: 1e-08  Min: 0.0  Max: 1.0  Default: 1e-08
Parameter FeasibilityTol unchanged
   Value: 1e-06  Min: 1e-09  Max: 0.01  Default: 1e-06
Changed value of parameter AggFill to 0
   Prev: -1  Min: -1  Max: 2000000000  Default: -1
Changed value of parameter PreDual to 0
   Prev: -1  Min: -1  Max: 2  Default: -1
Changed value of parameter GURO_PAR_BARDENSETHRESH to 200
   Prev: -1  Min: -1  Max: 2000000000  Default: -1
Gurobi Optimizer version 9.0.2 build v9.0.2rc0 (win64)
Optimize a model with 1061062 rows, 486289 columns and 2200279 nonzeros
Model fingerprint: 0x5e7ffeba
Coefficient statistics:
  Matrix range     [1e-03, 2e+02]
  Objective range  [2e-01, 2e+06]
  Bounds range     [1e-01, 2e+03]
  RHS range        [6e-04, 6e+07]
Presolve removed 685310 rows and 44599 columns
Presolve time: 0.89s
Presolved: 375752 rows, 441690 columns, 1435671 nonzeros
Ordering time: 1.81s

Barrier statistics:
 Dense cols : 423
 Free vars  : 38690
 AA' NZ     : 1.210e+06
 Factor NZ  : 1.745e+07 (roughly 500 MBytes of memory)
 Factor Ops : 1.084e+10 (less than 1 second per iteration)
 Threads    : 4

                  Objective                Residual
Iter       Primal          Dual         Primal    Dual     Compl     Time
   0   4.88339726e+19 -2.20261616e+18  1.08e+10 1.84e+10  2.09e+15     4s
   1   4.73043080e+19 -2.22439474e+18  1.05e+10 1.21e+10  1.76e+15     4s
   2   3.15397043e+19 -2.32932208e+18  6.99e+09 1.73e+09  9.29e+14     4s
   3   2.06744728e+18 -2.21002369e+18  4.91e+08 1.81e+08  7.19e+13     5s
   4   4.87511348e+17 -1.48817568e+18  9.61e+07 1.93e+07  1.42e+13     5s
   5   3.73285736e+16 -4.35079883e+17  6.94e+06 5.49e+05  1.27e+12     6s
   6   1.55281291e+16 -1.56783583e+17  2.78e+06 1.13e+05  4.51e+11     6s
   7   6.21404405e+15 -5.91241705e+16  1.04e+06 2.00e+04  1.53e+11     7s
   8   1.86587033e+15 -1.98771349e+16  2.42e+05 4.39e+03  3.97e+10     7s
   9   1.24204275e+15 -1.28773177e+16  1.33e+05 2.78e+03  2.40e+10     7s
......................
...................... 
...................... 
 121   2.00624349e+10  2.00621598e+10  6.83e-07 3.78e-05  3.12e-01    88s
 122   2.00623886e+10  2.00621831e+10  4.54e-07 5.37e-05  2.33e-01    90s
 123   2.00623313e+10  2.00621934e+10  2.66e-07 6.30e-05  1.56e-01    91s

Barrier solved model in 123 iterations and 91.16 seconds
Optimal objective 2.00623313e+10

INFO:pypsa.linopt:No model basis stored
INFO:pypsa.linopf:Optimization successful. Objective value: 2.01e+10
INFO:pypsa.linopf:Mean square difference after iteration 1 is 0.0
INFO:pypsa.linopf:Running last lopf with fixed branches, overwrite p_nom for links and s_nom for lines


INFO:pypsa.linopf:Prepare linear problem
INFO:pypsa.linopf:Total preparation time: 5.32s
INFO:pypsa.linopf:Solve linear problem using Gurobi solver
Read LP format model from file C:\Users\anasi\AppData\Local\Temp\pypsa-problem-k39xdyje.lp
Reading time = 5.10 seconds
obj: 1098657 rows, 486183 columns, 2198089 nonzeros
Changed value of parameter threads to 4
   Prev: 0  Min: 0  Max: 1024  Default: 0
Changed value of parameter method to 2
   Prev: -1  Min: -1  Max: 5  Default: -1
Changed value of parameter crossover to 0
   Prev: -1  Min: -1  Max: 5  Default: -1
Changed value of parameter BarConvTol to 1e-05
   Prev: 1e-08  Min: 0.0  Max: 1.0  Default: 1e-08
Parameter FeasibilityTol unchanged
   Value: 1e-06  Min: 1e-09  Max: 0.01  Default: 1e-06
Changed value of parameter AggFill to 0
   Prev: -1  Min: -1  Max: 2000000000  Default: -1
Changed value of parameter PreDual to 0
   Prev: -1  Min: -1  Max: 2  Default: -1
Changed value of parameter GURO_PAR_BARDENSETHRESH to 200
   Prev: -1  Min: -1  Max: 2000000000  Default: -1
Gurobi Optimizer version 9.0.2 build v9.0.2rc0 (win64)
Optimize a model with 1098657 rows, 486183 columns and 2198089 nonzeros
Model fingerprint: 0x63fa4784
Coefficient statistics:
  Matrix range     [1e-03, 1e+06]
  Objective range  [2e-01, 2e+06]
  Bounds range     [1e-01, 2e+03]
  RHS range        [6e-04, 6e+07]
Presolve removed 799555 rows and 82559 columns
Presolve time: 0.89s
Presolved: 299102 rows, 403624 columns, 1204991 nonzeros
Ordering time: 1.46s

Barrier statistics:
 Dense cols : 317
 AA' NZ     : 9.411e+05
 Factor NZ  : 1.504e+07 (roughly 400 MBytes of memory)
 Factor Ops : 7.997e+09 (less than 1 second per iteration)
 Threads    : 4

                  Objective                Residual
Iter       Primal          Dual         Primal    Dual     Compl     Time
   0   8.33307808e+19 -2.71812738e+17  1.21e+09 3.09e+11  2.35e+14     3s
   1   6.82607027e+19 -2.69901963e+17  1.18e+09 2.85e+11  2.24e+14     3s
   2   1.09628844e+19 -2.74436649e+17  9.57e+08 1.27e+11  1.69e+14     4s
   3   2.21969449e+18 -2.80915616e+17  1.35e+08 1.20e+10  2.52e+13     4s
......................
...................... 
...................... 

  70   6.42158546e+14  1.28148926e+16  9.93e+02 1.01e+03  2.97e+08    33s
  71   6.41386114e+14  1.41730416e+16  9.90e+02 1.01e+03  2.82e+08    34s

Barrier performed 71 iterations in 33.72 seconds
Numerical trouble encountered

Model may be infeasible or unbounded.  Consider using the
homogeneous algorithm (through parameter 'BarHomogeneous')

INFO:pypsa.linopt:No model basis stored
WARNING:pypsa.linopf:Optimization failed with status warning and termination condition numeric

how is it possible that in the first iteration the problem was solved, but in the other a numerical problem arised? what would be the problem?

Kind Regards,
Anas

Ebbe Kyhl

unread,
Apr 5, 2022, 3:37:39 AM4/5/22
to pypsa
Hi Anas,

I have encountered the same issue. Did you find a solution to your problem? Did you use the homogenous algorithm 'BarHomogenous', and, if so, how did it work out?

Best regards,
Ebbe Gøtske
Reply all
Reply to author
Forward
0 new messages