Skip to content

Commit e199686

Browse files
committed
Fixes
1 parent 4011ace commit e199686

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/Utilities/copy.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ function pass_attributes(dest::MOI.ModelLike, src::MOI.ModelLike, index_map)
4040
return
4141
end
4242

43+
struct UnsafeObjectiveFunction{F<:MOI.AbstractFunction} <:
44+
MOI.AbstractModelAttribute end
45+
46+
function MOI.get(model::MOI.ModelLike, ::UnsafeObjectiveFunction{F}) where {F}
47+
return MOI.get(model, MOI.ObjectiveFunction{F}())
48+
end
49+
50+
struct UnsafeConstraintFunction <: MOI.AbstractConstraintAttribute end
51+
52+
function MOI.get_fallback(
53+
model::MOI.ModelLike,
54+
::UnsafeConstraintFunction,
55+
ci::MOI.ConstraintIndex,
56+
)
57+
return MOI.get(model, MOI.ConstraintFunction(), ci)
58+
end
59+
4360
function _pass_attribute(
4461
dest::MOI.ModelLike,
4562
src::MOI.ModelLike,

src/Utilities/objective_container.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ function MOI.supports(
116116
return true
117117
end
118118

119-
struct UnsafeObjectiveFunction{F<:MOI.AbstractFunction} <:
120-
MOI.AbstractModelAttribute end
121-
122-
function MOI.get(model::MOI.ModelLike, ::UnsafeObjectiveFunction{F}) where {F}
123-
return MOI.get(model, MOI.ObjectiveFunction{F}())
124-
end
125-
126119
function MOI.get(
127120
o::ObjectiveContainer{T},
128121
attr::MOI.ObjectiveFunction{F},

src/Utilities/variables_container.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ MOI.is_valid(::VariablesContainer, ::MOI.ConstraintIndex) = false
310310

311311
function MOI.get(
312312
model::VariablesContainer,
313-
::MOI.ConstraintFunction,
313+
::Union{UnsafeConstraintFunction,MOI.ConstraintFunction},
314314
ci::MOI.ConstraintIndex{MOI.VariableIndex},
315315
)
316316
MOI.throw_if_not_valid(model, ci)

src/Utilities/vector_of_constraints.jl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,6 @@ function MOI.delete(
9696
return
9797
end
9898

99-
struct UnsafeConstraintFunction <: MOI.AbstractConstraintAttribute end
100-
101-
function MOI.get_fallback(
102-
model::MOI.ModelLike,
103-
::UnsafeConstraintFunction,
104-
ci::MOI.ConstraintIndex,
105-
)
106-
return MOI.get(model, MOI.ConstraintFunction(), ci)
107-
end
108-
10999
function MOI.get(
110100
v::VectorOfConstraints{F,S},
111101
::UnsafeConstraintFunction,

0 commit comments

Comments
 (0)