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

Computing Constraints with Polyhedra #1833

Closed
chelseas opened this issue May 6, 2022 · 1 comment
Closed

Computing Constraints with Polyhedra #1833

chelseas opened this issue May 6, 2022 · 1 comment

Comments

@chelseas
Copy link

chelseas commented May 6, 2022

I get the following error:

julia> for (F, S) in list_of_constraint_types(model)
                           for con in all_constraints(model, F, S)
                               if MOI.get(model, MOI.ConstraintConflictStatus(), con) == MOI.IN_CONFLICT
                                   push!(conflict_constraint_list, con)
                                   println(con)
                               end
                           end
                       end
-xerr_1 + z0[2] = 0.0
xerr_1 = -0.037020325660705566
-z0[2] ≤ 0.0
ERROR: ArgumentError: Bridge of type `Polyhedra.PolyhedraToLPBridge{Float64, MathOptInterface.ScalarAffineFunction{Float64}}` does not support accessing the attribute `MathOptInterface.ConstraintConflictStatus()`.
Stacktrace:
  [1] get(#unused#::MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, attr::MathOptInterface.ConstraintConflictStatus, bridge::Polyhedra.PolyhedraToLPBridge{Float64, MathOptInterface.ScalarAffineFunction{Float64}})
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge.jl:76
  [2] (::MathOptInterface.Bridges.var"#55#56"{MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, MathOptInterface.ConstraintConflictStatus})(bridge::Polyhedra.PolyhedraToLPBridge{Float64, MathOptInterface.ScalarAffineFunction{Float64}})
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:1206
  [3] (::MathOptInterface.Bridges.var"#1#2"{MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}}, MathOptInterface.Bridges.var"#55#56"{MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, MathOptInterface.ConstraintConflictStatus}})()
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:291
  [4] call_in_context(map::MathOptInterface.Bridges.Variable.Map, bridge_index::Int64, f::MathOptInterface.Bridges.var"#1#2"{MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}}, MathOptInterface.Bridges.var"#55#56"{MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, MathOptInterface.ConstraintConflictStatus}})
    @ MathOptInterface.Bridges.Variable ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/Variable/map.jl:455
  [5] call_in_context(map::MathOptInterface.Bridges.Variable.Map, ci::MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}}, f::Function)
    @ MathOptInterface.Bridges.Variable ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/Variable/map.jl:486
  [6] call_in_context(b::MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, ci::MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}}, f::MathOptInterface.Bridges.var"#55#56"{MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, MathOptInterface.ConstraintConflictStatus})
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:288
  [7] get(b::MathOptInterface.Bridges.LazyBridgeOptimizer{CPLEX.Optimizer}, attr::MathOptInterface.ConstraintConflictStatus, ci::MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}})
    @ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/YDdD3/src/Bridges/bridge_optimizer.jl:1206
  [8] get(model::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, attr::MathOptInterface.ConstraintConflictStatus, index::MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/YDdD3/src/Utilities/cachingoptimizer.jl:757
  [9] _moi_get_result(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}}, ::MathOptInterface.ConstraintConflictStatus, ::Vararg{Any, N} where N)
    @ JuMP ~/.julia/packages/JuMP/klrjG/src/JuMP.jl:1199
 [10] get(model::Model, attr::MathOptInterface.ConstraintConflictStatus, cr::ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, Polyhedra.PolyhedraOptSet{Float64, DefaultPolyhedron{Float64, MixedMatHRep{Float64, Matrix{Float64}}, MixedMatVRep{Float64, Matrix{Float64}}}}}, VectorShape})
    @ JuMP ~/.julia/packages/JuMP/klrjG/src/JuMP.jl:1244
 [11] top-level scope
    @ ./REPL[178]:3
 [12] top-level scope
    @ ~/.julia/packages/CUDA/Uurn4/src/initialization.jl:52
@odow
Copy link
Member

odow commented May 6, 2022

Hi Chelsea, I'm going to close this issue and ask you to post on the community forum: https://discourse.julialang.org/c/domain/opt/13 with a reproducible example. (Two main reasons: this isn't a bug in MathOptInterface, and it may help others with similar questions in the future.)

But it looks like this is a missing feature of Polyhedra, not MathOptInterface. The conflict analysis is also pretty limited to simple LPs/MIPs. It probably won't work through more complicated JuMP extensions like Polyhedra.jl.

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

No branches or pull requests

2 participants