Homework II

Problem A, Due Thursday, February 7:

This is a variation on the cell phone network in Homework I. Here are the specs:

Your program must find the following:

Some sample output values (PeriodSampler.Per = 0.1:

[root@localhost ~/156]# python Cell2.py 2 2 2 100000
fraction of pre-empted calls: 0.198612925922
average fraction cut among pre-empted: 0.460922131409
mean number of active channels, Method I: 0.795939783419
mean number of active channels, Method II: 0.796024796025
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 2 2 4 100000
fraction of pre-empted calls: 0.0150618152578
average fraction cut among pre-empted: 0.335597787476
mean number of active channels, Method I: 0.978552568276
mean number of active channels, Method II: 0.978566978567
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 2 2 1 100000
fraction of pre-empted calls: 0.498266157403
average fraction cut among pre-empted: 0.614047746779
mean number of active channels, Method I: 0.497912893675
mean number of active channels, Method II: 0.497885497885
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 6 2 4 100000
fraction of pre-empted calls: 0.205598199554
average fraction cut among pre-empted: 0.412846668117
mean number of active channels, Method I: 2.37979082673
mean number of active channels, Method II: 2.37945337945
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 6 1 4 100000
fraction of pre-empted calls: 0.468714913239
average fraction cut among pre-empted: 0.513897338516
mean number of active channels, Method I: 3.17985370163
mean number of active channels, Method II: 3.17973917974
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 16 22 15 100000
fraction of pre-empted calls: 0.0
average fraction cut among pre-empted: SimPy: No observations  for mean
None
mean number of active channels, Method I: 0.72712225164
mean number of active channels, Method II: 0.727332727333
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 16 12 15 100000
fraction of pre-empted calls: 0.0
average fraction cut among pre-empted: SimPy: No observations  for mean
None
mean number of active channels, Method I: 1.33305734281
mean number of active channels, Method II: 1.33365033365
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 16 9 8 100000
fraction of pre-empted calls: 0.000398390203847
average fraction cut among pre-empted: 0.269166716707
mean number of active channels, Method I: 1.77671591091
mean number of active channels, Method II: 1.77666277666
[root@localhost ~/156]#
[root@localhost ~/156]# python Cell2.py 16 6 6 100000
fraction of pre-empted calls: 0.0351164104918
average fraction cut among pre-empted: 0.319426416557
mean number of active channels, Method I: 2.57360221291
mean number of active channels, Method II: 2.57375157375