Skip to content

primal_feasibility_report fails with indicator constraints in distance_to_set #2922

@MagicMuscleMan

Description

@MagicMuscleMan

I am not sure whether this is a JuMP.jl problem calling the wrong method or a MathOptInterface.jl problem missing the correct method. I guess the latter one, so I report it here.

I want to find the constraint which violates a solution which should be valid according to what I want, but seems to be invalid according to what I have written. However, it crashes. I boiled it down to this:

julia> using JuMP

julia> model = Model();

julia> @variable(model, b, Bin);

julia> @variable(model, x);

julia> @constraint(model, b --> {x >= 0});

julia> primal_feasibility_report(model, Dict(x => 1.0, b => 1.0), atol=10^-9)
ERROR: distance_to_set using the distance metric MathOptInterface.Utilities.ProjectionUpperBoundDistance() for set type MathOptInterface.Indicator{MathOptInterface.ACTIVATE_ON_ONE, MathOptInterface.GreaterThan{Float64}} has not been implemented yet.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] distance_to_set(d::MathOptInterface.Utilities.ProjectionUpperBoundDistance, ::Vector{…}, set::MathOptInterface.Indicator{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/03Qtw/src/Utilities/distance_to_set.jl:75
  [3] distance_to_set(point::Vector{…}, set::MathOptInterface.Indicator{…})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/03Qtw/src/Utilities/distance_to_set.jl:71
  [4] _distance_to_set(point::Vector{…}, set::MathOptInterface.Indicator{…}, ::Type)
    @ JuMP ~/.julia/packages/JuMP/7eD71/src/feasibility_checker.jl:214
  [5] _add_infeasible_constraints(model::Model, ::Type{…}, ::Type{…}, violated_constraints::Dict{…}, point_f::Function, atol::Float64)
    @ JuMP ~/.julia/packages/JuMP/7eD71/src/feasibility_checker.jl:143
  [6] primal_feasibility_report(point::Function, model::Model; atol::Float64, skip_missing::Bool)
    @ JuMP ~/.julia/packages/JuMP/7eD71/src/feasibility_checker.jl:107
  [7] primal_feasibility_report
    @ ~/.julia/packages/JuMP/7eD71/src/feasibility_checker.jl:99 [inlined]
  [8] #primal_feasibility_report#114
    @ ~/.julia/packages/JuMP/7eD71/src/feasibility_checker.jl:58 [inlined]
  [9] top-level scope
    @ REPL[6]:1
 [10] top-level scope
    @ REPL:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions