-
Notifications
You must be signed in to change notification settings - Fork 122
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 more general linear operator constraint to sdp #350
Add more general linear operator constraint to sdp #350
Conversation
Thanks for opening your first pull request in this repository! Someone will review it when they have a chance. In the mean time, please be sure that you've handled the following things, to make the review process quicker and easier:
Thank you again for your contributions! 👍 |
Solely to avoid build errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SuvarshaChennareddy, thanks for taking the time to look into this. I have some basic comments before you proceed further. I think that tests are definitely necessary both to ensure that the implementation is correct, and also that it might behave like a user expects.
If I were you, I would start by assembling a couple reasonable examples of how a user might want to express a constraint in this way, and then designing to make those cases easy. 👍
@@ -109,6 +141,8 @@ inline void Smat(const MatAType& input, MatBType& output) | |||
} | |||
} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add this whitespace :)
*/ | ||
template<typename ElemType, typename MatBType> | ||
inline void convertToMatrix(std::function<ElemType(arma::Mat<ElemType>)> input, | ||
MatBType& output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the approach you are taking is to turn a std::function
that the user gives into a matrix, and then use that as a constraint. But this is the opposite of what we are looking for in #72: take the given example of the constraint that the sum of elements is a constant. You can express this very tediously as the constraint trace(1 1^T X) = b
, but the much easier way to represent this is sum(X) = b
. So, instead of extracting the matrix 1 1^T
, it would be better to just store the std::function
s in the SDP objects and evaluate them directly to get the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thank you for taking the time to look into this. I'm glad you asked this. I honestly didn't know if this would be alright.
However, (from what I understand) in the interior point method, the constraints need to be expressed as matrices (as matrix multiplication and transposing is involved).
Although, in the LRSDP implementation, I have used these std::function
s wherever the matrix conversion isn't necessary (again like in the case of matrix multiplication or transposing).
I had given it some thought but using these std::function
s directly would be extremely tedious as a lot of factors must be accounted for. For example, how would I calculate M=A(E^-1)F(A^T) where A is the matrix of vector forms of the constraints.
Nevertheless, I will think about this a bit more and try to come with a more appropriate solution.
Will do! Thank you! |
Co-authored-by: Ryan Curtin <[email protected]>
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍 |
Hello everyone,
This is related to issue #72. I've allowed the ability to store constraints as
std::function
objects.I have not modified/added tests yet. However, if this PR looks alright, I'll be willing to do so.
Any comments would be greatly appreciated.