A Secure Multi-Agent-Based Decision Model Using a Consensus Mechanism for Intelligent Manufacturing Tasks

Accord is an important operation in the mechanism design for multi-agent systems and consequently to applications built for these environments, such as ad hoc networks, virtual organizations


INTRODUCTION
An agent is a mechanical, biological, or software system that interacts with its environment.A Multi-Agent System (MAS) comprises several agents which interact with each other in a common environment [1].Interaction is the dynamic linking of two or more agents through a set of reciprocal actions.Agents interact to manage, communicate, coordinate, cooperate, negotiate, etc. MAS are currently a very active and widely applied field [2].This field is a branch of Distributed Artificial Intelligence (DAI) [3].Agents in such systems are endowed with a greater degree of freedom than typical entities of a security protocol.They may have clearly defined goals, abilities, and knowledge about the world; they can also form coalitions working towards a common goal.The advantages of MAS become particularly visible in the analysis of scenarios involving interaction between human and technical agents, such as healthcare and smart manufacturing.With the large advances in manufacturing technology [4] that aim to improve the production process and reduce the expenditures, interacting MAS are being developed to maintain products shorter life cycles, face fierce market competition, diversify demands of clients for products, and update speed.As shown in Figure 1, the environment initially contains a set of data, like a public key, that the system or rather agents need to perform their tasks.In smart manufacturing system, not all agents have to participate in a task (Demand-Cnsensus : 0).They acquire information from the environment (sensing) and then make decisions in a secure manner (acting).Trust is an essential aspect of this interaction due to the heterogeneity of decision-makers because the internal structures of the agents (the needs or the strategies of each agent) may not be known to the others.In addition, each agent does not necessarily share the idea of mutual benefits, as a result, member interaction may experience unexpected results.Therefore, designing protocols for robust, secure and verifiable decisions is a difficult task.A smart manufacturing system is a large but integrated system with various other intelligent subsystems, that represent distributed solution actions based on the exchange of information, materials, and energy; in which, complexity is a significant factor.By integrating DAI with the multi-agent system [5], successful technical support for the modeling and realization of the intelligent manufacturing system will be provided, which is today the basis of research in manufacturing.The manufacturing process can be considered as a typical platform for a multi-agent system, where every part in this process can be an agent, or in other words, the agent is responsible for it.That is, each partial task or unit of equipment in the entire manufacturing process can be represented by a single agent or a group of agents interacting with each other, where they can accomplish the manufacturing tasks together through decision-making, coordination, and mutual cooperation.Simulating a production system with a multi-factor system reduces its complexity, makes it easier to design and increases scalability and reliability while improving quality, flexibility, and adaptability.Manufacturing systems based on modern technologies are beneficial.However, the challenge lies in integrating these systems with the evolving needs of the customer.Recent market changes have revealed many problems, including allocating limited resources and responding to urgent emergencies.In addition, smart manufacturing at all levels is an open, vast, and complex environment that assumes shared and distributed decision-making with security in mind, which requires the communication of many complex and diverse forms of data between different sets of industrial environments.To provide a unified and effective solution in this field, this paper highlights a model based on multi-agents (Figure 2) ensuring some manufacturing services in a timely and appropriate manner by ensuring fairness in making decisions [6] regarding different procedures such as the exploitation of limited resources.

Contributions
Multi-agent systems are an excellent option for dealing with all these challenges and problems related to manufacturing.These systems have an increasingly important role to play in critical areas, as they greatly enhance the ability to model, design, and build highly efficient complex and distributed software systems.In addition to coordinating groups of users/machines with very different skills and roles, these systems, in particular, provide timely and error-free information and provide safe and trustworthy recommendations and decisions, Fig. 2 The figure shows the difference between the traditional method of decision-making consisting of a group of decision parts and the safest and most effective method of making one decision among several decisions.
provided that there are intelligent, independent, and proactive collaborative entities in a distributed environment.This paper contributes to monitoring manufacturing tasks in several ways, all of which depend on the proposed consensus mechanism.We can summarize the following points: First, it provides a collaborative working environment where several agents work together to deliver the right decision at the right time to a remote user/machine (Figure 3), i.e., the agent shares the workload with user/machine by means of the integrity and reliability of the decision taken for a particular procedure.This consensus algorithm ensures that the decision is not tampered [7], and additionally, the decision is safe not to involve outside or outside parties in its making.
Second, the proposed consensus algorithm is included in the processes of resource division based on multi-agent systems [8].Many of the proposed solutions in this field use blockchain technology [9], where we can apply the proposed consensus as each agent is a user participating in changing the content of the blockchain.This technology is decentralized which means that content cannot be tampered with.Sharing production resources in manufacturing through the mechanism of resource storage, circulation, supervision, and protection can significantly improve the degree of sharing of these resources [10].
The exploitation of the proposed model in blockchain technology contributes to narrowing the differences in resource allocation between parties while responding effectively to real-time tasks.Third, multitasking coordination involves accurately scheduling and completing tasks and putting tasks into the workflow.The task scheduling process will inevitably affect safety, satisfaction, and efficiency outcomes.This is even more important and evident in critical and complex environments such as manufacturing.The production is going through many situations where there are multiple tasks and limited resources to address them.Using a consensus mechanism, the presented model can improve the task scheduling algorithms [11][12][13] proposed in the literature, by providing additional security and accuracy.

Related work
Data acquisition, scheduling tasks, allocating resources, and taking decisions in manufacturing systems are critical issues that require complex mechanisms, especially when demands are high and random.To address all these challenges, several works have been proposed.In [14], the authors proposed an architecture that consists of autonomous agents capable of communicating with each other to make decisions using their knowledge.In particular, the architecture is proposed for negotiation processes and scheduling optimization algorithms in intelligent manufacturing systems.In production planning and control, where process planning involves multi-stage decision making, the authors of [15] proposed an approach to low-level process/machine control for manufacturing.To automatically adapt to changes in the production environment, the approach is based on a multi-agent system.For modeling supply chain dynamics with agents' decision-making, multi-agent approaches have been proposed in [16,17].To address a variety of scheduling problems within a decentralized and hierarchical architecture, agents based model has been proposed in [18]; these schedules include constraints such as the blocking constraint.A multiagent model to share distributed manufacturing resources has been proposed in [19].Paper [20] presented an agent cooperation approach for decentralized scheduling operations in a manufacturing network.
The exploitation of a multi-agent system to improve the overall performance of the system was not only limited to manufacturing but it was also included another sensitive sector, i.e., the healthcare.To raise the level of health monitoring and in particular in data acquisition, the authors in [21] introduced a multi-agent system for health monitoring, which entails a group of intelligent agents who collect patient data and vital signs, monitor them, and send them to the health care professional for appropriate action.In [22], the authors proposed a MAS fog computing model for healthcare mission-critical management.The role of the proposed model is to map between decision schedules to improve the scheduling of critical tasks by selecting priority tasks.In [23], the authors explored the prevalence of Covid-19 using a multi-agent-based model for an Italian region with a population scale of 1:1000.Some vaccination strategies were simulated.From the point of view of the decision support system, the research investigated the adoption of artificial intelligence techniques to provide suggestions for more effective policies.
Voting in multi-agent systems has been considered a key element in the design of mechanisms for coordination, cooperation, team building, negotiation and decision-making.Therefore, the focus of the study is the voting strategy to avoid manipulation and domination, rather than the voting procedure to ensure correct results.In a multi-agent system, paper [24] proposed an algorithm consisting at each instant t, the group of agents present to vote to know who should see their need for resources satisfied.If an agent obtained a number of votes greater than a threshold S then he could take the resource.In order to accommodate a company of voting agents, the authors proposed a structure based on a simplified pluralist voting protocol.
The process switches to the subscription state from the standby state, where members can register to vote.If an insufficient number of voters follows the election, the president may cancel this election process; otherwise, the ballot is opened, and the voting operation begins.The process ends with the closing of the ballot and the announcement of the result.Each time slot is initiated once the chairman broadcasts an election start message to all of the agents.The authors also studied adaptation algorithms in this formal framework, which can be based on case-based reasoning, machine learning, etc.
In [25], the authors formalized the selected features of the Selene [26] voting protocol by means of formulas and multi-agent models.Their models defined the space of strategies for the members, the electoral authority, and the potential coercive.In Selene, the electoral authority initializes the system; this configuration consists of generating electoral keys and preparing cryptographic vote control tools, one for each agent.The trackers are then encrypted and mixed, and published on the Web Bulletin Board (WBB).The goal is to sever any link between the voter and their encrypted tracker.Therefore, the tracker pool is public, while the tracker assignment is secret.Each agent fills in, encrypts, and signs their vote during the voting phase.The signed and encrypted ballot paper is then collected by the system.All votes cast are presented clearly in WBB.The work in [27] investigated the aspect of robustness, namely the requirement for robustness to respect the way in which votes are cast.The outcome is declared when the conceptual requirements could be encapsulated in a formal specification of the voting protocol has been presented.The authors of [28] proposed a system called smart voting by extending classical liquid democracy in two ways: allowing ranked delegations to avoid cycles and generalizing delegations to be more expressive.The first is to allow agents to submit a linear order of delegations, where less preferred delegations can be used to break cycles.The second enables agents to not only delegate to a single agent but to have their vote determined by the votes of many agents.For example, when an agent does not know how to vote on an issue, they may match their vote with the majority opinion of a group of agents whom they collectively trust in that issue.Some of the proposed algorithms suffer from high energy consumption due to the calculation complexity they perform.Other algorithms are very timeconsuming due to the large number of messages that are exchanged between agents.Others of the proposed algorithms in the literature depend on the leader concept to which all decisions belong, this is a kind of domination where the principle of equal opportunities is absent.On the one hand, this type of decision-making is not very safe because the leader can manipulate the final decision.The proposed model addresses all these gaps by relying first on linear arithmetic operations, minimizing the messages exchanged between agents, and thirdly, all agents have the same opportunity where the final decision can be the decision of any one of them depending on decision random choice, in which everyone contributes, in an intelligent way safe from tampering.Fig. 3 The real time decision, the proposed method aims to reduce t i which represents the time difference between taskbegin and taskend taking into consideration knowledgeacquisition from the external environment.

Model description
To further improve manufacturing system and to ensure that various decisions are made in a safe, effective, and secure manner, this research proposes a consensus mechanism in a distributed and heterogeneous environment (Figure 4) where the solution is the result of the interaction of several entities (agents), this interaction is expressed by a cooperation and competition.The conception has considered the lack of trust between agents.
Manufacturing system world wide web broadcast query-nbr-msg wait MWT, reading response-nbr-msg broadcast N (number of participants) x i ← decrypt v 1i using y i 19: if Count(y i ) = N then end if 26: end function As consensus mechanisms are used to verify transactions and maintain blockchain security, each of the final decisions in our model needs to be independently verified by a peer-to-peer agent before they are accepted into the system.These decisions can be considered transactions; then, the consensus will guarantee that all participants (agents) agree on a single version of history.In addition to the environment agent, the proposed model consists of a group of participating agents.Among the main features of this model is the absence of a central control body, i.e., no responsible agent to whom the final decision rests.The local states of each agent are defined by its local variables.A global state of the system is an evaluation of the local variables of all the agents.Each agent can observe its local variables and select local variables of the Environment.The following natural numbers parameterize the model: N participating agents where N is variable; a prime number p; the maximum time to wait for all responses from other agents M axW aitT ime.Agent Environment serves as a container for variables shared by selected agents and it traces the passage of time and changes the stage of consensus.The consensus process is divided into three steps.In the first step, the agents must know the total number of participants N in this moment; therefore, they broadcast a query − nbr − msg type message and wait for M axW aitT ime in order to receive the answers.After each agent announces its result N , the number N that gets a maximum of votes will be the number of participants.In the second step "creation of encrypted list", each agent A i generates a random and temporary number x i also a random and temporary secret key y i to encrypt x i using a symmetric scheme that based on key exchange protocol [29] according to the following equation: where p is a known prime and 0 < x i × y i < p.The generated x i is encrypted so that some faulty agent cannot control the result of the selection algorithm.
For more solidity, so that agent can change the secret key y i or manipulate the selection value; then, the agent diffuses v i and v ′ i where: Each agent will read all v i and v ′ i ; when the encrypted list is created and provided that all agents validate it, the third step (selection) begins.In the third step, each agent diffuses its secret key y i , and each other agent can calculate all the x i values by decrypting the v i values (x i = v i × y −1 i mod p ).Then, the agents calculate v according to the following equation: where N is the number of agents.The winner is the one that owns the value x i ; x i is closest to the value v.

Model analysis
Since agents must be able to participate, interact and make decisions, each one of them has a random value generation system.As shown in Figure 5, each agent has the value of identifying a personal activity.This value represents whether or not they wish to participate in a consensus or an election .Assuming the agent can leave or fail within a period of time, the profile will only be queried at the beginning of that time slot.Thus, the maximum waiting time should be set to prevent the rest of the participants from not waiting for too long.In the proposed protocol, system continuity will be ensured while avoiding the futile study of whether an agent was active or not in the previous consensus.The environment agent provides information about the maximum wait time M axW aitT ime and the public key p.
The proposed model uses a symmetric scheme that is lighter than asymmetric encryption [30,31].Also, It is less costly in terms of energy consumption compared to many consensus algorithms [32,33], which is an important factor in media and applications that use low-efficiency devices.When agents are waiting for each other to exchange y i values to decrypt x i , and one of them failed in the previous step, the others have to wait for a limited time and then start over.This procedure is obligatory to avoid endless waiting.The waiting time depends on the environment and the application.Domination is almost impossible because the generated numbers x i and y i are secret; besides, the choice of winner is pseudo-random.It is not possible to manipulate x i and y i or predict the consensus outcome.Regarding scalability, the first step is to calculate the participants' number N ; then, the agents will make a consensus based on N .In the worst-case scenario where the number of agents is significant, the maximum waiting time to calculate N can be enlarged; thus, a scalable system is going to be built.

The applied multiple decision situation and agent characteristics description
In the intelligent industry, there is a set of situations with multiple decisions, or rather multiple choices, and in the end, it is necessary to adopt one of these options or decisions.Some examples could be the following: Fig. 6 The acting of agent-inside, here consensus is clearly shown where exactly the proposed algorithm is executed.
• Forecasting the availability or unavailability of materials: when a group of agents is responsible for forecasting the availability of a material, the decision of one of these agents will be retained.• Receive a set of tasks: a consensus must be established in order to determine which agent will be assigned the most critical task.• Market selection: since the knowledge is different for each agent, there will be a difference in the opinions of the agents on the marketing of goods, so one of these opinions will have to be chosen by a consensus process.• Choose a supplier: when resources are lacking, they will be requested from other suppliers and a multi-agent system is used to do this process.Each agent has to submit a proposal based on their knowledge consisting for example of the confidence of the supplier, etc. Afterwards, one of these suggestions should be selected.
The proposed algorithm was applied to the selection of the manager agent in the process of sharing distributed manufacturing resources (DMR).Since companies are geographically dispersed and manufacturing resources of organizations are spread across different areas, a common scheduling model for DMR will need to use a multi-agent system.The purpose of the schedule is to decrease the service span and the manager agent (MA) has cognitive and rational abilities.MA is responsible for dealing with orders, arranging the production planning and scheduling of the orders, and controlling the actions of the other agents.Also, the MA can negotiate directly with the source provider.Before the MA is selected, each agent will act according to the scheme shown in Figure 6.

Agent characteristics description:
• Attributes: Set of attributes that characterize its simulated state at a given instant of time.These attributes include principal information about an agent e.g., agent identifier.• Knowledge: this consists of knowing details about the environment and other agents.This includes information related to the agent identifier and the input needed to execute the consensus algorithm.In a more comprehensive simulation, it might include the past performance of different agents or suppliers where these values can also be dynamically updated.• Interactions: constraints that define the agent's relationship with other agents in a consensus process, e.g., the set of agents with which it can interact.

Architecture and implementation
In this section, the types of agents and their behaviors will be described in order to choose the appropriate type for the proposed model, then we will talk about the algorithm implementation.

Architectures and communication
Within the MAS, there are different types of agents that are categorized by the issues to be addressed.Three types of agents can be distinguished: reactive, intentional, and social.The first type responds to environmental changes and incoming messages.The second type behaves in an independent and rational manner, as they make and implement plans of action depending on the updated information.The third type has common characteristics of both types in the formulation and implementation of action plans.It relies on information sharing protocols as a rational and consistent response, which is the type of choice in this experiment.MAS architectures differ according to the range of application domains i.e., the number of factors, system design, and the number of variables that determine the decision-making behavior of agents.They are functional, hierarchical, and blackboard structures.The functional architecture manages each task of a total process as a single agent.Agents connect and communicate with each other according to predefined ways.A blackboard structure is a distributed system of decision-making, with agents involved in executing tasks and sending work to a central board.This is to avoid bottlenecks by offering tasks to all agents.The hierarchical structure combines features of the first two, consisting of heterogeneous agents cooperating in hierarchical relationships.This is the utilized architecture in the conducted experiments.These experiments consider blackboard-based communication, where each agent can put information (data, knowledge) on the common space, and each agent can read from the blackboard at any moment; hence, there is no direct communication between agents.In the experiment, the space is a common matrix.The matrix contains five columns, and the number of rows varies depending on the number of agents participating in the consensus process.The first column is the agent ID, the second column is to store the multiplication value between the two randomly generated numbers, the third column is to store the value of the second number which is masked by the exponential operation, the fourth column is used to share the original value of the key (the second number), and the last column is to display the value of the first number on which the selection will be made.

Implemented algorithm
In experiments, each agent was simulated by a process, where multi-process programming was implemented.In several tests, a different number of processes was created, each of them starting with the creation of a random number ID ← random(), which is considered as the ID of the agent.Afterwards, each process follows the execution of the proposed algorithm (Algorithm 2). Figure 7 represents the behavior of the proposed algorithm when varying the number of participant agents in the consensus.The prime number p equal to 1000003 has been chosen, the values x and y are random in the range [100, 1000].It is worth noticing that with the number of agents being less than 15, the increase in time was relatively small since this increase represented on average was approximately 0.5 seconds.When the number of agents exceeded the number of 15, a faster increase was observed in execution time compared to the first two experiments, where this increase was 1 sec.This is due to the increased time resulting from the exchange of the messages containing the keys, as well as additional operations for encryption and decryption and calculation of the results to extract the leader.Figure 8 presents an example of applying the communication method chosen in the experiments, a blackboard.At time t 0 , the common main matrix M is empty, at time t 1 , this matrix M is accessible by all agents to fill in the first three columns, the identifier ID, the selection value x, and the encryption key y to exchange this information.M is accessible via exclusive access.In time t 2 , all agents declare their private key by placing it in the main matrix M in the fourth column.No agent can put another key than the first by which it encrypted the value of selection x, because this one was put in the encrypted form of exponential operation in time t 1 (y y mod p).At time t 3 , each agent creates its own matrix (copy of M ).Each agent calculates all selection values x ′ s , by dividing the second column (containing the multiplication of x and y) by the fourth column containing the key y.In time t 4 , each agent sorts its matrix in ascending order.At time t 5 , each agent extracts the leader using the process described in the Algorithm 2 line 23.The result that each agent gets should be the same as the other results, i.e., all agents get the same leader, and this is what was proved in the experiment.the leader is M (1, v) end function Table 1 represents the details of progress execution time.It must be noted that the first step of the execution of the algorithm takes all the time (almost 90%), due to the waiting time necessary to exchange the information, the identifier (ID), the value of the selection (x), and encryption key (y).Later, each agent runs on its own fabric, which greatly reduces the execution time of operations.

Conclusion and future research
Agent-based systems are increasingly being utilized to support decision-making in manufacturing systems, especially critical tasks, and environment-sensitive in terms of reliability and associated acceptance criteria that relate to risk and safety considerations.To address this challenge, this paper presented an effective algorithm for safe and rapid decision-making in a multi-agent paradigm, where it can be applied in several practices related to intelligent manufacturing such as obtaining information, scheduling tasks, managing resources, etc.However, although the effectiveness of this algorithm proved to be high, some key future directions that we plan to work on, are: • To expand it where tasks can be more complex, made up of interrelated subtasks, each requiring different types of knowledge.• This algorithm can be improved by a number of modifications.For example, each agent can be tied to weight so that this weight factor can increase -or decrease -that agent's chances of being a candidate.This weight factor can be expressed by the amount of knowledge of the agent, for example, or its success rate in previous tasks.

Fig. 1
Fig.1An illustration of agent interactions in an environment supplied with basic information where not all agents are involved in all decision-making.

)Fig. 4 Algorithm 1
Fig.4An overall architecture: MAS-based decision use case in smart manufacturing, where each agent use their own knowledge to make their own decision based on the mission and then everyone nominates one of those decisions.

Fig. 5
Fig.5This figure illustrates the general architecture of the agent that contains the variables it uses and the set of actions it performs.

Fig. 7
Fig.7This figure shows the relationship between the overall execution time of the proposed model and the number of agents in each execution process.

Fig. 8
Fig.8This is an example showing stages of decision selection from among five proposed decisions, where work is carried out on a matrix shared by the five agents, starting from an empty matrix to a matrix containing an agreed final decision.

Algorithm 2 2 : 8 :
Progress algorithm Require: ID, P, MWT, M(5,N) ▷ M: Matrix, N: number of agents Ensure: Leader function Prog generate randomly x generate randomly y 4:v 1 ← x × y v 2 ← y y mod p 6: insert(ID, v 1 , v 2 ) in M time ← 0 while uncompleted M (1) and time < M W T do wait ▷ M (1) denotes the first column that is ID while uncompleted M (4) and time < M W T do wait ▷ M (4) denotes the fourth column that is the key y 16:increase time end while 18:for i ← 1 to N do x ′ ← M (2)/M(4) 20:insert x ′ in M (5) ▷ x ′ is the decrypted value end for

Table 1
Processing time