Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 48 additions & 8 deletions src/Bridges/bridgeoptimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,42 @@ function MOI.get(b::AbstractBridgeOptimizer,
attr::MOI.AbstractConstraintAttribute,
ci::CI)
if is_bridged(b, typeof(ci))
if MOI.is_set_by_optimize(attr)
MOI.get(b, attr, bridge(b, ci))
else
MOI.get(b.bridged, attr, ci)
end
return MOI.get(b, attr, bridge(b, ci))
else
return MOI.get(b.model, attr, ci)
end
end
function MOI.supports(b::AbstractBridgeOptimizer,
attr::MOI.AbstractConstraintAttribute,
IndexType::Type{CI{F, S}}) where {F,S}
if is_bridged(b, IndexType)
return MOI.supports(b, attr, concrete_bridge_type(b, F, S))
else
return MOI.supports(b.model, attr, IndexType)
end
end

function MOI.set(b::AbstractBridgeOptimizer,
attr::MOI.AbstractConstraintAttribute,
index::CI, value)
if is_bridged(b, typeof(index))
return MOI.set(b, attr, bridge(b, index), value)
else
return MOI.set(b.model, attr, index, value)
end
end
## Getting and Setting names
function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName,
constraint_index::CI)
if is_bridged(b, typeof(constraint_index))
return MOI.get(b.bridged, attr, constraint_index)
else
MOI.get(b.model, attr, ci)
return MOI.get(b.model, attr, constraint_index)
end
end
## Setting names

function MOI.supports(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName,
Index::Type{<:CI})
Index::Type{CI{F,S}}) where {F,S}
if is_bridged(b, Index)
return MOI.supports(b.bridged, attr, Index)
else
Expand All @@ -253,6 +277,22 @@ function MOI.set(b::AbstractBridgeOptimizer, attr::MOI.ConstraintName,
MOI.set(b.model, attr, constraint_index, name)
end
end
## Getting functions and sets
function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ConstraintSet, ci::CI)
if is_bridged(b, typeof(ci))
return MOI.get(b.bridged, attr, ci)
else
return MOI.get(b.model, attr, ci)
end
end
function MOI.get(b::AbstractBridgeOptimizer, attr::MOI.ConstraintFunction,
ci::CI)
if is_bridged(b, typeof(ci))
return MOI.get(b.bridged, attr, ci)
else
return MOI.get(b.model, attr, ci)
end
end
## Setting functions and sets
function MOI.set(b::AbstractBridgeOptimizer, ::MOI.ConstraintSet,
constraint_index::CI{F, S}, set::S) where {F, S}
Expand Down