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

Quadratic Objectives not being solved #2

Closed
rodrigogarciana opened this issue Feb 18, 2019 · 14 comments
Closed

Quadratic Objectives not being solved #2

rodrigogarciana opened this issue Feb 18, 2019 · 14 comments

Comments

@rodrigogarciana
Copy link

When using JuMP v0.19 and MathOptInterfaceMosek.jl, I cannot solve models that I was previously solving with JuMP v0.18 and Mosek.jl
These models have a quadratic objective... I even tried with very simple models (objective such as x[i].^2) but it says that the solver (Mosek) cannot handle Scalar Quadratic objects or something similar.
Do you know what to do? or how should I be writing these functions? Thank you

@blegat
Copy link
Member

blegat commented Feb 18, 2019

This will be resolved by jump-dev/MathOptInterface.jl#529.
In the meantime, you can write it as a constraint, e.g.

@variable(model, t)
@constraint(model, x^2 <= t)
@objective(model, Min t)

instead of

@objective(model, Min, x^2)

@blegat blegat transferred this issue from JuliaOpt/MathOptInterfaceMosek.jl Feb 23, 2019
@arnavs
Copy link

arnavs commented Mar 11, 2019

I'm having this same issue- has it been resolved? Is the above workaround what we should be doing?

@arnavs
Copy link

arnavs commented Mar 11, 2019

Also, I tried the workaround above-

The optimizer supports second-order cone constraints and not quadratic constraints but you entered a quadratic constraint of type: MathOptInterface.ScalarQuadraticFunction{Float64}-in-MathOptInterface.LessThan{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.

@blegat
Copy link
Member

blegat commented Mar 11, 2019

No, objective bridges have not been added, yet, the workaround is still the way to go

@arnavs
Copy link

arnavs commented Mar 11, 2019

Any thoughts on the above error message that I get when I try it?

@blegat
Copy link
Member

blegat commented Mar 11, 2019

It means that the objective is not convex so it cannot be transformed into a SOC. Which objective did you enter ?

@arnavs
Copy link

arnavs commented Mar 11, 2019

A standard quadratic z' L z + z' q for some matrix L, vector of variables z, and vector of constants q.

@blegat
Copy link
Member

blegat commented Mar 11, 2019

What is eigvals(L + L') ?

@arnavs
Copy link

arnavs commented Mar 11, 2019

Looks like the first one is negative.

  -0.649373433583957  
   0.10460780869676427
   0.1184287900271472 
   0.14145591328958082
   0.17367838622258608
   0.2150827792602814 
   0.2656541849115951 
   0.32537719536705545
   0.3942365802283815 
   0.472217646160893  
   0.5593063290616023 
   0.6554890992764286 
   0.7607527602485178 
   ⋮                  
 166.4033515912563    
 166.50837219324285   
 166.60429916717237   
 166.6911219935768    
 166.76883115135976   
 166.8374181188413    
 166.89687537469132   
 166.9471963987555    
 166.98837567276928   
 167.02040868096367   
 167.04329191056016   
 167.05702285215617   

@arnavs
Copy link

arnavs commented Mar 11, 2019

If this specific error message about the cone constraints is just a quirk of the parameters we chose (i.e., the specific L matrix), we can choose different ones.

@blegat
Copy link
Member

blegat commented Mar 11, 2019

The only condition for this to work is all the eigenvalues of L should be strictly positive.

@blegat
Copy link
Member

blegat commented Mar 11, 2019

Because we need to take the cholesky decomposition of L to rewrite it as as a SOC, see e.g. https://en.wikipedia.org/wiki/Second-order_cone_programming#Example:_Quadratic_constraint

@arnavs
Copy link

arnavs commented Mar 11, 2019

Roger that, thanks for clarifying.

@blegat
Copy link
Member

blegat commented Feb 4, 2020

Objective bridges have been added in MOI v0.9.2

@blegat blegat closed this as completed Feb 4, 2020
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

3 participants