Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

can't use primal_feasibility_report with complex variables

Open Beginner friendly
#3,113 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
julia
Domain
testing-qa

Research direction

The stack trace points to src/Utilities/distance_to_set.jl and src/feasibility_checker.jl; start by reading the distance handling for EqualTo sets and the feasibility checker call site. Reproduce the example with complex variables and check that primal_feasibility_report handles the resulting EqualTo{ComplexF64} constraint without error.

Written by the indexing model from the issue text.

Description

Should be easy enough to implement.

using JuMP, LinearAlgebra
import Hypatia

function complex_test()
    model = Model(Hypatia.Optimizer)
    @variable(model, ρ[1:2,1:2] in HermitianPSDCone())
    @constraint(model, tr(ρ) == 1)
    @objective(model, Max, imag(ρ[1, 2]))
    set_silent(model)
    optimize!(model)
    display(primal_feasibility_report(model))
    return objective_value(model)
end

Stacktrace:

julia> complex_test()
ERROR: distance_to_set using the distance metric MathOptInterface.Utilities.ProjectionUpperBoundDistance() for set type MathOptInterface.EqualTo{ComplexF64} has not been implemented yet.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] distance_to_set(d::MathOptInterface.Utilities.ProjectionUpperBoundDistance, ::Float64, set::MathOptInterface.EqualTo{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/lY2WB/src/Utilities/distance_to_set.jl:75
  [3] distance_to_set(point::Float64, set::MathOptInterface.EqualTo{ComplexF64})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/lY2WB/src/Utilities/distance_to_set.jl:71
  [4] _distance_to_set(point_f::JuMP.var"#115#116"{…}, func::GenericAffExpr{…}, set::MathOptInterface.EqualTo{…}, ::Type{…})
    @ JuMP ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:196
  [5] _add_infeasible_constraints(model::Model, ::Type{…}, ::Type{…}, violated_constraints::Dict{…}, point_f::Function, atol::Float64)
    @ JuMP ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:160
  [6] primal_feasibility_report(point::Function, model::Model; atol::Float64, skip_missing::Bool)
    @ JuMP ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:130
  [7] primal_feasibility_report
    @ ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:109 [inlined]
  [8] #primal_feasibility_report#113
    @ ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:48 [inlined]
  [9] primal_feasibility_report
    @ ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:42 [inlined]
 [10] primal_feasibility_report(model::Model; kwargs::@Kwargs{})
    @ JuMP ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:81
 [11] primal_feasibility_report
    @ ~/.julia/packages/JuMP/insRt/src/feasibility_checker.jl:68 [inlined]
 [12] complex_test()
    @ Main ./REPL[5]:8
 [13] top-level scope
    @ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.
Dominant language
Julia
Stars
506
Forks
103
Avg merge
1d 1h
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jump-dev/MathOptInterface.jl

All issues in jump-dev/MathOptInterface.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.