1919template <typename MT, int ellipsoid_type, typename Custom_MT, typename VT, typename NT>
2020inline static std::tuple<MT, VT, NT>
2121compute_inscribed_ellipsoid (Custom_MT A, VT b, VT const & x0,
22- unsigned int const & maxiter,
23- NT const & tol, NT const & reg)
22+ EllipsoidParams<NT> const & params = EllipsoidParams<NT>{})
2423{
2524 if constexpr (ellipsoid_type == EllipsoidType::MAX_ELLIPSOID)
2625 {
27- return max_inscribed_ellipsoid<MT>(A, b, x0, maxiter, tol, reg );
26+ return max_inscribed_ellipsoid<MT>(A, b, x0, params. john_params );
2827 } else if constexpr (ellipsoid_type == EllipsoidType::LOG_BARRIER ||
2928 ellipsoid_type == EllipsoidType::VOLUMETRIC_BARRIER ||
3029 ellipsoid_type == EllipsoidType::VAIDYA_BARRIER)
3130 {
32- return barrier_center_ellipsoid_linear_ineq<MT, ellipsoid_type, NT>(A, b, x0);
31+ return barrier_center_ellipsoid_linear_ineq<MT, ellipsoid_type, NT>(A, b, x0, params. barrier_params );
3332 } else
3433 {
3534 std::runtime_error (" Unknown rounding method." );
@@ -46,12 +45,13 @@ template
4645 int ellipsoid_type = EllipsoidType::MAX_ELLIPSOID
4746>
4847std::tuple<MT, VT, NT> inscribed_ellipsoid_rounding (Polytope &P,
49- unsigned int const max_iterations = 5 ,
50- NT const max_eig_ratio = NT(6 ))
48+ int max_iterations = 5 ,
49+ NT const max_eig_ratio = NT(6 ),
50+ EllipsoidParams<NT> const & params = EllipsoidParams<NT>{})
5151{
5252 typedef typename Polytope::PointType Point;
5353 VT x = compute_feasible_point (P.get_mat (), P.get_vec ());
54- return inscribed_ellipsoid_rounding<MT, VT, NT>(P, Point (x), max_iterations, max_eig_ratio );
54+ return inscribed_ellipsoid_rounding<MT, VT, NT>(P, Point (x), max_eig_ratio, max_iterations, params );
5555}
5656
5757template
@@ -65,20 +65,21 @@ template
6565>
6666std::tuple<MT, VT, NT> inscribed_ellipsoid_rounding (Polytope &P,
6767 Point const & InnerPoint,
68- unsigned int const max_iterations = 5 ,
69- NT const max_eig_ratio = NT(6 ))
68+ int max_iterations = 5 ,
69+ NT const max_eig_ratio = NT(6 ),
70+ EllipsoidParams<NT> params = EllipsoidParams<NT>{})
7071{
7172 unsigned int maxiter = 500 , iter = 1 , d = P.dimension ();
7273 VT x0 = InnerPoint.getCoefficients (), center, shift = VT::Zero (d);
7374 MT E, L, T = MT::Identity (d, d);
7475 bool converged;
75- NT R = 100.0 , r = 1.0 , tol = std::pow ( 10 , - 6.0 ), reg = std::pow ( 10 , - 4.0 ), round_val = 1.0 ;
76+ NT R = 100.0 , r = 1.0 , round_val = 1.0 ;
7677
7778 while (true )
7879 {
7980 // Compute the desired inscribed ellipsoid in P
8081 std::tie (E, center, converged) =
81- compute_inscribed_ellipsoid<MT, ellipsoid_type>(P.get_mat (), P.get_vec (), x0, maxiter, tol, reg );
82+ compute_inscribed_ellipsoid<MT, ellipsoid_type>(P.get_mat (), P.get_vec (), x0, params );
8283
8384 E = (E + E.transpose ()) / 2.0 ;
8485 E += MT::Identity (d, d)*std::pow (10 , -8.0 ); // normalize E
@@ -112,7 +113,7 @@ std::tuple<MT, VT, NT> inscribed_ellipsoid_rounding(Polytope &P,
112113 round_val *= L.transpose ().determinant ();
113114 P.linear_transformIt (L);
114115
115- reg = std::max (reg / 10.0 , std::pow (10 , -10.0 ));
116+ params. john_params . reg = std::max (params. john_params . reg / 10.0 , std::pow (10 , -10.0 ));
116117 P.normalize ();
117118 x0 = VT::Zero (d);
118119
0 commit comments