# XOR Binary Gravitational Search Algorithm with Repository: Industry 4.0 Applications
## 1 Introduction
The third category of optimization algorithms is physics-inspired approaches in which, other than position and velocity, each particle benefits from more physical properties such as force, mass, electrical charge, etc. Examples of physics-inspired optimization algorithms are Big Bang-Big Crunch [11], central force optimization algorithm [12] and gravitational search algorithm (GSA) [13]. Among physics-inspired optimization algorithms, GSA is one of the most successful optimization algorithms [14]. Each particle in this algorithm benefits from mass, position vector, velocity vector and acceleration vector. The value of mass assigned to each particle is proportional to its merit with highest value being assigned to the best particle and the lowest value being assigned to the worst one. The gravitational force acting on these particles make the worst particle accelerated towards a low number of \"best\" particles, while searching the whole space for a possible \"better\" solution. To apply real-valued optimization algorithms to binary optimization problems, they are required to be modified considerably. In swarm-based and physic-inspired optimization algorithms, a randomly weighted velocity vector is added to position vector to obtain new position. The well-knownmodification to such problems is to change the definition of velocity to probability of change in bits of each dimension [15; 16]. However, the analysis in this paper shows that in the case of binary gravitational search algorithm (BGSA), the probability vector does not always behave as expected. To alleviate this problem, the velocity vector and consequently the probability of change is modified in this paper to include an exclusive or (XOR) operator. In this paper, the way mass values are assigned to each object, in the current BGSA, acceleration equation and formula for update of the change probability and position are fully analysed. The acceleration term is modified to use an XOR term. A repository is added as well to improve the performance of the optimization algorithm. To test the efficacy and performance of the proposed optimization algorithm, it is validated in simulation against a number of benchmark optimization problems. It is shown that the proposed algorithm is capable of optimizing such benchmark optimization problems with superior performance when it is compared to BGSA [16], improved binary particle swarm optimization (IBPSO) [17], binary particle swarm optimization (BPSO) [15], binary grey wolf optimization (BGWO) [18] and binary dragonfly optimization algorithm (BDA) [19]. Next, two Industry 4.0 applications namely assembly task planning and industrial robot path planning are considered. Assembly task planning is then validated on a digital twin first and then implemented on a physical robotic system. For the assembly task planning, a mock industrial calculator is designed and 3D printed. The studied task is to put bolts in their place using a robot manufactured by universal robot company namely UR5. Such an optimization process makes the production line robust as any new configuration for nuts and bolts can be easily given to the robot and it will optimally solve the sequence. It is shown that the proposed optimization algorithm is capable of planning this task and the length of path travelled by the robot is decreased by almost 17% in comparison to the human generated original pathway which leads to reduction in time and cost. Furthermore, path planing of the same robot in the presence of obstacles in its digital twin is considered. It is shown that the proposed approach is successful in finding an optimal path. In real-world practice the path generated in the digital twin would then be sent for human expert approval before transfer to physical robot. Such an automated optimization task reduces the need for intervention, yet keeps human elements involved as a safety measure. This paper is organized as follows: In Section 2, real-valued GSA is discussed.