pymasep.common.agent ==================== .. py:module:: pymasep.common.agent Classes ------- .. autoapisummary:: pymasep.common.agent.Agent Module Contents --------------- .. py:class:: Agent(environment, name = None, parent=None, template=None, xml_node = None, src_copy = None) Bases: :py:obj:`pymasep.common.object.Object` Agent that act inside the environment :param environment: an Environment instance :param name: name of the Agent. :param xml_node: XML used to create the agent. :param template: Template of the agent. Needed if no xml_node. :param parent: Parent object (see objects hierarchy) :param src_copy: The Agent to copy. Needed if no xml_node or template. The copy is not made into the constructor, see copy_obs() :raise pymasep.common.exception.CreationException: If no XML or no template is present .. py:attribute:: action :value: None next action of the agent .. py:attribute:: observation :value: None current observation of the agent .. py:attribute:: reward :value: None current reward of the agent, if pertinent .. py:attribute:: controller :value: None controller of the agent .. py:attribute:: control :value: None sub app id that control the agent (an interface or the engine) .. py:attribute:: intention :value: None current intention of the agent .. py:attribute:: belief belief of the agent .. py:method:: choose_action() Choose the next action of the agent using its controller .. py:method:: set_observation_reward(observation, reward = None) Set the observation and the reward of the agent. :param observation: Observation of the agent (as a State) :param reward: reward of the agent. .. py:method:: id_str() Create a string unique ID of the Agent. Depends on the content of the base object and the id_str of all characteristics in object_state, and the intention of the agent :return: The string unique ID .. py:method:: to_xml() Transform the Agent to XML. See :ref:`serialization` for more information. :return: XML version of the Agent .. py:method:: from_xml(environment, xml_node) Transform an XML to an Agent. The instance must be created before (with __init__(), passing the xml_node). See :ref:`serialization` for more information. :param environment: The environment where the Agent is created. :param xml_node: The XML node containing the Agent content. :raise pymasep.common.exception.CreationException: SubElement must be present if initializer is not present. At creation, Initializer must be present for all characteristics if initializer is not present for ObjectState .. py:method:: copy_obs(params) Deep copy the agent into a new instance (with sub BaseObjects, except the Belief) :param params: The agent needs the full name of the agent that observes (key: obs_agt_fname) Note : this method copy the reference of the parent. The parent should do the parent copy and assignment. Belief is the same (same reference) in the observation (for the agent that observes) and in the state.