@@ -215,6 +215,8 @@ objective function).
215215If `config.solve=true` confirm that it solves correctly.
216216"""
217217function solve_qp_edge_cases (model:: MOI.ModelLike , config:: TestConfig )
218+ obj_attr = MOI. ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} ()
219+ MOI. supports (model, obj_attr) || return
218220 MOI. empty! (model)
219221 x = MOI. add_variables (model, 2 )
220222 MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
@@ -235,7 +237,7 @@ function solve_qp_edge_cases(model::MOI.ModelLike, config::TestConfig)
235237 # min x^2 + y^2 | x>=1, y>=2
236238 MOI. set (
237239 model,
238- MOI . ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} () ,
240+ obj_attr ,
239241 MOI. ScalarQuadraticFunction (
240242 MOI. ScalarAffineTerm{Float64}[], # affine terms
241243 MOI. ScalarQuadraticTerm .([2.0 , 2.0 ], x, x), # quad
@@ -253,7 +255,7 @@ function solve_qp_edge_cases(model::MOI.ModelLike, config::TestConfig)
253255 # min x + x + x^2 + y^2 | x>=1, y>=2
254256 MOI. set (
255257 model,
256- MOI . ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} () ,
258+ obj_attr ,
257259 MOI. ScalarQuadraticFunction (
258260 MOI. ScalarAffineTerm .([1.0 , 1.0 ], [x[1 ], x[1 ]]), # affine terms
259261 MOI. ScalarQuadraticTerm .([2.0 , 2.0 ], x, x), # quad
@@ -271,7 +273,7 @@ function solve_qp_edge_cases(model::MOI.ModelLike, config::TestConfig)
271273 # min x^2 + x^2 | x>=1, y>=2
272274 MOI. set (
273275 model,
274- MOI . ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} () ,
276+ obj_attr ,
275277 MOI. ScalarQuadraticFunction (
276278 MOI. ScalarAffineTerm{Float64}[], # affine terms
277279 MOI. ScalarQuadraticTerm .(
@@ -293,7 +295,7 @@ function solve_qp_edge_cases(model::MOI.ModelLike, config::TestConfig)
293295 # min x^2 + 0.25x*y + 0.25y*x + 0.5x*y + y^2 | x>=1, y>=2
294296 MOI. set (
295297 model,
296- MOI . ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} () ,
298+ obj_attr ,
297299 MOI. ScalarQuadraticFunction (
298300 MOI. ScalarAffineTerm{Float64}[], # affine terms
299301 MOI. ScalarQuadraticTerm .(
@@ -322,6 +324,8 @@ Test quadratic program with a zero off-diagonal term.
322324If `config.solve=true` confirm that it solves correctly.
323325"""
324326function solve_qp_zero_offdiag (model:: MOI.ModelLike , config:: TestConfig )
327+ obj_attr = MOI. ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} ()
328+ MOI. supports (model, obj_attr) || return
325329 MOI. empty! (model)
326330 x = MOI. add_variables (model, 2 )
327331 MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
@@ -339,7 +343,7 @@ function solve_qp_zero_offdiag(model::MOI.ModelLike, config::TestConfig)
339343 @test vc2. value == x[2 ]. value
340344 MOI. set (
341345 model,
342- MOI . ObjectiveFunction {MOI.ScalarQuadraticFunction{Float64}} () ,
346+ obj_attr ,
343347 MOI. ScalarQuadraticFunction (
344348 MOI. ScalarAffineTerm{Float64}[], # affine terms
345349 MOI. ScalarQuadraticTerm .(
0 commit comments