From a9db7cd394ee2151e692fe66877debcf0e54a596 Mon Sep 17 00:00:00 2001 From: Twan Koolen Date: Wed, 18 Jul 2018 15:00:56 -0400 Subject: [PATCH] Add duplicate terms to linear part of objective in qp2test To catch https://github.com/JuliaOpt/Gurobi.jl/pull/125#issuecomment-406017666, https://github.com/JuliaOpt/Xpress.jl/issues/22, https://github.com/JuliaOpt/GLPK.jl/issues/57. --- src/Test/contquadratic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Test/contquadratic.jl b/src/Test/contquadratic.jl index 38dae2bd1c..39048c512e 100644 --- a/src/Test/contquadratic.jl +++ b/src/Test/contquadratic.jl @@ -93,7 +93,7 @@ function qp2test(model::MOI.ModelLike, config::TestConfig) c2 = MOI.addconstraint!(model, MOI.ScalarAffineFunction(MOI.ScalarAffineTerm.([1.0,1.0], [v[1],v[2]]), 0.0), MOI.GreaterThan(1.0)) @test MOI.get(model, MOI.NumberOfConstraints{MOI.ScalarAffineFunction{Float64}, MOI.GreaterThan{Float64}}()) == 2 - obj = MOI.ScalarQuadraticFunction(MOI.ScalarAffineTerm.(0.0, v), MOI.ScalarQuadraticTerm.([2.0, 0.5, 0.5, 2.0, 1.0, 1.0, 1.0], [v[1], v[1], v[1], v[2], v[2], v[3], v[3]], [v[1], v[2], v[2], v[2], v[3], v[3], v[3]]), 0.0) + obj = MOI.ScalarQuadraticFunction([MOI.ScalarAffineTerm.(1.0, v); MOI.ScalarAffineTerm.(-1.0, v)], MOI.ScalarQuadraticTerm.([2.0, 0.5, 0.5, 2.0, 1.0, 1.0, 1.0], [v[1], v[1], v[1], v[2], v[2], v[3], v[3]], [v[1], v[2], v[2], v[2], v[3], v[3], v[3]]), 0.0) @test MOI.canset(model, MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}()) MOI.set!(model, MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{Float64}}(), obj) @test MOI.canset(model, MOI.ObjectiveSense())