## 2 Materials and Methods
### Optimization Process  
The proposed method requires a simulation model capable of evaluating the movement of a robot manipulator through a given end-point trajectory while computing the values of joint angles and torques in individual time steps. This is possible, for example, in the popular robotic simulation system CoppeliaSim (formerly known as V-Rep), which was also chosen for our work.  
The scripting capability of CoppeliaSim allows programming a robot's end-point movement through a given trajectory and time, and the built-in physics engine (i.e., Bullet 2.78) is able to check for collisions and evaluate joint torque values. The inverse kinematics (IK) are calculated using the integrated pseudoinverse IK solver. The CoppeliaSim API (Application Programming Interface) framework (_RemoteAPI_) can be used to remotely configure the simulation, which, in our case, includes particularly the process of changing the robot placement relative to the trajectory, as we are trying to determine the optimal placement of the robot. A custom application was written in Visual C++ for this purpose.  
Due to the long simulation times in CoppeliaSim, especially in the cases when the IK calculation fails (the robot cannot reach some parts of the given trajectory), all valid positions of the robot relative to the given trajectory were pre-calculated in the C++ application and CoppeliaSim was used only to calculate the fitness function value in those positions. The valid locations were found using a simple kinematic simulation inside the C++ application, which can quickly verify the ability of the robot to fulfill a given task from the specific location, including collision checking.  
The search space is represented as a discrete 3-dimensional grid with the spacing in all three dimensions equal to \(s=0.03\) m. The system returns the valid robot positions as a list of points, where each point represents the location of the center of the robot base (see the coordinate system in Figure 2a) in the workspace. Verification of the whole robot trajectory in this simulation system took approximately 1800-times less time than the same task in CoppeliaSim, and invalid robot locations were discarded even faster.  
For the reproducibility of the research, this supplementary custom simulation system is not necessary, as its main purpose is simply to shorten the overall simulation time. However, it is necessary to have an external application or a script in CoppeliaSim that successively places the robot in the locations from the above-mentioned search space (grid), executes the CoppeliaSim simulation, and calculates and stores the results.  
The reason for choosing a 3-dimensional grid for the potential locations of the robot base instead of a 2-dimensional plane (representing the factory floor) is that the proposed method is intended to be as general as possible, and limiting the search to a 2-D grid could likely miss some interesting solutions. In reality, robots are commonly mounted on a stand, table or a console; therefore, the height of the robot can be chosen. However, the results can be easily limited to, for example, a 2-dimensional plane, if the actual application requires such a limit.