## 7 Results and Discussion  
For the implementation of the proposed scheme, we have used NS3-gym. The architecture of the Ns3-gym framework has two modules, OpenAI Gym and the NS-3. OpenAI Gym framework is utilized to deploy agents, while NS-3 serves as the environment. The general interface between NS-3 and OpenAI Gym allows the perfect integration of these two frameworks. The interface manages the life cycle of the NS-3 simulation process, as well as providing state and action information between the Gym agent and simulation environment. We have compared the results of our proposed scheme DCWO with that of CCOD [21]. DCWO control the value of CW taking advantage of the principles of Deep Reinforcement Learning (DRL) for learning the correct setting under various network conditions. Every experiment was carried out for 15 rounds of 60 s simulations. The first 14 rounds were training phase, and the 15 th round was the operational phase. Every simulation consisted of interaction times of 10 ms, between which the proposed algorithm was executed. The result of DCWO is evaluated in static and dynamic scenarios and are compared with CCOD. Graphs are plotted to observe the overall performance of the proposed algorithm in terms of instantaneous and average network throughput, fairness index and cumulative reward. Moreover, we have also represented the variation of CW as the number of nodes increases over the time. For network throughput and fairness index, we evaluate the DCWO in static as well as dynamic scenarios and compare the results with those obtained from CCOD. A mean CW value was selected by DDQN in every round of simulation scenario for 25 nodes. In the static scenario, number of nodes connected to AP were fixed throughout the simulations. In such a scenario, constant CW value is optimal. It can be seen from the Figure 5 that our proposed scheme, DCWO with DDQN performs better than CCOD for both the algorithms i.e., DQN and DDPG, and can optimize the value of CW in static network conditions. Figure 5 shows that DCWO achieves 25% higher throughput compared to CCOD when the number of nodes in the network exceed 30. Figure 4: DDQN Approach for DCWO. As the standard 802.11 results in decrease of network throughput in such a scenario while our proposed scheme maintains the network efficiency, thus resulting in enhanced network performance. The results show that DDQN outperforms DQN and DDPG in terms of network throughput in the static scenario. In the dynamic scenario, the number of nodes is not fixed and increases from 10 to 50. The purpose for designing this scenario was to evaluate the performance of proposed algorithm in a dynamic network. As the number of nodes increased from 10 to 50, it results in an increase in the collision rate. With the increase in the number of nodes, the values of CW are updated dynamically. Figure 6 shows the Instantaneous network throughput. It can be seen that DCWO performs better than CCOD with DQN and DDPG. CCOD improves instantaneous throughput by 5% and 10%, respectively, compared to the CCOD with DDPG and CCOD with DQN due to the former choosing optimal CW dynamically. The dynamic selection of the optimal size of the CW is shown in Figure 7.  
The network throughput for the dynamic scenario is shown in Figure 8. From the Figure it is evident that DCWO is also outperforming CCOD with DQN and with DDPG in the dynamic scenario. DCWO achieves on average 23% higher network throughput than CCOD when the network size exceeds 40 nodes. DCWO also gives better performance even when the total number of nodes in the network are below 40. Giving fair opportunity to access the wireless channel is also an important performance metric for an algorithm. We have also evaluated our simulation results considering the Jain's fairness index. Figures 9 and 10 show the Fairness index for DCWO in static and dynamic scenarios, respectively. The figures further compare the performance of DCWO and CCOD with DQN as well as CCOD with DDPG.