## 4 Industrial Implementation  
Since agents are programmed based on AOP, an MAS framework implementation is required in order for these entities to be spawned and managed. In this case, they utilize the Janus framework and SARL programming language. There are four main types within AOP, namely, agents, events, capacities, and skills. The agent is the equivalent of a class in OOP and is a placeholder for the methods, events, skills, and variables that consist of the agent as an entity. Capacity, on the other hand, is a generic description of an agent's capability and is independent of the implementation. As an example, a capacity may be a pick and place in the case of a robot control agent, whereas the skill, on the other hand, is the specific implementation and, in this case, the set of step commands needed to perform the pick and place operation. Lastly, the events are the way that the agents interact, and this is what makes it different from OOP. Events are broadcasted within the network of agents by the agents unaware of who will be the listener of the events. In other words, the agents are autonomous entities that receive an event as long as the event is compatible with their skills and internal operations and may or may not produce new events for the system. In JANUS and the proposed implementation, there are four main concepts as well, described as follows:  
* Agent: An agent is capable of receiving the scheduling request from the UI and selecting the corresponding scheduling algorithm to perform the scheduling calculation. After the scheduling output has been completed, the planning agent emits the schedule response to other agents in the MAS, who will handle this information based on their functionality as well. * Skills and capacity: A capacity is a wrapper of skills. The reason for having a capacity is that an agent can implement a skill from a certain capacity with a specific parameterization. In the planning agent implementation, the skills refer to the different capabilities of the planning agent. The planning agent is capable of choosing the correct scheduler, performing the scheduling task through scheduler interfaces and REST API connections, and posting the scheduling task outcome to a UI. * Events: There are two kinds of events in this implementation. The schedule request, where another entity in the MAS broadcasts it, and the schedule response, where the planning agent broadcasts when the scheduling task has finished. These types were implemented into Janus, as displayed in Figure 5. SARL is built on top of the Java programming language, which makes it extremely compatible with the exploitation of Java interfaces, methods, and classes to perform actions for which Java has existing libraries and packages. In addition to the traditional JANUS entities, some additional classes were implemented:  
* UIConnector: When the scheduler finishes its operation, the outcome needs to be shown in a UI, where the user will be able to read it and decide the following production activities (apply or reject the schedule). * SchedulerInterface: This class is used for the preprocessing and post-processing. The input needs to be reformed into the proper scheduler input format, and the output from the scheduler needs to be reformed into a readable output. * SchedulersConnection: The schedulers listen to the schedule request through a REST API and provide the response with the use of MQTT. Thus, an additional class for the connection of the schedulers' endpoints with the planning agents' skills was required. The planning agent contained (was able to receive/listen to) three different MAS events:
* \"Initialization\", spawn of the agent and configuration of the connections with the schedulers based on the AAS;
* \"Scheduling request\", a message containing the production data to be scheduled;
* \"Schedule response\", a chain event broadcasted after the end of the scheduling process.