本文整理汇总了Python中simulation.Simulation.slottedAlohaSelfish方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.slottedAlohaSelfish方法的具体用法?Python Simulation.slottedAlohaSelfish怎么用?Python Simulation.slottedAlohaSelfish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.Simulation
的用法示例。
在下文中一共展示了Simulation.slottedAlohaSelfish方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Nodes
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import slottedAlohaSelfish [as 别名]
print "^" * 125
print "Pure Aloha Throughput for 2 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.pureAloha, SETTINGS.SIMULATION_LENGTH, 2))
print "Pure Aloha Throughput for 3 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.pureAloha, SETTINGS.SIMULATION_LENGTH, 3))
print "Pure Aloha Throughput for 4 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.pureAloha, SETTINGS.SIMULATION_LENGTH, 4))
print "Pure Aloha Throughput for 8 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.pureAloha, SETTINGS.SIMULATION_LENGTH, 8))
print "^" * 125 + "\n"
sim.slottedAloha(40, 2, True)
print "^" * 125
print "Slotted Aloha Throughput for 2 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAloha, SETTINGS.SIMULATION_LENGTH, 2))
print "Slotted Aloha Throughput for 3 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAloha, SETTINGS.SIMULATION_LENGTH, 3))
print "Slotted Aloha Throughput for 4 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAloha, SETTINGS.SIMULATION_LENGTH, 4))
print "Slotted Aloha Throughput for 8 Nodes: ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAloha, SETTINGS.SIMULATION_LENGTH, 8))
print "^" * 125 + "\n"
sim.slottedAlohaSelfish(40, 1, 1, True)
print "^" * 125
print "Slotted Aloha - Selfish Node Throughput for 2 Nodes (1/1): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 1, 1))
print "Slotted Aloha - Selfish Node Throughput for 3 Nodes (2/1): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 2, 1))
print "Slotted Aloha - Selfish Node Throughput for 3 Nodes (1/2): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 1, 2))
print "Slotted Aloha - Selfish Node Throughput for 4 Nodes (3/1): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 3, 1))
print "Slotted Aloha - Selfish Node Throughput for 4 Nodes (2/2): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 2, 2))
print "Slotted Aloha - Selfish Node Throughput for 4 Nodes (1/3): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 1, 3))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (7/1): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 7, 1))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (6/2): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 6, 2))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (5/3): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 5, 3))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (4/4): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 4, 4))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (3/5): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 3, 5))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (2/6): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 2, 6))
print "Slotted Aloha - Selfish Node Throughput for 8 Nodes (1/7): ", np.mean(sim.repeatSim(SETTINGS.SIMULATIONS, sim.slottedAlohaSelfish, SETTINGS.SIMULATION_LENGTH, 1, 7))
print "^" * 125 + "\n"