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

Add support for Hermitian PSD for conic inequality #3705

Merged
merged 3 commits into from
Mar 9, 2024
Merged

Add support for Hermitian PSD for conic inequality #3705

merged 3 commits into from
Mar 9, 2024

Conversation

blegat
Copy link
Member

@blegat blegat commented Mar 8, 2024

Before this PR

@variable(model, x)
julia> @constraint(model, LinearAlgebra.Hermitian([1 x; x 1])>=0, HermitianPSDCone())
ERROR: At REPL[23]:1: `@constraint(model, LinearAlgebra.Hermitian([1 x; x 1]) >= 0, HermitianPSDCone())`: Unrecognized constraint building format. Tried to invoke `build_constraint(error, AffExpr[1 x; x 1], MathOptInterface.GreaterThan{Bool}(false), HermitianPSDCone())`, but no such method exists. This is due to specifying an unrecognized function, constraint set, and/or extra positional/keyword arguments.

If you're trying to create a JuMP extension, you need to implement `build_constraint` to accomodate these arguments.
Stacktrace:
 [1] error(::String, ::String)
   @ Base ./error.jl:44
 [2] (::JuMP.Containers.var"#error_fn#98"{String})(str::String)
   @ JuMP.Containers ~/.julia/dev/JuMP/src/Containers/macro.jl:325
 [3] build_constraint(error_fn::JuMP.Containers.var"#error_fn#98"{}, func::Hermitian{…}, set::MathOptInterface.GreaterThan{…}, args::HermitianPSDCone; kwargs::@Kwargs{})
   @ JuMP ~/.julia/dev/JuMP/src/macros/@constraint.jl:781
 [4] build_constraint(error_fn::Function, func::Hermitian{…}, set::MathOptInterface.GreaterThan{…}, args::HermitianPSDCone)
   @ JuMP ~/.julia/dev/JuMP/src/macros/@constraint.jl:776
 [5] #build_constraint#81
   @ ~/.julia/dev/JuMP/src/macros/@constraint.jl:726 [inlined]
 [6] build_constraint(error_fn::Function, f::Hermitian{AffExpr, Matrix{AffExpr}}, set::Nonnegatives, args::HermitianPSDCone)
   @ JuMP ~/.julia/dev/JuMP/src/macros/@constraint.jl:719

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.35%. Comparing base (a39e241) to head (f4495c3).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3705   +/-   ##
=======================================
  Coverage   98.35%   98.35%           
=======================================
  Files          43       43           
  Lines        5707     5709    +2     
=======================================
+ Hits         5613     5615    +2     
  Misses         94       94           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@odow
Copy link
Member

odow commented Mar 9, 2024

Did you try this?

@odow odow merged commit d7c45a9 into master Mar 9, 2024
11 checks passed
@odow odow deleted the bl/herm_nn branch March 9, 2024 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants