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

Improve max volume ellipsoid computation #309

Conversation

TolisChal
Copy link
Member

No description provided.

@TolisChal TolisChal requested a review from vfisikop June 19, 2024 16:42
Copy link
Contributor

@vfisikop vfisikop left a 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.

}

Copy link
Contributor

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

Copy link
Member Author

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) ||
Copy link
Contributor

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?

Copy link
Member Author

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;
Copy link
Contributor

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.

Copy link
Member Author

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}
Copy link
Contributor

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)?

Copy link
Member Author

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)));
Copy link
Contributor

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?

Copy link
Member Author

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.

@TolisChal TolisChal merged commit ddcf97b into GeomScale:develop Jun 20, 2024
25 of 27 checks passed
@TolisChal TolisChal deleted the improve_max_volume_ellipsoid_computations branch June 21, 2024 19:13
TolisChal added a commit that referenced this pull request Jul 7, 2024
* 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]>
TolisChal added a commit that referenced this pull request Jul 7, 2024
* 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
TolisChal added a commit to TolisChal/volume_approximation that referenced this pull request Jul 7, 2024
* 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
TolisChal added a commit to TolisChal/volume_approximation that referenced this pull request Jul 7, 2024
* 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
TolisChal added a commit to TolisChal/volume_approximation that referenced this pull request Jul 8, 2024
* 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
TolisChal added a commit to TolisChal/volume_approximation that referenced this pull request Jul 8, 2024
* 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
TolisChal added a commit to TolisChal/volume_approximation that referenced this pull request Jul 8, 2024
* 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
TolisChal added a commit that referenced this pull request Jul 17, 2024
* 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
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.

2 participants