Skip to content

Commit

Permalink
Add a MIN test
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Dec 10, 2024
1 parent 6efbcd2 commit 60b90de
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ function test_not_dcp_objective()
return
end

function test_not_dcp_objective_min()
inner = Convex.Optimizer(ECOS.Optimizer)
model = MOI.Utilities.CachingOptimizer(
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()),
MOI.Bridges.full_bridge_optimizer(inner, Float64),
)
x = MOI.add_variable(model)
g = MOI.ScalarNonlinearFunction(:^, Any[x, 2])
f = MOI.ScalarNonlinearFunction(:-, Any[f])
MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE)
attr = MOI.ObjectiveFunction{typeof(f)}()
MOI.set(model, attr, f)
@test_throws(
MOI.SetAttributeNotAllowed{typeof(attr)},
MOI.Utilities.attach_optimizer(model),
)
return
end

end # TestMOIWrapper

TestMOIWrapper.runtests()

0 comments on commit 60b90de

Please sign in to comment.