matbesancon / MathOptSetDistances.jl

Distances to sets for MathOptInterface
MIT License
24 stars 4 forks source link

Power Cone (WIP) #35

Closed tjdiamandis closed 2 years ago

tjdiamandis commented 3 years ago

Add power cone projection (working) and derivative of projection (some numerical errors).

Derivative of the projection is not working right now. Errors occur in case 4, when the algorithm cannot find a bounding interval for the bisection search. For example, the error can be reproduced in with the random seed below:

Random.seed!(983)
v = randn(3)
α = rand(0.05:0.05:0.95)
s = MOI.PowerCone(α)
dΠ = MOD.projection_gradient_on_set(MOD.DefaultDistance(), v, s)

I have noticed that these errors occur when \alpha is 0.05 or 0.95 and Phi(r) is approximately -r since one of x or y is negative and abs(z) is small.

  x, y, z = v
  α = s.exponent
  Phi_prod(xi,αi,z,r) = (xi + sqrt(xi^2 + 4*αi*r*(abs(z) - r)))
  Phi(r) = 0.5*(Phi_prod(x,α,z,r)^α * Phi_prod(y,1-α,z,r)^(1-α)) - r

Would appreciate any thoughts or ideas. The errors are relatively rare (15 of 200 tests). Some ideas I had:

matbesancon commented 3 years ago

The values to reproduce the first example are:

julia> v = randn(3)
3-element Array{Float64,1}:
  0.7677486332685353
 -1.680097972220894
  0.10222967523066824

julia> α = 0.05

(just writing them down to keep them for later)

joaquimg commented 2 years ago

ok to close in favor of #45 ?