Научная статья на тему 'Generation of a random landscape by given configuration entropy and Total Edge'

Generation of a random landscape by given configuration entropy and Total Edge Текст научной статьи по специальности «Математика»

CC BY
91
8
i Надоели баннеры? Вы всегда можете отключить рекламу.
Область наук
Ключевые слова
КОНФИГУРАЦИОННАЯ ЭНТРОПИЯ / ENTROPY / TOTAL EDGE / ПОСТРОЕНИЕ ЛАНДШАФТА / LANDSCAPE GENERATION / КЛЕТОЧНЫЙ АВТОМАТ / CELLULAR AUTOMATA

Аннотация научной статьи по математике, автор научной работы — Kuznetsov Alexander Vladimirovich

The article addresses the development of algorithms for a generation of a random landscape with a given configuration entropy and Total Edge. Two algorithms are proposed. The first one is based on the uniform random filling of a landscape by cells of different types. The second one is based on the probabilistic cellular automaton. The algorithm based on the cellular automaton fills the landscape with cells row by row, and the probability of an “extraordinary” appearance of a new type of cell is predefined. The ratio between cells of different classes is determined from the given configurational entropy. Dependencies between landscape metrics configuration entropy and Total Edge along with the number of cell types for the landscape built in different ways are demonstrated. Examples of landscapes obtained by the proposed algorithm are shown. These landscape generation algorithms can be used for verification of pathfinding algorithms for the construction of a large number of random landscapes with the same metrics.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Генерация случайного ландшафта с заданной конфигурационной энтропией и Total Edge

Статья посвящена разработке алгоритмов построения случайного ландшафта с заданными конфигурационной энтропией и Total Edge. Предложен алгоритм,основанный на равномерном случайном заполнении ландшафта клетками разных типов и алгоритм на основе вероятностного клеточного автомата. В алгоритме на основе клеточного автомата ландшафт построчно заполняется клетками, причем задана вероятность «внеочередного» появления клетки нового типа. Соотношение между клетками разных классов определяется исходя из заданной конфигурационной энтропии. Выявлены зависимости между ландшафтными метриками конфигурационной энтропией и Total Edge и количеством типов клеток для ландшафтов, построенного разными способами. Демонстрируются примеры ландшафтов, полученных с помощью предлагаемых алгоритмов. Полученные алгоритмы построения ландшафтов могут быть использованы при проверке алгоритмов обхода препятствий для построения случайных ландшафтов с заданными метриками.

Текст научной работы на тему «Generation of a random landscape by given configuration entropy and Total Edge»

Вычислительные технологии

Том 22, № 4, 2017

Generation of a random landscape by given configuration entropy and Total Edge

Kuznetsov, Alexander V.

Voronezh State University, Voronezh, 394018, Russia

Contact e-mail: avkuz@bk.ru

The article addresses the development of algorithms for a generation of a random landscape with a given configuration entropy and Total Edge. Two algorithms are proposed. The first one is based on the uniform random filling of a landscape by cells of different types. The second one is based on the probabilistic cellular automaton. The algorithm based on the cellular automaton fills the landscape with cells row by row, and the probability of an "extraordinary" appearance of a new type of cell is predefined. The ratio between cells of different classes is determined from the given configurational entropy. Dependencies between landscape metrics — configuration entropy and Total Edge along with the number of cell types for the landscape built in different ways are demonstrated. Examples of landscapes obtained by the proposed algorithm are shown. These landscape generation algorithms can be used for verification of pathfinding algorithms for the construction of a large number of random landscapes with the same metrics.

Keywords: entropy, Total Edge, landscape generation, cellular automata.

1. Formulation of the problem. Definitions

A configurational entropy of the landscape, Total Edge, and Total Edge Density [1, 2] are widely used characteristics of a landscape (metrics). A configuration entropy describes a quantitative relationship between elements of different classes in a landscape, Total Edge and Total Edge Density metrics characterize to what extent elements of different classes are mixed in a landscape.

These metrics are easy to calculate, and there are a large number of software products for their calculation. However, there is an inverse problem: to generate the landscape C(N, I) with specified landscape configuration entropy, Total Edge, and Total Edge Density. It is required for testing of algorithms of the pathfinding, such as those described in [3] and for obtaining quantitative characteristics of these algorithms, for example, dependence the efficiency of the algorithm from the landscape features. In this case, a construction of the landscape should be fast enough, as the landscape is necessary, primarily, to accumulate statistics on the time of agents propagating through it. Thus it is needed to sort a large number of different landscapes with the same characteristics within a reasonable computation time.

© ict sb ras, 2017

Of course, one can simply generate random landscapes and then filter those which are suitable for the metrics. However, to obtain a good solution even for a landscape 50 by 50 cells the computation time could exceed several days.

The present work addresses the description of landscape generation algorithms with predefined metrics. Also, paper's goal is to clarify the relationship of these metrics, as in [4] it has been shown that landscapes with the same configuration entropy may look completely different and have very different Total Edge.

We use the cellular automaton for the creation of a landscape with a given Total Edge. Cellular automata are utilized for a landscape generation in computer games. However, the problem to generate a texture or a landscape with characteristics like the given entropy or Total Edge is not commonly stated as it follows from [5, 6].

Definition 1. The landscape C(N,l) is the set of N equal-sized cells Lij, (i,j) G I C N2, belonging to I different classes, where class i belongs to N.\ cell, that is i=l N.\ = N.

Cells of landscapes will be divided into classes according to the maximal speed at which these cells can be crossed with in order to test obstacle-avoidance and pathfinding algorithms.

Definition 2. Let us define a configuration entropy as

Definition 3. Total Edge (TE) is the total number of the abutting edges of cells belonged to different classes in C(N,l). We will further denote the Total Edge of the landscape C(N,l) as TE(C(N,l)).

Definition 4. Total Edge Density (TED) of the landscape C(N,l) is defined as the ratio TE(£) to the total cell quantity in C(N, I) and would be denoted as

2. Generation of a landscape with given configuration entropy

In this section, we solve the problem to efficiently generate a landscape C(N, I) for the given configuration entropy S(C(N,l)). This goal can be achieved by determining a vector V = (Nl,..., Ni) of numbers Ni of each class i cells that satisfies the following expression

We select N.\ = ¡31-1 Nl, Nl < N, ¡3 > 0. Since interchange of V components obviously does not change S(V), we consider a non-increasing sequence N.\ only, then 0 < ¡3 < 1. If ¡3 = 0, we assume that ¡30 = 1. Then conditions (1) satisfying the known properties of geometric progression can be rewritten as

5 (C(N,l)) =

TED(C(N, I)) = TE(C(N, l))/N.

1 1 m

£ Nt = N, S(V) = - £ ln = 5(C(N,l)).

(1)

1 Q i-lAT

S(V) = P N 1 (ln ¡31-1 + ln Ni - ln N)

v№'-m - i) + ln ?.. (2)

N y N y )

i=l

Fig. 1. Landscapes £(48 x 48,10) generated with the algorithm from the section 2. From the left to the right S = 0.349119, TED = 0.40842, S = 1.1004, TED = 1.05773, S = 2.00013, TED = 1.63411

Numbers ft1 l(i - 1) form arithmetico-geometric sequence, therefore

N, V ft-Hi - 1) =1—— = N ft - . (3)

v ; 1 - ft 11 - ft 1 - ft 1 - ft K '

1=1

We substitute (3) into (2) and obtain that

c(V) ft(1 - ft') - (1 - ft)lft1. 1 - ft1

S (V) =--(1 - ft)(1 -ft') ln ft +ln Y-ft • (4)

Thus, the algorithm for the constructing of vectors V = (N,, • • •, Ni) by the given entropy S is the following

1. Solve the equation (4) with respect to ft.

2. Define N, by the solution found as N, = N(1 - ft)(1 - ftl)-1.

3. Construct the vector Vo = (N,,ftN]_,...,ftl~ 1N1). Round and random shuffle its components to integers and obtain the vector V. It is necessary to trace that the sum of all V components is equal to the N.

The algorithm for the landscape £(N, I) = (L^-} generation which is based on the vector V = (N,, • ••, Ni) is the following

1. Set the class "-1" to all cells of the £(N,1).

2. Generate the pair of integers (i,j) G I from the uniform random distribution.

3. Generate the integer 1 < k < I from the uniform random distribution so that N^ = 0.

4. If the class of the is equal to -1, set class of the to k and Nk := Nk - 1.

5. Repeat step 2 until V = 0.

Examples of landscapes generated with the algorithm described above are shown in Fig. 1. The author has established via the computational experiment that the temporal computational complexity of the algorithm for a rectangular landscape depends on the number of cells N as 0(N3/2), and on the number of classes of cells I as 0(1).

3. Generation of landscape with given Total Edge

Suppose that the landscape £( N, I) = £( N, I) = (Lij |1 <i<n, 1 < j < m}. The minimum value of TE(£(N, I)) will be obtained by the landscape £(N, I) wherein CI, class cells are sequentially placed into one line, then Cl2 cells etc, starting from one of corners. If cells of

one class end, the line of these cells continues by cells of another class. If Nk is the quantity of k-th class cells, then we set Nk := Nk - 1 when place a cell of k-th class on the landscape. When the entire line is processed then proceed to the next one, which we process in the opposite direction. Introduce the strict order relation "<" on the lanscape C(N, I) as follows

Lij < L s

i < S,

j<r, i = s = 2k - 1, 1 < k < [n/2] + 1, j>r, i = s = 2k, 1 < k < [n/2].

The relation "<" naturally generates operations pred(Ly) = Lsr of the previous cell finding, Lsr < Lij and it does not exist Lpq so that Lsr < Lpq < Lij, succ(Ly) = Lsr of the successive cell finding, Lij = pred(Lsr). Let us denote Cl(Lij) as the class of the Lij cell.

The aforementioned algorithm of the landscape filling may be described as the cellular automaton in which the initial state % of any cell Lij, (i,j) = (1,1) is equal to -1, the initial state sn = where £ E 1,1 is an random class number. The quantity N(Clk) of "remaining in reserve" cells of the Clk class is defined at each moment of the cellular automaton functioning for each cell class Clk. The local transition function is defined as

Sij (£)

{

Cl(pred(Lij)), Cl(pred(Lij)) > 0, N(C7(pred(Ly))) > 0, i + j = 0, ( < 1 - £, rq, rq = Cl(pred(Lij)) V i = n A j = m, ( > 1 - e,

N(Cl(sl3)) := N(Cl(sij)) - 1,

where ( G [0,1] is an uniformly distributed random number, "q G 1,/ is an uniformly distributed random number, 0 < e < 1.

The rectangular landscape C(n x m, I) will have the maximal TE if all cells belong to different classes. The maximum of the configuration entropy for the such landscape will be Smax = Smax(C(n x m,l)) = ln I. Numerical experiment (see Fig. 2), which was repeated 50 times for each value of parameters, showed that the average value of the TED depends on e

Fig. 2. Dependencies of the TED on the e with different values of the configuration entropy S, n = m = 48, I = 152

Table 1. Values of constants for dependencies of the entropy and TED

Number 1 2 3 4 5

ao 0.631706 1.04616 1.50153 3.92962 5.29811

bo 0.902495 1.7169 2.53405 7.66127 10.9732

Cq 0.541963 0.489177 0.392038 0.188599 0.154264

k 0.0896779 0.105287 0.0763552 0.0183298 0.00576306

Fig. 3. Landscapes with S = 1.90026, TED = 0.728733, e = 0.05, S = 2.19722, TED = 1.03125, e = 0.2, S = 1.90026, TED = 1.57552, e = 0.9

almost linearly. The form of such dependence only insignificantly varies with a change of the number of classes I. Therefore, it is possible to find the average value of the TED(C(N, I)) in the form

CQ( S/ Smax)£

k

TED = Oq(S/Smax) ln —-——--— + &o(S/Smax),

(1 - Cq ( S/Smax)e)

where aQ, bQ are constants which depends on the configuration entropy of the landscape. Values of these constants for dependencies showed in Fig. 2, are given in Table 1.

Results of the algorithm can be seen in Fig. 3. The temporal computational complexity of this algorithm depends on the number of cells N as 0(N) and on the number of classes of cells I as 0(1).

4. The relationship between entropy and Total Edge

Suppose that the rectangular landscape n x m cells generated by the algorithm described in the section 2. The author performed 50 numerical experiments to explain the nature of the relationship between TE and configurational entropy. It became apparent during experiments that the average value of the TED for the landscape generated by the above algorithm virtually does not depend on the number of cells in the landscape, but depends only on the number of cell classes. We will search the dependence of the TED(C(n x m, I)) average value on and configuration entropy S in the form

TED = a1(l)a(b1(l)S/ ln l) + ax(l)/2,

Fig. 4. The dependence of the TED on the S/Smax and cells classes quantities I (n = m = 48)

where a(x) = (1 + e-x)-1, a1, b1 are unknown functions from empirical considerations (see Fig. 4). We can obtain acceptable (with coefficients of determination r2 = 0.999999 for a1 and r2 = 1.0 for b1) approximations

ai(l) = 3.90302 + 5.25218(x - 10.9641)-2'19235,

&i(Z) = 1.15228 ln(0.990096z - 1.18397).

Conclusion

The relationship between landscape metrics was established, and the algorithm for construction of a landscape with a given Total Edge metric was developed in this article. It has been discovered that the more random the filling of a landscape with cells of different classes is, the stronger the relationship between the configuration entropy and the Total Edge of a landscape. The formula of such dependence was inferred by a computational experiment. The landscape may be filled not only from top to bottom, in a line-by-line fashion, but also by a more complex way as a further improvement of landscape generation algorithms outlined in this paper. Another possible improvement might be the creation of a landscape by some smaller landscapes with specified characteristics.

References

[1] Rodriguez-Iturbe, I., D'Odorico Paolo, R.A. Configuration entropy of fractal landscapes // Geophysical Research Letters. 1998. Vol. 25, No. 7. P. 1015-1018.

[2] FRAGSTATS: Spatial pattern analysis program for categorical maps. Documentation. URL: http://www.umass.edu/landeco/research/fragstats/documents/fragstats_documents.html

[3] Kuznetsov, A.V. A model of the joint motion of agents with a three-level hierarchy based on a cellular automaton // Computational Mathematics and Mathematical Physics. 2017. Vol. 57, No. 2. P. 340-349.

[4] Cushman, S.A. Calculating the configurational entropy of a landscape mosaic // Landscape Ecology. 2016. Vol. 31, No. 3. P. 481-489.

[5] Johnson, L., Yannakakis, G.N., Togelius, J. Cellular automata for real-time generation of infinite cave levels // Proc. of the 2010 Workshop on Procedural Content Generation in Games. PCGames '10. New York, USA: ACM, 2010. P. 10:1-10:4.

[6] A survey of procedural noise functions / A. Lagae, S. Lefebvre, R. Cook, T. DeRose, G. Dret-takis, D. Ebert, J. Lewis, K. Perlin, M. Zwicker // Computer Graphics Forum 29 (2010). P. 2579-2600. URL: http://www-sop.inria.fr/reves/Basilic/2010/LLCDDELPZ10a

Received 20 December 2016 Received in revised form 7 May 2017

i Надоели баннеры? Вы всегда можете отключить рекламу.