PowerFlows.jl icon indicating copy to clipboard operation
PowerFlows.jl copied to clipboard

Lk/robust homotopy

Open luke-kiernan opened this issue 7 months ago • 2 comments

I've implemented and tested the "Magnitude Homotopy" approach method described here. There's more detail in #137.

Brief description of their method: let φ(x) equal the sum of 0.5*(v_mag - 1.0)^2 over all PQ buses. Instead of finding the zero of our power balance equations F(x) in one fell swoop, we consider a sequence of functions G_1(x), G_2(x), ... G_n(x) that linearly interpolate between φ(x) and 0.5*dot(F(x), F(x)). We minimize G_1 = φ(x), then use that as a starting point to minimize G_2, and so on, until we're minimizing G_n = 0.5*dot(F(x), F(x)) starting from the minimum of G_{n-1}. Minimize how? This is a least squares problem, so we what Wikipedia calls "Newton's Method in Optimization:" pick a search direction by solving H_G(x) Δx = -∇G(x) where H is the Hessian, then do a line search to figure out how far to step in that direction to get a "good" rate of decrease.

luke-kiernan avatar Apr 14 '25 18:04 luke-kiernan

The CI is failing, specifically for windows, due to the MPI.jl backend. Relevant issue

luke-kiernan avatar Apr 14 '25 20:04 luke-kiernan

Update on the Windows bug: I discovered that the sequential, MPI-free version of MUMPS.jl is also broken on Windows, but not on Mac. This leads me to think the problem lies in the build_tarballs.jl scripts in Yggdrasil. i.e. the Julia code itself is fine, but the binary artifacts MUMPS_jll and MUMPS_seq_jll aren't. BinaryBuilder.jl emits a couple warnings during the build process, which could point in the right direction. See the above linked issue for details. However, I'm going to let this bug rest for now.

luke-kiernan avatar May 20 '25 23:05 luke-kiernan

we need a better alternative to Mumps if it creates such a problem

jd-lara avatar Jul 15 '25 04:07 jd-lara

Here's some options:

  1. Use Pardiso.jl on Windows and MUMPS.jl on Mac/Linux. That'd require maintaining two separate backends, though.
  2. Use LDLFactorizations.jl However, the second sentence in its readme basically says "don't expect this to be competitive with MUMPS.jl, HSL.jl, or Pardiso.jl."
  3. Use HSL.jl. Fast and cross-platform, but requires a license and nontrivial build/setup process on Windows (or so says ChatGPT).

edit: SkylineSolvers.jl implements sparse factorizations, but it doesn't look like you can do the symbolic and numeric steps separately.

luke-kiernan avatar Jul 15 '25 20:07 luke-kiernan

I've rebased onto psy5 and opened a separate PR. Leaving this branch intact for now, just in case.

luke-kiernan avatar Jul 16 '25 01:07 luke-kiernan