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

Add support for quadratic constraints #50

Closed
amontoison opened this issue Apr 13, 2020 · 12 comments · Fixed by #181
Closed

Add support for quadratic constraints #50

amontoison opened this issue Apr 13, 2020 · 12 comments · Fixed by #181

Comments

@amontoison
Copy link
Member

It could be useful to treat separately quadratic and other nonlinear constraints.
An open question is how to store all hessian of the quadratic constraints?

  • List of 2D COO
  • 3D COO for third order tensor (rows, cols, tubes, vals)
  • ...
@dpo
Copy link
Member

dpo commented Apr 13, 2020

Maybe this should go to NLPModels?

@amontoison
Copy link
Member Author

Yes, maybe we should also move some functions like https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/blob/master/src/utils.jl#L56-L73 in NLPModels.jl.

@amontoison
Copy link
Member Author

@abelsiqueira

@abelsiqueira
Copy link
Member

Should we create a simple TripletMatrix?

@dpo
Copy link
Member

dpo commented May 1, 2020

Maybe a separate package with a COOSparseMatrix type that conforms to the Julia AbstractMatrix API.

@abelsiqueira
Copy link
Member

Agreed

@amontoison
Copy link
Member Author

If we want to add support for quadratic constraints (amontoison@378439f), we need to:

  • store all hessian of the quadratic constraints;
  • compute nnzj of the quadratic constraints;
  • separate quadratic and nonlinear constraints in NLPModels (nlin, nquad, nln).

It could be a project for a student.

@tmigot
Copy link
Member

tmigot commented Sep 29, 2021

Simply to revitalize the debate. @amontoison
Could we consider having a COO-triplet for the matrices of the quadratic constraints, and a vector that contains the number of non-zeros elements in each matrix? For instance,

# With 2 quadratic constraints with matrices Q1 = [1, 2; 3, 4] and Q2 = [5, 6; 7, 8], we would get :
I = [1, 1, 2, 2, 1, 1, 2, 2]
J = [1, 2, 1, 2, 1, 2, 1, 2]
V = [1, 2, 3, 4, 5, 6, 7, 8]
Qnnz = [4, 8]

@dpo
Copy link
Member

dpo commented Sep 29, 2021

Why would they be stored together? Also they're symmetric, so we'd only store one triangle.

@tmigot
Copy link
Member

tmigot commented Sep 29, 2021

Indeed, this is a good point that they are symmetric.
We could definitely have a list of I, J and V. This way we would avoid the Qnnz vector.

@amontoison
Copy link
Member Author

I have a structure that handle a quadratic objective : https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/blob/main/src/utils.jl#L47-L53

I can reuse it like this :

mutable struct QuadraticConstraint
  hessian::COO
  b::SparseVector{Float64}
  nnzh::Int
  nnzb::Int
end

and add a Vector{QuadraticConstraint} inside the model.

@dpo
Copy link
Member

dpo commented Sep 29, 2021

That sounds good.

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

Successfully merging a pull request may close this issue.

4 participants