@@ -52,24 +52,29 @@ def finished(self) -> bool:
5252
5353
5454class WithQTableMixinBase (metaclass = abc .ABCMeta ):
55- """
56- Base class to impose the concept of Q-table
55+ """Base class to impose the concept of Q-table
5756 """
5857
59- def __init__ (self ):
58+ def __init__ (self , table : QTable = None ):
6059 # the table representing the q function
6160 # client code should choose the type of
6261 # the table
63- self .q_table : QTable = None
62+ self .q_table : QTable = table
6463
6564
6665class WithQTableMixin (WithQTableMixinBase ):
66+ """Helper class to associate a q_table with an algorithm
6767 """
68- Helper class to associate a q_table with an algorithm
69- if this is needed.
70- """
71- def __init__ (self ):
72- super (WithQTableMixin , self ).__init__ ()
68+ def __init__ (self , table : QTable = None ):
69+ """
70+ Constructor
71+
72+ Parameters
73+ ----------
74+ table: The Q-table representing the Q-function
75+
76+ """
77+ super (WithQTableMixin , self ).__init__ (table )
7378
7479 def state_action_values (self , state : Any , n_actions : int ):
7580
@@ -81,12 +86,11 @@ def state_action_values(self, state: Any, n_actions: int):
8186
8287
8388class WithMaxActionMixin (WithQTableMixin ):
84- """
85- The class WithMaxActionMixin.
89+ """The class WithMaxActionMixin.
8690 """
8791
88- def __init__ (self ):
89- super (WithMaxActionMixin , self ).__init__ ()
92+ def __init__ (self , table : QTable = None ):
93+ super (WithMaxActionMixin , self ).__init__ (table )
9094
9195 def max_action (self , state : Any , n_actions : int ) -> int :
9296 """
0 commit comments