/// <summary> /// Received a response from the operator with the results of the client /// task request in the environment. Check if a valid agent is registered /// and form a coordination group with the respective agents if required. /// </summary> /// <param name="destination">Client agent which made the original request</param> /// <param name="task">The results of the Client task request in the enivornment</param> private void HandleInformMessage(Agent destination, ClientTask task) { if (task.RegisteredAgents.Count > 0) { // Create an entry in the execution tree. For now the order // is placed as a task in the tree with the current client as // the target. ExecutionNode n = new ExecutionNode(task); tree.Root.Add(n); // Greedy method means that the best payoff result will be assigned to the // coordination group. // Send a message to the client and the manufacturer informing them of // the current situation InformMessage i = new InformMessage(this, task); // Send the message first to the client messageQueue.SendPost(task.Agent, i); // Generate a manufacturer task ManufacturerTask mTask = new ManufacturerTask((ClientAgent)task.Agent); mTask.Agent = task.RegisteredAgents[0].TaskAgent; tree.AddChild(task, mTask); i = new InformMessage(this, mTask); // Send the message also to the manufacturer communicationNode.AddEdge(task.RegisteredAgents[0].TaskAgent.CommunicationNode); messageQueue.SendPost(task.RegisteredAgents[0].TaskAgent, i); } }
private void HandleInformMessage(Agent destination, ManufacturerTask task) { if (task.RegisteredAgents.Count > 0) { // Generate a Supplier task SupplierTask sTask = new SupplierTask((SupplierAgent)task.RegisteredAgents[0].TaskAgent, (ManufacturerAgent)task.Agent, task.Demand); tree.AddChild(task, sTask); InformMessage i = new InformMessage(this, sTask); // Send the message first to the client messageQueue.SendPost(task.Agent, i); // Send the message also to the manufacturer messageQueue.SendPost(task.RegisteredAgents[0].TaskAgent, i); } }
/// <summary> /// Handles the assignment from the controller agent. Updates the communication /// graph to indicate the possible communication links. /// </summary> /// <param name="author">The systems controller agent.</param> /// <param name="content">The new manufacturing task for the current agent.</param> private void HandleInformMessage(Controller author, ManufacturerTask content) { coordinationNode.AddEdge(content.Client.CoordinationNode); communicationNode.AddEdge(content.Client.CommunicationNode); // Update the coordination information assignedTask = content; manager = author; communicationNode.AddEdge(author.CommunicationNode); }