/* Meeting under the clock in Picat. """ Meeting Under the Clock (This problem is posed by Julian Simon(1994)) Two persons agree to arrive at the two clock sometime between 1 pm and 2 pm and to stay for 20 minutes. What is the probability that they will be there at the same time? """ Cf my Gamble model gamble_meeting_under_the_clock.rkt 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. /* var : c1 Probabilities (truncated): 29: 0.0191000000000000 31: 0.0188000000000000 25: 0.0186000000000000 19: 0.0179000000000000 ......... 57: 0.0154500000000000 18: 0.0154500000000000 21: 0.0149500000000000 51: 0.0149000000000000 mean = 30.37115 var : c2 Probabilities (truncated): 56: 0.0189500000000000 37: 0.0184000000000000 12: 0.0182500000000000 27: 0.0181000000000000 ......... 47: 0.0156000000000000 17: 0.0154500000000000 58: 0.0152000000000000 39: 0.0149000000000000 mean = 30.3688 var : d Probabilities (truncated): 3: 0.0332500000000000 2: 0.0328000000000000 1: 0.0316500000000000 5: 0.0308000000000000 ......... 56: 0.0019500000000000 57: 0.0014000000000000 58: 0.0012000000000000 59: 0.0007500000000000 mean = 20.0775 var : prob Probabilities: true: 0.5641500000000000 false: 0.4358500000000000 mean = [true = 0.56415,false = 0.43585] */ go ?=> reset_store, run_model(20_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths, % fail, nl. go => true. model() => WaitTime = 20, C1 = random_integer1(60), C2 = random_integer1(60), D = abs(C1-C2), Prob = check(D <= WaitTime), add("c1",C1), add("c2",C2), add("d",D), add("prob",Prob).