CN111625959A - Random value-taking algorithm for two-dimensional probability distribution matrix - Google Patents
Random value-taking algorithm for two-dimensional probability distribution matrix Download PDFInfo
- Publication number
- CN111625959A CN111625959A CN202010456781.0A CN202010456781A CN111625959A CN 111625959 A CN111625959 A CN 111625959A CN 202010456781 A CN202010456781 A CN 202010456781A CN 111625959 A CN111625959 A CN 111625959A
- Authority
- CN
- China
- Prior art keywords
- theta
- equal
- probability distribution
- column
- random value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 239000011159 matrix material Substances 0.000 title claims abstract description 26
- 238000009826 distribution Methods 0.000 title claims abstract description 23
- 238000000034 method Methods 0.000 claims abstract description 14
- 238000009827 uniform distribution Methods 0.000 claims abstract description 8
- 239000013598 vector Substances 0.000 description 7
- 238000004088 simulation Methods 0.000 description 4
- 238000005094 computer simulation Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2111/00—Details relating to CAD techniques
- G06F2111/08—Probabilistic or stochastic CAD
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2111/00—Details relating to CAD techniques
- G06F2111/10—Numerical modelling
Abstract
The invention provides a random value-taking algorithm for a two-dimensional probability distribution matrix, and belongs to the technical field of mathematical modeling analysis. The method solves the technical problems that the conventional roulette random value-taking algorithm cannot be applied to two-dimensional probability distribution matrix data and the like. The algorithm comprises the following steps: the method comprises the following steps: creating a matrix theta of u rows and v +1 columns based on phi; a value taking step: randomly generating a bit at (0.0, 1.0) according to uniform distribution]Real number within interval1Determining that the first one from top to bottom in the v +1 th column of theta is greater than or equal to the second one in a binary search mode1The line number i of the element (a) randomly generates a line number (0.0, theta) in a uniform distributioni,v]Real number within interval2Determining that the first one from left to right in the ith row of theta is greater than or equal to the second one in a binary search mode2Column number j of the element(s), using the set of row number i and column number jInteger of the whole number of the ancestors<i,j>. The invention can realize the random value-taking operation of the two-dimensional probability distribution matrix.
Description
Technical Field
The invention belongs to the technical field of mathematical modeling analysis, relates to a random value-taking theoretical research method of computer simulation and discrete probability distribution of a complex system, and particularly relates to a random value-taking algorithm for a two-dimensional probability distribution matrix.
Background
Random value operations of discrete random events are often involved in computer simulations of complex systems to generate simulation instances, and the Roulette Algorithm (Roulette Algorithm) is a random value Algorithm commonly used therein.
The probability distribution of some discrete random events in real life can be described more intuitively by using a two-dimensional matrix. For example, an OD demand probability distribution matrix is often used to describe the proportion of passenger travel demands among stations in a certain time period of an urban public transportation network, and the matrix can be established based on statistics on historical travel records of passengers, and elements in an ith row and a jth column of the matrix are defined as the proportion of passenger travel volume in the corresponding time period, wherein the passenger travel volume takes the ith station as a departure station and the jth station as a destination station, to the total passenger travel volume of the whole network. In passenger flow simulation aiming at the urban public transport network, when a passenger travel simulation case is generated each time, an initial station and a target station of the passenger travel simulation case can be randomly assigned according to an OD demand probability distribution matrix.
The basic flow of the conventional roulette random value algorithm generally includes: firstly, a pre-stage: establishing a Cumulative Probability Distribution (CPD) vector corresponding to the discrete Probability Distribution (PD); a value taking stage: for example, if a discrete random event has 3 possible values, i.e., the probability of a value a is 0.5, the probability of a value B is 0.4, and the probability of a value C is 0.1, it can be seen that the PD vector of the event is <0.5,0.4,0.1>, the CPD vector is <0.5,0.5+0.4 is 0.9,0.9+ 0.1.0 >, wherein subscript 1 corresponds to value a, subscript 2 corresponds to value B, subscript 3 corresponds to value C, when a certain random value of the discrete random event is taken using a roulette algorithm, the randomly generated CPD vector is 0.95, since the first element in the vector of the discrete random event greater than or equal to 0.95 is left to right, the possible value of the discrete event is 3, and the possible value of the current event is determined to include the random value C, the time complexity of the pre-stage in the above process is o (n); during each random value taking operation, a binary search mode can be used for quickly positioning the designated elements of the CPD vector, and the time complexity is O (log (n)). It can be seen that the conventional roulette random value-taking algorithm has good performance, but it completes related operations based on probability distribution vectors, and cannot be directly applied to the case of a two-dimensional probability distribution matrix.
Disclosure of Invention
The invention provides a random value-taking algorithm aiming at a two-dimensional probability distribution matrix according to the problems in the prior art, and the invention aims to solve the technical problems that: how to provide a simple and reliable random value-taking algorithm aiming at a two-dimensional probability distribution matrix.
The purpose of the invention can be realized by the following technical scheme:
a random value-taking algorithm for a two-dimensional probability distribution matrix is characterized in that the process of randomly selecting an integer tuple < i, j > consisting of a row number i and a column number j according to a two-dimensional probability distribution matrix phi of u rows and v columns sequentially comprises the following steps 1 and 2:
step 1 (pre-step): the method sequentially comprises the following substeps:
①, creating a matrix theta of u rows and v +1 columns, aiming at the condition that x is more than or equal to 1 and less than or equal to u and y is more than or equal to 1 and less than or equal to v, leading the theta to be higher than or equal to x and less than or equal to u, and leading the theta to be higher than or equal to y andx,y=Φx,y;
②, traversing each line of theta, and in the process of traversing each line, traversing from the 2 nd element to the v th element one by one, wherein the line number of the currently traversed element is set as x, the column number is set as y, and the theta is enabled to bex,y=Θx,y-1+Θx,y;
③, let theta1,v+1=Θ1,v;
④, traversing from the 2 nd element to the u th element in the v +1 th column of theta one by one, setting the line number of the current traverse element as x, and leading theta to be consistent with the line number of the currently traversed elementx,v+1=Θx-1,v+1+Θx,v;
Step 2 (value taking step): the method sequentially comprises the following substeps:
①, randomly generating a bit at (0.0, 1.0) according to a uniform distribution]Within a regionReal number of1Determining that the first one from top to bottom in the v +1 th column of theta is greater than or equal to the second one in a binary search mode1The row number i of the element of (1);
②, randomly generating a position (0.0, theta i, v) according to uniform distribution]Real number within interval2Determining that the first one from left to right in the ith row of theta is greater than or equal to the second one in a binary search mode2Column number j of the element of (1);
and thirdly, forming an integer element ancestor < i, j > by using the line number i determined by the substep I and the column number j determined by the substep II.
If the number of elements included in the two-dimensional probability distribution matrix Φ is n × u × v, the time complexity of the foregoing algorithm pre-step is O (u × v) ═ O (n), and the time complexity of the value-taking step is O (log (u) + log (v) ═ O (log (n)). It can be seen that the above algorithm has a time complexity comparable to the conventional roulette random value algorithm.
Compared with the prior art, the random value taking operation based on the two-dimensional probability distribution matrix can be directly and efficiently completed.
Drawings
FIG. 1 is a schematic flow chart of the operation of the present method in a specific embodiment.
Detailed Description
The following is a specific embodiment of the present invention and is further described with reference to the accompanying drawings, but the present invention is not limited to the following embodiment.
As shown in fig. 1(a), the process of randomly selecting an integer tuple < i, j > composed of a row number i and a column number j according to a two-dimensional probability distribution matrix Φ with 4 rows and 4 columns in the method in this embodiment sequentially includes the following steps 1 and 2:
step 1 (pre-step) sequentially comprises the following substeps 1.1-1.4:
step 1.1: creating a matrix theta with 4 rows and 5 columns, and aiming at the condition that x is more than or equal to 1 and less than or equal to 4 and y is more than or equal to 1 and less than or equal to 4, enabling the theta to be higher than or equal to x and less than or equal to 4x,y=Φx,y。
Step 1.2: traversing each line theta, and in the process of traversing each line, traversing from the 2 nd element to the 4 th element of the currently traversed line one by one: let us assume thatThe row number of the calendar element is x, and the column number is y, so that thetax,y=Θx,y-1+Θx,y。
Step 1.3: let theta1,5=Θ1,4。
Step 1.4: traversing from the 2 nd element of the Θ column 5 to the 4 th element one by one: let the line number of the current traversal element be x, so that thetax,5=Θx-1,5+Θx,4。
The matrix Θ obtained after the operation of the pre-step is shown in the subgraph of fig. 1 (b).
Step 2 (value taking step) sequentially comprises the following substeps 2.1-2.3:
step 2.1: randomly generating a bit at (0.0, 1.0) according to uniform distribution]Real number within interval1Determining that the first one from top to bottom in the 5 th column of theta is greater than or equal to the second one in a binary search mode1The row number i of the element(s).
Set to be generated randomly10.65, the determined line number i is 3, as shown in the sub-diagram of FIG. 1 (c).
Step 2.2: randomly generating a position (0.0, theta) according to uniform distribution3,5=0.2]Real number within interval2Determining that the first one from left to right in the 3 rd row of theta is greater than or equal to the second one in a binary search mode2Column number j of the element(s).
Set to be generated randomly1Is 0.09, then the determined column number j is 2, as shown in the sub-diagram of FIG. 1 (d).
Step 2.3: the integer ancestor <3,2> is formed using the row number i ═ 3 determined in step 2.1 and the column number j ═ 2 determined in step 2.2.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.
Claims (1)
1. A random value-taking algorithm for a two-dimensional probability distribution matrix is characterized in that: the process of randomly selecting an integer tuple < i, j > consisting of a row number i and a column number j according to a two-dimensional probability distribution matrix phi of u rows and v columns sequentially comprises the following steps:
①, creating a matrix theta of u rows and v +1 columns, aiming at the condition that x is more than or equal to 1 and less than or equal to u and y is more than or equal to 1 and less than or equal to vx,y=Φx,y;
②, traversing each line of theta, and in the process of traversing each line, traversing from the 2 nd element to the v th element one by one, wherein the line number of the currently traversed element is set as x, the column number is set as y, and the theta is enabled to bex,y=Θx,y-1+Θx,y;
③, let theta1,v+1=Θ1,v;
④, traversing from the 2 nd element to the u th element in the v +1 th column of theta one by one, setting the line number of the current traverse element as x, and leading theta to be consistent with the line number of the currently traversed elementx,v+1=Θx-1,v+1+Θx,v;
①, randomly generating a position (0.0, 1.0) according to uniform distribution]Real number within interval1Determining that the first one from top to bottom in the v +1 th column of theta is greater than or equal to the second one in a binary search mode1The row number i of the element of (1);
②, randomly generating a position (0.0, theta) according to uniform distributioni,v]Real number within interval2Determining that the first one from left to right in the ith row of theta is greater than or equal to the second one in a binary search mode2Column number j of the element of (1);
③, the integer ancestor < i, j > is formed by using the row number i determined in step 2.1 and the column number j determined in step 2.2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010456781.0A CN111625959A (en) | 2020-05-26 | 2020-05-26 | Random value-taking algorithm for two-dimensional probability distribution matrix |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010456781.0A CN111625959A (en) | 2020-05-26 | 2020-05-26 | Random value-taking algorithm for two-dimensional probability distribution matrix |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111625959A true CN111625959A (en) | 2020-09-04 |
Family
ID=72271153
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010456781.0A Pending CN111625959A (en) | 2020-05-26 | 2020-05-26 | Random value-taking algorithm for two-dimensional probability distribution matrix |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111625959A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140330536A1 (en) * | 2013-05-06 | 2014-11-06 | Sas Institute Inc. | Techniques to simulate statistical tests |
CN104715343A (en) * | 2015-03-31 | 2015-06-17 | 国电南瑞科技股份有限公司 | Method for evaluating adequacy of electric power system on basis of reinforcement learning and self-adapting sequential importance sampling |
CN106570252A (en) * | 2016-10-26 | 2017-04-19 | 中国运载火箭技术研究院 | Probability technology based thermal protection system design method |
CN110244980A (en) * | 2019-06-24 | 2019-09-17 | 四川新网银行股份有限公司 | A kind of method and data flow handling two ordered categories sequence isotonicities |
CN110827339A (en) * | 2019-11-05 | 2020-02-21 | 北京深测科技有限公司 | Method for extracting target point cloud |
-
2020
- 2020-05-26 CN CN202010456781.0A patent/CN111625959A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140330536A1 (en) * | 2013-05-06 | 2014-11-06 | Sas Institute Inc. | Techniques to simulate statistical tests |
CN104715343A (en) * | 2015-03-31 | 2015-06-17 | 国电南瑞科技股份有限公司 | Method for evaluating adequacy of electric power system on basis of reinforcement learning and self-adapting sequential importance sampling |
CN106570252A (en) * | 2016-10-26 | 2017-04-19 | 中国运载火箭技术研究院 | Probability technology based thermal protection system design method |
CN110244980A (en) * | 2019-06-24 | 2019-09-17 | 四川新网银行股份有限公司 | A kind of method and data flow handling two ordered categories sequence isotonicities |
CN110827339A (en) * | 2019-11-05 | 2020-02-21 | 北京深测科技有限公司 | Method for extracting target point cloud |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106168797B (en) | A kind of method that modularization obtains the useful item failure probability of nuclear power station fault tree | |
CN104408589A (en) | AGV optimization scheduling method based on mixed particle swarm optimization | |
Ventura et al. | Grouping parts and tools in flexible manufacturing systems production planning | |
CN114399227A (en) | Production scheduling method and device based on digital twins and computer equipment | |
CN109891438B (en) | Numerical quantum experiment method and system | |
CN103699676B (en) | MSSQL SERVER based table partition and automatic maintenance method and system | |
CN112115611B (en) | Collaborative simulation management system | |
CN107870949A (en) | Data analysis job dependence relation generation method and system | |
CN108108883B (en) | Clustering algorithm-based vehicle scheduling network elastic simplification method | |
CN106775705A (en) | A kind of software module division methods | |
Spivak et al. | Construction of a Conceptual Model of the Accounting and Analytical System of Report Formation Under IFRS | |
CN111625959A (en) | Random value-taking algorithm for two-dimensional probability distribution matrix | |
CN107038244A (en) | A kind of data digging method and device, a kind of computer-readable recording medium and storage control | |
Dao et al. | Optimisation of resource scheduling in VCIM systems using genetic algorithm | |
CN110689174A (en) | Personnel route planning method and device based on public transport | |
Wang et al. | Research on hybrid real-time picking routing optimization based on multiple picking stations | |
WO2022166851A1 (en) | Quantum computer operating system, quantum computer, and readable storage medium | |
Meerkov et al. | Cellular production lines with asymptotically reliable Bernoulli machines: Lead time analysis and control | |
CN114116864A (en) | Multi-source time-space data fusion method and device, computer equipment and storage medium | |
CN111487962B (en) | Multi-robot path rapid planning method applied to warehousing environment | |
CN107122472A (en) | Extensive unstructured data extracting method, its system, DDM platform | |
CN113239034A (en) | Big data resource integration method and system based on artificial intelligence and cloud platform | |
CN111915327A (en) | Intelligent distribution method and device based on event characteristics | |
CN109902851A (en) | A kind of the determination method and device of production plan | |
Aksvonov et al. | Development of a hybrid decision-making method based on a simulation-genetic algorithm in a web-oriented metallurgical enterprise information system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |