diff --git a/src/redundancy.jl b/src/redundancy.jl index 48eaa3cd..023574ec 100644 --- a/src/redundancy.jl +++ b/src/redundancy.jl @@ -188,6 +188,8 @@ function Base.show(io::IO, message::_RedundantMessage) print(io, "` is redundant.") end +function _is_redundant(rep::Representation, ) + function _redundant_indices(rep::Representation, model::MOI.ModelLike, T::Type, hull, indices, clean) red_indices = Int[] @@ -205,7 +207,7 @@ function _redundant_indices(rep::Representation, model::MOI.ModelLike, T::Type, MOI.set(model, MOI.ConstraintSet(), ci, MOI.EqualTo{T}(ai)) end #if !isone(length(indices)) && - if is_feasible(model, _RedundantMessage(element, idx)) + if is_feasible(model, _RedundantMessage(element, idx)) MOI.delete(model, λ[i]) push!(red_indices, i) else @@ -246,6 +248,11 @@ function nonredundant_halfspaces(vr::HRepresentation, model, T, hull, clean) return _nonredundant(vr, model, T, hull, halfspaces(vr), clean) end +struct RedundancyChecker{M,T} + model::M + hull::Vector{MOI.ScalarAffineFunction{T}} +end + """ removehredundancy(hr::HRepresentation, solver) @@ -294,7 +301,7 @@ function removevredundancy(vr::VRepresentation, solver) # TODO It's much more efficient to remove redundant lines with `removeduplicates`. # Moreover, linearity may have already been detected. # The only advantage over `removeduplicates` is that it does not alter - # the lines, it just remove the redundant ones. + # the lines, it just removes the redundant ones. nr_lines = nonredundant_lines(vr, model, T, hull, true) nr_rays = nonredundant_rays(vr, model, T, hull, true) nr_points = nonredundant_points(vr, model, T, hull, false) @@ -304,7 +311,7 @@ end _dim_for_hull(h::HRepresentation) = fulldim(h) + 1 _dim_for_hull(v::VRepresentation) = fulldim(v) function _zero_hull(rep::Representation, T::Type) - return [zero(MOI.ScalarAffineFunction{T}) for i in 1:_dim_for_hull(rep)] + return [zero(MOI.ScalarAffineFunction{T}) for _ in 1:_dim_for_hull(rep)] end _coord_for_hull(h::HRepElement) = [h.a; h.β] _coord_for_hull(r::VRepElement) = coord(r) diff --git a/src/repelemop.jl b/src/repelemop.jl index 8049d900..abc3235a 100644 --- a/src/repelemop.jl +++ b/src/repelemop.jl @@ -132,7 +132,7 @@ end function support_function_model(h::AbstractVector, rep::Rep, solver) length(h) != fulldim(rep) && throw(DimensionMismatch()) model, T = layered_optimizer(solver) - x, cx = MOI.add_constrained_variables(model, PolyhedraOptSet(rep)) + x, _ = MOI.add_constrained_variables(model, PolyhedraOptSet(rep)) MOI.set(model, MOI.ObjectiveSense(), MOI.MAX_SENSE) MOI.set(model, MOI.ObjectiveFunction{MOI.ScalarAffineFunction{T}}(), _dot(h, x, T)) return model