Algorithm 指数退避平均碰撞次数
Algorithm 指数退避平均碰撞次数,algorithm,networking,exponential,Algorithm,Networking,Exponential,我正在研究一个简单的指数退避算法,我想知道我的结果是否正确。以下是假设:
有N个车站
每个站点有1个数据包要发送
最初,所有电台都尝试在时隙0中发送
当两个或多个站点希望在同一时间段内发送其帧时,会发生冲突(因此,所有站点的帧在第一轮中都会发生冲突)
发生碰撞时,工作站使用指数退避函数计算其等待时间(即,在c次碰撞后,它将等待从0到2^c-1的随机数个时隙)
我用Java编写代码。以下是使用10个站点运行的结果:
Slot 0: Station 0 Station 1 Station 2
我正在研究一个简单的指数退避算法,我想知道我的结果是否正确。以下是假设:
- 有N个车站
- 每个站点有1个数据包要发送
- 最初,所有电台都尝试在时隙0中发送
- 当两个或多个站点希望在同一时间段内发送其帧时,会发生冲突(因此,所有站点的帧在第一轮中都会发生冲突)
- 发生碰撞时,工作站使用指数退避函数计算其等待时间(即,在c次碰撞后,它将等待从0到2^c-1的随机数个时隙)
我用Java编写代码。以下是使用10个站点运行的结果:
Slot 0: Station 0 Station 1 Station 2 Station 3 Station 4 Station 5 Station 6 Station 7 Station 8 Station 9
Slot 1:
Slot 2:
Slot 3:
Slot 4:
Slot 5:
Slot 6:
Slot 7:
Slot 8:
Slot 9:
Slot 10:
Slot 11:
Slot 12:
Slot 13:
Slot 14:
Slot 15:
Slot 16:
Slot 17:
Slot 18:
Slot 19:
Slot 20:
Slot 21:
Slot 22:
Slot 23:
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30:
Slot 31:
Slot 32:
Slot 33:
Slot 34:
Slot 35:
Slot 36:
Slot 37:
Slot 38:
Slot 39:
Slot 40:
Slot 41:
Slot 42:
Slot 43:
Slot 44:
Slot 45:
Slot 46:
Slot 47:
Slot 48:
Slot 49:
Collisions in round 1: Station 0 Station 1 Station 2 Station 3 Station 4 Station 5 Station 6 Station 7 Station 8 Station 9
Slot 0:
Slot 1: Station 1 Station 3 Station 5 Station 6
Slot 2: Station 0 Station 2 Station 4 Station 7 Station 8 Station 9
Slot 3:
Slot 4:
Slot 5:
Slot 6:
Slot 7:
Slot 8:
Slot 9:
Slot 10:
Slot 11:
Slot 12:
Slot 13:
Slot 14:
Slot 15:
Slot 16:
Slot 17:
Slot 18:
Slot 19:
Slot 20:
Slot 21:
Slot 22:
Slot 23:
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30:
Slot 31:
Slot 32:
Slot 33:
Slot 34:
Slot 35:
Slot 36:
Slot 37:
Slot 38:
Slot 39:
Slot 40:
Slot 41:
Slot 42:
Slot 43:
Slot 44:
Slot 45:
Slot 46:
Slot 47:
Slot 48:
Slot 49:
Collisions in round 2: Station 0 Station 1 Station 2 Station 3 Station 4 Station 5 Station 6 Station 7 Station 8 Station 9
Slot 0:
Slot 1:
Slot 2: Station 3
Slot 3: Station 0 Station 2 Station 4 Station 6
Slot 4: Station 1 Station 8 Station 9
Slot 5: Station 5 Station 7
Slot 6:
Slot 7:
Slot 8:
Slot 9:
Slot 10:
Slot 11:
Slot 12:
Slot 13:
Slot 14:
Slot 15:
Slot 16:
Slot 17:
Slot 18:
Slot 19:
Slot 20:
Slot 21:
Slot 22:
Slot 23:
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30:
Slot 31:
Slot 32:
Slot 33:
Slot 34:
Slot 35:
Slot 36:
Slot 37:
Slot 38:
Slot 39:
Slot 40:
Slot 41:
Slot 42:
Slot 43:
Slot 44:
Slot 45:
Slot 46:
Slot 47:
Slot 48:
Slot 49:
Collisions in round 3: Station 0 Station 1 Station 2 Station 4 Station 5 Station 6 Station 7 Station 8 Station 9
Slot 0:
Slot 1:
Slot 2: Station 3
Slot 3:
Slot 4:
Slot 5: Station 6
Slot 6:
Slot 7: Station 9
Slot 8: Station 0
Slot 9: Station 1 Station 4
Slot 10: Station 8
Slot 11: Station 2
Slot 12: Station 7
Slot 13: Station 5
Slot 14:
Slot 15:
Slot 16:
Slot 17:
Slot 18:
Slot 19:
Slot 20:
Slot 21:
Slot 22:
Slot 23:
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30:
Slot 31:
Slot 32:
Slot 33:
Slot 34:
Slot 35:
Slot 36:
Slot 37:
Slot 38:
Slot 39:
Slot 40:
Slot 41:
Slot 42:
Slot 43:
Slot 44:
Slot 45:
Slot 46:
Slot 47:
Slot 48:
Slot 49:
Collisions in round 4: Station 1 Station 4
Slot 0:
Slot 1:
Slot 2: Station 3
Slot 3:
Slot 4:
Slot 5: Station 6
Slot 6:
Slot 7: Station 9
Slot 8: Station 0
Slot 9:
Slot 10: Station 8
Slot 11: Station 2
Slot 12: Station 7
Slot 13: Station 5
Slot 14: Station 1
Slot 15:
Slot 16:
Slot 17:
Slot 18:
Slot 19:
Slot 20:
Slot 21:
Slot 22:
Slot 23: Station 4
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30:
Slot 31:
Slot 32:
Slot 33:
Slot 34:
Slot 35:
Slot 36:
Slot 37:
Slot 38:
Slot 39:
Slot 40:
Slot 41:
Slot 42:
Slot 43:
Slot 44:
Slot 45:
Slot 46:
Slot 47:
Slot 48:
Slot 49:
Collisions in round 5: No collisions!
Total number of collisions: 77
Station 0 sent at time slot 8 with 3 collisions.
Station 1 sent at time slot 14 with 4 collisions.
Station 2 sent at time slot 11 with 3 collisions.
Station 3 sent at time slot 2 with 2 collisions.
Station 4 sent at time slot 23 with 4 collisions.
Station 5 sent at time slot 13 with 3 collisions.
Station 6 sent at time slot 5 with 3 collisions.
Station 7 sent at time slot 12 with 3 collisions.
Station 8 sent at time slot 10 with 3 collisions.
Station 9 sent at time slot 7 with 3 collisions.
槽0:0号站1号站2号站3号站4号站5号站6号站7号站8号站9
插槽1:
插槽2:
插槽3:
插槽4:
插槽5:
插槽6:
插槽7:
插槽8:
插槽9:
插槽10:
插槽11:
插槽12:
插槽13:
插槽14:
插槽15:
插槽16:
插槽17:
插槽18:
插槽19:
插槽20:
插槽21:
插槽22:
插槽23:
插槽24:
插槽25:
插槽26:
插槽27:
插槽28:
插槽29:
插槽30:
插槽31:
插槽32:
插槽33:
插槽34:
插槽35:
插槽36:
插槽37:
插槽38:
插槽39:
插槽40:
插槽41:
插槽42:
插槽43:
插槽44:
插槽45:
插槽46:
插槽47:
插槽48:
插槽49:
第一轮碰撞:0号站1号站2号站3号站4号站5号站6号站7号站8号站9
插槽0:
插槽1:车站1车站3车站5车站6
插槽2:车站0车站2车站4车站7车站8车站9
插槽3:
插槽4:
插槽5:
插槽6:
插槽7:
插槽8:
插槽9:
插槽10:
插槽11:
插槽12:
插槽13:
插槽14:
插槽15:
插槽16:
插槽17:
插槽18:
插槽19:
插槽20:
插槽21:
插槽22:
插槽23:
插槽24:
插槽25:
插槽26:
插槽27:
插槽28:
插槽29:
插槽30:
插槽31:
插槽32:
插槽33:
插槽34:
插槽35:
插槽36:
插槽37:
插槽38:
插槽39:
插槽40:
插槽41:
插槽42:
插槽43:
插槽44:
插槽45:
插槽46:
插槽47:
插槽48:
插槽49:
第二轮碰撞:0号站1号站2号站3号站4号站5号站6号站7号站8号站9
插槽0:
插槽1:
槽2:3号站
插槽3:站0站2站4站6
插槽4:车站1车站8车站9
插槽5:5号站7号站
插槽6:
插槽7:
插槽8:
插槽9:
插槽10:
插槽11:
插槽12:
插槽13:
插槽14:
插槽15:
插槽16:
插槽17:
插槽18:
插槽19:
插槽20:
插槽21:
插槽22:
插槽23:
插槽24:
插槽25:
插槽26:
插槽27:
插槽28:
插槽29:
插槽30:
插槽31:
插槽32:
插槽33:
插槽34:
插槽35:
插槽36:
插槽37:
插槽38:
插槽39:
插槽40:
插槽41:
插槽42:
插槽43:
插槽44:
插槽45:
插槽46:
插槽47:
插槽48:
插槽49:
第三轮碰撞:0号站1号站2号站4号站5号站6号站7号站8号站9号站
插槽0:
插槽1:
槽2:3号站
插槽3:
插槽4:
槽5:6号站
插槽6:
槽7:9号站
槽8:0号站
插槽9:1号站4号站
槽10:8号站
槽11:2号站
槽12:7号站
槽13:5号站
插槽14:
插槽15:
插槽16:
插槽17:
插槽18:
插槽19:
插槽20:
插槽21:
插槽22:
插槽23:
插槽24:
插槽25:
插槽26:
插槽27:
插槽28:
插槽29:
插槽30:
插槽31:
插槽32:
插槽33:
插槽34:
插槽35:
插槽36:
插槽37:
插槽38:
插槽39:
插槽40:
插槽41:
插槽42:
插槽43:
插槽44:
插槽45:
插槽46:
插槽47:
插槽48:
插槽49:
第四轮碰撞:第1站第4站
插槽0:
插槽1:
槽2:3号站
插槽3:
插槽4:
槽5:6号站
插槽6:
槽7:9号站
槽8:0号站
插槽9:
槽10:8号站
槽11:2号站
槽12:7号站
槽13:5号站
槽14:1号站
插槽15:
插槽16:
插槽17:
插槽18:
插槽19:
插槽20:
插槽21:
插槽22:
槽23:4号站
插槽24:
插槽25:
插槽26:
插槽27:
插槽28:
插槽29:
插槽30:
插槽31:
插槽32:
插槽33:
插槽34:
插槽35:
插槽36:
插槽37:
插槽38:
插槽39:
插槽40:
插槽41:
插槽42:
插槽43:
插槽44:
插槽45:
插槽46:
插槽47:
插槽48:
插槽49:
第五轮碰撞:无碰撞!
碰撞总数:77
站0在时隙8发送,发生3次冲突。
站1在时隙14发送,有4次碰撞。
站2在时隙11发送,有3次碰撞。
站3在时隙2发送,发生2次碰撞。
站4在时隙23发送,有4次碰撞。
站5在时隙13发送,有3次碰撞。
站6在时隙5发送,发生3次碰撞。
站7在时隙12发送,有3次碰撞。
站8在时隙10发送,有3次碰撞。
站9在时隙7发送,发生3次碰撞。
这个看起来对吗?我似乎在任何地方都找不到使用这个函数的N个站点的平均碰撞次数,所以我不确定我是否搞砸了什么。非常感谢您的帮助。一个电台可以在一个时段内多次发送邮件,这似乎有些奇怪。在我看来,退避值应该是站点跳过的时隙数。所以如果A站发生碰撞
slot stations
2 1, 3, 5, 7, 9
3 2, 4, 6, 8, 10
slot stations
3 1, 2, 4, 6, 8, 10
4 3, 7
5 9
6 5