# XOR Binary Gravitational Search Algorithm with Repository: Industry 4.0 Applications
## 6 Industry 4.0 Applications  
In current manufacturing environments, modifications made to a product often require redesign and retraining/programming of production elements on the factory floor. Optimal or sub-optimal solutions to design changes in a process is the goal of decision-making processes. Recent work has explored showing that systematic optimization is possible in a well-defined detailed digital twin in which searching algorithms can perform multiple trial and errors without safety and resource restrictions. Additionally, current robot programming techniques require highly talented professionals  
Figure 3: Box plot obtained for the knapsack problem using the proposed XOR BGSA vs. three other algorithms namely: BGSA [16], BGWO [18] and BDA [19]. Knapsack optimization problems 7 to 18.  
to perform programming, which increases response times and increases costs [27]. Real-time decision making and robot programming is therefore highly desirable and is a stated requirement of Industry 4.0 [28]. However, autonomous programming of robots will impact safety and certification requirements as well. To mediate such impacts, one solution is to tie the digital twin solutions to the real-production methods. Such a digital twin needs to be as accurate as possible to ensure compatibility of actions with real world. The simulated movements in such an environment can then be transformed to the real robot after full examination of resulting optimization solutions by a human expert. This framework makes the most of machine learning and artificial intelligence approaches. In this part, the proposed XOR BGSA with repository is used to find an optimal solution for assembly task planning and motion planning for an industrial robot namely UR5 that would then be passed to a human for certification before implementation. Previously the proposed XOR BGSA is tested against different types of optimization problems including uni-modal, multi-modal, those with single optimum solution, those which suffer from multiple local minimums and knapsack optimization problem which is a constrained one. The fact that the proposed optimization procedure obtained the best results among six binary optimization problems in most cases motivates us to use it in Industry 4.0 optimization problems. It is required for robots to be able to optimally plan their own task autonomously otherwise massive resources may be used to redesign, reconfigure and reprogram them. To fulfil this goal, it is required to decode the planning process in the form of an optimization problem and use artificial intelligence approaches to solve the problem on a UR5 capable of handling 5 Kg loads to a precision of order of 0.1 mm. The assembly task planning to be optimized in this application is to put bolts in their respective places while minimizing the distance. The bolts used in this study are from three different types of of \(M6\times 20\) mm, \(M8\times 20\) mm and \(M10\times 20\) mm. Hence, we have three different type of nuts which must be fastened using the bolts. The place and the position of the nuts and bolts are depicted in Figure 4 with the \(z\) component of position for nuts being on 5.7 cm and for bolts being equal to 7 cm. Such an assembly task is similar to the benchmark problem frequently solved in computer science projects called the travelling salesperson. The cost function to be optimized in this case is the total distance travelled with main difference between the assembly task designed to test the proposed XOR BGSA and the travel salesperson being that in the current experiment, we have certain bolts which can be used to fasten certain nuts; this imposes some constrains on the optimization problem. To encode the optimization problem, 31 bits are considered for each individual. Inspired by the results obtained by the proposed optimization procedure, it is used to minimize the total distance travelled by UR5 during the assembly task of industrial calculator (See Figure 5).