Esempio n. 1
0
 /// <summary>
 /// Handle a request from any agent for the current controllers reference
 /// </summary>
 protected void HandleRequestMessage(Agent destination, Controller request)
 {
     if (request == null) {
     Message m = new InformMessage(this, manager);
     messageQueue.SendPost(destination, m);
       }
 }
Esempio n. 2
0
 /// <summary>
 /// Response from the controller indicating that the task group is a success
 /// </summary>
 /// <param name="controller">Controller which sent the message</param>
 /// <param name="task">Task associated with the current message</param>
 private void HandleInformMessage(Controller controller, ClientTask task)
 {
     coordinationNode.AddEdge(task.RegisteredAgents[0].TaskAgent.CoordinationNode);
       assignedTask = task;
 }
Esempio n. 3
0
 public Agent AddNewAgent(AGENT_TYPE agentType, Image image)
 {
     Agent newAgent = null;
       Environment a = this;
       // Set a random location for the agent
       RectangleF bounds = device.Graphics.VisibleClipBounds;
       PointF location = new PointF((float)(bounds.Width * rnd.NextDouble()),
                            (float)(bounds.Height * rnd.NextDouble()));
       switch (agentType) {
     case AGENT_TYPE.AGENT_CONTROLLER: {
     newAgent = new Controller(ref a, ref messageQueue, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_OPERATOR: {
     newAgent = new Operator(ref a, ref messageQueue, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_LOGISTICS: {
     // Logistics Agent
     newAgent = new TransportAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_SUPPLIER: {
     newAgent = new SupplierAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_MANUFACTURE: {
     newAgent = new ManufacturerAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_CLIENT: {
     newAgent = new ClientAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
       }
       agents.Add(newAgent);
       if (NewAgent != null)
     NewAgent(this, ref newAgent);
       return newAgent;
 }
 /// <summary>
 /// Handles the request for a potential supplier for the manufacturer.
 /// </summary>
 /// <param name="author">Controller agent which sent the reply</param>
 /// <param name="content">A Supplier task with a potential supplier agent provided.</param>
 private void HandleInformMessage(Controller author, SupplierTask content)
 {
     coordinationNode.AddEdge(content.Agent.CoordinationNode);
       communicationNode.AddEdge(content.Agent.CommunicationNode);
       // Update the coordination information
       ((ManufacturerTask)assignedTask).Supplier = content.Agent;
 }
 /// <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);
 }
 /// <summary>
 /// Handles the response for the transport request
 /// </summary>
 /// <param name="agent">Controller agent</param>
 /// <param name="content">The transport task the manufacturer requested</param>
 protected void HandleInformMessage(Controller agent, TransportTask content)
 {
     ((ManufacturerTask)assignedTask).Transport = content.Agent;
 }
Esempio n. 7
0
 /// <summary>
 /// Handles the request for a potential supplier for the manufacturer.
 /// </summary>
 /// <param name="author">Controller agent which sent the reply</param>
 /// <param name="content">A Supplier task with a potential supplier agent provided.</param>
 private void HandleInformMessage(Controller author, TransportTask content)
 {
     coordinationNode.AddEdge(content.Agent.CoordinationNode);
       communicationNode.AddEdge(content.Agent.CommunicationNode);
       assignedTask = content;
       manager = author;
 }