# Patent

## Title
Generating random sequences based on stochastic generative model having multiple random variates

## Abstract

Random sequences are generated based on a stochastic generative model having multiple random variates. Inputs representative of the stochastic generative model are received. The inputs include a first random variate having a finite set of alphabets, a second random variate having a set of alphabets, and a third random variate having a finite set of alphabets. Outputs representative of the random sequences are generated based on the stochastic generative model. The outputs include a first random sequence that is a finite-length random sequence of alphabets randomly selected from the first random variate, a second random sequence having a set of alphabets selected from the second random variate, and a third random sequence having a set of alphabets randomly selected from the third random variate.

## Background
FIELD OF THE INVENTION
The present invention is generally related to generating random sequences of messages, which may be used to test a software entity that has an application programming interface (API). More particularly, the present invention is related to generating such random sequences based on a stochastic generative model having multiple random variates.
BACKGROUND OF THE INVENTION
The task of verifying the functionality of a software entity, such as a software component or a web service, which exposes an application programming interface (API), typically involves constructing a test model of the software entity, designing test cases, designing test data, developing test scripts, and executing the test cases using the test scripts in relation to the test model. Automating the generation of test cases and corresponding tests data, from a test model can, however, be difficult to achieve.
For instance, typically software entities are governed by a programming model that describes rules and guidelines for interacting with the entity. A test case for a software entity is a sequence of messages (i.e., an API operation) that can stimulate the system in a desirable or undesirable manner. Since a large system will have many interacting software entities, which can exchange combinations of messages among them, the programming model in question defines the boundary conditions that distinguish valid combinations from invalid combinations. In order to maximize the possibility of detecting defects, it can be desirable to generate random sequences of messages as test cases. However, a collection of the random sequences must nevertheless satisfy a probability distribution governed by the programming model. As such, generating random, or stochastic, test cases has however proven difficult to accomplish in practice.
SUMMARY OF THE INVENTION
The present invention relates to generating random sequences based on a stochastic generative model that has multiple random variates. The random sequences may be used to test a software entity that has an application programming interface (API), for instance. A method of one embodiment of the invention is thus for generating random sequences based on a stochastic generative model having multiple random variates. The method is implemented by one or more computer programs executed by one or more processors such that execution of the computer programs by the processors causes performance of the method.
The method receives inputs representative of the stochastic generative model. The inputs include: a first random variate having a finite set of alphabets; a second random variate having a set of alphabets; and a third random variate having a finite set of alphabets. The method generates outputs representative of the random sequences based on the stochastic generative model.
The outputs include a first random sequence, a second random sequence, and a third random sequence. The first random sequence is a finite-length random sequence of alphabets randomly selected from the first random variate. The second random sequence has a set of alphabets selected from the second random variate. The set of alphabets of the second random sequence correspond to each alphabet of the first random sequence. The third random sequence has a set of alphabets randomly selected from the third random variate. The set of alphabets of the third random sequence correspond to each alphabet in the first random sequence.
A computer program product of an embodiment of the invention stores one or more computer programs. The computer programs are executable by one or more processors to perform a method to generate random sequences, including a first random sequence, a second random sequence, and a third random sequence, based on a stochastic generative model having multiple random variates. The method reads inputs representative of the stochastic generative model.
The inputs include: a first random variate having a finite set of alphabets; a second random variate having a set of alphabets; and, a third random variate having a finite set of alphabets. The inputs further include a first relative probability of occurrence of each alphabet within the first random variate to be found in the first random sequence, as well as a positional population density of the alphabets within the second random variate to be found along a length of the first random sequence. The inputs also include a second relative probability of occurrence of each alphabet within the third random variate to be found in the third random sequence.
The method validates the positional population density, processes the inputs, and normalizes the first relative probability of occurrence and the second relative probability of occurrence. The method then performs the following for each current position of a number of positions of a length of each of the first, second, and third random sequences, from a first position to a last position. First, the method generates the current position of the first random sequence based on the inputs. Second, the method generates the current position of the second random sequence based on the inputs. Third, the method generates the current position of the third random sequence based on the inputs.
A computing system of an embodiment of the invention is for generating random sequences based on a stochastic generative model having multiple random variates. The computing system includes hardware and a random sequence generator implemented via the hardware. The random sequence generator receives inputs representative of the stochastic generative model, and generates outputs representative of the random sequences based on the stochastic generative model.
The inputs include: a first random variate having a finite set of alphabets; a second random variate having a set of alphabets; and, a third random variate having a finite set of alphabets. The outputs include a first random sequence that is a finite-length random sequence of alphabets randomly selected from the first random variate. The outputs also include a second random sequence having a set of alphabets selected from the second random variate. The set of alphabets of the second random sequence correspond to each alphabet of the first random sequence. The outputs further include a third random sequence having a set of alphabets randomly selected from the third random variate. The set of alphabets of the third random sequence correspond to each alphabet in the first random sequence.



BRIEF DESCRIPTION OF THE DRAWINGS
The drawings referenced herein form a part of the specification. Features shown in the drawing are meant as illustrative of only some embodiments of the invention, and not of all embodiments of the invention, unless otherwise explicitly indicated, and implications to the contrary are otherwise not to be made.
FIG. 1 is a diagram of a system for generating random sequences, according to an embodiment of the present invention.
FIG. 2 is a diagram of a method for generating random sequences, according to an embodiment of the present invention.
FIG. 3 is a diagram of a representative system, according to an embodiment of the present invention.



DETAILED DESCRIPTION OF THE DRAWINGS
In the following detailed description of exemplary embodiments of the invention, reference is made to the accompanying drawings that form a part hereof, and in which is shown by way of illustration specific exemplary embodiments in which the invention may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention. Other embodiments may be utilized, and logical, mechanical, and other changes may be made without departing from the spirit or scope of the present invention. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims.
DEFINITIONS
In this section of the detailed description, various terms that are used throughout the remainder of the detailed description are defined in a general a non-limiting sense. Statistical randomness can be defined as a quality that a sequence has. In particular, a sequence is said to be statistically random when it contains no recognizable patterns or regularities. Examples of such sequences include the results of an ideal dice roll, as well as the digits of Pi.
A random sequence is a sequence of alphabets (selected from E) or numbers (selected from a range R), having a length L, where the following is true. L may be of infinite length or finite length. E is a set of independent or dependent alphabets. E is said to have independent alphabets, if its probability transition matrix is an identity matrix or a unit matrix. A probability transition matrix defines the probability of transitioning from one alphabet to another alphabet in a sequence, for all combinations. Some desired properties of random sequences can include unpredictability, a period length, a resolution, efficiency, and repeatability. Unpredictability is a very high degree of randomness, whereas as to period length, the longer the period the better. The resolution of the numbers in the sequence can be considered as multiples of 2−L, where 2−L is the resolution for L fractional binary digits between [0, 1]. Efficiency is the length of the sequence generated per a unit of time, such as per second. Repeatability is the ability to replicate the same random sequence, which can be useful in repeating simulating experiments.
A pseudo-random sequence is a sequence that appears to be random, but is not. A quasi-random sequence progressively covers a d-dimensional space with a set of points that are uniformly distributed. A low-discrepancy sequence has the property that for all N, the sub-sequence x1, . . . , xN is almost uniformly distributed, where x1, . . . , xN+1 is almost uniformly distributed as well.
A stochastic pattern can be defined as follows. Stochastic models are models involving or containing a random variable or variables, and involve chance or probability. A pattern is a perceptual structure or feature within a domain, which can be used to make or to generate things or parts of a thing. A stochastic pattern is thus a recognizable stochastic model exhibit by a thing within a domain. It can be used to generate things or parts of a thing that are—approximately or stochastically—similar to the original thing.
A variate is a generalization of a concept of a random variable defined without reference to a particular type of probabilistic experiment. It is defined as the set of all random variables that obey a given probabilistic law. A random variate generation algorithm for real numbers is a program that halts with probability one and exits with real number X.
Problem Statement
In this section of the detailed description, a description or statement of the problem that is solved by at least some embodiments of the present invention is formally described. A system includes the following input random variates: Ω having a finite set of alphabets Xi; ψ having a set of alphabets Yi; and, λ having a finite set of alphabets Wi. The relationships among the random variates are as follows. Ω is dependent on λ, in that the alphabets in Ω describe and control the nature of and the number of alphabets sampled from λ. ψ and λ are independent of one another. ψ is dependent on Ω, in that some of the alphabets in Ω, which are referred to as control alphabets, determine the creation and destruction or deletion of Yi alphabets in ψ, and where the rate of creation and destruction is defined for each control alphabet in Ω.
The problem that is solved by at least some embodiments of the invention is to generate a multivariate sequence, as output, where each element in the sequence includes {Si{Ni}, {Vi}}, and where the following is true: S→{Xi}, i=1 to sequence length; Ni→{Y(i,j)}, j=1 to fy(Xi); Vi→{W(i,k)}, k=1 to fw(Xi)}. The function fy(Xi) defines the length of Ni for the given Xi, where the function fw(Xi) defines the length of Vi for the given Xi.
S is a finite-length sequence of alphabets random selected from Ω, with the following embedded, known spatio-temporal stochastic patterns defined for each alphabet in the sequence. The first pattern is the relatively probability of occurrence of each alphabet in the string S, the second pattern is the positional probability density for each alphabet in the string S. The third pattern is the probability of co-occurrences of alphabets as a function of distance between them and order, in the string S. The fourth pattern is the positional population density of alphabets in ψ, due to the presence of control alphabets in S.
N is a random sequence with a set of alphabets selected from ψ, corresponding to each alphabet in the sequence S, with the following embedded and known spatio-temporal stochastic patterns defined for each alphabet in ψ. The first pattern is fy(Xi), which is the number of alphabets from ψ, for Xi in S. The second pattern is the distribution function describing the lifetime of alphabets in ψ.
V is a random sequence with a set of alphabets randomly selected from λ, corresponding to each alphabet in the sequence S, with the following embedded and known spatio-temporal stochastic patterns defined for each alphabet in λ. The first pattern is fw(Xi), which is the number of alphabets from λ, for Xi in S. The second pattern is the relative probability of occurrence of each alphabet, within the string V. The third pattern is the positional probability density for each alphabet, within the string V. The fourth pattern is the probability of co-occurrences of alphabets, as a function of distance between them and order, within the string V.
The method is to generate a final output sequence that is merged from the above three sequences: {<S, N, V>}. For example, an output sequence could be {<X2, {Y0, Y5, Y1}, {W2, W6}; <X5, { }, {W2, W1}>}. The following observations regarding the problem statement are further noted. First, Ω, ψ, and λ are representative random variates, in which a problem can include one of two things. First, the problem can include many λ random variates, provided the λ's are independent of one another and is independent of <Ω & ψ>. Second, the problem can include many random-variate tuples <Ω, ψ>, provided they are independent of one another and are independent of λ's in the system.
The second observation is that Ω is similar to λ, except for some alphabets that affect the random variate ψ. The third observation is that the system may include just the following types of stochastic patterns. The first type of stochastic pattern is the relative probability of occurrence of each alphabet in the generated string, which is applicable to Ω and λ. The second type is the positional probability density for each alphabet in the generated string, which is also applicable to Ω and λ. The third type is the co-occurrence probability of alphabets, as a function of distance between them and order, within the generate string, which is also applicable to Ω and λ.
The fourth type includes the pattern(s) described based on the relationship between the random-variable tuple <Ω, ψ>. Such patterns of the fourth type include the positional population density of alphabets in ψ, due to the presence of control alphabets in the generated sequence S, which is applicable to Ω. Such patterns of the fourth type also include the lifetime distribution of alphabets in ψ, due to the presence of control alphabets in the generated sequence S, which is applicable to ψ. The fifth type includes patterns in which the functions fy( ) and fw( ) for the alphabets in Ω just specifies the number of alphabets sampled from ψ and λ for the final output sequence.
Overview of Generating Random Sequences
FIG. 1 shows a system 100, according to an embodiment of the present invention. The system 100 includes a random sequence generator 102, and a sequence consumer 104. The random sequence generator 102 encapsulates a multivariate sequence generation model, and may be implemented in hardware, software, or a combination of hardware and software. The sequence consumer 104 may be a software entity, such as a software component or a web service, which has an application programming interface (API), and is the entity that is being tested within the system 100. The software entity may run on hardware.
In general, inputs 106 are provided to the random sequence generator 102, which correspondingly generates random or stochastic sequences as its outputs 108. The outputs 108 are the parameters and other inputs specified by the API of the sequence consumer 104 in one embodiment. Furthermore, in one embodiment, some degree of feedback 110 may be provided by the sequence consumer 104 to the random sequence generator 102, although this is not required. For instance, the feedback 110 may be based on outputs of the sequence consumer 104, which can then guide the random sequence generator 102 as to providing additional relevant random sequences for consumption by the consumer 104.
The random sequence generator 102 accepts the following generative model parameters as the inputs 106. The first input is Xi, which is the set of alphabets in Ω. This set of alphabets includes Ci, which is a set of alphabets in Ω that will result in creation of Yi in ψ; Di, which is a set of alphabets in Ω that will result in deletion of Yi from ψ; and, Zi, defined as Xi minus the union of Ci and Di. The second input is Yi, which is the set of alphabets in ψ, and the third input is Wi, which is the set of alphabets in λ.
Additional generative model parameters that are part of the inputs 106 can include dependencies between Ω and ψ. Such dependencies include vector functions fy(C), fy(D), and fy(Z). The vector function fy(C) describes the creation characteristics of alphabets in C and the number of Yi created in ψ. The vector function fy(d) describes the deletion characteristics of alphabets in D and the number of Yi deleted from ψ. The vector function fy(Z) describes the operation characteristics of the alphabets in Z and is the number of Yi used by Z.
Additional generative model parameters that are part of the inputs 106 can include dependencies between Ω and λ, specifically the vector function fw(X). The vector function fw(X) describes the operation characteristics of alphabets in Ω and the number of Wi used by X. Another generation model parameter that is part of the inputs 106 is a unique random sequence of numbers U within the range [0, 1], generated by a function Gu.
The outputs 108 generated by the random sequence generator 102 includes random sequences S, N, and V. The random sequence S is a sequence with alphabets from Ω, and has a sequence length seq-len. The random sequence N is a sequence of an ordered collection of Yi, with alphabets from ψ. The size of each entry in the sequence N is determined by the corresponding alphabets in S and fy( ) and the sequence N has the sequence length seq-len as well. The random sequence V is a sequence of an ordered collection of Wi, with alphabets from ψ. The size of each entry in the sequence V is determined by the corresponding alphabets in S and fw( ) and the sequence V has the sequence length seq-len, too.
The generative model of the random sequence generator 102 may also have the following stochastic pattern definitions, which may be built into the generator 102, or provided by the inputs 106, and which have to be presented in the generated output sequences. The first pattern is Rx, which is the relative probability of occurrence of Xi in S, the second pattern is Px, which is the positional probability distribution for Xi in S, and the third pattern is Mx, which is the probability distribution function describing a pair-wise co-occurrence of alphabets in S, as a function of distance between them.
A fourth pattern is Qy, which is the position population density of Y in ψ, along the length of the output sequence S, and a fifth pattern is Ty, which is a lifetime distribution function of the alphabets in ψ. A seventh pattern is Rw, which is the relative probability of occurrence of Wi in V, an eighth pattern is Pw, which is the positional probability distribution for the Wi in V, and a ninth pattern is Mw, which is the probability distribution function describing a pair-wise co-occurrence of alphabets in V, as a function of distance between them.
Furthermore, the generative model of the random sequence generator 102 may also have the following generative rules, which may be built into the generator 102, or provided by the inputs 106, and which prescribe the rules of generation of the generator 102. These rules include the presence or absence of λ in the generative model, as well as the presence or absence of each of the following stochastic patterns in S: Rx, Px, Mx, and Qy. The rules further include the presence or absence of the stochastic pattern Ty in N, as well as the presence or absence of each of the following stochastic patterns in V: Rw, Pw, and Mw.
FIG. 2 shows a method 200, according to an embodiment of the invention. The method 200 is implemented as one or more computer programs, which are executed by one or more processors of one or more computing devices to perform the method 200. The method 200 receives and/or reads the inputs representative of the stochastic generative model that have been discussed (202). In response, the method 200 generates outputs representative of random sequences, based on the stochastic generative model as represented by the inputs, as has also been discussed (204).
In one embodiment, part 204 of the method 200 is performed as follows. The position population density Qy is validated (206), to determine whether this expected Qy is achievable, based on the knowledge of the ability of the alphabets in C and D to create and/or delete elements, respectively, in ψ. The inputs are then processed and initialization is performed (208). For instance, processing may include analyzing the input for the presence or absence of the stochastic patterns (Rx, Px, Mx, Qy, Ty, Rw, Pw, and Mw), and initializing these patterns with default values. Likewise, the output sequences S, N, and V is initialized, an age vector Yage for the alphabets in ψ is initialized, and the actual population of Yi in ψ, represented as Ay, is initialized. The probabilities of occurrence—i.e., the vectors Rx and Rw—are then normalized (210).
Thereafter, for each current position of a sequence length ranging from a first position in each sequence to a last position in each sequence—i.e., 0<=k<seq-len—the following is performed (212). The current position of the first random sequence, Sk, is generated based on the inputs (214). More specifically, the input vector Px is normalized for the k-th position, and the probability distribution vector for the alphabets in Ω, Py, is determined based on the expected population of Yi in ψ (i.e., Qyk) and on the actual population of Yi (i.e., Ay). The probability distribution vector for alphabets in Ω, MPx, is also determined, based on the co-occurrence probability Mx for the previously generated alphabets in S. The overall probability distribution vector of Ω for the k-th position of S is then determined, keeping in mind any applicable generative rules, which may be represented as GR. The overall probability distribution vector is VPx, and is equal to Rx×Px×MPx×Py. Finally, Sk is obtained by sampling the non-uniform random variate Ω having the probability distribution vector VPx for an alphabet, using the uniform random variate U.
The current position of the second random sequence, Nk, is also generated based on the inputs (216). More specifically, Nk is obtained by sampling the non-uniform random variate ψ having the age distribution vector Yage, for fy(Sk) alphabets. As part of part 216, Ay may also be determined as the modified population of Yi in ψ. Finally, the current position of the third random sequence, Vk, is generated based on the inputs as well (218). More specifically, the input vector Pw is normalized for the k-th position, and the probability distribution vector for alphabets in ψ, MPw, is also determined, based on the co-occurrence probability Mw for the previously generated alphabets in V. The overall probability distribution vector of λ for the k-th position of V is then determined, keeping in mind any applicable generative rules, which may be represented as GR. The overall probability distribution vector is VPw, and is equal to Rw×Pw×MPw. Finally, Vk is obtained by sampling the non-uniform random variate λ having the probability distribution vector VPw for fw(Sk) alphabets.
The random sequences are then output (220). That is, {Sk, {Nk}, {Vk}} is output for 0<−k<seq-len. These outputs can then be used to test a software entity, for instance (222). In particular, elements from the sequence S, N, and V form tuples <s, n, v> that are used as input for a sequence consumer, such as a software entity represented by a simulation engine or a system being tested. It is noted that in the method 200, generating Sk and generating Nk are used to sample the random-variate tuple <Ω, ψ> to generate Sk and Nk, respectively. Furthermore, generating Vk is used to sample the λ random variate, to generate Vk.
The method 200 can be extended for additional random variates, in addition to Ω, ψ, and λ, provided that such additional random variates subscribe to the properties described in the problem statement above. That is, for all additional random-variate(s), which are similar to λ and there is a need to generate a corresponding sequence comparable to Vk, the method 200 is extended to provide additional such sequence in the same way as Vk is generated. Likewise, for all additional random-variate tuples, which are similar to <Ω, ψ>, the method 200 can be extended to provide additional generations of sequences comparable to Sk and Nk, in the same way as Sk and Nk are generated.
It is further noted that the random variates in the generative model are assumed to operate on a sample space with finite and uniquely identifiable elements. Another assumption is that the size of the in-memory representation of the distribution function associated with the random variates is limited by a given system's memory. A third assumption is that interference between random variates—particularly between the probability distribution functions—may exist within the generative model but will not be discovered by the generator.
It is finally noted that the generation of random or stochastic sequences via the method 200 has various measurable desirable characteristics. These characteristics include repeatability, which is that a given random sequence is reproducible for the same input data values. These characteristics also include faithfulness, which is that a stochastic pattern is faithfully reproduced within the resulting sequences for non-interfering patterns. These characteristics finally include extensibility, which is that multiple random sequences are efficiently generated. Tests performed by the inventors on an embodiment of the invention show that high repeatability, faithfulness, and extensibility are provided, which is an advantage of the present invention.
EXAMPLE
In the context of software entity testing, the test input vector used to verify the behavior of the entity in question is a series of tuples <Oj, Mi, Pk>. Mi is an application program interface (API) method of the software component, Oj is the target entity (i.e., state variable), and Pk includes parameters of the method Mi. In a simplified scenario a multivariate sequence generator can use a random-sequence-generation approach to generate a series of methods from M, objects from O, and parameter values from domain D. However, in actuality, a programming model of the software entity typically imposes various constraints on the API.
Such constraints include the order of invocation of the methods. For example, in socket programming, a typical program will open a socket, then open an input stream, then read from the stream, then close the stream, and finally close the socket. Another constraint is the parameter passing between method invocations in a call sequence. In the previous example, for instance, the read-from-stream operation needs the output of the previous operation (namely, the open-stream operation) as its input parameter. This is a type of feedback that has been described in the previous section of the detailed description. A third constraint includes the initialization and exit conditions of the state variables, if the software entity being tested is a stateful software entity.
In the context of software entity testing, then, ψ is a finite, discrete sample space including all the entities (i.e., target object instances) that the API methods will operate on, where Y is the discrete random variable on ψ. Furthermore, λ is a finite, discrete sample space including all the data values that the API methods will use as parameters, where W is the discrete random variable on λ. Additionally, Ω is a finite, discrete sample space including all the API methods of the software entity, where X is the discrete random variable representing all of Ω, and where fy is a function that describes the operation characteristics of the API method in Ω, and which maps an API method in Ω to a random collection of entities in w for its execution.
Also in the context of software entity testing, C is the discrete random variable representing the set of all the creation API methods in Ω. The execution of the creation API methods results in the addition of uniquely identifiable entities Y to ψ. Fy(c) is a function that describes the creation characteristics of the API method in Ω. Fy(c) maps an API method in Ω to a random collection of entities in ψ after its execution.
Furthermore, D is the discrete random variable representing the set of all destruction or deletion API methods in Ω. The execution of these API methods results in the removal of uniquely identifiable entities Y from ψ. Fy(D) is a function that describes the deletion characteristics of the API method in Ω. Fy(D) maps an API method in Ω to a random collection of entities in ψ before its execution.
Furthermore, other sample spaces include ξ, η, and χ. The sample space ξ includes all the random sequences of API methods (from Ω), where each operates on an entity selected from ψ. S is a discrete random variable representing all of ξ. The sample space η includes all the random sequences of entities (from ψ) to be operated on by the API methods selected from Ω. N is a discrete random variable representing all of η. The sample space χ includes all the random sequences of entities (from λ) to be used as parameter values by the API methods selected from Ω. V is a discrete random variable representing all of χ.
Detailed Embodiments for Generating Random Sequences
In this section of the detailed description, detailed embodiments for generating random sequences using stochastic generative models are presented. In its simples form, a multivariate sequence generator ζ maps a random list of <X> (from Ω) to S (from ξ), maps a random list of <Y> (from ψ) to N (from η), and maps a random list of <W> (from λ) to V (from χ). The length of S, N, and V are the same, and the elements of S, N, and V form a sequence of tuples <s, n, v> for the sequence consumer. The stochastic patterns in the resulting sequences S, N, and V are known a priori to the generator ζ, and are referred to as a stochastic generative model, or SGM, herein.
The SGM includes multiple random variables, such as X, Y, W, S, N, and V), by sampling from the respective random spaces (such as Ω, ψ, ξ, η, and χ) as described by an expected arbitrary probability, or EAD. The EAD are the embedded stochastic patterns in S, N, and V. The SGM can be incrementally constructed by analyzing each random variate and its associated EAD as follows.
First, R(X) is the EAD of Xi in Ω, where R is the relative probability of occurrence of each element from Ω, in the sequence S. For example, if R follows a uniform distribution function, then all the elements in Ω will have an equal probability of occurrence in the sequence S, generated by the generator. In another example, if Ω is the set of {X1, X2, X3, X4, and X5} and the corresponding R(X) is {0.2, 0.1, 0.05, 0.05, and 0.6}, then the random sequence generator takes into account this non-uniform distribution function while generating the sequence. Hence, the generated sequence will have more X5 than X1, X2, X3, and X4, in that order.
Second, P(X, t) is the EAD of Xi in Ω, at time T=t. In other words, the relative probability of occurrence of each element from Ω is dependent on its position in the generated random sequence S. For example, Ω may be a set of {X1, X2, X3, X4, and X5} and the probability density function may vary with time tn in which the change in the probability of occurrence of X1 occurs at T=t0, t1, . . . , tN. The change in the probability of occurrence of Xi along the t-axis (i.e., the index position in the sequence) acts as an EAD pattern P(X, t) for the sequence generator. For example, the EAD pattern may state that X5 will not occur at T3, T4, T7, and T8, since the probability of occurrence is zero. The EAD pattern as another example may state that at T=T6, the arbitrary probability distribution pattern can be read as X1=0.3, X2=0.1, X3=0.3, X4=0, and X5=1. After normalization, this can be transformed into an arbitrary non-uniform probability distribution function that influences the sequence generation.
Third, M(Xn, Xm, d) is the EAD that governs the probability of occurrence of Xm at position m in the sequence S, as a function of distance d, given the occurrence of Xn at position n, where m>n. This aspect of the stochastic model describes the affinity (or repulsion) between two elements of Ω as a function of its distance d, as well as the order of occurrence of the elements of Ω. For example, if M(Xn, Xm, d) follows an exponential probability density (λe−λx), where d is 1/λ, given the occurrence of Xn (at n), a smaller value of d will influence the generator to generate Xm as close to Xn as possible. Similarly, this also influences the order of occurrence in S.
Fourth, Q(Y, t) is the population density (i.e., EAD) of Yt in ψ, at time T=t. The population density of elements in ψ can thus vary along the length of S. Therefore, P(Y, t) has an indirect impact on the distribution and occurrences of C and D within the sequence S. For example, if Q(Y, t) follows a normal distribution, then the generated application programming interface (API) method sequence initially has higher density of elements from C, to ensure an increase in population density in accordance with such a distribution. The latter half of the random sequence has a higher density of elements from D, to again ensure reduction in population and conform to the normal distribution. Therefore, the rate of change of the EAD population density function determines the positional probability distribution function of the elements in C and D.
Initially, the generator is based on equal probability of occurrences of all elements Ω (including C and D) in S. Subsequent occurrences of elements from C and D are affected by the EAD Q(Y, t) as follows. First, a positive rate of change in the population density function means that the probability of occurrences of an element from C has to be greater than D, and the magnitude is determined by the rate of change. Second, a negative rate of change in population density gives a higher probability of occurrences of an element from D than from C.
Fifth, T(y) is the EAD of the lifetime of an entity from ψ in Y. If S is the sequence selected by the generator, the lifetime distribution T(Y) will have an impact on the selection of Y's in the corresponding sequence N generated by the same generator. Primarily, the occurrences of elements from D in S impacts the choice of the Y's in N, to ensure adherence to T(Y). For example, if T(Y) follows a normal distribution, the following is true. For every occurrence of an alphabet from C in the control sequence C, creations of Y's in ψ result. Furthermore, for every occurrence of an alphabet from X (other than C or D) within the control sequence S, a random selection of Y elements from ψ results, depending on the number of Y elements needed by the element (from X). Finally, for every occurrence of an alphabet from D in the control sequence S, a random selection of Y elements from ψ results, such that the termination time of the randomly selected Y elements follows T(Y)—the normal distribution function. That is, from the sample space ψ, entities are sampled such that the age of the selected Y elements fit T(Y)—the normal distribution function.
Sixth, R(W) is the EAD of Wi in λ, where R is the relative probability of occurrence of each element from λ, within the sequence V. Seventh, P(W, t) is the EAD of Wi in λ, at time T=t. That is, the relative probability of occurrence of each element from λ is dependent on its position in the generated random sequence V. Eighth, M(Wn, Wm, d) is the EAD that governs the probability of occurrence of Wm at position m in the sequence V, as a function of distance d, given the occurrence of Wn at position n, where m>n.
In summary, then, the SGM is a combination of the following random variates (and one or more of their associated EAD's). The first random variate is X, where R(X) is the relative probability of occurrence of elements from Ω in S, P(X, t) is the positional probability distribution of elements from Ω in S, and M(Xn, Xm, d) is the affinity description function between Xn and Xm as a function of distance d. The second random variate is Y, where Q(Y, t) is the positional population density function of elements Y in ψ, and T(Y) is the expected lifetime of elements Y in ψ. The third random variate is W, where R(W) is the relatively probability of occurrence of elements from λ in V, P(W, t) is the positional probability distribution of elements from λ in V, and M(Wn, Wm, d) is the affinity description function between Wn and Wm as a function of distance d.
A multivariate sequence generator thus accepts the SGM as input, and generates the following sequences. The first sequence is S, which is an ordered list of elements from Ω, such as {X3, X5, X1, X4, X2}. The second sequence is N, which for each element of S, includes a list of elements from ξ, such as {{Y3, Y2, Y1}, { }, {Y4, Y6}, {Y5}, {Y6, Y1, Y2}, {Y3}}. The third sequence is V, which for each element of S, includes a list of elements from χ, such as {{W1, W5, W3}, {W4}, {W5, W1}, {W6, W1}, { }}.
Characteristics of the SGM include spatio-temporal characteristics of the EAD, as follows. R(X) specifies a spatial distribution along the X dimension, which affects the choice of elements from Ω uniformly at all positions within the sequence S, has a temporarily uniform and global impact for all t, and has spatially arbitrary and global impact for all elements of X. P(X, t) specifies spatial (along the X dimension) and temporal (along the t dimension) distribution. P(X, t) affects the choice of elements from Ω differently at each position in the sequence S, has a temporally arbitrary and local impact determined by the t variable in the distribution function, and has a spatially arbitrary and local impact determined by the X variable in the distribution function.
M(Xn, Xm, d) specifies a temporal distribution across two elements in X, and affects the choice of elements from Ω depending on the occurrence of Xn in S for a duration D. M(Xn, Xm, d) has a temporally arbitrary and localized impact for duration d and a spatially and localized impact for just two points in space. M(Xn, Xm, d) can temporally interfere with itself, in situations where Xn is generated within the given duration d. Furthermore, one M(Xn, Xm, d1) can interfere with another M(Xn, Xm, d2), in situations where Xp is generated within the given duration d1.
Q(Y, t) specifies the temporal distribution of Y along the t dimension. Q(Y, t) indirectly affects the choice of elements from Ω (particularly elements in C and D) at each position in the sequence S, and affects the choice of elements from ψ at each position in N, since it results in the creation of new elements in ψ. Q(Y, t) has temporally arbitrary and global impact for all t, and a spatially arbitrary and localized impact on the elements in C and D.
T(Y) specifies the temporal distribution of Y along the t dimension, and affects the choice of elements from ψ at each position in N. T(Y) has a temporally arbitrary and global impact for all t, and a spatially arbitrary and localized impact on the elements ψ. R(W) specifies a spatial distribution along the W dimension, and affects the choice of elements from ψ uniformly at all positions in the sequence V. R(W) has a temporally uniform and global impact for all t. R(W) further has a spatially arbitrary and global impact for all elements of W.
P(W, t) specifies spatial distribution along the W dimension and temporal distribution along the t dimension. P(W, t) affects the choice of elements from ψ differently at each position in the sequence S. P(W, t) has a temporally arbitrary and local impact determined by the t variable in the distribution function, and a spatially arbitrary and local impact determined by the W variable in the distribution function.
M(Wn, Wm, d) specifies a temporal distribution across two elements in W, and affects the choice of elements from Ω depending on the occurrence of Wn in V for a duration d. M(Wn, Wm, d) has a temporally arbitrary and localized impact for duration d, and a spatially arbitrary and localized impact for just two points in space. M(Wn, Wm, d) can temporally interfere with itself, in situations where Wn is generated within the given duration d. Furthermore, one M(Wn, Wm, d1) can temporally interference with another M(Wn, Wm, d) in situations where Wp is generated within the given duration d1. It is noted that the term arbitrary as used herein refers to a non-linear function.
It is noted that an SGM with more than one EAD—namely R(X), P(X, t), M(Xn, Xm, d), Q(Y, t), T(Y), R(W), P(W, t), and M(Wn, Wm, d)—will results in non-linear stochastic interference. That is, for a given position within the generated sequence S (or N or V), more than one EAD will affect the occurrence of an element from X (or Y or W). These interference fields can result in unpredictable behavior.
There are two aspects of interference that can affect whether an SGM behaves predictably. The first aspect is the region of interference. Overlapping regions of interference may result in unpredictable behavior, whereas non-overlapping regions do not. A region is defined by the range in the t-dimension and in the X- (or Y-) dimension. For example, a region R1 could be defined as [3<t<6, {X2, X5}], and another region R2 as [0<t<3, {X1, X3, X6}], and a third region R3 [5<t<8, {X3, X5}]. In this example, R1 and R2 are non-overlapping, whereas R1 and R3 overlap.
The second aspect is the nature of the interference. A conflicting region of interference may result in unpredictable behaviors, whereas a converging region of interference does not. An example of a conflict is, for a given position in S, where R(X3) requires a very high probability of occurrence of X3 whereas P(X3) requires a very low probability of occurrence of X3. An SGM is thus said to have interference if and only if, there exist overlapping regions in the EAD, and the EAD is conflicting in these overlapping regions. A multivariate sequence generator performs predictably for non-interfering EAD's within the SGM.
A multivariate sequence generator has two following core operations, which are referred to herein as uniform-to-arbitrary (U2A) mapping and random-select (RSelect). As to the first operation, OutVal is defined by U2A (InVal, OutSet, Px). Specifically, InSet is a sample space having values in the range [0, 1]. InVal is a discrete input variate on InSet, with a uniform probability distribution. OutSet is a sample space having discrete elements, and OutVal is the discrete random variable on OutSet, with an arbitrary probability distribution Px.
The operation U2A can be effectuated as follows. First, the input <Px> of length Lx is sorted in ascending order, and the vector <OutSet> is arranged in the same sorted order as <Px>. Next, a range matrix of Rng dimension Lx×2 is prepared, where Rngi[0] holds minValue and Rngi[1] holds maxValue of the range. The Rng is filled with values from the sorted Px, as follows. Rng[0]=0 and Rng[1]=Px0. For all i, 0<I<Lx, Rngi[0]=Rngi−1[1] and Rngi[1]=Rngi[0]+Pxi+1. Third, the input InSet is mapped to OutSet, and the OutVal of the given InVal is determined as follows. If (Rngi[0]<=Rngi[1]), where i=0 to Lx, then OutVal=OutSet[i], else OutVal=the null set. Finally, OutVal is returned.
As to the second operation, OutVal is defined by RSelect (aSet, inAge, outDist, outSize). <aSet> is a sample space having discrete elements (i.e., an ordered collection); <inAge> associates a number to the elements of <aSet>, which is interpreted as the age of an element in <aSet>. <OutVal> is a discrete random variate on <aSet>, having a probability distribution described by <outDist>, and <outDist> is a distribution function over the age of the elements in <aSet>. For example, a distribution function can be defined as follows:




  
    P
    outDist
  
  =
  
    {
    
      
        
          0.0
        
        
          
            t
            <
            5
          
        
      
      
        
          
            0.2
            *
            
              (
              
                t
                -
                5
              
              )
            
          
        
        
          
            5
            ≤
            t
            ≤
            10
          
        
      
      
        
          1.0
        
        
          
            t
            >
            10
          
        
      
    
  




Here, the <outDist> vector determines and stores the values within the range [5, 10], and assumes the edge values are copied for the rest of the age-ranges. Finally, <outsize> is the maximum number of elements sampled by <outVal> from <aSet>. RSelect may return a partial list, or even a null list, if the <inAge> does not have sufficient values that satisfy the distribution prescribed by <outDist>.

The operation RSelect can be effectuated as follows. First, a uniform random variate iRand is initialized to generate random numbers within the value range [0, 1]. Next, for all k, 0<k<=outsize, the following is performed. The input <inAge> is sorted in ascending order, and the input <aSet> is rearranged in this same order. The mxAge and mnAge values are determined from <inAge> such that mnAge is the least value in the sorted <inAge> vector and mxAge is the largest value in the sorted <inAge> vector. The value of <outDist> is copied to a probability distribution vector VPx for the age range [mnAge, mxAge], where the index of VPx maps to the age value. Wx is prepared with weights for each index value of VPx by counting the number of elements in <aSet> with the index value (or the age value) in inAge; i.e.:

∀i,(mnAge≦i≦mxAge),

Wxi{count(aSetk)inAgek≡i∀k}

The weighted VPx is then normalized such that:





  
    ∀
    i
  
  ,
  
    (
    
      mnAge
      ≤
      i
      ≤
      mxAge
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        
          VPx
          i
        
        ×
        
          Wx
          i
        
      
    
    ≡
    1
  




An index vector iVect is prepared, such that for all k, mnAge<=k<=mxAge, iVectk=k. A random integer number is generated in the range [1, mxAge], and which follows a distribution <VPx>. Thus, rIndex=U2A (iRandk, iVect, VPx), and if rIndex is equal to the empty set, then outValk is set to the empty set. However, if rIndex is not equal to the empty set, then an element is selected randomly from the subset of elements in <aSet> that have the same rIndex in <inAge>, and they are stored in outVal; i.e.:

aSubSet{∀k∃aSetkinAgek≡rIndex}

outValkrandom select an element from {aSubSet}

In this latter step, for the element outValk, its corresponding entry is removed from <aSet>. Finally, <outVal> is returned.

To conclude the detailed embodiment for generating random sequences in this section of the detailed description, the method 200 of FIG. 2 is referred to once again, in more particular but in consistent fashion than as has been described above. The method 200 generates the random sequences S, N, and V, from the given Ω, ψ, and λ, given X, R(X), P(X, t), M(Xn, Xm, d), given Y, Q(Y, t), and T(Y), and given W, R(W), P(W, t), and M(Wn, Wm, d).
First, inputs representative of the SGM are read or otherwise received (202). The inputs include the following. One input is a vector <X> of length Lx, having elements from ω that include a vector <C>, a function fy(Ci), a vector <D>, a function fy(Di), and a vector <Z>. The vector <C> is of length LC, with creation elements from Ω; the occurrence of an element from <C> in outSeq results in the creation of Y in ψ. The function fy(Ci) determines the number of Y's created by Ci. The vector <D> is of length Ld, having destruction elements from Ω; the occurrence of an element from <D> in outSeq results in the deletion of Y in ψ. The function fy(Di) determines the maximum number of Y's to be deleted by Di, whereas the vector <Z> is of length LZ (defined as Lx-LC-LD) and has elements from {X}—{C}-{D}.
Another input includes a uniform random sequence variate U, which generates a pseudo-random sequence <inSeq> of Length LIN(==LOUT), with range [0, 1]. An input vector <Y> has length LY input vector <Y> has length LY with elements from ψ. An input vector <W> has length LW with elements from λ.
Additional inputs include the expected arbitrary probability distribution (EAD), including a vector <Rx>, a matrix <Px>, an indexed collection of vectors Mx(Xn, Xm), a vector <Qy>, a vector <Ty>, a vector <Rw>, a matrix <Pw>, and an indexed collection of vectors Mw(Wn, Wm). The vector <Rx> is of type double[ ] and has length Lx, and represents an arbitrary non-uniform discrete probability distribution. The matrix <Px is also of type double, has dimensions Lx×LIN, and represents an arbitrary distribution pattern of each Xi along the length of the output sequence (or time axis). The value range is [0, 1], and the sum of all the values along the time axis need not be 1.
The collection Mx(Xn, Xm) is indexed by the tuple <Xn, Xm>, and has a value that is a vector representing an arbitrary affinity pattern between Xn and Xm along the length of the output sequence (or time axis). The elements of the vector are of type double[ ], and have values within the range [−1, 1]. The value of 0 indicates no affinity or repulsion, whereas positive values indicate affinity and negative values indicate repulsion. Values closer to 1 indicate greater affinity as compared to values closer to 0. Likewise, values closer to −1 indicate greater repulsion as compared to values closer to 0. The length of the vector describes the depth of the dependency between Xn and Xm. The vector for <Xn, Xm> need not be the same as <Xm, Xn>, since the former captures the relative affinity of Xm, given the occurrence of Xn, and the latter captures the relative affinity of Xn, given the occurrence of Xm.
The vector <Qy> is of type double[ ] and has a length LIN. This vector represents an expected arbitrary non-uniform population density of Y's along the length of the output sequence (or time axis). The index of the vector represents the time line, and the vector's values are positive numbers, representing the population of Y's in ψ. The initial absolute population of Y in ψ can be 0 (or Qy0), however.
The vector <Ty> represents the expected lifetime distribution function of Y's in ψ over the age of elements in ψ. For example, the distribution function can be defined as follows:




  Ty
  =
  
    {
    
      
        
          0.0
        
        
          
            t
            <
            5
          
        
      
      
        
          
            0.2
            *
            
              (
              
                t
                -
                5
              
              )
            
          
        
        
          
            5
            ≤
            t
            ≤
            10
          
        
      
      
        
          1.0
        
        
          
            t
            >
            10
          
        
      
    
  




In this case, the Ty vector determines and stores the value within the range [5, 10], and assumes the edge values are copied for the remainder of the age ranges.

The vector <Rw> is of type double[ ] and has a length Lw. This vector represents an arbitrary non-uniform discrete probability distribution. The matrix <Pw> is also of type double, and has dimensions Lw×LIN. This matrix represents an arbitrary distribution pattern of each Wi along the length of the output sequence or time axis. The range of the values is [0, 1], and the sum of all the values along the time axis does not have to be 1. Finally, Mw(Wn, Wm) is an indexed collection of vectors, where the index is a tuple <Wn, Wm>, and its value is a vector that represents an arbitrary affinity pattern between Wn and Wm along the length of the output sequence or time axis.
Still referring to FIG. 2, outputs are generated that are representative of the random sequences, based on the SGM as represented by the inputs (204). Specifically, these outputs include pseudo-random sequences S, N, and V all having the length LOUT. The sequence S is a vector of elements from Ω. The sequence N is a vector of collections of elements from ψ. The sequence V is a vector of collections of elements from λ.
The outputs are generated as follows. First, the position population density, or Qy, if provided is verified or validated (206). Specifically, it is verified that the rate of positive change of values in Qy is less than the maximum possible number of Y's that can be created by a Ci in <C>. That is, Max of Fy(C), for all <C>,

∀ici∈C,fy(ci)→ψ:∥ψi∥−∥ψi−1∥

∀kDQyk→Qyk−Qyk−1 

∃max(fci)≦max(DQyk)∀DQy>0

It is further verified that the rate of negative change of values in Qy is less than the maximum possible number of Y's that can be deleted from ψ by and di in <D>. That is, Max of Fy(d), for all <D>,

•idi∈D,fy(di)→ψ:∥ψi∥−∥ψi−1∥

•kDQyk→Qyk−Qyk−1 

∃max(|fdi|)≧max(|DQyk|)∀DQy>0

A failure is reported if either of these conditions cannot be met. While the method 200 can continue after reporting failure, faithfulness as to the specified population profile cannot be guaranteed in this instance.

Next, the inputs are processed and initialization is performed (208). The output sequences S and N are each initialized as an empty list { }. If input Rx is not provided, an Rx vector of length Lx=1 is created. If Mx is provided, LxMaxDepth—the maximum depth of the vectors in Mx—is determined. If Qy is provided, the desired population change vector, DQy is determined as, for all I, (0<I<LIN), DQyi=Qyi−Qy(i−1). Furthermore, if Qy is provided, the mean μDQy is determined, and the standard deviation σDQy is determined, for the desired population change vector DQy. More specifically, μDQy is the mean of DQyi, where 0<i<Lin, and σDQy is the standard deviation of DQyi, where 0<i<Lin.
Furthermore, for all X elements in Ω, a Y contribution vector YC is prepared as follows. First, if the element in Ω is a member of D, then −fy(D) is copied into the corresponding position of the YC vector. That is,

∀idi∈D 

∃xj∈Xdi≡xj∵D⊂X 

YCi−fy(di)

Second, if the element in Ω is a member of Z, then 0 is copied into the corresponding position of the YC vector. That is,

k→sizeof(YC)

∀izi∈Z 

∃xj∈Xzi≡xj∵Z⊂X 

YCk+i0

Third, if the element in Ω is a member of C, then the Fy(C) is copied into the corresponding position of the YC vector. That is,

k→sizeof(YC)

∀ici∈C 

∃xj∈Xci≡xj∵C⊂X 

YCk+ify(ci)

Part 208 of the method 200 concludes as follows. For all Y elements in ψ, a Yage vector is initialized as zero. Finally, the variable Ay, representing the actual population of Y, is also initialized to zero. Next, the probabilities of occurrence are normalized (210). That is, the input vector Rx and the input vector Rw are each normalized. Specifically, the input vector Rx is normalized such that:




  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        x
      
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        Rx
        i
      
    
    ≡
    1
  
  ,




And the input vector Rw is normalized such that:





  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        w
      
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        Rw
        i
      
    
    ≡
    1.
  




Next, for each current position of the sequence length, from the first position to the last position—that is, for each position k (0<=k<LOUT) the following is performed (212). First, the current position of the random sequence S, Sk, is generated based on the inputs (214). If Px is provided, Px is prepared by normalizing the k-th vector within the input matrix Px, such that:




  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        x
      
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        Px
        
          (
          
            i
            ,
            k
          
          )
        
      
    
    ≡
    1.
  




If Qy is provided, Py is prepared by determining the probability distribution for the elements of <C>, <D>, and <Z>, based on the actual population of Y (Ay at position k), and expected population (Qyk+1), as follows. The probabilities Pc, Pd, and Pz, which are the probabilities of an element from <C>, <D>, and <Z>, respectively, are each initialized to zero.

The probability distribution vector for all elements in <X> is also initialized in part 214:

∀ixi∈X,Py(i,k)→0.

Next, the desired population change DPQy is determined as Qyk+1−Ay, and if DPQy is zero, then the probability Py for each element in <X> is determined as:

∀i(0≦i<Lx)xi∈Z,Py(k,i)→1/sizeOf(Z)

∀j(0≦j<Lx)xj∈D∪C,Py(k,j)→0

If DPQy is positive, then the probability Py is determined for each element in <X>, using DPQy as the mean and σDQy as the deviation of a normal distribution function as follows:




  
    ∀
    
      
        
          i
          ⁡
          
            (
            
              0
              ≤
              i
              <
              
                L
                x
              
            
            )
          
        
        ⁢
                ⁢
        
          x
          i
        
      
      ∈
      
        C
        ⋃
        Z
      
    
  




  
    
      
        Py
        
          (
          
            k
            ,
            i
          
          )
        
      
      →
      
        
          1
          
            
              σ
              DQy
            
            ⁢
            
              
                2
                ⁢
                
                  
                
                ⁢
                π
              
            
          
        
        ⁢
        
          
            exp
            ⁡
            
              (
              
                -
                
                  
                    
                      (
                      
                        
                          YC
                          i
                        
                        -
                        DPQy
                      
                      )
                    
                    2
                  
                  
                    2
                    ⁢
                    
                      
                    
                    ⁢
                    
                      σ
                      DQy
                      2
                    
                  
                
              
              )
            
          
          .
          
            

          
          ⁢
          
            ∀
            
              
                
                  j
                  ⁡
                  
                    (
                    
                      0
                      ≤
                      j
                      <
                      
                        L
                        x
                      
                    
                    )
                  
                
                ⁢
                                ⁢
                
                  x
                  j
                
              
              ∈
              D
            
          
        
      
    
    ,
    
      
        Py
        
          (
          
            k
            ,
            j
          
          )
        
      
      →
      0
    
  



By comparison, if DPQy is negative, then the probability Py for each element in <X> is determined using DPQy as the mean and σDQy as the deviation of a normal distribution function as follows:




  
    ∀
    
      
        
          i
          ⁡
          
            (
            
              0
              ≤
              i
              <
              
                L
                x
              
            
            )
          
        
        ⁢
                ⁢
        
          x
          i
        
      
      ∈
      
        D
        ⋃
        Z
      
    
  




  
    
      
        Py
        
          (
          
            k
            ,
            i
          
          )
        
      
      →
      
        
          1
          
            
              σ
              DQy
            
            ⁢
            
              
                2
                ⁢
                
                  
                
                ⁢
                π
              
            
          
        
        ⁢
        
          
            exp
            ⁡
            
              (
              
                -
                
                  
                    
                      (
                      
                        
                          YC
                          i
                        
                        -
                        DPQy
                      
                      )
                    
                    2
                  
                  
                    2
                    ⁢
                    
                      
                    
                    ⁢
                    
                      σ
                      DQy
                      2
                    
                  
                
              
              )
            
          
          .
          
            

          
          ⁢
          
            ∀
            
              
                j
                ⁢
                                ⁢
                
                  x
                  j
                
              
              ∈
              C
            
          
        
      
    
    ,
    
      
        Py
        
          (
          
            k
            ,
            j
          
          )
        
      
      →
      0
    
  



Finally, the determined Py for all <X> is normalized, such that:





  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        x
      
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        Py
        i
      
    
    ≡
    1.
  




Still referring to part 214 of the method 200, if Mx is provided, MPx is prepared. First, a co-occurrence matrix CMx is prepared based on the EAD, Mx for all the previously generated values in S. This entails initializing the co-occurrence matrix CMx (dimension Lx×min(LxMaxDepth, k)) with 0.5 in all of its cells, and for all i, 0<=m<min(LxMaxDepth, k), if there exists a valid vector for the tuple <Sk−m, Xi> in Mx, setting CMx(i, m) to (Mx<Sk−m, Xi>(m)+1)/2.0. Second, a VPatx vector is prepared using the co-occurrence matrix Mx. That is, for all I, 0<=I<Lx, VPatxi=




  
    ∏
    m
    
      min
      ⁡
      
        (
        
          
            L
            MaxDepth
          
          ,
          k
        
        )
      
    
  
  ⁢
  
    
  
  ⁢
  
    
      CMx
      ⁡
      
        (
        
          i
          ,
          m
        
        )
      
    
    .
  




Third, MPx is determined from VPatx, by normalizing VPatx, such that:




  
    
      ∀
      i
    
    ,
    
      (
      
        0
        ≤
        i
        <
        
          L
          x
        
      
      )
    
    ,
      




  
    
      MPx
      i
    
    ↦
    
      {
      
        
          
            
              
                VPatx
                i
              
              /
              
                
                  ∑
                  k
                  
                    L
                    x
                  
                
                ⁢
                
                  
                
                ⁢
                
                  VPatx
                  k
                
              
            
          
          
            
              
                
                  ∑
                  k
                  
                    L
                    x
                  
                
                ⁢
                
                  
                
                ⁢
                
                  VPatx
                  k
                
              
              ≠
              0.
            
          
        
        
          
            0
          
          
            
              
                
                  ∑
                  k
                  
                    L
                    x
                  
                
                ⁢
                
                  
                
                ⁢
                
                  VPatx
                  k
                
              
              ≡
              0
            
          
        
      
    
  



Fourth, VPx, the arbitrary probability distribution vector having dimension Lx is determined by copying the resulting normalized vector. For all I (0<=i<Lx), VPxi is initialized to Rxi; if Qy is provided then VPxi is set to VPxi×Py(i,k); if Mx is provided then VPxi is set to VPxi×MPxi; and, if Px is provided then VPxi is set to VPxi×Px(i,k). Finally, VPx is normalized. Fifth, random values are generated for the k-th position in <S>, using inSeqk, via Sk=U2A (inSeqk, X, VPx).

Next, the current position of the random sequence N, Nk, is generated for Sk (216), as follows. If Sk ∈ C, then new Y elements are added to ψ, as dictated by Fy(Sk), the actual population Ay is updated with the new value, and the Yage vector is augmented with additional values to cater to the new Y elements in ψ, such that the corresponding age value is initialized to zero. If Sk ∉ the union of C and D, then Nk is determined via RSelect(Y, Yage, U, fz(Sk)), where U is a uniform sequence of length LY with each value equal to one, and fz(Sk) is the number of elements to be selected. If inSeqpos ∈ D, then, if Ty is provided, Nk is set as RSelect(Y, Yage, Ty, Fy(Sk)), and if Ty is not provided, Nk is set as RSelect(Y, Yage, U, Fy(Sk)); furthermore, the Y elements listed in Nk are removed from ψ, the corresponding entries in the Yage vector are removed, and the actual population Ay is updated with the new value. Finally, the entries in the Yage vector are incremented by one.
Finally, the current position of the random sequence V, Vk, is generated (218), as follows. If Pw is provided, Pw is prepared by normalizing the k-th vector in the input matrix Pw, such that:




  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        W
      
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        Pw
        
          (
          
            i
            ,
            k
          
          )
        
      
    
    ≡
    1.
  




If Mw is provided, MPw is prepared as follows. A co-occurrence matrix CMw is prepared based on the EAD, Mw, for all the previously generated values in V. This entails initializing a co-occurrence matrix CMw having dimensions Lw×min(LwMaxDepth, k) with 0.5 in all its cells, and for all i, 0<=i<Lw, and for all m, 0<=m<min(LwMaxDepth, k), if there exists a valid vector for the tuple <Vk−m, Wi> in Mw, then setting CMw(I, m) as (Mw<Vk−m, Wi>(m)+1)/2.0. Next, MPw is continued to be prepared by preparing a VPatw vector using the co-occurrence matrix Mw, such that for all i, 0<=I>Lw, VPatwi=





  
    ∏
    m
    
      min
      ⁡
      
        (
        
          
            Lw
            MaxDepth
          
          ,
          k
        
        )
      
    
  
  ⁢
  
    
  
  ⁢
  
    
      CMw
      ⁡
      
        (
        
          i
          ,
          m
        
        )
      
    
    .
  




Finally, MPw is continued to be prepared by determining MPw from VPatw, by normalizing VPatw such that:





  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        w
      
    
    )
  
  ,
  
    ∋
    
      

    
    ⁢
    
      
        MPw
        i
      
      ↦
      
        {
        
          
            
              
                
                  VPatw
                  i
                
                /
                
                  
                    ∑
                    k
                    Lw
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    VPatw
                    k
                  
                
              
            
            
              
                
                  
                    ∑
                    k
                    
                      L
                      w
                    
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    VPatw
                    k
                  
                
                ≠
                0.
              
            
          
          
            
              0
            
            
              
                
                  
                    ∑
                    k
                    
                      L
                      w
                    
                  
                  ⁢
                  
                    
                  
                  ⁢
                  
                    VPatw
                    k
                  
                
                ≡
                0
              
            
          
        
      
    
  




Still in part 218, the arbitrary population vector VPw, having the dimension Lw, is determined by copying the resulting normalized vector. That is, for all I (0<=I<Lw), VPwi is initialized to Rwi; if Mw is provided then VPwi is set as VPwi×MPwi; if Pw is provided then VPwi is set as VPwi×Pw(i,k). VPw is then normalized via:




  
    ∀
    i
  
  ,
  
    (
    
      0
      ≤
      i
      <
      
        L
        w
      
    
    )
  
  ,
  
    
      
        ∑
        i
      
      ⁢
      
        
      
      ⁢
      
        VPw
        i
      
    
    ≡
    1.
  




Part 214 of the method 200 concludes by generating Vk for Sk, such that

∀i,(0≦i<fw(Sk)),

rVal→random sample from [0,1] with uniform distribution,

Vk→{Vk:U2A(rVal,W,VPw)}

Where fw(Sk) is the number of elements sampled from W for a given Sk.

The method 200 continues by outputting the random sequences that have been generated (220). These sequences are the sequences S, N, and V. Finally, these outputs (i.e., the random sequence S, N, and V) can be used to test a software entity (222), in one embodiment of the invention, as has been described.
General System, Implementation Details, and Conclusion
In this final section of the detailed description, FIG. 4 shows the system 100 of FIG. 1 in a very general representation, according to an embodiment of the invention. In addition to the random sequence generator 102, the system 100 includes hardware 302 and a tester 304. The hardware 302 may include processors, memory, and other types of hardware commonly found in computing devices, as can be appreciated by those of ordinary skill within the art. As such, either the random sequence generator 102, the tester 304, or both the generator 102 and the tester 304 are implemented via the hardware 302.
The random sequence generator 102 is implemented as has been described, by performing the methods of embodiments of the invention that have described above. The tester 304, by comparison, can be used to test a sequence consumer, such as the sequence consumer 104 of FIG. 1, which is not depicted in FIG. 4. For instance, the sequence consumer may be a software entity exposing an application programming interface (API). As such, the tester 304 uses the outputs of the random sequence generator 102 as inputs to the API to test the software entity in question.
As can be appreciated by one those of ordinary skill within the art, aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, aspects of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the present invention may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon.
Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
In general, a computer program product includes a computer-readable medium on which one or more computer programs are stored. Execution of the computer programs from the computer-readable medium by one or more processors of one or more hardware devices causes a method to be performed. For instance, the method that is to be performed may be one or more of the methods that have been described above.
The computer programs themselves include computer program code. Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).
Aspects of the present invention have been described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
At least some embodiments of the present invention thus generate multivariate random sequences that have arbitrary stochastic patterns. The expected arbitrary stochastic patterns that are to be presented in the generated sequences may be taken as inputs. As such, a test engineer can describe a test model for API testing stochastically, using a multivariate simulation input model. The stochastic test model can describe the test conditions, such as the relative probability of occurrence of a test message in a test vector, a positional probability of every test message in the test vector, the probability of co-occurrences of two or more test messages, and the order of co-occurring test messages. The test vector is a sample of this test model. The random sequences generated are thus instances from the test model to be used to stochastically test the API of a software entity.
It is finally noted that, although specific embodiments have been illustrated and described herein, it will be appreciated by those of ordinary skill in the art that any arrangement calculated to achieve the same purpose may be substituted for the specific embodiments shown. This application is thus intended to cover any adaptations or variations of embodiments of the present invention. For example, while embodiments have been described in general terms, and an example has been provided in which the random sequences generated (with embedded spatio-temporal stochastic patterns) may be used to test a software entity having an application programming interface (API), other examples are also amenable to embodiments of the invention. For instance, embodiments of the invention are amenable to a food web model that is used by ecologists, as just one example among many others, such as any type of simulation system. As such and therefore, it is manifestly intended that this invention be limited only by the claims and equivalents thereof.

## Claims

1. A method to generate random sequences based on a stochastic generative model having multiple random variates, the method implemented by one or more computer programs executed by one or more processors such that execution of the computer programs by the processors causes performance of the method, the method comprising:
receiving a plurality of inputs representative of the stochastic generative model, the inputs comprising:
a first random variate having a finite set of alphabets;
a second random variate having a set of alphabets; and,
a third random variate having a finite set of alphabets;

generating a plurality of outputs representative of the random sequences based on the stochastic generative model, by the processors executing the computer programs, the outputs comprising:
a first random sequence, the first random sequence being a finite-length random sequence of alphabets randomly selected from the first random variate;
a second random sequence having a set of alphabets selected from the second random variate, the set of alphabets of the second random sequence corresponding to each alphabet of the first random sequence; and,
a third random sequence having a set of alphabets randomly selected from the third random variate, the set of alphabets of the third random sequence corresponding to each alphabet in the first random sequence.

2. The method of claim 1, further comprising using the outputs to test a software entity running on hardware that exposes an application programming interface (API), the software entity tested by using the outputs as inputs to the API.

3. The method of claim 1, wherein the inputs further comprise, regarding the first random variate:
a first subset of alphabets of the first random variate that result in creation of the set of alphabets of the second random variate;
a second subset of alphabets of the first random variate that result in deletion of the set of alphabets of the second random variate; and,
a third subset of alphabets of the first random variate that is equal to the finite set of alphabets of the first random variate minus the union of the first subset of alphabets and the second subset of alphabets.

4. The method of claim 3, wherein the inputs further comprise, regarding dependencies between the first random variate and the second random variate:
a first vector function describing creation characteristics of the alphabets within the first subset;
a second vector function describing deletion characteristics of the alphabets within the second subset; and,
a third vector function describing operation characteristics of the alphabets within the third subset.

5. The method of claim 1, wherein the inputs further comprise:
regarding dependencies between the first random variate and the third random variate, a vector function describing operation characteristics of the alphabets within the first random variate; and,
a uniform random sequence of numbers within a range [0, 1].

6. The method of claim 1, wherein the inputs further comprise a plurality of stochastic pattern definitions comprising:
a first relative probability of occurrence of each alphabet within the first random variate to be found in the first random sequence;
a first positional probability distribution for each alphabet within the first random variate to be found in the first random sequence;
a first probability distribution function describing a pair-wise co-occurrence of the alphabets to be found within the first random sequence;
a positional population density of the alphabets within the second random variate to be found along a length of the first random sequence;
a lifetime distribution function of the alphabets within the second random variate;
a second relative probability of occurrence of each alphabet within the third random variate to be found in the third random sequence;
a second positional probability distribution of each alphabet within the third random variate to be found in the third random sequence; and,
a second probability distribution function describing a pair-wise co-occurrence of the alphabets to be found within the third random sequence.

7. The method of claim 6, wherein the inputs further comprise a plurality of generative rules prescribing how the outputs are to be generated based on the inputs, the generative rules comprising:
a presence or absence of the third random variable within the stochastic generative model;
a presence or absence of each of a plurality of first stochastic patterns within the first random sequence, the first stochastic patterns comprising the first relative probability of occurrence, the first positional probability distribution, the first probability distribution function, the positional population density;
a presence or absence of a second stochastic pattern within the second random sequence, the second stochastic pattern comprising the lifetime distribution function; and,
a presence of absence of each of a plurality of third stochastic patterns within the third random sequence, the third stochastic patterns comprising the second relative probability, the second positional probability, and the second probability distribution function.

8. The method of claim 1, wherein a size of each entry in the second random sequence is controlled by at least the alphabets within the first random sequence, and a size of each entry of the third random sequence is controlled by at least the alphabets within the first random sequence.

9. A computer program product comprising a non-transitory computer-readable storage medium storing one or more computer programs, the computer programs executable by one or more processors to perform a method to generate random sequences, including a first random sequence, a second random sequence, and a third random sequence, based on a stochastic generative model having multiple random variates, the method comprising:
reading a plurality of inputs representative of the stochastic generative model, the inputs comprising:
a first random variate having a finite set of alphabets;
a second random variate having a set of alphabets;
a third random variate having a finite set of alphabets;
a first relative probability of occurrence of each alphabet within the first random variate to be found in the first random sequence;
a positional population density of the alphabets within the second random variate to be found along a length of the first random sequence; and,
a second relative probability of occurrence of each alphabet within the third random variate to be found in the third random sequence;

validating the positional population density;
processing the inputs;
normalizing the first relative probability of occurrence and the second relative probability of occurrence;
for each current position of a plurality of positions of a length of each of the first, second, and third random sequences, from a first position to a last position,
generating the current position of the first random sequence based on the inputs;
generating the current position of the second random sequence based on the inputs; and,
generating the current position of the third random sequence based on the inputs.

10. The computer program product of claim 9, wherein the method further comprises outputting the first, second, and third random sequences.

11. The computer program product of claim 9, wherein the method further comprises using the outputs to test a software entity running on hardware that exposes an application programming interface (API), the software entity tested by using the outputs as inputs to the API.

12. The computer program product of claim 9, wherein the inputs further comprise:
regarding dependencies between the first random variate and the third random variate, a vector function describing operation characteristics of the alphabets within the first random variate; and,
a uniform random sequence of numbers within a range [0, 1].

13. The computer program product of claim 12,
wherein the inputs further comprise, regarding the first random variate:
a first subset of alphabets of the first random variate that result in creation of the set of alphabets of the second random variate;
a second subset of alphabets of the first random variate that result in deletion of the set of alphabets of the second random variate; and,
a third subset of alphabets of the first random variate that is equal to the finite set of alphabets of the first random variate minus the union of the first subset of alphabets and the second subset of alphabets,

and wherein the inputs further comprise, regarding dependencies between the first random variate and the second random variate:
a first vector function describing creation characteristics of the alphabets within the first subset;
a second vector function describing deletion characteristics of the alphabets within the second subset; and,
a third vector function describing operation characteristics of the alphabets within the third subset.

14. The computer program product of claim 13, wherein the inputs further comprise a plurality of stochastic pattern definitions comprising:
a first positional probability distribution for each alphabet within the first random variate to be found in the first random sequence;
a first probability distribution function describing a pair-wise co-occurrence of the alphabets to be found within the first random sequence;
a lifetime distribution function of the alphabets within the second random variate;
a second positional probability distribution of each alphabet within the third random variate to be found in the third random sequence; and,
a second probability distribution function describing a pair-wise co-occurrence of the alphabets to be found within the third random sequence.

15. The computer program product of claim 14, wherein the inputs further comprise a plurality of generative rules prescribing how the outputs are to be generated based on the inputs, the generative rules comprising:
a presence or absence of the third random variable within the stochastic generative model;
a presence or absence of each of a plurality of first stochastic patterns within the first random sequence, the first stochastic patterns comprising the first relative probability of occurrence, the first positional probability distribution, the first probability distribution function, the positional population density;
a presence or absence of a second stochastic pattern within the second random sequence, the second stochastic pattern comprising the lifetime distribution function; and,
a presence of absence of each of a plurality of third stochastic patterns within the third random sequence, the third stochastic patterns comprising the second relative probability, the second positional probability, and the second probability distribution function.

16. The computer program product of claim 14, wherein generating the current position of the first random sequence comprises:
normalizing the first position probability distribution for the current position;
determining a probability distribution vector for the alphabets within the first random variate, based on the positional population density and on an actual population of the alphabets within the second random variate;
determining a probability distribution vector for the alphabets within the first random variate based on the first probability distribution function;
determining an overall probability distribution vector for the alphabets within the first random variate for the current position of the first random sequence; and,
sampling the first random variate via the probability distribution vector, using the uniform random sequence of numbers, to generate the current position of the first random sequence.

17. The computer program product of claim 14, wherein generating the current position of the second random sequence comprises:
sampling the second random variate via an age-distribution vector, using the first vector function, to generate the current position of the second random sequence; and,
determining a modified population of the alphabets within the second random variate.

18. The computer program product of claim 14, wherein generating the current position of the third random sequence comprises:
normalizing the second position probability distribution for the current position;
determining a probability distribution vector for the alphabets within the third random variate based on the second probability distribution function;
determining an overall probability distribution vector for the alphabets within the third random variate for the current position of the third random sequence; and,
sampling the third random variate via the probability distribution vector to generate the current position of the first random sequence.

19. A computing system to generate random sequences based on a stochastic generative model having multiple random variates, comprising:
hardware;
a random sequence generator implemented via the hardware, the random sequence generator to receive a plurality of inputs representative of the stochastic generative model, and to generate a plurality of outputs representative of the random sequences based on the stochastic generative model,
wherein the inputs comprise:
a first random variate having a finite set of alphabets;
a second random variate having a set of alphabets; and,
a third random variate having a finite set of alphabets,

and wherein the outputs comprise:
a first random sequence, the first random sequence being a finite-length random sequence of alphabets randomly selected from the first random variate;
a second random sequence having a set of alphabets selected from the second random variate, the set of alphabets of the second random sequence corresponding to each alphabet of the first random sequence; and,
a third random sequence having a set of alphabets randomly selected from the third random variate, the set of alphabets of the third random sequence corresponding to each alphabet in the first random sequence.

20. The computing system of claim 19, further comprising a tester to test a software entity exposing an application programming interface (API), the software entity tested by using the outputs as inputs to the API.