Skip to content

Commit

Permalink
implementing pylint suggestions (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarth authored Sep 4, 2024
1 parent 563b73d commit 866ef1f
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions aigyminsper/search/Graph.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Module providing classes Node and State."""

from abc import ABC, abstractmethod

class Node:
Expand All @@ -13,7 +15,7 @@ def __init__(self,state,father_node):

self.state = state
self.father_node = father_node
if self.father_node == None:
if self.father_node is None:
self.depth = 0
self.g = 0
else:
Expand All @@ -24,11 +26,10 @@ def show_path(self):
"""
Return the path from the root node to the current node
"""
if self.father_node != None:
return self.father_node.show_path() + " ; " + self.state.operator
else:
return self.state.operator

if self.father_node is not None:
return self.father_node.show_path() + " ; " + self.state.operator
return self.state.operator

def h(self):
"""
Return the heuristic value of the current node
Expand All @@ -40,8 +41,8 @@ def f(self):
Return the evaluation function value of the current node: f(n) = g(n) + h(n)
"""
return self.g + self.h()


class State(ABC):
"""
This class represents a state in a search problem.
Expand All @@ -61,28 +62,24 @@ def successors(self):
"""
Return a list of successors of the current state
"""
pass


@abstractmethod
def is_goal(self):
"""
It returns True if the current state is a goal state
"""
pass


@abstractmethod
def description(self):
"""
Return a string with a brief description of the problem
"""
pass


@abstractmethod
def cost(self):
"""
Return the cost of the current state
"""
pass

def print(self):
"""
Expand All @@ -95,4 +92,3 @@ def env(self):
"""
Return the description of the environment of the current state
"""
pass

0 comments on commit 866ef1f

Please sign in to comment.