## 2 Modeling of Vehicles Interactions Due to Simultaneity
### An Optimized Monte Carlo Algorithm for Traffic Generation Considering Single Lane Simultaneity
* The case \(f(x)=3\) is illustrated in Figure 5:
* Generate, if necessary, the vehicle typologies of the three vehicles;  
Figure 3: Step function \(f(x)\) (Equation (20)). consider that the first vehicle is at the end of the lane: In this situation (Figure 5a), the optimal implementation of the procedure calls for the generation of the third vehicle first; in fact, as other two vehicles are traveling the lane, the positions of the third vehicle belongs to the interval \((2\;d,L)\), being \(2\;d\) the minimum length required to hold two vehicles; * generate the position \(x_{3}\;\in\;(2\;d,L)\) of the third vehicle; * owing the fact that the minimum distance between the second vehicle and the two adjacent ones, the first and the third, is \(d\) and considering that the position of the second vehicle belongs to the interval \((d,x_{3}\;-\;d)\) (Figure 5b), generate the position \(x_{2}\;\in\;(d,x_{3}\;-\;d)\) of the second vehicle (Figure 5c); * since no other vehicles need to be generated, store the data concerning this three-vehicle convoy and go to step \(11\). * The general case \(f(x)\;=\;i\;>\;3\) is illustrated in Figure 6: * Generate, if necessary, the vehicle typologies of the \(i\) vehicles; * consider that the first vehicle is at the end of the lane: On the basis of the previous discussion about case \(f(x)\;=\;3\), the optimal implementation of the procedure calls for the generation of vehicles in descending order, starting from the \(i\)-th (Figure 6a). Evidently, because other \(i\;-\;1\) vehicles are traveling the lane and the minimum length required to hold \(i\;-\;1\) vehicles is \((i\;-\;1)\;d\), the position of the \(i\)-th vehicle belongs to the interval \(((i\;-\;1)\;d,L)\); * generate the position \(x_{i}\;\in\;((i\;-\;1)\;d,L)\) of the \(i\)-th vehicle; * recalling that the minimum distance between the \((i\;-\;1)\)-th vehicle and the two adjacent ones is \(d\) and therefore the position of the \((i\;-\;1)\)-th vehicle belongs to the interval \(((i\;-\;2)\;d,x_{i}\;-\;d)\) (Figure 6b), generate the place \(x_{i\;-\;1}\) of the \((i\;-\;1)\)-th vehicle, \(x_{i\;-\;1}\in((i\;-\;2)\;d,x_{i}\;-\;d)\) (Figure 6c); * repeat the procedure for the \((i\;-\;2)\)-th vehicle, etc. until the third and the second vehicle are generated (Figure 6d,e); * when all the \(i\) vehicles have been generated, store the data concerning this \(i\)-vehicles convoy and go to step \(11\). Check the total number of generated vehicles: If the number matches that required for the traffic sample end the procedure, or else go back to step \(7\). Figure 4: Generation of two simultaneous vehicles: (**a**) Available locations for second vehicle; (**b**) relative positions of generated vehicles. Figure 5: Generation of three simultaneous vehicles: (**a**) Available locations for third vehicle; (**b**) available locations for second vehicle; (**c**) relative positions of generated vehicles. Finally, an artificial traffic sample is obtained, fully complying with the theoretical probability that several vehicles are simultaneously traveling the lane, as well as with the traffic composition. Obviously, these traffic samples can be suitably used as input data when simultaneity on two or more lanes is investigated, as discussed next. Figure 6: Generation of three simultaneous vehicles: (**a**) Available locations for i-th vehicle; (**b**) Available locations for \((\mathrm{i}-1)\)-th vehicle; (**c**) Available locations for \((\mathrm{i}-2)\)-th vehicle; (**d**) Available locations for second vehicle; (**e**) Relative positions of generated vehicles. Of course, although the present study is mainly devoted to traffic loads on bridges, the field of application of the procedure is much wider. In fact, as the procedure allows to deal with traffic composed only by lorries, as well as by lorry and cars, it is suitable also for typical transportation problems.