All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Probability
'- subject to availability -' (Posted on 2022-06-02) Difficulty: 3 of 5

A passenger aircraft seats 210 passengers in economy class, 7 abreast in rows 30 to 59. All seats are full for the current trip.

The in-flight menu for economy passengers has 3 main-course choices: curried mutton with rice, chicken supreme with brocolli, and pork belly with bean sprouts. Given that, on average, one-third of the passengers will prefer each main-course choice, the aircraft carries 70 meals of each type.

The meals are served from large trolleys that the servers push through the aircraft from row 30 abaft. Each passenger in turn is asked which meal they choose. Naturally, this depends on individual preference, but overall each choice is equally likely. Subject to availability, the passenger is then handed their selection.

Questions:
(1) In what row will at least one main-course choice likely become unavailable?
(2) How many passengers will likely receive a non-preferred meal?

No Solution Yet Submitted by broll    
Rating: 2.3333 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution by simulation | Comment 2 of 7 |
There are 36 possible sets of preferences for each row. No given meal can run out before row 10, as there are 70 of each. It's an indication that the number of states of the system will get out of hand, taking up time and space to keep track of all of them for the thirty rows. So a simulation is in order.


totFirst=0; unsatisfied=0;rowlist=zeros(1,60);unslist=zeros(1,210);
for trial = 1:100000
  unsthistime=0;
  first=60;
  pref=randi(3,30,7);
  cart=[70,70,70];
  for row=30:59
    uns=0;
    type="randperm";
    for i= randperm(3)
      asked(i)=length(find(pref(row-29,:)==i));
      if cart(i)>=asked(i)
        cart(i)=cart(i)-asked(i);
      else
        uns=uns+asked(i)-cart(i);
        if first>row
          first=row;
          rowlist(first)=rowlist(first)+1;
        end
      end
      unsatisfied=unsatisfied+uns;
      unsthistime=unsthistime+uns;
      while uns>0
        r=randi(3);
        if cart(r)>0
          cart(r)=cart(r)-1;
          uns=uns-1;
        end
      end
    end    
  end
  totFirst=totFirst+first;
  unslist(unsthistime+1)=unslist(unsthistime+1)+1;
end
fprintf('%10d %10d %10.5f %10.5f %s\n',unsatisfied,trial,...
  totFirst/trial,unsatisfied/trial,type);
%   disp([totFirst/trial unsatisfied/trial])
for i=30:60
  if rowlist(i)>60
    disp([i rowlist(i)])
  end
end
for i=1:210
  if unslist(i)>0
    disp([i unslist(i)])
  end
end


In the above, a couple of choices had to be made:

1. If a passenger's choice was not available, the entree to be served was chosen at random.

2. Runs were done two ways: serving a given row always mutton first, pork last; or in random order.

The below results show, first for random order (randperm), then for entrees 1 through 3 each row.

The order of the numbers shown is: number of unsatisfied fliers, total number of trials, average first row in which something has run out, average number of unsatisfied customers, and type of run (whether each row was served in random order of entree or straight run order of entree).

Then a list broken down by number of times within the 100,000 flights that each given row was the first in which something ran out.

Then a list broken down by number of times within the 100,000 flights that the given number of passengers did not get their first choice meals.

For the first two runs each row was served mutton through pork. the next two runs, random order of entree.

>> subjectToAvailability
    822633     100000   56.83830    8.22633    1:3
    
         row      times out of 100,000
          51         184
          52         697
          53        2064
          54        5169
          55       10579
          56       18161
          57       25015
          58       24825
          59       12876
          
# not first choice flights out of 100,000 flights      
           1         394
           2        3078
           3        5650
           4        7384
           5        8306
           6        8539
           7        8470
           8        8151
           9        7734
          10        7027
          11        6402
          12        5604
          13        4880
          14        4073
          15        3340
          16        2739
          17        2173
          18        1617
          19        1252
          20         957
          21         694
          22         500
          23         327
          24         249
          25         141
          26         118
          27          70
          28          49
          29          27
          30          23
          31          12
          32          10
          33           5
          34           4
          35           0
          36           1
          
>> subjectToAvailability
    822027     100000   56.84589    8.22027    1:3
    
          51         155
          52         645
          53        1970
          54        5256
          55       10726
          56       17954
          57       24997
          58       24846
          59       13023
          
          
           1         391
           2        3112
           3        5624
           4        7478
           5        8322
           6        8545
           7        8480
           8        8048
           9        7768
          10        7104
          11        6255
          12        5646
          13        4743
          14        4044
          15        3423
          16        2787
          17        2132
          18        1699
          19        1215
          20         949
          21         716
          22         477
          23         362
          24         236
          25         151
          26         113
          27          68
          28          45
          29          24
          30          17
          31           5
          32           6
          33           5
          34           6
          35           3
          36           1
    
    
>> subjectToAvailability
    822195     100000   56.84147    8.22195 randperm
    
          51         149
          52         658
          53        2088
          54        5207
          55       10514
          56       18211
          57       25078
          58       24771
          59       12935
          
           1         363
           2        3012
           3        5680
           4        7244
           5        8327
           6        8770
           7        8506
           8        8165
           9        7660
          10        7189
          11        6405
          12        5591
          13        4793
          14        4117
          15        3313
          16        2647
          17        2091
          18        1621
          19        1304
          20         957
          21         688
          22         516
          23         341
          24         249
          25         144
          26         113
          27          85
          28          47
          29          22
          30          15
          31          12
          32           5
          33           2
          34           4
          35           1
          36           0
          37           0
          38           1 
          
          
>> subjectToAvailability
    821794     100000   56.83554    8.21794 randperm
          51         162
          52         684
          53        2114
          54        5112
          55       10748
          56       18050
          57       25139
          58       24668
          59       12896
          
           1         382
           2        3105
           3        5731
           4        7426
           5        8239
           6        8555
           7        8508
           8        8082
           9        7536
          10        7093
          11        6487
          12        5612
          13        4963
          14        4120
          15        3343
          16        2635
          17        2093
          18        1670
          19        1241
          20         939
          21         712
          22         475
          23         368
          24         219
          25         167
          26         105
          27          53
          28          54
          29          41
          30          13
          31          12
          32          11
          33           6
          34           2
          35           2  
          
    
It doesn't seem that randomizing the order of entrees served within a row makes a difference. The first row to run out of something averages row 56.8. On average, about 8.2 people do not get their desired preference.    
          

  Posted by Charlie on 2022-06-02 11:32:17
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information