pymasep.common.action ===================== .. py:module:: pymasep.common.action Classes ------- .. autoapisummary:: pymasep.common.action.Action Module Contents --------------- .. py:class:: Action(environment, action_type = None, xml_node = None, src_copy = None) This class represents an action that can be done by an agent. :param environment: the environment where the action is created. :param action_type: Type of the action. None, if xml_node. :param xml_node: XML used to create the Action. :param src_copy: The Action will be copied. See copy_obs(). :exception pymasep.common.exception.CreationException: Raised when xml_node, action_type and src_copy are None. .. py:attribute:: environment .. py:attribute:: type :type: Optional[int] type of the action. May be initialized later if the action is created from xml .. py:attribute:: params parameters of the actions .. py:method:: add_parameter(name, value) Add a parameter to the action. :param name: Name of the parameter. :param value: Value of the parameter. Must be XML serializable. .. py:method:: id_str() Create a string unique ID of the Action. Depends on the content of the Action (parameters). :return: The string unique ID .. py:method:: to_xml() Transform the Action to XML. See :ref:`serialization` for more information. :return: XML version of the Action .. py:method:: from_xml(environment, xml_node) Transform an XML to an Action. The instance must be created before. See :ref:`serialization` for more information. :param environment: The environment where the Action is created. :param xml_node: The XML node that contains the Action values and parameters. .. py:method:: __str__() .. py:method:: copy_obs(params) Deep copy an action into a new instance (with its parameters). :param params: Not directly used in this method but passed to the action parameters copy.