Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JuMP appears unable to recognise that a matrix is positive definite #2517

Closed
ASaragga opened this issue Mar 3, 2021 · 1 comment
Closed

Comments

@ASaragga
Copy link

ASaragga commented Mar 3, 2021

*** Please disregard this issue. I didn't notice that there was already a reply to an identical issue I had posted yesterday.

Running the model

model = Model(COSMO.Optimizer)   # or SCS.Optimizer
@variable(model, w[1:6] >= 0)
@constraint(model, sum(w) == 1)
@constraint(model, w' * pcov * w == 0.038)
@objective(model, Max, sum((pmean[i] * w[i]) for i = 1:6))
optimize!(model)
optimal_solution = value.(w)

with

pmean = [0.006719140992780818 0.011577810667787833 0.01344208119264699 0.005535719592233162 0.026922967360723037 0.00934581295816873]
pcov = [0.018717403832096687 0.005706355121276367 0.006459876807928641 0.0012524618528797894 0.002563861720279623 0.0007671488407868487; 0.005706355121276367 0.006526570285541143 0.004384136499235087 0.0011480135148245983 0.0018044216713121253 0.001154428875412326; 0.006459876807928641 0.004384136499235087 0.0054284300755523115 0.0006596834879959167 0.0016581295100441041 0.0007133949662164625; 0.0012524618528797894 0.0011480135148245983 0.0006596834879959167 0.0026543564006455294 0.00048713871877351897 0.0011206346404939; 0.002563861720279623 0.0018044216713121253 0.0016581295100441041 0.00048713871877351897 0.0023567945429189227 0.00043958950944804554; 0.0007671488407868487 0.001154428875412326 0.0007133949662164625 0.0011206346404939 0.00043958950944804554 0.0020143379751173373]

throws the following error:

ERROR: LoadError: The optimizer supports second-order cone constraints and not quadratic constraints but you entered a quadratic constraint of type: `MathOptInterface.ScalarQuadraticFunction{Float64}`-in-`MathOptInterface.GreaterThan{Float64}`. A bridge attempted to transform the quadratic constraint to a second order cone constraint but the constraint is not strongly convex, i.e., the symmetric matrix of quadratic coefficients is not positive definite. Convex constraints that are not strongly convex, i.e. the matrix is positive semidefinite but not positive definite, are not supported yet.

However, the covariance matrix pcov is positive definite (all eigen values > 0) and so the constraint is strongly convex.

@ASaragga ASaragga closed this as completed Mar 3, 2021
@odow
Copy link
Member

odow commented Mar 3, 2021

I moved jump-dev/MathOptInterface.jl#1259 because it related to MathOptInterface.jl, not JuMP.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants