Mathematics and Computers in Simulation 49 (1999) 285±296
Mathematical model of sectoring in 3D space Eugene P. Pauloa,*, Linda C. Maloneb a
b
Department of Systems Engineering, United States Military Academy, West Point, NY 10996, USA Department of Industrial Engineering and Management Systems, University of Central Florida, Orlando, FL 32816, USA Received 1 January 1999; accepted 1 March 1999
Abstract This paper describes a mathematical model used to support an in-depth simulation study that investigated a variety of sectoring methodologies intended to increase simulation efficiency in the case of autonomous moving objects in 3D space. The potential physical systems that could be represented in this fashion are airplane traffic flow, combat entities on the ground and in the air, and blood flowing in the body. The mathematical model considers effect of possible collisions between moving objects, as well as the impact of overhead created by sector crossings. Different sectoring methodologies are analyzed, which consider the impact of different sector shapes (cubes or spheres) on the number of possible pairwise comparisons. Certain empirical data generated from the corresponding simulation was used for expected number of collisions and sector crossings. Future research could develop true mathematical formulations for each piece of the mathematical model. The mathematical model provides important information into the movement of objects in 3D space. It gave insight into the potential benefits of using different sectoring methodologies under varying conditions. Additionally, the model provided a new approach that included the effect of sector crossings on number of pairwise comparisons. # 1999 IMACS/Elsevier Science B.V. All rights reserved. Keywords: Fixed sectoring; Dynamic sectoring; 3D autonomous objects; Sector crossings
1. Introduction Mathematical modeling of a physical phenomenon has many benefits. When used in conjunction with a simulation that is also developed to study the physical phenomenon, a means of comparison and prediction become possible. This paper discusses the development of the framework of a mathematical model used to support an in-depth simulation study that investigated a variety of sectoring methodologies intended to increase simulation efficiency in the case of autonomous moving objects in ÐÐÐÐ * Corresponding author. Tel.: +1-914-938-8169; fax: +1-914-446-7211; e-mail:
[email protected] 0378-4754/99/$20.00 # 1999 IMACS/Elsevier Science B.V. All rights reserved. PII: S 0 3 7 8 - 4 7 5 4 ( 9 9 ) 0 0 0 4 2 - 7
286
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
3D space. The potential physical systems that could be represented in this fashion are airplane traffic flow, combat entities on the ground and in the air, and blood flowing in the body. Recent research into modeling and simulation efficiency has found merit in the concept of sectoring [2±7]. For spatial objects to move autonomously in a simulation, the location vector of all other objects within the simulation boundaries must be tracked. This means that determining subsequent events (collisions) results in each object querying every other object. This technique is computationally inefficient when the number of objects gets large. The idea of sectoring allows the trajectory space to be split into sectors of certain geometric shapes that require an object to query only other objects that are in its sector or adjacent sectors. While sectoring reduces the number of queries between objects, the crossing of sector boundaries becomes an additional event to track and compute. Therefore, in order for sectoring to be beneficial, the reduction in overall queries between objects must overcome the additional computational load of tracking the objects as they cross sector boundaries. 2. Framework of the mathematical model Previous attempts to describe this physical phenomenon with a mathematical model have focused on the instance of the collision event, and the subsequent computational complexity required to determine the next event [8]. Specifically, this methodology is based on the aftermath of a collision between balls or between a ball and the simulation boundary, and estimates the number of pairwise comparisons necessary to establish a new sequence of scheduled events. Consequently, the impact of sector crossings was not examined. The new mathematical model also estimates the number of pairwise comparisons, but extends the focus from one collision instance to a specific distance traveled by a ball. As a result of this distance traveled by the ball, an expected number of collisions and an expected number of sector crossings can be estimated for that ball. Consequently, an estimate for the total amount of computational effort (possible pairwise comparisons) during this time period can be made based on this expected number of events and the computational cost of determining the next event. These steps are effective for fixed and dynamic sectoring methodologies, as well as different shaped sectors. The derivation of this mathematical model requires two parts. The first involves determining the computational complexity (as measured by the number of comparisons) required to calculate the next event (collision or sector crossing) for a ball that just completed an event. This includes the steps necessary to calculate the next event for the ball being considered, as well as updating the master event list. The second part is to estimate the number of events that will occur over a specific period of time. 2.1. Determine next event and update master event list The flow chart (Fig. 1) describes part one of the process. To begin, assume that an event has just occurred and now the ball (or balls) involved in the event must have its (their) next event scheduled. The first step in scheduling the next event is to identify the type of conflict, or event. Here, a determination is made as to whether the ball will next touch a boundary (sector or trajectory space) or another ball. The event is then resolved, meaning a new velocity vector is assigned if the event was a type of collision, rather than a sector crossing. Then, that ball and all other balls are advanced to their
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
287
Fig. 1. Determining next event of a single object.
updated locations. If the event was a collision between balls, then the second ball must have its next event identified, resolved, and placed on the master event list. If the event was a sector crossing, the ball's new sector must be identified and updated. Differences in the computational intensity occur depending on whether a sectoring methodology is being used. For any sectoring methodology, the model compares trajectories of the object with all other objects in the current sector and adjacent sectors. All adjacent sectors are checked due to the possibility that an object may be at or near the sector boundary, and a collision at a boundary may occur. If no sectoring is used, the model must check for possible collisions of the ball with all other objects in the simulation. The result will be the next scheduled event for the object involved in the collision. The second stage compares the time of the newly scheduled event with those currently in the master event list. The model searches for the proper place in the event sequence for the new event and places it there. Additionally, the new event could involve another object (assuming the new event is a collision between balls) and therefore the event previously scheduled involving this new object must be removed. This removal means that the object that would have collided with this object must also have a new event calculated. This cycle of continuously updating the event list, as a worst-case, could occur for every object in the trajectory space. This phenomenon is displayed in the Fig. 2, and includes the worst-case assumption that all currently scheduled events are collisions between balls, since the rescheduling of an event in the master list involving only one ball would cause the master list update process to halt. An apparent result is that the second stage of the process could greatly dominate resources in the portion of the problem when the next event is calculated.
288
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
Fig. 2. Updating master event list.
2.2. Calculate expected number of events Over a period of time, the balls move a specific distance depending on their velocities. While moving this distance, it is possible to estimate how many collisions between balls, between ball and boundary, and sector crossings occur. The expected number of each type of event for each sectoring methodology is a function of the number and radii of balls, and the number of sectors. 2.3. Event estimation methods A complete mathematical model was not developed for the expected number of collisions between balls, collision between ball and boundary, and sector crossings. Instead, the estimates for the number of collisions between balls and between ball and boundary were based on actual data taken from the simulation developed by the author for this research. During selected simulation runs, the number of both types of collisions were recorded for each unit of time on the simulation clock. The estimates for the expected number of sector crossings are based on actual data and basic probability assumptions. While the number of sector crossings per time unit was not collected, the total number during the simulation was recorded and an average number of sector crossings per unit time was calculated for each simulation run. Additionally, a way to add validity to this result is to consider the distance traveled, the spacing of the sector boundaries, and approximating the probability that a ball traveling this distance would cross a sector. Using this approximation of the probability of a single ball crossing a sector given that it traveled a specific distance, and multiplying by the number of balls in the
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
289
current model, an estimate of the number of sector crossings per time unit is made. The specifics of these calculations and approximations are provided below in the discussion of each methodology. 3. Applying the model to sectoring methodologies Estimates of the number of comparisons involved in performing the steps discussed above were developed for the various sectoring methodologies. A summary describing the results of these applications is found in the sections below. 3.1. No sectoring methodology The work associated with determining the next event for the object involved in the latest collision is N6. This comes from the requirement of the object to check its new trajectory with those of every other object in the simulation for a possible new collision (which is actually Nÿ2, but simplified to equal N), as well as each of the six boundaries in the 3D trajectory space. To update the master list in the no sectoring methodology, `worst-case' assumptions are made, in that the process described above leads to an update of the entire list, which consists solely of ball collisions. For N number of objects in the simulation, the upper limit of the measurement of the amount of work necessary to update the master event list is (N/2)(N6) or (N2/2)3N. Therefore, the estimated amount (worst-case) of pairwise comparisons needed to determine the next event for the no sectoring methodology is: N2 4N 6: 2
(1)
For the calculation of work required through a specific time period, Eq. (1) is multiplied by the total expected number of events during this time period. The total expected number of events for the no sectoring methodology is the sum of the expected number of collisions between two balls EBCN;r (multiplied by 2, since two balls are involved, with each needing its next event determined) and the expected number of collisions between a ball and the trajectory space boundary EBTN;r . Therefore, the estimated amount of pairwise comparisons over a specific time period for the no sectoring methodology (WNS) is: ÿ N2 4N 6 : (2) WNS 2EBCN;r EBTN;r 2 3.2. Fixed sectoring methodology, uniform/random object distribution Calculating order of work for fixed cubic sectoring is somewhat more complicated. This methodology divides the trajectory space into k cubic sectors of equal dimension. If spatial objects are distributed uniformly throughout the simulation region, the expected number of objects in each sector is N/k. Following a collision, the determination of the next event follows the two-stage process described above. Basically, the new velocity vector of the object that just collided in a particular sector is
290
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
examined and compared to the vectors of the other objects in that sector and adjacent sectors. The time of any potential collisions is recorded, and the earliest is compared to the projected time of reaching the sector boundary that lies within the trajectory of the ball. The amount of work necessary to complete these comparisons is:
N=k
ASk;SM 1 6
(3)
where ASk;SM is the average number of adjacent sectors, and is dependent on k, the number of sectors, and SM, the sectoring methodology being used. The maximum number of adjacent sectors is 26 (assuming a center cubic sector), while the minimum number of adjacent sectors is 7 for corner sectors. Since the number of adjacent sectors varies, it will be designated as the variable ASk;SM . The new event is then inserted into the master event list, which triggers the cycle of determining a new schedule of events. The steps required to update the master event list are equivalent to those used by the no sectoring methodology. Again, assuming a worst-case scenario, the amount of computational effort is based on all scheduled events being collisions between balls, and that the new event scheduled affects the current event that is at the top of the list. This situation, if continued throughout the entire master list, would result in N/2 balls being rescheduled, with a computational cost of N=k
ASk;SM 1 per ball. Therefore, the second stage in which the master event list is updated has a worst-case of: N N
ASk;SM 1 6 : (4) 2 k Overall the measure necessary to determine the next event for fixed sectoring, uniform ball distribution is the sum of (3) and (4), is: N2 Nÿ ASk;SM 1 6 : (5) 2 k For the calculation of work required through a specific time period, Eq. (5) is multiplied by the total expected number of events during this time period. The total expected number of events for the fixed sectoring methodology is the sum of the expected number of collisions between balls EBCN;r (again multiplied by 2, since two balls are involved), the expected number of collisions between a ball and the trajectory space boundary
EBTN;r , and the expected number of sector crossings
ESCN;r;k;SM . The expected number of sector crossings is a function of the number of balls, radius of the balls, the number of sectors, and the sectoring methodology. Therefore, the estimated total amount (worst-case) of pairwise comparisons over a specific time period for the fixed sectoring methodology with uniform or random distribution (WF;U ) is: ÿ N 2 Nÿ ASk;SM 1 6 : (6) WF;U 2EBCN;r EBTN;r ESEN;r;k;SM 2 k 3.3. Dynamic sectoring (cubic sectors) methodology Dynamic sectoring with cubic sectors appears useful when objects are no longer distributed uniformly or randomly throughout the simulation region, but rather are clustered in certain areas. A pair
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
291
Fig. 3. 2D dynamic sectoring (squares).
of thresholds are introduced into the simulation, with one being the upper limit of objects allowed in the sector before that sector sub-divides into smaller square sectors, and the other being the lower limit allowed in sub-divided sectors before the smaller sectors consolidate into their previous larger sector. In the 2D figure (Fig. 3), the threshold value is 3, so that any sector having more than three objects will sub-divide into smaller square sectors such that none of the smaller sectors have more than three objects. The calculation of order of work for dynamic sectoring with cubic sectors is similar to fixed sectoring, requiring several small adjustments. First, the average, or expected, number of objects per sector (N/k) is now approximated by the threshold value, which can be called t. Additionally, the number of sectors (k) becomes a variable s, since the number of total sectors changes throughout the simulation as sectors are sub-divided and then consolidated. Finally, the upper bound of the number of possible adjacent sectors, ASk;SM , theoretically changes to infinity (assuming N could also reach infinity). The upper bound is a function of the number of balls (N) and the threshold value (t). The following equation represents the total number of pairwise comparisons to determine the next event using dynamic sectoring with cubic sectors (WD;C ): N2 ÿ (7) t ASk;SM 1 6 : 2 Extending this calculation to a specific time period means that the estimated amount of possible pairwise comparisons for the dynamic sectoring methodology with cubic sectors (WD;C ) is: ÿ N2 ÿ WD;C 2EBCN;r EBTN;r ESCN;r;k;SM (8) t ASk;SM 1 6 : 2
292
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
3.4. Fixed sectoring (concentric spheres) methodology While the use of square sectors (cubic in 3D) has been studied in several simulation research efforts, other sector shapes may also be worth consideration. Concentric spherical sectors seem to have several advantages over cubes. These advantages can be seen in situations of both fixed sectoring, where the balls are distributed uniformly or randomly, and dynamic sectoring, where the balls form clusters. The calculation of order of work for fixed sectoring with concentric spherical sectors is similar to fixed sectoring with cubes, except for one significant change. The number of adjacent sectors
ASk;SM is approximated to be 2, since the concentric nature of the sectors means that the outer-most and inner-most sectors have one adjacent sector, while the remaining sectors have two adjacent sectors. Substituting 2 for ASk;SM in Eq. (5), the calculation of the total amount of work to determine the next event using fixed sectoring with concentric spherical sectors (WF;S ) uses the following equation: N 2 3N 6 : (9) 2 k Extending this calculation to a specific time period means that the estimated amount (worst-case) of possible pairwise comparisons for the fixed sectoring methodology with concentric spherical sectors (WF;S ) is: ÿ N 2 3N 6 : (10) WF;S 2EBCN;r EBTN;r ESCN;r;k;SM 2 k 3.5. Dynamic sectoring (concentric spheres) methodology The notion of using concentric spheres, or 3D ellipsoids, may be particularly helpful for certain types of object distribution. Rather than just the occurrence of clusters, where certain areas have a noticeably higher concentration of objects than other areas, consider the case where most of all the objects move toward and remain near a particular region of the simulation space. This region, or point in space, is called an attractor, and results in a single concentration of objects in the simulation region. A practical application of this might be an airport, or the main battle area of a military conflict. For dynamic sectoring with concentric spheres, the number of sectors varies according to a designated threshold, or t, which is the maximum number of objects allowed in the spherical sector before an additional spherical sector is created. The computation of possible comparisons is basically the same as for dynamic sectoring with cubic sectors, with the exception of (ASk;SM ) again set at 2. Therefore, the equation for the total possible work needed to determine the next event using dynamic sectoring with concentric spheres
WD;S is: N2
3t 6 (11) 2 where ASk;SM is set at 2. Extending this calculation to a specific time period means that the estimated amount (worst-case) of possible pairwise comparisons for the dynamic sectoring methodology with
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
293
concentric spheres
WD;S is: WD;S
ÿ N 2 2EBCN;r EBTN;r ESCN;r;k;SM
3t 6: 2
(12)
4. Case study using mathematical model Simulation data is available only for fixed sectoring using random and uniform distribution of balls. The three methodologies examined are no sectoring, fixed sectoring using cubic sectors, and fixed sectoring using concentric spheres. While dynamic sectoring with cubes is not specifically examined, intuitively it should provide the same results as fixed sectoring when objects are distributed uniformly. 4.1. Methods of estimating input variables For the comparison, a 3D trajectory space with 216 cubic sectors (k) and a total number of 1500 objects (N) was chosen. The average number of objects, or balls, per sector (N/k) is approximately equal to 7. Only 64 of the 216 are not at least a part of the trajectory space boundary, and therefore those 64 have 26 adjacent cubic sectors. Of the remaining 152 sectors, eight sectors have seven adjacent sectors, 48 sectors have 11 adjacent sectors, and 96 sectors have 17 adjacent sectors, depending on whether the sector being considered forms a corner of the simulation space or merely part of the simulation boundary plane. The average number of adjacent sectors at k216 is: AS216;fixed cubes
8 7
48 11
96 17
64 26 17:96: 216
(13)
Establishing accurate values for EBCN;r , EBTN;r , and ESCN;r;k began with an attempt to understand the distribution of these random variables. Simulation data were collected for various conditions using fixed sectoring and no sectoring. The number of ball collisions and boundary collisions that occurred during each single time unit was collected for various combinations of number of balls and radius. The results of a Kolmogorov±Smirnoff test indicate that the assumption of normality is not rejected [1]. With this consideration of the distributions of the number of ball collisions and number of collisions between ball and boundary, the simulation average number of collisions between two balls and between balls and boundaries can be used as an estimate of EBCN;r and EBTN;r , since x is an unbiased estimator of the mean of a normal distribution (see Table 1).
Table 1 Number of collisions between balls generated by the simulation Balls/radius/sectors
EBCN;r
EBtN;r
ESCN;r;k;SM
2000/30/216 1000/30/216 1500/15/216 1500/20/216
54.2 14.33 7.3 13.21
6.3 12.4 7.42 8.12
19.8 23.7 21.0 31.8
294
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
The only data gathered concerning sector crossings was the total number that occurred during each simulation run. ESCN;r;k;SM was therefore approximated to be the total number of sector crossings divided by the number of simulation time units. Values for ESCN;r;k;SM are also included in the table. 4.2. Results With these approximations for the expected values of ball collisions, collisions between ball and boundary, and sector crossings, an estimate of the number of comparisons can be determined. For N1500, r15, and 216 sectors, the upper limit on the total number of pairwise comparisons through one time unit for the conditions of fixed sectoring and uniform or random distribution of balls is 4 447 737. Under the same conditions, with no sectoring, the upper limit on the total is 24 904 752. The results differ slightly when making only a change in radius of the balls (for instance to r20), since an increase in density, which is a function of the radius, would increase the number of total collisions. Consequently, the number of comparisons increases for both the fixed and no sectoring cases, yet the ratio between the two numbers is similar. In this case, the total number of pairwise comparisons through one time unit for the conditions of fixed sectoring and uniform or random ball distribution is 6 858 737. Under the same conditions with no sectoring, the total is 39 064 947. Conducting a similar comparison with the same number of objects, yet with the number of cubic sectors (k) being set at 1000, results in different numbers of possible comparisons. The average number of objects per sector (n) is now 1.5. The average number of adjacent sectors increases to 20.95, since now a larger percentage of sectors have 26 cubic adjacent sectors, and a correspondingly smaller percentage have between 7 and 17. At a radius equal to 15, the resulting number of possible comparisons for fixed sectoring is 2 318 151. If the radius is set at 20, the upper limit becomes 2 767 590. Theoretically, more savings may result from the use of spherical sectors. Using 216 concentric spherical fixed sectors, the calculation remains equivalent to that of fixed cubic sectors, with two exceptions. First, ASk;SM is reduced from 17.96 to 2. Second, it is reasonable to assume that the number of sector crossings would be greater than that of fixed sectoring with cubic sectors and random/uniform distribution of balls. This assumption is based on how much total sector boundary (measured in area in 3D environment, and length in 2D environment) is in the trajectory space. Fig. 4 gives visual insight into the problem in 2D. Both the 2D regions below are partitioned into four sectors. If L is set at 4, and R is set to be equal to L/4, then R1. The total lengths of the sector
Fig. 4. Comparing sector lengths.
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
295
Table 2 Pairwise comparison summary (uniform/random dispersion of 1500 balls) Methodology
r15
r20
No sectoring Fixed sectoring, cubic sectors (216 sectors) Fixed sectoring, cubic sectors (1000 sectors) Fixed sectoring, spherical sectors (216 sectors)
24 904 752 4 447 737 2 318 155 866 931
39 064 947 6 858 737 2 767 590 1 336 812
boundaries of the example using square sectors is 2L, or 8. If the radii of the circular sectors (of the example using concentric circular sectors) are R, 2R, and 3R, the total lengths (sum of the circumferences) of the boundaries in that example are 12R, or 37.7. While this means that there is 4.5 times as much sector boundary to cross using concentric circles versus squares in this setting, it is unlikely that ESCN;r;k for concentric circles would be 4.5 times greater than squares. A typical ball, traveling distance d, as shown in the figure, would have two sector crossings using square sectors, and four sector crossings using concentric circles. While the actual number of sector crossings that occur would depend on several factors, a fair estimate is to set ESCN;r;k for concentric circles at twice that of squares. Therefore, for spherical sectoring using r15, the upper limit of pairwise comparisons is 866 931, while for r20 it is 1 336 812. The values for EBCN;r and EBtN;r can be assumed to be the same as for cubic sectoring. A summary of the results is as shown in Table 2. 5. Final analysis and conclusions The above analysis provides insight into the effects of various combinations of sectoring methodologies and object distribution on the amount of computational effort required. Several key points concerning this analysis should be addressed. First, this is the initial attempt at developing and implementing a mathematical model that includes sector crossings. Previously, only work per collision involving a single ball (or single pair of balls) was considered. To address sector crossings, this view was modified to consider events occurring in a specific time period. Second, while many of the estimates are based on actual empirical results, this data was not available for all cases. Therefore, while the mathematical model accurately displays possible improvements using different sectoring methodologies, the scale of these improvements is likely not what is projected in the model. While data-based estimates for input variables provide a basis for analytically investigating this process, it seems quite feasible that a full mathematical model for each of these three events could be built. It also seems reasonable that an analytical model describing the expected number of sector crossings could be constructed based on the average distance between sectors, or (for a 2D simulation) the total lengths of the sector boundaries. Finally, it can be concluded that the mathematical model provided important information into this phenomenon. It gave insight into the potential benefits of using different sectoring methodologies under varying conditions. Additionally, the model provided a new approach that included the effect of sector crossings on number of pairwise comparisons, and allows for future researchers to further enrich and develop the model's mathematical framework.
296
E.P. Paulo, L.C. Malone / Mathematics and Computers in Simulation 49 (1999) 285±296
References [1] R.L. Schaeffer, J.T. McClave, Probability and Statistics for Engineers, Wadsworth Publishing Company, Belmont, CA, 1995. [2] J.G. Cleary, Colliding pucks solved using temporal logic, Proc. SCS Multiconf. Distributed Simulation 22(1) (1990) 219±224. [3] B. Beckman, M. DiLoreto, K. Sturdevant, P. Hontalas, L. Van Warren, L. Blume, D. Jefferson, S. Bellenot, Distributed simulation and time warp (Part 1: Design of colliding pucks), Proc. SCS Multiconf. Distributed Simulation 19(3) (1988) 56±60. [4] W. Bishop, M. Hembruch, A transputer based simulation of colliding pucks, CCECE/CCGEI'95, pp. 920±924. [5] P. Hontales, B. Beckman, M. DiLoreto, L. Blume, P. Reiher, K. Sturdevant, L. Van Warren, J. Wedel, F. Wieland, D. Jefferson, Performance of the colliding pucks simulation on the time warp operating systems (Part 1: Asynchronous behavior and sectoring), Proc. SCS Multiconf. Distributed Simulation 21(2) (1989) 3±7. [6] C. Doescher, A statistical verification of the improvement in computational efficiency of uniformly distributed spatial objects using fixed sectoring simulation, Unpublished Master's Thesis, University of Central Florida, Orlando, 1996. [7] A.P. Goldberg, Object-oriented simulation of pool ball motion, Unpublished Master's Thesis, University of California, Los Angeles, 1984. [8] G.J. Harless, Improving computational efficiency in the discrete event simulation of non-uniformly distributed autonomous spatial objects, Unpublished Doctoral Dissertation, University of Central Florida, Orlando, 1995.