def agentprediction(self, tx, agent): """ Predict how long the agent will stay at the node and its destination once it leaves. This must be implemented by the subclass to predict agent behaviour if node has a queue. :param tx: neo4j write transaction :param agent: agent id :return: view of local environment for agent """ view = intf.perception(tx, agent["id"]) return view
def agentperception(self, tx, agent, dest=None, waittime=None): """ The local environment of the node filtered by availability to a particular agent. Subclass must implement this function to add node filtering for particular model :param tx: neo4j read or write transaction :param agent: agent id :param dest: passed by nodes with queues if agent destination has already been determined by prediction. :param waittime: time the agent has been waiting at the node :return: view of local environment for agent as list of relationships """ if dest: view = dest else: view = intf.perception(tx, agent["id"])[1:] if type(view) == list: for edge in view: if "cap" in edge.end_node.keys(): if edge.end_node["cap"] <= edge.end_node["load"]: view.remove(edge) return view