A Discrete-Event Network Simulator
API
thompson-sampling-wifi-manager.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2021 IITP RAS
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Alexander Krotov <krotov@iitp.ru>
19  */
20 
21 #ifndef THOMPSON_SAMPLING_WIFI_MANAGER_H
22 #define THOMPSON_SAMPLING_WIFI_MANAGER_H
23 
24 #include "ns3/random-variable-stream.h"
25 
26 #include "ns3/wifi-remote-station-manager.h"
27 
28 namespace ns3 {
29 
40 {
41 public:
46  static TypeId GetTypeId (void);
49 
50  int64_t AssignStreams (int64_t stream) override;
51 
52 private:
53  WifiRemoteStation *DoCreateStation () const override;
54  void DoReportRxOk (WifiRemoteStation *station,
55  double rxSnr, WifiMode txMode) override;
56  void DoReportRtsFailed (WifiRemoteStation *station) override;
57  void DoReportDataFailed (WifiRemoteStation *station) override;
58  void DoReportRtsOk (WifiRemoteStation *station,
59  double ctsSnr, WifiMode ctsMode, double rtsSnr) override;
60  void DoReportDataOk (WifiRemoteStation *station,
61  double ackSnr, WifiMode ackMode, double dataSnr,
62  uint16_t dataChannelWidth, uint8_t dataNss) override;
64  uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus,
65  double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override;
66  void DoReportFinalRtsFailed (WifiRemoteStation *station) override;
67  void DoReportFinalDataFailed (WifiRemoteStation *station) override;
70 
77  void InitializeStation (WifiRemoteStation *station) const;
78 
90  void UpdateNextMode (WifiRemoteStation *station) const;
91 
98  void Decay (WifiRemoteStation *st, size_t i) const;
99 
107  uint16_t GetModeGuardInterval (WifiRemoteStation *st, WifiMode mode) const;
108 
115  double SampleBetaVariable (uint64_t alpha, uint64_t beta) const;
116 
118 
119  double m_decay;
120 
122 };
123 
124 } //namespace ns3
125 
126 #endif /* THOMPSON_SAMPLING_WIFI_MANAGER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Thompson Sampling rate control algorithm.
uint16_t GetModeGuardInterval(WifiRemoteStation *st, WifiMode mode) const
Returns guard interval in nanoseconds for the given mode.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
void InitializeStation(WifiRemoteStation *station) const
Initializes station rate tables.
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
TracedValue< uint64_t > m_currentRate
Trace rate changes.
double SampleBetaVariable(uint64_t alpha, uint64_t beta) const
Sample beta random variable with given parameters.
WifiRemoteStation * DoCreateStation() const override
Ptr< GammaRandomVariable > m_gammaRandomVariable
Variable used to sample beta-distributed random variables.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
static TypeId GetTypeId(void)
Get the type ID.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
double m_decay
Exponential decay coefficient, Hz.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void UpdateNextMode(WifiRemoteStation *station) const
Draws a new MCS and related parameters to try next time for this station.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) override
This method is a pure virtual method that must be implemented by the sub-class.
void Decay(WifiRemoteStation *st, size_t i) const
Applies exponential decay to MCS statistics.
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:48
hold a list of per-remote-station state.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
float alpha
Plot alpha value (transparency)
hold per-remote-station state.