Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Jun 24, 2024
1 parent c1d9408 commit 6a66482
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,18 @@ end
function MOI.set(
model::Optimizer,
::MOI.ConstraintFunction,
c::MOI.ConstraintIndex{F,S},
c::MOI.ConstraintIndex{F},
f::F,
) where {F,S}
) where {F}
MOI.set(model.optimizer, MOI.ConstraintFunction(), c, f)
return
end

function MOI.get(
model::Optimizer,
attr::MOI.ConstraintFunction,
ci::MOI.ConstraintIndex{F,S},
) where {F,S}
ci::MOI.ConstraintIndex,
)
if haskey(model.quadratic_outer_to_inner, ci)
inner_ci = model.quadratic_outer_to_inner[ci]
return _original_function(model.quadratic_constraint_cache[inner_ci])
Expand Down Expand Up @@ -501,8 +501,8 @@ end
function MOI.get(
model::Optimizer,
attr::MOI.ConstraintSet,
ci::MOI.ConstraintIndex{F,S},
) where {F,S}
ci::MOI.ConstraintIndex,
)
if haskey(model.quadratic_outer_to_inner, ci)
inner_ci = model.quadratic_outer_to_inner[ci]
return model.quadratic_constraint_cache_set[inner_ci]
Expand Down Expand Up @@ -1099,27 +1099,10 @@ function MOI.get(
attr::MOI.AbstractConstraintAttribute,
c::MOI.ConstraintIndex,
)
moi_ci = get(model.constraint_outer_to_inner, c, c)
return MOI.get(model.optimizer, attr, c)
end

function MOI.get(
model::Optimizer,
attr::MOI.AbstractConstraintAttribute,
c::MOI.ConstraintIndex{<:MOI.ScalarAffineFunction},
)
moi_ci = get(model.affine_outer_to_inner, c, c)
return MOI.get(model.optimizer, attr, moi_ci)
end

function MOI.get(
model::Optimizer,
attr::MOI.AbstractConstraintAttribute,
c::MOI.ConstraintIndex{<:MOI.ScalarQuadraticFunction},
)
moi_ci = get(model.quadratic_outer_to_inner, c, c)
return MOI.get(model.optimizer, attr, moi_ci)
end

#
# Special Attributes
#
Expand Down

0 comments on commit 6a66482

Please sign in to comment.