Skip to content

Commit 5ffe3c9

Browse files
authored
Throw errors for unsupported keywords (#104)
* Throw errors for unsupported keywords * Fix format
1 parent 68939f2 commit 5ffe3c9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/SAGE/SAGE.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ function JuMP.build_constraint(
7373
set::Union{Signomials,Polynomials};
7474
kws...,
7575
)
76+
for (key, _) in kws
77+
_error("unsupported keyword argument `$key`.")
78+
end
7679
coefs = PolyJuMP.non_constant_coefficients(p)
7780
monos = MP.monomials(p)
7881
cone = JuMP.moi_set(set, monos)

test/sage.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ function test_motzkin(x, y, T, solver)
7575
return
7676
end
7777

78+
# See https://github.com/jump-dev/PolyJuMP.jl/issues/102#issuecomment-1888004697
79+
function test_domain(x, y, T, solver)
80+
p = x^3 - x^2 + 2x * y - y^2 + y^3
81+
S = @set x >= 0 && y >= 0 && x + y >= 1
82+
model = Model(solver)
83+
setpolymodule!(model, PolyJuMP.SAGE)
84+
@variable(model, α)
85+
@objective(model, Max, α)
86+
@test_throws ErrorException @constraint(model, c3, p >= α, domain = S)
87+
end
88+
7889
import ECOS
7990
const SOLVERS =
8091
[optimizer_with_attributes(ECOS.Optimizer, MOI.Silent() => true)]

0 commit comments

Comments
 (0)