matbesancon / MathOptSetDistances.jl

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

Power cone #45

Closed matbesancon closed 2 years ago

matbesancon commented 3 years ago

@tjdiamandis this is the power cone PR, I fixed the conflicts and add the option to pass the number of solve iterations for the power cone

codecov[bot] commented 3 years ago

Codecov Report

Merging #45 (b532969) into master (6ca5e90) will increase coverage by 1.67%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
+ Coverage   85.32%   87.00%   +1.67%     
==========================================
  Files           6        6              
  Lines         593      654      +61     
==========================================
+ Hits          506      569      +63     
+ Misses         87       85       -2     
Impacted Files Coverage Δ
src/projections.jl 88.92% <100.00%> (+3.30%) :arrow_up:
src/utils.jl 93.33% <100.00%> (-0.42%) :arrow_down:
src/chainrules.jl 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6ca5e90...b532969. Read the comment docs.

matbesancon commented 3 years ago

We still have some tests failing, and sometimes reaching some error points

matbesancon commented 3 years ago

for the 1.0 fail, I would be for just removing 1.0 support

matbesancon commented 3 years ago

ok the only failures now remaining should be addressed

joaquimg commented 2 years ago

bump, can you re-run? maybe only allow 1.6 and greater?

joaquimg commented 2 years ago

This probably has the same tolerance errors as #60

joaquimg commented 2 years ago

here is the error that only appears in julia 1.7+ with its default rng:

Primal Cone: Test Failed at C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:324
  Expression: ≈(dΠ, grad_fdm1, atol = tol) || (≈(dΠ, grad_fdm2, atol = tol) || ≈(dΠ, grad_fdm3, atol = tol))
Stacktrace:
 [1] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:445 [inlined]
 [2] macro expansion
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:324 [inlined]
 [3] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
 [4] macro expansion
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:317 [inlined]
 [5] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
 [6] macro expansion
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:284 [inlined]
 [7] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
 [8] top-level scope
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:63
Primal Cone: Error During Test at C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:316
  Got exception outside of a @test
  v=[-1.734031934454407, 0.9443717539227713, 0.0]
  dΠ = [0.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 0.0]
  case=3
  FD1=[0.0 -2.0980130181249832e-13 0.0; 0.0 1.0000000000000786 0.0; -1.0821794378555402e-8 -1.622619960411393e-8 0.01443273383863533]
  FD2=[0.0 2.522053555429714e-13 0.0; 0.0 1.0000000000002252 0.0; 1.0821794378555544e-8 1.6218780217006635e-8 0.014432733838635685]
  FD3=[0.0 -7.042994714361593e-15 0.0; 0.0 0.9999999999999822 0.0; 0.0 -7.651666511078383e-13 0.02200381194144106]
  Stacktrace:
    [1] error(s::String)
      @ Base .\error.jl:33
    [2] macro expansion
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:326 [inlined]
    [3] macro expansion
      @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
    [4] macro expansion
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:317 [inlined]
    [5] macro expansion
      @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
    [6] macro expansion
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:284 [inlined]
    [7] macro expansion
      @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
    [8] top-level scope
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:63
    [9] include(fname::String)
      @ Base.MainInclude .\client.jl:451
   [10] top-level scope
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\runtests.jl:20
   [11] include(fname::String)
      @ Base.MainInclude .\client.jl:451
   [12] top-level scope
      @ none:6
   [13] eval
      @ .\boot.jl:373 [inlined]
   [14] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:268
   [15] _start()
      @ Base .\client.jl:495
Dual Cone: Test Failed at C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:338
  Expression: ≈(dΠ, grad_fdm1, atol = tol) || (≈(dΠ, grad_fdm2, atol = tol) || ≈(dΠ, grad_fdm3, atol = tol))
Stacktrace:
 [1] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:445 [inlined]
 [2] macro expansion
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:338 [inlined]
 [3] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
 [4] macro expansion
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:331 [inlined]
 [5] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
 [6] macro expansion
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:284 [inlined]
 [7] macro expansion
   @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
 [8] top-level scope
   @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:63
Dual Cone: Error During Test at C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:330
  Got exception outside of a @test
  v=[-1.734031934454407, 0.9443717539227713, 0.0]
  dΠ = [0.0 -0.0 -0.0; -0.0 1.0 -0.0; -0.0 -0.0 0.0]
  case=3
  FD1=[0.0 -2.0980130181249832e-13 0.0; 0.0 1.0000000000000786 0.0; -3.020862527478313e-8 -4.5284838317582615e-8 0.059973663283424884]
  FD2=[0.0 2.522053555429714e-13 0.0; 0.0 1.0000000000002252 0.0; 3.0208625274783456e-8 4.527781341893516e-8 0.05997366328342468]
  FD3=[0.0 -7.042994714361593e-15 0.0; 0.0 0.9999999999999822 0.0; 0.0 0.0 0.08908091290482184]
  Stacktrace:
    [1] error(s::String)
      @ Base .\error.jl:33
    [2] macro expansion
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:340 [inlined]
    [3] macro expansion
      @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
    [4] macro expansion
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:331 [inlined]
    [5] macro expansion
      @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
    [6] macro expansion
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:284 [inlined]
    [7] macro expansion
      @ C:\Users\joaquimgarcia\AppData\Local\Programs\Julia-1.7.1\share\julia\stdlib\v1.7\Test\src\Test.jl:1283 [inlined]
    [8] top-level scope
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\projection_gradients.jl:63
    [9] include(fname::String)
      @ Base.MainInclude .\client.jl:451
   [10] top-level scope
      @ C:\Users\joaquimgarcia\.julia\dev\MathOptSetDistances\test\runtests.jl:20
   [11] include(fname::String)
      @ Base.MainInclude .\client.jl:451
   [12] top-level scope
      @ none:6
   [13] eval
      @ .\boot.jl:373 [inlined]
   [14] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:268
   [15] _start()
      @ Base .\client.jl:495
joaquimg commented 2 years ago

Formula in: _powcone∇proj_case_3 seems perfect, so I would say that is just fail of finite diff