Jay Hannah, Omaha NE, USA

jays.net

Room Count for Share-with Reservations

edit
Day of week:  MTWRFSS
        res1  xxxxxxx   los 7
        res2  x         los 1
        res3  xxx       los 3
        res4   xx       los 2
        res5     x      los 1
        res6      xx    los 2
Occupancy:    3332221

 res1 rcnt: 0.4375
 res2 rcnt: 0.0625
 res3 rcnt: 0.1875
 res4 rcnt: 0.125
 res5 rcnt: 0.0625
 res6 rcnt: 0.125
TOTAL rcnt: 1

 

  • r is a reservation in this share-with
  • R is the set of all reservations in this share-with
  • los is length of stay
  • rcnt is room count

Source code

edit
my @los = ( 7,1,3,2,1,2 );

my $los_total;
foreach (@los) {
   $los_total += $_;
} 

my $rcnt_total;
my $res_num = 1;
foreach (@los) {
   my $rcnt = $_ / $los_total;
   $rcnt_total += $rcnt;
   print "  res$res_num rcnt: $rcnt\n";
   $res_num++;
}
print " TOTAL rcnt: $rcnt_total\n";

Other Math Junk

edit

aka shoot me now. Math markup help.

Binomial distribution

 

  • N: the fixed sample size
  • p: the probability that one thing has the characteristic
  • q: the probability that it doesn't (1-p)