/* Order statistics - estimator of M in Picat. From Siegrist "Probability Mathematical Statisics and Stochastic Processes" Estimation of an unknown m (number of possible objects). Here are some examples. Siegrist problem 1 """ Suppose that in a certain war, 5 enemy tanks have been captured. The serial numbers are 51, 3, 27, 82, 65. Compute the estimate of m, the total number of tanks, using all of the estimators discussed above. Answer 1. u1 = 17 2. u2 = 80 3. u3 = 101 4. u4 = 96.5 5. u5 = 97.4 6. v = 90.2 """ Siegrist problem 1 = [51,3,27,82,65] u0 = [17.0,80.0,101.0,96.5,97.4] u = 97.4 v = 90.2 Siegrist's problem 2 """ Suppose that in a certain war, 10 enemy tanks have been captured. The serial numbers are 304, 125, 417, 226, 192, 340, 468, 499, 87, 352. Compute the estimate of m, the total number of tanks, using the estimator based on the maximum and the estimator based on the mean. Answer 1. u = 548 2. v = 601 """ Siegrist problem 2 = [304,125,417,226,192,340,468,499,87,352] u0 = [956.0,686.5,703.0,620.5,667.8,622.333,552.143,572.375,571.0,547.9] u = 547.9 v = 601.0 German tank problem German tanks problem = [10,256,202,97] u0 = [49.0,241.5,335.667,319.0] u = 319.0 v = 281.5 Locomotive problem = [60] u0 = [119.0] u = 119.0 v = 119.0 Random1 10x(1..20) = [1,18,3,7,14,10,11,15,9,1] u0 = [10.0,4.5,10.0,18.25,18.8,17.3333,16.2857,18.25,17.3333,18.8] u = 18.8 v = 16.8 Random2 10x(1..20) = [9,8,14,18,19,18,1,10,10,3] u0 = [10.0,15.5,28.3333,23.75,21.0,17.3333,21.0,23.75,21.0,19.9] u = 19.9 v = 21.0 Random3 10x(1..200) = [185,189,192,99,144,182,94,170,16,180] u0 = [175.0,516.0,362.0,395.0,373.0,329.0,285.0,253.375,230.0,210.2] u = 210.2 v = 289.2 Random4 3x(1..1200) = [132,828,857] u0 = [527.0,1655.0,1141.67] u = 1141.67 v = 1210.33 Cf - my Gamble model gamble_order_statistics_estimator_of_m.rkt - ppl_german_tank_problem.pi - ppl_locomotive_problem.pi This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils. import util. main => go. go ?=> _ = random2(), AllValues = [["Siegrist problem 1", [51,3,27,82,65]], ["Siegrist problem 2", [304,125,417,226,192,340,468,499,87,352]], ["German tanks problem", [10,256,202,97]], ["Locomotive problem", [60]], ["Random1 10x(1..20)", random_integer1_n(20,10)], ["Random2 10x(1..20)", random_integer1_n(20,10)], ["Random3 10x(1..200)", random_integer1_n(200,10)], ["Random4 3x(1..1200)", random_integer1_n(1200,3)] ], foreach([Problem, Values] in AllValues) println(Problem=Values), U0 = order_statistics_m_estimator_u_all(Values), println(u0=U0), U = order_statistics_m_estimator_u(Values,Values.length), println(u=U), V = order_statistics_m_estimator_v(Values), println(v=V), nl, end, fail, nl. go => true.