-
Notifications
You must be signed in to change notification settings - Fork 121
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
Improve max volume ellipsoid computation #309
Improve max volume ellipsoid computation #309
Conversation
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.
Thanks, great improvement!
I left a few comments.
} | ||
|
||
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.
please remove this trailing whitespace
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.
Done
@@ -67,6 +78,12 @@ std::tuple<MT, VT, NT> max_inscribed_ellipsoid_rounding(Polytope &P, | |||
P.normalize(); | |||
x0 = VT::Zero(d); | |||
|
|||
// check the roundness of the polytope | |||
if(((std::abs(R / r) <= 6.0 && iter_res.second) || iter >= 5) || |
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.
instead of having a new bool variable aggressive_mode
, we can have max_iterations
as a parameter with default value 5
and if the user gives 1
then it is equivalent to aggressive_mode=true
.
The above check becomes ((std::abs(R / r) <= 6.0 && iter_res.second) || iter >= max_iterations)
.
One variable less and more flexibility (max_iterations
can take various values).
Should we also have another parameter max_ratio
or max_sandwitch_ratio
with default value 6
?
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.
Thanks, I implemented both suggestions
@@ -22,7 +22,8 @@ template | |||
typename Point | |||
> | |||
std::tuple<MT, VT, NT> max_inscribed_ellipsoid_rounding(Polytope &P, | |||
Point const& InnerPoint) | |||
Point const& InnerPoint, | |||
const bool aggressive_mode = false) | |||
{ | |||
std::pair<std::pair<MT, VT>, bool> iter_res; |
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.
We can add a todo here to change this to std::tuple.
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.
Thanks, I added a comment in max_inscribed_ellipsoid.hpp
@@ -44,18 +45,28 @@ std::tuple<MT, VT, NT> max_inscribed_ellipsoid_rounding(Polytope &P, | |||
E = (E + E.transpose()) / 2.0; | |||
E = E + MT::Identity(d, d)*std::pow(10, -8.0); //normalize E | |||
|
|||
Eigen::LLT<MT> lltOfA(E); // compute the Cholesky decomposition of E | |||
Eigen::LLT<MT> lltOfA(E.inverse()); // compute the Cholesky decomposition of E^{-1} |
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.
Is E
psd? If so why not invert it more efficiently e.g. E.llt().solve(I)
?
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.
Thanks, done
// computing eigenvalues of E | ||
Spectra::DenseSymMatProd<NT> op(E); | ||
Spectra::SymEigsSolver<NT, Spectra::SELECT_EIGENVALUE::BOTH_ENDS, | ||
Spectra::DenseSymMatProd<NT>> eigs(&op, 2, std::min(std::max(10, int(d)/5), int(d))); |
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.
could we add a comment on the numeric values here and how we select them?
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.
The values is chosen empirically. I added a comment.
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments --------- Authored-by: Apostolos Chalkis (TolisChal) <[email protected]>
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
* improve the implementation of maximum ellipsoid computation * minor fix in rounding unit-test * fix file copyrights * apply termination criterion after transformation in max ellipsoid rounding * resolve PR comments
No description provided.