Merge branch 'main' into feat/search

This commit is contained in:
Leni Aniva 2024-10-30 18:30:46 -07:00
commit 6d9cb9cd3d
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 3 additions and 3 deletions

View File

@ -15,6 +15,7 @@ class SearchState:
parent: Optional[Self] parent: Optional[Self]
parent_goal_id: Optional[int] parent_goal_id: Optional[int]
priorities: list[float] priorities: list[float]
tactic_feedback: Optional[str] = None
def __post_init__(self): def __post_init__(self):
assert len(self.priorities) == len(self.goal_state.goals) assert len(self.priorities) == len(self.goal_state.goals)
@ -48,7 +49,6 @@ class Agent:
""" """
An agent interface for proof search An agent interface for proof search
""" """
tactic_feedback: Optional[str] = None
@abstractmethod @abstractmethod
def next_tactic( def next_tactic(
@ -126,7 +126,7 @@ class Agent:
print(f"Next tactic: {tactic}") print(f"Next tactic: {tactic}")
if not tactic: if not tactic:
# resets the feedback # resets the feedback
self.tactic_feedback = None search_state.tactic_feedback = None
# pop the current state and continue to the next # pop the current state and continue to the next
search_stack.pop(-1) search_stack.pop(-1)
if not search_stack: if not search_stack:
@ -163,7 +163,7 @@ class Agent:
except TacticFailure as t: except TacticFailure as t:
if verbose: if verbose:
print(f"Tactic failed: {t}") print(f"Tactic failed: {t}")
self.tactic_feedback = str(t) search_state.tactic_feedback = str(t)
# try the next tactic. this one failed # try the next tactic. this one failed
except ServerError as e: except ServerError as e:
raise RuntimeError(f"While executing tactic: {tactic}") from e raise RuntimeError(f"While executing tactic: {tactic}") from e