Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw errors for unsupported keywords #104

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions src/SAGE/SAGE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
set::Union{Signomials,Polynomials};
kws...,
)
for (key, _) in kws
_error("unsupported keyword argument `$key`.")
end

Check warning on line 78 in src/SAGE/SAGE.jl

View check run for this annotation

Codecov / codecov/patch

src/SAGE/SAGE.jl#L78

Added line #L78 was not covered by tests
coefs = PolyJuMP.non_constant_coefficients(p)
monos = MP.monomials(p)
cone = JuMP.moi_set(set, monos)
Expand Down
11 changes: 11 additions & 0 deletions test/sage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ function test_motzkin(x, y, T, solver)
return
end

# See https://github.com/jump-dev/PolyJuMP.jl/issues/102#issuecomment-1888004697
function test_domain(x, y, T, solver)
p = x^3 - x^2 + 2x * y - y^2 + y^3
S = @set x >= 0 && y >= 0 && x + y >= 1
model = Model(solver)
setpolymodule!(model, PolyJuMP.SAGE)
@variable(model, α)
@objective(model, Max, α)
@test_throws ErrorException @constraint(model, c3, p >= α, domain = S)
end

import ECOS
const SOLVERS =
[optimizer_with_attributes(ECOS.Optimizer, MOI.Silent() => true)]
Expand Down
Loading