Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.35.0 broke DiffOpt docs (nearest_correlation) #2608

Closed
joaquimg opened this issue Jan 12, 2025 · 1 comment · Fixed by matbesancon/MathOptSetDistances.jl#83
Closed
Assignees

Comments

@joaquimg
Copy link
Member

It builds fine in 1.34.x : jump-dev/DiffOpt.jl#268
But fails in 1.35.0 : jump-dev/DiffOpt.jl#267

/home/runner/work/DiffOpt.jl/DiffOpt.jl/docs/src/examples/nearest_correlation.jl: Error During Test at /home/runner/work/DiffOpt.jl/DiffOpt.jl/docs/make.jl:35
  Got exception outside of a @test
  LoadError: MethodError: no method matching projection_gradient_on_set(::MathOptSetDistances.DefaultDistance, ::Vector{Float64}, ::MathOptInterface.Scaled{MathOptInterface.PositiveSemidefiniteConeTriangle})
  The function `projection_gradient_on_set` exists, but no method is defined for this combination of argument types.
  
  Closest candidates are:
    projection_gradient_on_set(::MathOptSetDistances.DefaultDistance, ::AbstractVector{T}, !Matched::MathOptInterface.RotatedSecondOrderCone) where T
     @ MathOptSetDistances ~/.julia/packages/MathOptSetDistances/CwCGT/src/projections.jl:590
    projection_gradient_on_set(::MathOptSetDistances.DefaultDistance, ::AbstractVector{T}, !Matched::MathOptInterface.Nonnegatives) where T
     @ MathOptSetDistances ~/.julia/packages/MathOptSetDistances/CwCGT/src/projections.jl:538
    projection_gradient_on_set(::MathOptSetDistances.DefaultDistance, ::AbstractVector{T}, !Matched::MathOptInterface.DualExponentialCone) where T
     @ MathOptSetDistances ~/.julia/packages/MathOptSetDistances/CwCGT/src/projections.jl:710
    ...
  
  Stacktrace:
    [1] (::DiffOpt.var"#14#15"{Vector{Float64}, MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.FreeVariables, MathOptInterface.Utilities.MatrixOfConstraints{Float64, MathOptInterface.Utilities.MutableSparseMatrixCSC{Float64, Int64, MathOptInterface.Utilities.OneBasedIndexing}, Vector{Float64}, DiffOpt.ProductOfSets{Float64}}}})(ci::MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Scaled{MathOptInterface.PositiveSemidefiniteConeTriangle}}, r::UnitRange{Int64})
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/diff_opt.jl:418
    [2] _map_rows!(f::DiffOpt.var"#14#15"{Vector{Float64}, MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.FreeVariables, MathOptInterface.Utilities.MatrixOfConstraints{Float64, MathOptInterface.Utilities.MutableSparseMatrixCSC{Float64, Int64, MathOptInterface.Utilities.OneBasedIndexing}, Vector{Float64}, DiffOpt.ProductOfSets{Float64}}}}, x::Vector{Matrix{Float64}}, model::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.FreeVariables, MathOptInterface.Utilities.MatrixOfConstraints{Float64, MathOptInterface.Utilities.MutableSparseMatrixCSC{Float64, Int64, MathOptInterface.Utilities.OneBasedIndexing}, Vector{Float64}, DiffOpt.ProductOfSets{Float64}}}, cones::DiffOpt.ProductOfSets{Float64}, ::Type{MathOptInterface.VectorAffineFunction{Float64}}, ::Type{MathOptInterface.Scaled{MathOptInterface.PositiveSemidefiniteConeTriangle}}, map_mode::DiffOpt.Nested{Matrix{Float64}}, k::Int64)
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/diff_opt.jl:456
    [3] map_rows(f::Function, model::MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ObjectiveContainer{Float64}, MathOptInterface.Utilities.FreeVariables, MathOptInterface.Utilities.MatrixOfConstraints{Float64, MathOptInterface.Utilities.MutableSparseMatrixCSC{Float64, Int64, MathOptInterface.Utilities.OneBasedIndexing}, Vector{Float64}, DiffOpt.ProductOfSets{Float64}}}, cones::DiffOpt.ProductOfSets{Float64}, map_mode::DiffOpt.Nested{Matrix{Float64}})
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/diff_opt.jl:495
    [4] Dπ
      @ ~/work/DiffOpt.jl/DiffOpt.jl/src/diff_opt.jl:416 [inlined]
    [5] _gradient_cache(model::DiffOpt.ConicProgram.Model)
      @ DiffOpt.ConicProgram ~/work/DiffOpt.jl/DiffOpt.jl/src/ConicProgram/ConicProgram.jl:213
    [6] macro expansion
      @ ~/work/DiffOpt.jl/DiffOpt.jl/src/ConicProgram/ConicProgram.jl:247 [inlined]
    [7] macro expansion
      @ ./timing.jl:421 [inlined]
    [8] forward_differentiate!(model::DiffOpt.ConicProgram.Model)
      @ DiffOpt.ConicProgram ~/work/DiffOpt.jl/DiffOpt.jl/src/ConicProgram/ConicProgram.jl:246
    [9] forward_differentiate!(model::MathOptInterface.Bridges.LazyBridgeOptimizer{DiffOpt.ConicProgram.Model})
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/jump_moi_overloads.jl:327
   [10] forward_differentiate!(model::DiffOpt.Optimizer{MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{SCS.Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}})
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/moi_wrapper.jl:552
   [11] forward_differentiate!
      @ ~/work/DiffOpt.jl/DiffOpt.jl/src/jump_moi_overloads.jl:327 [inlined]
   [12] forward_differentiate!(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{DiffOpt.Optimizer{MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{SCS.Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}}}, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}})
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/jump_moi_overloads.jl:317
   [13] forward_differentiate!(model::JuMP.Model)
      @ DiffOpt ~/work/DiffOpt.jl/DiffOpt.jl/src/jump_moi_overloads.jl:307
   [14] proj(A::LinearAlgebra.Tridiagonal{Float64, Vector{Float64}}, dH::LinearAlgebra.Diagonal{Float64, Vector{Float64}}, H::Matrix{Float64})
      @ Main.var"##386" ~/work/DiffOpt.jl/DiffOpt.jl/docs/src/examples/nearest_correlation.jl:26
   [15] proj(A::LinearAlgebra.Tridiagonal{Float64, Vector{Float64}})
      @ Main.var"##386" ~/work/DiffOpt.jl/DiffOpt.jl/docs/src/examples/nearest_correlation.jl:15
   [16] top-level scope
      @ ~/work/DiffOpt.jl/DiffOpt.jl/docs/src/examples/nearest_correlation.jl:37
   [17] include
      @ ./Base.jl:557 [inlined]
   [18] _include_sandbox(filename::String)
      @ Main ~/work/DiffOpt.jl/DiffOpt.jl/docs/make.jl:20
   [19] macro expansion
      @ ~/work/DiffOpt.jl/DiffOpt.jl/docs/make.jl:36 [inlined]
   [20] macro expansion
      @ /opt/hostedtoolcache/julia/1.11.2/x64/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [21] literate_directory(dir::String)
      @ Main ~/work/DiffOpt.jl/DiffOpt.jl/docs/make.jl:36
   [22] top-level scope
      @ ~/work/DiffOpt.jl/DiffOpt.jl/docs/make.jl:43
   [23] include(mod::Module, _path::String)
      @ Base ./Base.jl:557
   [24] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:323
   [25] _start()
      @ Base ./client.jl:531
  in expression starting at /home/runner/work/DiffOpt.jl/DiffOpt.jl/docs/src/examples/nearest_correlation.jl:37

Indeed the requested method does not exist in MOSD. It should exist and maybe this is the right solution.
But it was not called before. Changes in bridges? Could the order change lead to this?

@blegat
Copy link
Member

blegat commented Jan 12, 2025

Not sure why the behavior has changed but I added the missing method in matbesancon/MathOptSetDistances.jl#83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants