Skip to content

Commit

Permalink
Merge pull request #12 from joaquimg/jg/ambiguity
Browse files Browse the repository at this point in the history
Fix Ambiguities
  • Loading branch information
joaquimg authored Sep 30, 2020
2 parents 010bf83 + 66eeeef commit 8bd8323
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/moi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ mutable struct Optimizer{T, OT <: MOI.ModelLike} <: MOI.AbstractOptimizer
fallback_lb::Float64
fallback_ub::Float64

allow_soc::Bool

function Optimizer{T}(optimizer::OT; lb = -Inf, ub = +Inf, global_precision = 1e-4
) where {T, OT <: MOI.ModelLike}
# TODO optimizer must support binary, and affine in less and greater
Expand All @@ -146,6 +148,7 @@ mutable struct Optimizer{T, OT <: MOI.ModelLike} <: MOI.AbstractOptimizer
false,
lb,
ub,
true,
)
end
end
Expand Down Expand Up @@ -303,13 +306,33 @@ function MOI.get(model::Optimizer, ::MOI.SolverName)
end

function MOI.supports_add_constrained_variables(
model::Optimizer, ::Type{S}) where S
model::Optimizer, ::Type{S}) where {S<:MOI.AbstractVectorSet}
return MOI.supports_add_constrained_variables(model.optimizer, S)
end
function MOI.supports_add_constrained_variables(
model::Optimizer, ::Type{S}) where {S<:MOI.AbstractScalarSet}
return MOI.supports_add_constrained_variables(model.optimizer, S)
end
function MOI.supports_add_constrained_variables(
model::Optimizer, ::Type{MOI.Reals})
return MOI.supports_add_constrained_variables(model.optimizer, MOI.Reals)
end
function MOI.supports_add_constrained_variables(
model::Optimizer, ::Type{S}) where {
S<:Union{MOI.SecondOrderCone, MOI.RotatedSecondOrderCone}
}
if model.allow_soc
return MOI.supports_add_constrained_variables(model.optimizer, S)
else
return false
end
end
function MOI.supports_add_constrained_variables(
model::Optimizer, ::Type{S}) where {
S<:Union{MOI.SOS1{T}, MOI.SOS2{T}}
} where T
return MOI.supports_add_constrained_variables(model.optimizer, S)
end

# function MOI.set(model::Optimizer, param::MOI.RawParameter, value)
# # if in a subset of the q2b save it
Expand Down

0 comments on commit 8bd8323

Please sign in to comment.