Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Aug 15, 2023
1 parent f8cb7f2 commit 2ee4130
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/sd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ function build_constraint(
)
return error_fn(
"The tuple function $(typeof(f)) is not supported for a set of type " *
"$(typeof(set)). Try concatenating the elements into a vector instead.",
"$(typeof(set)).",
)
end

Expand Down
7 changes: 0 additions & 7 deletions src/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ function build_constraint(
return VectorConstraint(args, moi_set(set, length(args)), shape)
end

function build_constraint(error_fn::Function, f::Tuple, set::AbstractVectorSet)
return error_fn(
"The tuple function $(typeof(f)) is not supported for a set of type " *
"$(typeof(set)). Try concatenating the elements into a vector instead.",
)
end

"""
build_constraint(
_error::Function,
Expand Down
21 changes: 15 additions & 6 deletions test/test_constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1779,14 +1779,23 @@ end

function test_tuple_shape_unsupported_error()
model = Model()
@variable(model, X[1:2, 1:2])
@variable(model, t)
@variable(model, x[1:2])
err = ErrorException(
"In ` @constraint(model, (t,) in MOI.ZeroOne())`: " *
"The tuple function $(Tuple{VariableRef}) is not supported for " *
"a set of type $(MOI.ZeroOne).",
)
@test_throws_strip err @constraint(model, (t,) in MOI.ZeroOne())
err = ErrorException(
"In `@constraint(model, (X,) in PSDCone())`: " *
"The tuple function Tuple{Matrix{VariableRef}} is not supported for " *
"a set of type PSDCone. Try concatenating the elements into a " *
"vector instead.",
"In `@constraint(model, ((x[1], x[2]),) in MOI.SOS1([1.0, 2.0]))`: " *
"The tuple function $(Tuple{Tuple{VariableRef, VariableRef}}) is not " *
"supported for a set of type $(MOI.SOS1{Float64}).",
)
@test_throws_strip(
err,
@constraint(model, ((x[1], x[2]),) in MOI.SOS1([1.0, 2.0])),
)
@test_throws_strip err @constraint(model, (X,) in PSDCone())
return
end

Expand Down

0 comments on commit 2ee4130

Please sign in to comment.