Example #1
0
    def __init__(self, action_space, action_space_converter=None, **kwargs_converter):
        self.action_space_converter = action_space_converter
        self.init_action_space = action_space

        if action_space_converter is None:
            BaseAgent.__init__(self, action_space)
        else:
            if isinstance(action_space_converter, type):
                if issubclass(action_space_converter, Converter):
                    action_space_converter_this_env_class = action_space_converter.init_grid(action_space)
                    this_action_space = action_space_converter_this_env_class(action_space)
                    BaseAgent.__init__(self, this_action_space)
                else:
                    raise Grid2OpException("Impossible to make an BaseAgent with a converter of type {}. "
                                           "Please use a converter deriving from grid2op.ActionSpaceConverter.Converter."
                                           "".format(action_space_converter))
            elif isinstance(action_space_converter, Converter):
                if isinstance(action_space_converter._template_act, self.init_action_space.actionClass):
                    BaseAgent.__init__(self, action_space_converter)
                else:
                    raise Grid2OpException("Impossible to make an BaseAgent with the provided converter of type {}. "
                                           "It doesn't use the same type of action as the BaseAgent's action space."
                                           "".format(action_space_converter))
            else:
                raise Grid2OpException("You try to initialize and BaseAgent with an invalid converter \"{}\". It must"
                                       "either be a type deriving from \"Converter\", or an instance of a class"
                                       "deriving from it."
                                       "".format(action_space_converter))

            self.action_space.init_converter(**kwargs_converter)
Example #2
0
 def __init__(self, action_space):
     BaseAgent.__init__(self, action_space)
     self.tested_action = None
Example #3
0
 def __init__(self, action_space):
     BaseAgent.__init__(self, action_space)
Example #4
0
 def __init__(self, action_space, action_space_converter=None):
     BaseAgent.__init__(self, action_space)
     self.tested_action = None
Example #5
0
 def __init__(self, action_space):
     BaseAgent.__init__(self, action_space)
     self.tested_action = None
     self.resulting_rewards = None
Example #6
0
 def __init__(self, action_space, action_space_converter=None):
     BaseAgent.__init__(self, action_space)
     self.has_changed = False
Example #7
0
 def __init__(self, action_space):
     BaseAgent.__init__(self, action_space)
     self.has_changed = False
     self.do_nothing_action = self.action_space({})
Example #8
0
 def __init__(self, *args, **kwargs):
     BaseAgent.__init__(self, *args, **kwargs)
     warnings.warn(
         "Agent class has been renamed \"BaseAgent\". The Agent class will be removed"
         "in future versions.",
         category=PendingDeprecationWarning)