# Finding Optimal Manipulator Arm Shapes to Avoid Collisions in a Static Environment
## 4 Optimization Algorithms
### Method 2--PSO Algorithm without Collision Analysis  
The algorithm based on the particle swarm optimization (PSO) method relies purely on the ability of PSO to find the solution to the given problem; there is no need for the detailed collision classification described above, and collision events are not recorded. Collisions still have to be checked, but the feedback is only in the binary form (no collision occurred; some collision occurred). This algorithm starts directly with the arms in any configuration (unlike the previous algorithm, which required the arms to initially be as short as possible). PSO [26] solves the problem using a population of particles that move in the search space in a way that eventually converges to the optimal solution based on the specified fitness function. This particular optimization method was chosen because it is one of the commonly used methods in various applications and because it can be implemented efficiently. The aim of this work is not to compare various optimization methods, but merely to demonstrate that optimization methods can be used for our purpose.  
The search space in our case is six-dimensional, with the following variables, all normalized to the range \(\langle-1;1\rangle\):  
* Distance between the joints of the lower arm (\(d_{\text{L}}\)),
* Bending direction of the lower arm (\(b_{\text{dL}}\)),
* Bending amount of the lower arm (\(b_{\text{aL}}\)),
* Distance between the joints of the upper arm (\(d_{\text{U}}\)),
* Bending direction of the upper arm (\(b_{\text{dU}}\)),
* Bending amount of the upper arm (\(b_{\text{aU}}\)).  
The fitness function was chosen with respect to the goal of finding the smallest robot:  
\[F=0.2d_{\text{L}}+0.2d_{\text{U}}+0.3b_{\text{aL}}+0.3b_{\text{aU}}, \tag{30}\]  
where all the individual factors (as mentioned above), and thus also the resulting value of \(F\), are in the range \(\langle-1;1\rangle\). The chosen weights give slightly more importance to the bending amount (0.3 for each link) than to the distance between the joints (0.2 for each link), which means that even a slightly longer straight arm is considered better than an arm with a curve.  
The PSO variation implemented uses the fully connected neighborhood structure (also called the Global Best PSO), which typically provides the fastest convergence speed, but can be worse in exploring outside the locally optimal regions [27; 28]. The termination of the iterative process is configured according to the \"no improvement\" method, with a slight alteration: A particle becomes inactive (not updated anymore) if its personal best fitness function value has not improved by more than 0.0001 over the last 10 eras; the whole swarm calculation stops when no particles are updating. To increase the initial coverage and diversity of the particles, a large number of 1000 particles was used; this simplified approach provides acceptable results, but could preferably be replaced by some of the Multi-Start PSO methods and a lower number of particles [28]. Particles that correspond to a robot configuration that is not able to fulfill the given task (i.e., the robot is in a collision or the IK failed) are always given the fitness value \(F\) = 10,000.