diff --git a/src/agents/__init__.py b/src/agents/__init__.py index 742365a..72829f9 100644 --- a/src/agents/__init__.py +++ b/src/agents/__init__.py @@ -2,3 +2,10 @@ from .randomized_reflex_agent import RandomizedReflexAgent from .reflex_vacuum_agent import reflex_vacuum_agent from .simple_reflex_agent import SimpleReflexAgent + +__all__ = [ + "ModelBasedReflexAgent", + "RandomizedReflexAgent", + "reflex_vacuum_agent", + "SimpleReflexAgent", +] diff --git a/src/algorithms/__init__.py b/src/algorithms/__init__.py index 1dcd828..7aa46f2 100644 --- a/src/algorithms/__init__.py +++ b/src/algorithms/__init__.py @@ -5,3 +5,15 @@ from .expand import expand from .iterative_deepening_search import iterative_deepening_search from .ucs import uniform_cost_search + +__all__ = [ + "best_first_search", + "bibf_search", + "breadth_first_search", + "depth", + "depth_limited_search", + "is_cycle", + "expand", + "iterative_deepening_search", + "uniform_cost_search", +] diff --git a/src/algorithms/depth_limited_search.py b/src/algorithms/depth_limited_search.py index e93c5ed..d996d2a 100644 --- a/src/algorithms/depth_limited_search.py +++ b/src/algorithms/depth_limited_search.py @@ -47,7 +47,7 @@ def is_cycle(node: Node) -> bool: return False -def depth_limited_search(problem: Problem, l: int) -> Node | str | None: +def depth_limited_search(problem: Problem, l_depth: int) -> Node | str | None: """Expands the root node, the next child, repeating this process until the depth limit is reached, then backtracking to the next successor of the root. This process is repeated until a goal is @@ -70,7 +70,7 @@ def depth_limited_search(problem: Problem, l: int) -> Node | str | None: if problem.is_goal(node.state): return node - if depth(node) > l: + if depth(node) > l_depth: result = "cutoff" elif not is_cycle(node): for child in expand(problem, node): diff --git a/src/data_structures/__init__.py b/src/data_structures/__init__.py index 31b45db..cfd3d52 100644 --- a/src/data_structures/__init__.py +++ b/src/data_structures/__init__.py @@ -4,3 +4,12 @@ from .priority_queue import PriorityQueue from .problem import Problem from .sensor import Sensor + +__all__ = [ + "Actuator", + "Environment", + "Node", + "PriorityQueue", + "Problem", + "Sensor", +] diff --git a/test/data_structures/test_priority_queue.py b/test/data_structures/test_priority_queue.py index f576aea..8e0c032 100644 --- a/test/data_structures/test_priority_queue.py +++ b/test/data_structures/test_priority_queue.py @@ -38,7 +38,7 @@ def test_pop(self) -> None: assert self._queue.is_empty() def test_top(self) -> None: - assert self._queue.top() == None + assert self._queue.top() is None A = Node(state={}, parent=None, action="None", path_cost=0) self._queue.add(A) @@ -52,13 +52,13 @@ def test_top(self) -> None: def test_add(self) -> None: while not self._queue.is_empty(): - node = self._queue.pop() + _ = self._queue.pop() A = Node(state={}, parent=None, action="None", path_cost=0) B = Node(state={}, parent=None, action="None", path_cost=1) C = Node(state={}, parent=None, action="None", path_cost=2) - assert self._queue.top() == None + assert self._queue.top() is None self._queue.add(C)