Closed odow closed 2 months ago
I'll add to this a request for support of ScalarQuadraticFunction
, which is maybe what https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/issues/50 is about?
Hi @odow and @ccoffrin, I started to support quadratic constraints with #102. I can find time to finalize it next week.
Sorry for the delay @ccoffrin and @odow. I finally added the support of quadratic constraints in #181. We will return an error if we encounter an unsupported feature now.
Do you know where I can find an example of a JuMP model with a VectorQuadraticFunction
?
A MOI.VectorQuadraticFunction
is a vector of quadratic terms:
model = Model()
@variable(model, x[1:2])
@constraint(model, [x[1], x[1]^2 + x[1] * x[2] + 3.0] >= 0)
Thanks Oscar, it will help to verify that my parser of MOI.VectorQuadraticFunction
is working:
https://github.com/amontoison/NLPModelsJuMP.jl/blob/quadcon/src/utils.jl#L284-L345
I didn't look at the details, but my only comment is that you might need a 2.0
or a 0.5
factor in there
https://github.com/amontoison/NLPModelsJuMP.jl/blob/0b227b47a2ad9c99b4c7c4f9efa569f421295532/src/utils.jl#L322
I don't know if your COO assumes symmetry, etc.
We assume symmetry in this case, and add the 0.5
when we evaluate the constraints:
https://github.com/amontoison/NLPModelsJuMP.jl/blob/0b227b47a2ad9c99b4c7c4f9efa569f421295532/src/moi_nlp_model.jl#L114
Cool cool. I think the definition of ScalarQuadraticFunction
was a mistake. We should have just made it a list of terms. It's so easy to get confused with the different conventions.
When we define a constraint with VectorQuadraticFunction
, what are the accepted sets?
Is it MOI.NonPosivitive / MOI.NonNegative or MOI.Zeros, the sets allowed for VectorAffineFunction
?
https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/blob/main/test/nlp_problems/lincon.jl#L8
what are the accepted sets
Any subtype of MOI.AbstractVectorSet
. But yes, Nonnegative
is f(x) >= 0
, Nonpositive
is f(x) <= 0
, and Zeros
is f(x) = 0
.
@ccoffrin was running a few examples and getting incorrect results because quadratic constraints are not supported (#50).
Shouldn't this be an error instead of a warning?
https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/blob/12d8f2315328f1b8c8af0a6a4552b6ad71327674/src/utils.jl#L216-L219