Skip to content
Snippets Groups Projects
Commit 8a44d2b3 authored by Jorn Hoofwijk's avatar Jorn Hoofwijk
Browse files

raise assertionerror if we cannot find an existing simplex

parent 236d1d6d
No related branches found
No related tags found
1 merge request!88refactor LearnerND._ask to be more readable (and faster)
Pipeline #11584 passed
......@@ -336,7 +336,7 @@ class LearnerND(BaseLearner):
def _pop_highest_existing_simplex(self):
# find the simplex with the highest loss, we do need to check that the
# simplex hasn't been deleted yet
while True:
while len(self._losses_combined):
loss, simplex, subsimplex = heapq.heappop(self._losses_combined)
if (subsimplex is None
and simplex in self.tri.simplices
......@@ -347,6 +347,13 @@ class LearnerND(BaseLearner):
and subsimplex in self._subtriangulations[simplex].simplices):
return abs(loss), simplex, subsimplex
# Could not find a simplex, this code should never be reached
assert self.tri is not None
raise AssertionError(
"""Could not find a simplex to. Yet there should always be a simplex
available if LearnerND.tri() is not None"""
)
def _ask_best_point(self):
assert self.tri is not None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment