5G-LENA nr-v3.3-161-gad18933f
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-mac-scheduler-tdma-ai.h
1// Copyright (c) 2024 Seoul National University (SNU)
2// Copyright (c) 2024 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3//
4// SPDX-License-Identifier: GPL-2.0-only
5
6#pragma once
7
8#include "nr-mac-scheduler-tdma-qos.h"
9#include "nr-mac-scheduler-ue-info-ai.h"
10
11namespace ns3
12{
13
35{
36 friend class NrTestSchedulerAiCase;
37
38 public:
43 static TypeId GetTypeId();
44
49
50 protected:
56 std::shared_ptr<NrMacSchedulerUeInfo> CreateUeRepresentation(
57 const NrMacCschedSapProvider::CschedUeConfigReqParameters& params) const override;
58
64 std::function<bool(const NrMacSchedulerNs3::UePtrAndBufferReq& lhs,
66 GetUeCompareDlFn() const override;
67
73 std::function<bool(const NrMacSchedulerNs3::UePtrAndBufferReq& lhs,
75 GetUeCompareUlFn() const override;
76
82
88
95 std::vector<NrMacSchedulerUeInfoAi::LcObservation> GetUeObservationsDl(
96 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
97
104 std::vector<NrMacSchedulerUeInfoAi::LcObservation> GetUeObservationsUl(
105 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
106
111 bool GetIsGameOverDl() const;
112
117 bool GetIsGameOverUl() const;
118
125 float GetUeRewardsDl(const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
126
133 float GetUeRewardsUl(const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
134
141 void CallNotifyDlFn(
142 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const override;
143
150 void CallNotifyUlFn(
151 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const override;
152
162 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
163
173 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
174
175 private:
176 double m_alpha{0.0};
179};
180
181} // namespace ns3
std::pair< UePtr, uint32_t > UePtrAndBufferReq
Pair between a pointer to NrMacSchedulerUeInfo and its buffer occupancy.
The TDMA scheduler with AI implementation.
NrMacSchedulerTdmaAi()
NrMacSchedulerTdma constructor.
std::shared_ptr< NrMacSchedulerUeInfo > CreateUeRepresentation(const NrMacCschedSapProvider::CschedUeConfigReqParameters &params) const override
Create an UE representation of the type NrMacSchedulerUeInfoAi.
void CallNotifyDlFn(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const override
Call the notify callback function in the OpenGymEnv class in the ns3-gym module for downlink.
void UpdateAllUeWeightsDl(const NrMacSchedulerUeInfoAi::UeWeightsMap &ueWeights, const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Update weights of all UEs for downlink.
bool GetIsGameOverUl() const
Check if the uplink game is over.
void UpdateAllUeWeightsUl(const NrMacSchedulerUeInfoAi::UeWeightsMap &ueWeights, const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Update weights of all UEs for uplink.
float GetUeRewardsDl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get rewards for downlink.
void CallNotifyUlFn(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const override
Call the notify callback function in the OpenGymEnv class in the ns3-gym module for uplink.
static TypeId GetTypeId()
GetTypeId.
std::function< bool(const NrMacSchedulerNs3::UePtrAndBufferReq &lhs, const NrMacSchedulerNs3::UePtrAndBufferReq &rhs)> GetUeCompareUlFn() const override
Return the comparison function to sort UL UEs according to the scheduler policy.
void SetNotifyCbDl(NrMacSchedulerUeInfoAi::NotifyCb notifyCb)
Set the notify callback function for downlink.
std::vector< NrMacSchedulerUeInfoAi::LcObservation > GetUeObservationsDl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get UE observations for downlink.
std::function< bool(const NrMacSchedulerNs3::UePtrAndBufferReq &lhs, const NrMacSchedulerNs3::UePtrAndBufferReq &rhs)> GetUeCompareDlFn() const override
Return the comparison function to sort DL UEs according to the scheduler policy.
bool GetIsGameOverDl() const
Check if the downlink game is over.
std::vector< NrMacSchedulerUeInfoAi::LcObservation > GetUeObservationsUl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get UE observations for uplink.
float GetUeRewardsUl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get rewards for uplink.
void SetNotifyCbUl(NrMacSchedulerUeInfoAi::NotifyCb notifyCb)
Set the notify callback function for uplink.
Assign entire symbols in a QoS-based fashion.
std::unordered_map< uint8_t, Weights > UeWeightsMap
A hash map for UE weights.
Callback< void, const std::vector< LcObservation > &, bool, float, const std::string &, const UpdateAllUeWeightsFn & > NotifyCb
A callback type for notifying with specific parameters.