Comparation of nonuniform and uniform Monte-Carlo Searching

Nonuniform Monte-Carlo method is often used for optimization and solution of function mapping. This method has some disadvantages. New genetic algorithm, based on uniform Monte-Carlo is proposed by authors reduce disadvantage of nonuniform MonteCarlo method. Both of these methods are based on random number generation and therefore the solutions are approximate. Statistical evaluation of solutions is used for comparison.


Introduction
In solving the real problems of technical work, we often encounter the concept of uncertainty in the task a simple example of uncertainty in engineering practice can be manufacturing tolerances of machine parts, unknown quantity of material in the bins, and so on. Uncertainties of this nature in contact, modal-spectral and other types of tasks have a significant impact on the value of the obtained results. From the point of view of designing machine components with required service life or security level, it is therefore necessary to find such combination of indeterminate parameters of the solved task in which the value of the investigated function acquires extreme values [1][2][3][4]. Often, however, the uncertainties are bounded by their minimum and maximum values and in this case, the task changes to the interval analysis of the problem [5][6][7][8][9]. The basic and the easiest method of solving this type of task is the Monte-Carlo method, where we randomly generate points from the uncertainty interval and perform an analysis of the investigated problem for these random combinations of uncertainty, and finally we determine the combination of unknown parameters at which the investigated function has reached the extreme [10][11][12][13][14][15][16][17][18][19][20].

Nonuniform Monte -Carlo method
The basic requirement for point generation by the Monte-Carlo method is the assumption of generating points with equable or normal configuration of probability density for point coordinates. This assumption is quite often used in practice. Usage of this method while generating of points in the solution area and depending on the unknown parameters is timeefficient and easy in case of algorithmic approach. On the other hand, if this method is explored in more detail we will find several shortages: -under the condition of equable distribution of probability density of individual coordinates, we can also obtain the set of points shown in Fig. 1 and point distribution histogram for axis x, similarly for axis y. Histograms indicate an equable distribution of probability density, whereby, points are grouped in two sub-areas; -creating of areas with a large number of clustered points and white spots without the presence of points; -increasing the quantity of points used in mapping of the solution may not increase the accuracy of the solution or ensure the accuracy of the solution obtained for the subsequent generation and usage of additional points; -low probability of generating points near combinations of infimum and supremum in mapped uncertainty area. It also often happens that during solving of practical problems, the solution is at the point of combining the infimum and supremum intervals of the mapped area, viz. there is no local or global extreme in the mapped area but the value at the border gets an extreme value; -the need for a relatively high number of points for area mapping. This fact is not directly related to the Monte-Carlo method but with the scope of the analyzed task, so it is necessary to take it into account when choosing the number of mapping points. If we have the established condition that we want to get the solution with probability P = 0,1 in the uncertainty interval ⟨0,1⟩for one-dimensional task based on the probability theory, we need n= � � points to map the area. Then, for mapping the area which includes the number of m uncertainties parameters with the same probability, we need n= � � � � � points for mapping of the area. To remedy the above shortcomings, several modifications of the Monte-Carlo algorithm have been created. The most common of them is the modification of the Hypercube method, its principle lies in dividing the mapped area into subareas where the Monte-Carlo classical method will be used. Such subdivision should provide a minimum number of mapping points for each subarea.

Genetic algorithms
This type of algorithms is characterized by a specific procedure for generating points for mapping of solution. With these algorithms, a set of offspring -points will be generated and, on a base of the evolutionary condition, the offspring or a group of offspring, which fits better to the evolutionary condition, will be ranked among the parents. The variety of algorithms for generation of offspring and evolutionary conditions creates a space for creating a large number of computational procedures for determining parents -area mapping points in the category of generic algorithms Fig. 2.
If we set the main goal while creating of a new genetic algorithm, such as eliminating of disadvantages of the Monte-Carlo method under points 2-4 and at the same time under condition of randomness of the generated offspring points. The algorithm will not generate the same points -parents in case of relaunching. The group of genetic algorithms, generated in this way, can be named as uniform Monte -Carlo. Such gradual filling of white spaces simultaneously removes the disadvantage of the nonuniform Monte-Carlo method referred under the point 3 and guarantees the accuracy of the solution depending on the number of generated points.

Uniform Monte -Carlo method
Algorithm of uniform Monte -Carlo searching Fig. 3 can be divided into the following basic steps: -generation of a combination of supremum and infimum. When creating an algorithm, we must realize that it is necessary to create a combination of two values in a m dimension field, the total number of combinations is then given by a relation n=2 � Individual combinations can be obtained by creating a vector v=���������n � ��, which is then converted into a binary system. By the transformation, we will obtain m sizeable combination of nulls and base values, after changing the nulls and base values (1) to the infimum and supremum each number then represent desired combinations of infimum and supremum. This algorithm is universal in terms of the analyzed task dimension. At first glance, program implementation of the algorithm is complicated with respect to binary transformation, but most of the programming languages have this feature as a standard one; -when generating the offspring, we will use the Monte-Carlo classical method, i.e. generating of random numbers. During generating of points, the condition of equable distribution of points for one coordinate of generated m dimensional field of random points. -subsequently, we measure the distance between offspring and parents; -finding of the offspring with the greatest distance to the parents; -end algorithm test, here are a few possible steps presented. Finishing if we find a determined number of parents in advance. Ending of parents search if the largest distance between parents and offspring falls below a predetermined value, the first descendant reaches this value. Ending of parents searching if the largest distance for a group of newly-generated parents will be less than the prescribed value. It is not possible to find any white space for generating a new parent. The gradual thickening and filling of white spots is shown in Fig. 4, the first 100 generated points are shown by *, following 100 points are displayed by the +, and the last 100 by the x. The randomness of points distribution for repeated generation of points in uniform Monte -Carlo algorithm for mapping the area is Fig. 4.
The basic disadvantage of the uniform Monte -Carlo algorithm comparing to the nonuniform Monte-Carlo method is that the algorithm is time-consuming. The time consuming of the algorithm is caused due to a large number of necessary measurements of points distance. We will document this time consuming on the example used in the following section, where we compare the results obtained with the nonuniform Monte-Carlo method and the uniform Monte -Carlo algorithm. At the first analysis, we will require 100 points generated in the area of interest. While generating of new offspring, we will always generate 50 new points. We will get 4 points in case of generating of the infimum and supremum combination. Then, when searching for the fifth point, we will measure the distance between 4 parents and 50 offspring, i. e. 200 times in total. When searching for the sixth point, we need to implement the distance measurements 250 times. Overall, we need to measure the distance 247200 times to determine 100 points. On the other hand, this algorithm can be easily parallelized by dividing the offspring vector into an appropriate number of vectors according to the number of calculating fibers.

Numeric experiments evaluation the nonuniform Monte -Carlo method and uniform Monte -Carlo method
We use two examples to experimentally evaluate these two approaches for mapping the uncertainty area. In the first example, we compile the function (1) Fig. 5, which will have a maximum value in the field of mapping at the point opt = �0.25 0.25�, i. e.
In the second example, the maximum of function, which was mentioned above (2), will be displaced out of the mapping area Fig. 5, the function will have the following shape and the maximum value will be in the point opt = ��0.25 0.25�, i. e.
y= Next, it is necessary to set the criteria, which will help us to evaluate the algorithms used by us. When setting the first criterion, we will evaluate the accuracy of the points finding (3) with the extreme of functions given by the relation (1) a (2), NMC --the point of extreme, which was found by usage of the nonuniform Monte -Carlo method, UMC -the point of extreme, which was found by usage of the uniform Monte -Carlo method. When evaluating the accuracy, we will measure the distance of such a point from the point of the extreme function determined analytically: If we base on the evaluation of accuracy of finding an extreme function point in this way, we can compare the algorithms and tell which of them has higher chances to approach to the point with a true extreme of function, while searching the extreme point of function.
The second criterion will be used to determine the value of the integral (4) of the functions given by the relations (1) and (2) in the mapped area according to the following formula: (4) In this case, we determine the integral value by a rectangular rule for the function with two variables. The criterion, defined in this way, gives us some information about the quality of the whole area mapping. Taking into consideration, that both nonuniform Monte-Carlo and uniform Monte -Carlo methods work with random numbers, and with each attempt to find the values, mentioned above, according to relations (3) and (4), we will find another point or other value of the integral, we can say that it is not possible to compare the results obtained during individual analyzes easily. We can set a comparative value, which consists of a standard deviation of the calculated values of the extreme function location and the integral value.
Because of the relevance of the statistical processing of results, we will repeat each analysis 100 times for a set number of points (100, 200, 300, 500, 1000) in the mapped area. The mapped area will be measured as ⟨0 1⟩ × ⟨0 1⟩ and the number of new generated offspring for determining the new parent of the uniform Monte -Carlo algorithm will be 50. The analysis results for the first example where the investigated function has the shape (1) with the function extreme located in the mapping area are shown in the Tab. 1. Similarly, for the second example, the function being investigated (2), where the function's extreme is located outside of the mapping area Tab. 2.

Conclusion
If we base on the results shown in Tab. 1, we can state that the uniform Mote -Carlo method has better assumptions for finding an extreme point of function comparing to the nonuniform Monte-Carlo method. If the function has an extreme in the mapped area, the ratio of the standard deviation of the extreme point finding accuracy for the nonuniform Monte-Carlo method to the standard deviation of the extreme point finding accuracy by using the uniform Monte -Carlo algorithm is in the interval ⟨1.41 1.75⟩. We can claim the similar fact for finding a point with a function's extreme, if the maximum is located outside of the mapping area Tab. 2. When searching for a point with a maximum value, the standard deviation for the uniform Monte -Carlo method is smaller comparingly to the nonuniform Monte-Carlo method in the interval ⟨2.01 2.60⟩.
When comparing the results of determining the integral value of the investigated function by the relation (4) for the function with the extreme in the mapping area (1), the ratio of the standard deviations for the nonuniform Monte-Carlo method and the uniform Monte -Carlo algorithm is in the interval⟨2.57 3.66⟩. We have also obtained the similar results for determining the value of the integral for the function with the maximum function value at the boundary of the mapped area given by the relation (2). During comparing the standard value deviations of the integral in the nonuniform Monte Carlo method and the uniform Monte -Carlo algorithm, we can see their ratio in the interval⟨2.95 4.00⟩.
According to these results, we can say that the WSS algorithm is more useful than the nonuniform Monte-Carlo method in case of looking for the extreme of function as well as mapping of the whole area. Uniform Monte -Carlo algorithm enables us to get more equable distribution of points on the mapped area. If we compare it with a totally random distribution of points in case of the nonuniform Monte-Carlo method, we will see that the uniform Monte -Carlo algorithm has more significant effect on determining the value of the integral of a given function, then, on the mapping the value of the function on the investigated area, whence on the finding of the extreme point of function.
A significant shortcoming of the uniform Monte -Carlo method is a time consuming. On the other hand, this disadvantage should not be an obstacle in case of the practical solution of the tasks of technical practice. For this type of tasks, analysis of the desired function may last from a few seconds to a few hours. In the case of time-consuming FEM analysis of target function, the time-consuming of the uniform Monte -Carlo algorithm is comparable to the duration of one FEM analysis of the target function and, overall, is not so significant. The assumption of finding a point, which is closer to the extreme of the function, is significantly higher for the uniform Monte -Carlo algorithm.
The contribution was created on the basis of the financial support of the grant project APVV 14-0096 a KEGA 037ŽU-4/2018.