Closed WhiteGrayxp closed 3 years ago
梁老师,您好:
最近在复现您的代码时,发现代码中计算V2V链路受到的干扰时,可能存在一些问题: 在
Environment_marl.py
文件中,函数Compute_Performance_Reward_Train(self, actions_power)
的第344行:V2V_Interference[indexes[j, 0], indexes[j, 1]] = 10 ** ((self.V2I_power_dB - self.V2V_channels_with_fastfading[i, receiver_j, i] + 2 * self.vehAntGain - self.vehNoiseFigure) / 10)
这里采用的是
=
赋值,而在接下来的第351行采用的是+=
赋值V2V_Interference[indexes[k, 0], indexes[k, 1]] += 10 ** ((self.V2V_power_dB_List[power_selection[indexes[j, 0], indexes[j, 1]]] - self.V2V_channels_with_fastfading[indexes[j][0]][receiver_k][i] + 2 * self.vehAntGain - self.vehNoiseFigure) / 10)
看起来会在下一次循环时将上一次循环累加的值给覆盖掉,我认为第344行这里应该也是
+=
赋值。 文件Environment_marl_test.py
中的第346行同理。 我参考了link中的类似代码,函数compute_reward_with_channel_selection(self, actions_ch_sel)
的第451行,也是采用的+=
赋值,所以个人感觉这里有一些问题,可能会使实验整体结果偏高。
It's intended so since Line 344 means there's only one V2I link interfering with the transmission of the current V2V link (indexed by j in Line 339) which is meanwhile affected by interference from multiple V2V links sharing the same spectrum, hence += in Line 351.
Yes, I understand there is only one interfering V2I link, and multiple V2V links may share the same resource block, that means the length of indexes
larger than 1, so that the loop of line 347
will calculate the interference introduced by other V2V link k
whose index larger than j
. That's what line 349
does, and meanwhile line 351
calculates the interference from V2V link j
to V2V link k
. But when the next time the loop
of line 339
is executed (j
increases 1, and exactly equal to the k
), the accumulated interference in line 351
last loop will be overwritten since use =
instead of +=
in line 344
, and I think this kind of operation will ignore some part of interference from V2V links.
In general, I think for V2V link k
and j
sharing the same RB ( and k > j
), the interference link j
introduce to link k
is not accumulated.
I finally see what you mean and after double checking I agree with you. Thanks for raising this issue. 谢谢你。
梁老师,您好:
最近在复现您的代码时,发现代码中计算V2V链路受到的干扰时,可能存在一些问题: 在
Environment_marl.py
文件中,函数Compute_Performance_Reward_Train(self, actions_power)
的第344行:这里采用的是
=
赋值,而在接下来的第351行采用的是+=
赋值看起来会在下一次循环时将上一次循环累加的值给覆盖掉,我认为第344行这里应该也是
+=
赋值。 文件Environment_marl_test.py
中的第346行同理。 我参考了link中的类似代码,函数compute_reward_with_channel_selection(self, actions_ch_sel)
的第451行,也是采用的+=
赋值,所以个人感觉这里有一些问题,可能会使实验整体结果偏高。