jump-dev / PolyJuMP.jl

A JuMP extension for Polynomial Optimization
Other
41 stars 8 forks source link

ScalarQuadraticFunction not supported with SCIP and QCQP. #120

Closed votroto closed 7 months ago

votroto commented 7 months ago

Ehm... Hello again ^_^

Issue

This works:

using JuMP, PolyJuMP, SCIP

m = Model(SCIP.Optimizer)

@variable(m, x >= 0)
@variable(m, y >= 0)
@variable(m, xx)

@constraint(m, xx == x*x)
@constraint(m, x + y == 1)

@objective(m, Min, xx*x + y)

optimize!(m)

but changing the optimizer to

m = Model(() -> PolyJuMP.QCQP.Optimizer(SCIP.Optimizer()))

fails with

LoadError: MathOptInterface.UnsupportedAttribute{MathOptInterface.ObjectiveFunction{MathOptInterface.ScalarQuadraticFunction{Float64}}}: Attribute MathOptInterface.ObjectiveFunction{MathOptInterface.ScalarQuadraticFunction{Float64}}() is not supported by the model.

any ideas? Is this a SCIP issue?

Versions

Same results setting it manually, of course

aff = MOI.ScalarAffineTerm(1.0, MOI.VariableIndex(y))
qua = MOI.ScalarQuadraticTerm(1.0, MOI.VariableIndex(xx), MOI.VariableIndex(x))
sqf = MOI.ScalarQuadraticFunction([qua], [aff], 0.0)
set_objective_function(m, sqf)
blegat commented 7 months ago

Thanks for the thorough testing ^^ This is because SCIP needs to bridge quadratic objective into quadratic functions but because the bridges are applied before QCQP it decides to bridge it into polynomial function which is then transformed into QCQP by the QCQP optimizer but because there is no bridge after the QCQP optimizer, it fails