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

RFC: Conic interface #31

Merged
merged 10 commits into from
Jun 8, 2014
Merged

RFC: Conic interface #31

merged 10 commits into from
Jun 8, 2014

Conversation

mlubin
Copy link
Member

@mlubin mlubin commented May 21, 2014

Addressing #29, here's a proposal for a general conic interface.

You can see the compiled documentation here: http://mathprogbasejl.readthedocs.org/en/conic/conic.html.

The major points are that the cones can be specified in any order and that we differ from SCS in the choice of the canonical primal problem. This format seems more natural for modeling, and is used, for example, by MOSEK.

I'm not very familiar with the exponential cones, so I'm not sure if it's appropriate to include both the primal and dual versions.

Feel free to suggest radical changes, but I wanted to put this down as a concrete proposal to get the discussion moving along.

CC: @IainNZ @joehuchette @juan-pablo-vielma @madeleineudell @karanveerm @ulfworsoe @tkelman @daviddelaat @jfsantos

in column-major form (lower triangle) or equivalently row-major form
(upper triangle).

.. function:: getconicsolution(m::AbstractMathProgModel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't really need a separate getconicsolution

@mlubin
Copy link
Member Author

mlubin commented May 21, 2014

Just to clarify, this is the low-level interface. On top of this we can easily implement a single-shot conicprog function analogously to linprog, mixintprog, and quadprog.

- ``:SOC``, the second-order (Lorenz) cone :math:`\{(p,x) \in \mathbb{R} \times \mathbb{R}^{n-1} : ||x||_2^2 \leq p^2, p \geq 0\}`
- ``:SOCRotated``, the rotated second-order cone :math:`\{(p,q,x) \in \mathbb{R} \times \mathbb{R} \times \mathbb{R}^{n-2} : ||x||_2^2 \leq 2pq, p \geq 0, q \geq 0\}`
- ``:SDP``, the cone of symmetric positive semidefinite matrices :math:`\{ X \in \mathbb{R}^{n\times n} : X \succeq 0\}`
- ``:ExpPrimal``, the exponential cone :math:`\{ (x,y,z) \in \mathbb{R}^3 : y > 0, y e^{x/z} \leq z \}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically I think this should be the closure of what you wrote: http://www.seas.ucla.edu/~vandenbe/236C/lectures/conic.pdf

@karanveerm
Copy link
Member

@mlubin mlubin mentioned this pull request May 24, 2014
@tkelman
Copy link
Contributor

tkelman commented May 24, 2014

Would projection operators or standard self-concordant barrier functions be implemented here, or need to be written elsewhere?

@mlubin
Copy link
Member Author

mlubin commented May 24, 2014

@tkelman, they could be provided in MathProgBase, but that's mostly orthogonal to this interface.

@joehuchette
Copy link
Member

It may be worth separating inequality and equality constraints, since some solvers can exploit the distinction. It will make dual values a bit messier, though.

@mlubin
Copy link
Member Author

mlubin commented May 24, 2014

Inequality constraints are a special case of specifying that a given affine expression is constrained to fall in a cone, which the current interface does not support. @madeleineudell argued that this transformation should be handled at the modeling level.

@mlubin
Copy link
Member Author

mlubin commented May 31, 2014

Ping @madeleineudell @karanveerm @davidlizeng. Let me know if you guys are on board.

@madeleineudell
Copy link

It looks good to me, with a few small quibbles:

  1. We should make it clear that entries in cones can be repeated, eg
    [(:free,2),(:socp,3),(:free,4)]

  2. I imagine we will save headaches in the long run if we make the list
    unordered and specify absolute indices, eg
    [(:free,1:2),(:socp,3:6),(:free,7:10)]. in this case, we could also have
    variables default to be free if they are not specified to be in any cone.

  3. I'm not sure what you mean about the representation of the sdp cone. Do
    you mean that the vector x only contains n(n+1)/2 variables from an SDP
    matrix, rather than the full matrix? That form is certainly more concise,
    but seems awkward to work with for, eg, matrix multiplication. I think I'd
    prefer to see (:sdp, n^2), where it is understood that the matrices are
    symmetric and hence square. (Or, in absolute indices, i:n^2+i-1).

  4. It would probably be nice if MathProjBase provided utility functions for
    converting between equivalent cones, eg SOCRotated and SOC. It doesn't
    really seem like a solver issue to me.

On Sat, May 31, 2014 at 11:25 AM, Miles Lubin [email protected]
wrote:

Ping @madeleineudell https://github.com/madeleineudell @karanveerm
https://github.com/karanveerm @davidlizeng
https://github.com/davidlizeng. Let me know if you guys are on board.


Reply to this email directly or view it on GitHub
#31 (comment)
.

Madeleine Udell
PhD Candidate in Computational and Mathematical Engineering
Stanford University
www.stanford.edu/~udell

@mlubin
Copy link
Member Author

mlubin commented Jun 2, 2014

  1. We should make it clear that entries in cones can be repeated, eg
    [(:free,2),(:socp,3),(:free,4)]

Will do.

  1. I imagine we will save headaches in the long run if we make the list
    unordered and specify absolute indices, eg
    [(:free,1:2),(:socp,3:6),(:free,7:10)]. in this case, we could also have
    variables default to be free if they are not specified to be in any cone.

This works as well. Should we allow any iterable set to specify the indices or only allow ranges? Since solvers will already need to deal with permutations of the indices, I don't see the harm in allowing any iterable set. Regarding :free by default, this conflicts with the convention in linear programming land for variables to be nonnegative by default. I think it's better to be explicit about all cones in order to minimize the potential for confusion.

  1. I'm not sure what you mean about the representation of the sdp cone. Do
    you mean that the vector x only contains n(n+1)/2 variables from an SDP
    matrix, rather than the full matrix? That form is certainly more concise,
    but seems awkward to work with for, eg, matrix multiplication. I think I'd
    prefer to see (:sdp, n^2), where it is understood that the matrices are
    symmetric and hence square. (Or, in absolute indices, i:n^2+i-1).

Yes, I mean that the matrix is stored using n(n+1)/2 variables. Either format is okay with me. @joehuchette, would either format be more convenient for interfacing with the SDP solvers that you've seen?

  1. It would probably be nice if MathProjBase provided utility functions for
    converting between equivalent cones, eg SOCRotated and SOC. It doesn't
    really seem like a solver issue to me.

A number of solvers (Gurobi, CPLEX, Mosek) support SOCRotated natively, which is why it's important to let users specify cones in that format. For the solvers that don't, we can definitely have a solver-independent layer in MathProgBase that does the necessary transformations. To start out, I'd say don't worry yet about supporting SOCRotated.

@joehuchette
Copy link
Member

The fundamental user-facing objects in Mosek are SDP matrices rather than groups of n(n+1)/2 scalar variables that live in a SD cone, so the n^2 form is more natural here. It also appears that the SDPA format that is used by many of the pure SDP solvers also works this way.

I think the real question is what is most natural for conic modeling, however. (I hope to keep a separate SDP interface for pure SDP problems, much like we have for quadratic/SOC/SOCRotated constraints). @madeleineudell @karanveerm @davidlizeng what form is most natural for CVX? Perhaps we should go with that.

@madeleineudell
Copy link

I'd say the n^2 representation is most natural for CVX.

On Mon, Jun 2, 2014 at 8:04 AM, Joey Huchette [email protected]
wrote:

The fundamental user-facing objects in Mosek are SDP matrices rather than
groups of n(n+1)/2 scalar variables that live in a SD cone, so the n^2 form
is more natural here. It also appears that the SDPA format that is used by
many of the pure SDP solvers also works this way.

I think the real question is what is most natural for conic modeling,
however. (I hope to keep a separate SDP interface for pure SDP problems,
much like we have for quadratic/SOC/SOCRotated constraints).
@madeleineudell https://github.com/madeleineudell @karanveerm
https://github.com/karanveerm @davidlizeng
https://github.com/davidlizeng what form is most natural for CVX?
Perhaps we should go with that.


Reply to this email directly or view it on GitHub
#31 (comment)
.

Madeleine Udell
PhD Candidate in Computational and Mathematical Engineering
Stanford University
www.stanford.edu/~udell

@mlubin
Copy link
Member Author

mlubin commented Jun 3, 2014

I've pushed changes to reflect this discussion. Ready to merge, unless there are any objections.

@madeleineudell
Copy link

looks great to me.

On Tue, Jun 3, 2014 at 4:22 PM, Miles Lubin [email protected]
wrote:

I've pushed changes to reflect this discussion. Ready to merge, unless
there are any objections.


Reply to this email directly or view it on GitHub
#31 (comment)
.

Madeleine Udell
PhD Candidate in Computational and Mathematical Engineering
Stanford University
www.stanford.edu/~udell

mlubin added a commit that referenced this pull request Jun 8, 2014
@mlubin mlubin merged commit 8e635a5 into master Jun 8, 2014
@mlubin mlubin deleted the conic branch June 8, 2014 05:10
@mlubin mlubin mentioned this pull request Jun 19, 2014
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 this pull request may close these issues.

6 participants