Skip to content

Commit bf05fe6

Browse files
author
akisschinas
committed
Enhance rounding methods
1 parent cdcb43c commit bf05fe6

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

dingo/bindings/bindings.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,14 +462,20 @@ void HPolytopeCPP::apply_rounding(int rounding_method, double* new_A, double* ne
462462
// run the rounding method
463463
if (rounding_method == 1) { // max ellipsoid
464464
round_res = inscribed_ellipsoid_rounding<MT, VT, NT>(P, CheBall.first);
465-
466465
} else if (rounding_method == 2) { // isotropization
467466
round_res = svd_rounding<AcceleratedBilliardWalk, MT, VT>(P, CheBall, 1, rng);
468467
} else if (rounding_method == 3) { // min ellipsoid
469-
round_res = min_sampling_covering_ellipsoid_rounding<AcceleratedBilliardWalk, MT, VT>(P,
470-
CheBall,
471-
walk_len,
472-
rng);
468+
round_res = min_sampling_covering_ellipsoid_rounding
469+
<AcceleratedBilliardWalk, MT, VT>(P, CheBall, walk_len, rng);
470+
} else if (rounding_method == 4) { // log barrier
471+
round_res = inscribed_ellipsoid_rounding
472+
<MT, VT, NT, decltype(P), decltype(CheBall.first), 2>(P, CheBall.first);
473+
} else if (rounding_method == 5) { // Vaidya barrier
474+
round_res = inscribed_ellipsoid_rounding
475+
<MT, VT, NT, decltype(P), decltype(CheBall.first), 3>(P, CheBall.first);
476+
} else if (rounding_method == 6) { // volumetric barrier
477+
round_res = inscribed_ellipsoid_rounding
478+
<MT, VT, NT, decltype(P), decltype(CheBall.first), 4>(P, CheBall.first);
473479
} else {
474480
throw std::runtime_error("Unknown rounding method.");
475481
}

dingo/volestipy.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ cdef class HPolytope:
162162
int_method = 2
163163
elif rounding_method == 'min_ellipsoid':
164164
int_method = 3
165+
elif rounding_method == 'log_barrier':
166+
int_method = 4
167+
elif rounding_method == 'vaidya_barrier':
168+
int_method = 5
169+
elif rounding_method == 'volumetric_barrier':
170+
int_method = 6
165171
else:
166172
raise RuntimeError("Uknown rounding method")
167173

tests/rounding.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,18 @@ def test_rounding_min_ellipsoid(self):
6464
def test_rounding_john_position(self):
6565
test_rounding(self, "john_position")
6666

67+
def test_rounding_log_barrier(self):
68+
test_rounding(self, "log_barrier")
69+
70+
def test_rounding_vaidya_barrier(self):
71+
test_rounding(self, "vaidya_barrier")
72+
73+
def test_rounding_volumetric_barrier(self):
74+
test_rounding(self, "volumetric_barrier")
75+
6776
if __name__ == "__main__":
6877
if len(sys.argv) > 1:
6978
set_default_solver(sys.argv[1])
7079
sys.argv.pop(1)
71-
unittest.main()
80+
unittest.main()
81+

0 commit comments

Comments
 (0)