Skip to content

Commit

Permalink
fix run when computation is over
Browse files Browse the repository at this point in the history
  • Loading branch information
videlec committed Dec 6, 2023
1 parent 60fa6e5 commit 1770ec9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions veerer/automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,40 @@ def run(self, max_size=None):
sage: C.run()
sage: C
Reduced core veering automaton with 356 vertices
TESTS::
sage: from veerer import VeeringTriangulation, CoreAutomaton
sage: T = VeeringTriangulation("(0,2,~1)(1,~0,~2)", "RBB")
sage: A = CoreAutomaton()
sage: A
Uninitialized core veering automaton with 0 vertex
sage: A.set_seed(T)
sage: A
Partial core veering automaton with 1 vertex
sage: A.run(1)
sage: A
Partial core veering automaton with 2 vertices
sage: A.run(1)
sage: A
Core veering automaton with 2 vertices
sage: A0 = CoreAutomaton()
sage: A0.set_seed(T)
sage: A0.run()
sage: A0._flip_branch
[[]]
sage: A1 = CoreAutomaton()
sage: A1.set_seed(T)
sage: A1.run(1)
sage: A1.run(1)
sage: A1._flip_branch
[[]]
"""
if not self._flip_branch:
raise ValueError('uninitialized automaton; call set_seed() first')

if len(self._flip_branch) == 1 and not self._flip_branch[0]:
return

T = self._state
Expand Down Expand Up @@ -683,6 +715,8 @@ def run(self, max_size=None):
flip_branch.pop()
assert T == state_branch[-1]
if not flip_branch[-1]:
# done
assert len(flip_branch) == 1
break

if self._verbosity == 1:
Expand Down

0 comments on commit 1770ec9

Please sign in to comment.