Skip to content

add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) #976

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

Merged
merged 17 commits into from
Jan 6, 2020

Conversation

chriscoey
Copy link
Contributor

These cones are dual to each other. I've added the definitions in sets.jl and when we are agreed on those, I'll finish off the rest including bridges for SDP extended formulations. An important decision to make is how to handle the (general/nonsymmetric) matrix part in the definition, like whether to vectorize it row-major or column-major.

@codecov-io
Copy link

codecov-io commented Dec 24, 2019

Codecov Report

Merging #976 into master will decrease coverage by 0.02%.
The diff coverage is 96.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #976      +/-   ##
==========================================
- Coverage   95.23%   95.21%   -0.03%     
==========================================
  Files          98       98              
  Lines       11002    11048      +46     
==========================================
+ Hits        10478    10519      +41     
- Misses        524      529       +5
Impacted Files Coverage Δ
src/MathOptInterface.jl 100% <ø> (ø) ⬆️
src/indextypes.jl 85.71% <ø> (ø) ⬆️
src/FileFormats/SDPA/SDPA.jl 100% <100%> (ø) ⬆️
src/Bridges/Constraint/set_map.jl 100% <100%> (ø) ⬆️
src/FileFormats/MOF/nonlinear.jl 100% <100%> (ø) ⬆️
src/FileFormats/FileFormats.jl 100% <100%> (ø) ⬆️
src/FileFormats/MOF/MOF.jl 100% <100%> (ø) ⬆️
src/FileFormats/MOF/write.jl 66.3% <66.3%> (-1.48%) ⬇️
src/Utilities/mutable_arithmetics.jl 89.89% <87.5%> (ø) ⬆️
src/FileFormats/MOF/read.jl 93.1% <93.1%> (+0.12%) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e81356a...395583b. Read the comment docs.

@chriscoey
Copy link
Contributor Author

ref: #705 for discussion of how to define complex generalizations of cones such as the spectral/nuclear cones. If that issue is resolved soon then I'll generalize for complex in this PR. The complex cones just have complex matrix entries but the epigraph variable stays real.

@chriscoey
Copy link
Contributor Author

chriscoey commented Dec 25, 2019

Another question is whether these should fall under the "matrix sets", which are currently all symmetric matrix sets, or whether there should be abstract nonsymmetric general matrix sets distinguished from abstract symmetric matrix sets

@chriscoey
Copy link
Contributor Author

chriscoey commented Dec 25, 2019

What should I name the bridge file? something like norm_spec_nuc_to_psd? I'll need to rename the norm_to_lp file to something like norm_one_inf_to_lp, because "norm" isn't specific enough anymore. That's breaking I suppose?
Edit: the old bridge names themselves are specific enough, so it looks like just the file name may need to change, which doesn't change the interface so I guess not breaking

@chriscoey
Copy link
Contributor Author

Bridges seem challenging. I can't infer the row_dim and column_dim of the matrix from the length of a vector alone, so I don't know how to implement some of the functions that other bridges implement.

Could we merge this without any bridges (after I remove the bridge file)? Or just not implement many of the bridge functions?

@blegat
Copy link
Member

blegat commented Dec 26, 2019

No, changing file name is not breaking.

Bridges seem challenging. I can't infer the row_dim and column_dim of the matrix from the length of a vector alone, so I don't know how to implement some of the functions that other bridges implement.

Could you elaborate on this ?

Could we merge this without any bridges (after I remove the bridge file)? Or just not implement many of the bridge functions?

Yes, but we should make sure now if the set definition will need to change for the bridging to work.

@chriscoey
Copy link
Contributor Author

chriscoey commented Dec 31, 2019

Bridges seem challenging. I can't infer the row_dim and column_dim of the matrix from the length of a vector alone, so I don't know how to implement some of the functions that other bridges implement.

Could you elaborate on this ?

I'll try. So take the map_function function for example. Its arguments are a bridge type and a function, but not the actual bridge or the actual set. The set definition contains the row_dim and column_dim integers that are needed to actually determine what the set looks like. It is not possible to determine row_dim and column_dim simply from the dimension of a vector (vector dimension is 1 + row_dim * column_dim), and we do not know the number of rows and columns of the set inside the map_function function, which means we can't construct the extended formulation.

I suppose an option is to parametrize the bridge type by the row_dim and column_dim integers. But might it be cleaner to just change the design of the bridge interface to give access to the fields inside the set (row_dim and column_dim) when in a function such as map_function?

Several of the other sets I want to add are in the same boat: a vector dimension alone is not enough information to construct the extended formulation.

@blegat
Copy link
Member

blegat commented Dec 31, 2019

Your bridge does not have to be a SetMapBridges, this interface is not the AbstractBridge interface.
SetMapBridge is a subtype of bridge for which the bridge is a linear map between two sets and the map only depends on the type of the sets. For instance, VectorizeBridge does not use this interface.

@chriscoey
Copy link
Contributor Author

Thanks @blegat. Which existing bridge would be most similar to this one, so that I can base it on a prototype?

@blegat
Copy link
Member

blegat commented Dec 31, 2019

NormOneBridge would be a good start :)

@chriscoey chriscoey changed the title WIP/RFC: add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) Jan 2, 2020
@chriscoey
Copy link
Contributor Author

@blegat this is ready for review I think

@chriscoey chriscoey requested a review from blegat January 2, 2020 16:14
@chriscoey
Copy link
Contributor Author

I'm seeing some fragility when running the new contconic spec/nuc tests with solvers, so I think I'll change those instances

@chriscoey
Copy link
Contributor Author

chriscoey commented Jan 4, 2020

Hypatia is passing the new conic tests both with and without the new bridges.
So this is good to merge, from my perspective.

@chriscoey chriscoey requested a review from blegat January 4, 2020 11:54
@blegat
Copy link
Member

blegat commented Jan 5, 2020

Can you add ConstraintPrimalStart and ConstraintDualStart? See #684

@chriscoey
Copy link
Contributor Author

If that was implemented already for NormOne then I could use that as a template. But it's not and the other bridges are set map bridges, which I don't understand. I would prefer to get this PR merged before discussing that further.

@blegat
Copy link
Member

blegat commented Jan 5, 2020

VectorizeBridge and ScalarizeBridge are not SetMapBridge and implement starting values, see #936 and #937

@blegat
Copy link
Member

blegat commented Jan 5, 2020

See also #994

@chriscoey chriscoey changed the title add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) WIP: add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) Jan 5, 2020
@chriscoey
Copy link
Contributor Author

@blegat I added constraint primal start for spectral cone and constraint dual start for nuclear cone. Not sure how to do con dual start for spectral or con primal start for nuclear.

@chriscoey chriscoey changed the title WIP: add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) add nuclear norm and spectral norm cone sets (for general/nonsymmetric matrices) Jan 6, 2020
X = 2 * dual[[trimap(i, j) for j in 1:column_dim for i in (column_dim + 1):side_dim]]
return vcat(t, X)
end

Copy link
Member

Choose a reason for hiding this comment

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

For ConstraintDualStart, I would set all trimap(i, i) to the dual of t divided by 2side_dim. It might not be the only possibility but it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK should I make another PR for that?

Copy link
Member

@blegat blegat Jan 6, 2020

Choose a reason for hiding this comment

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

I'm wrong, that won't make the matrix PSD.
In fact, it's easier to discuss the ConstraintPrimalStart of NormNuclearBridge.
So suppose you have X and t set.
[A X'; X B] >= 0 is equivalent to A >= X' inv(B) X. If X = U S V', then, it's equivalent to
V' * A * V <= S * U' * inv(B) * U * S
then, by choosing A = V * S * V' and B = U * S * U', you get
S <= S * inv(S) * S which is satisfied.
As the trace must sum up to t, you set A = V * S * V' * (t / tr(S)) and B = U * S * U' * (t / tr(S).
The matrix [A X'; X B] >= will be PSD iff t >= sum sigma_i(X) so it seems like a good candidate for starting value :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if that works for constraint primal start of NormNuclear then should it also work for constraint dual start of NormSpectral?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it was just easier to reason in the primal than in the dual ^^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK rather than having you explain the details to me, it's probably easier if you implement those new start functions

@blegat blegat merged commit c6db50d into jump-dev:master Jan 6, 2020
@blegat blegat added this to the v0.9.10 milestone Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants