5G-LENA nr-v3.3-161-gad18933f
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-mac-scheduler-ofdma-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-ofdma-qos.h"
9#include "nr-mac-scheduler-ue-info-ai.h"
10
11#include "ns3/traced-value.h"
12
13namespace ns3
14{
15
37{
38 friend class NrTestSchedulerAiCase;
39
40 public:
45 static TypeId GetTypeId();
46
51
52 protected:
58 std::shared_ptr<NrMacSchedulerUeInfo> CreateUeRepresentation(
59 const NrMacCschedSapProvider::CschedUeConfigReqParameters& params) const override;
60
66 std::function<bool(const NrMacSchedulerNs3::UePtrAndBufferReq& lhs,
68 GetUeCompareDlFn() const override;
69
75 std::function<bool(const NrMacSchedulerNs3::UePtrAndBufferReq& lhs,
77 GetUeCompareUlFn() const override;
78
84
90
97 std::vector<NrMacSchedulerUeInfoAi::LcObservation> GetUeObservationsDl(
98 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
99
106 std::vector<NrMacSchedulerUeInfoAi::LcObservation> GetUeObservationsUl(
107 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
108
113 bool GetIsGameOverDl() const;
114
119 bool GetIsGameOverUl() const;
120
127 float GetUeRewardsDl(const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
128
135 float GetUeRewardsUl(const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
136
143 void CallNotifyDlFn(
144 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const override;
145
152 void CallNotifyUlFn(
153 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const override;
154
164 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
165
175 const std::vector<NrMacSchedulerNs3::UePtrAndBufferReq>& ueVector) const;
176
177 private:
178 float m_alpha{0.0};
181};
182} // namespace ns3
std::pair< UePtr, uint32_t > UePtrAndBufferReq
Pair between a pointer to NrMacSchedulerUeInfo and its buffer occupancy.
The OFDMA scheduler with AI implementation.
bool GetIsGameOverUl() const
Check if the uplink game is over.
float GetUeRewardsDl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get rewards for downlink.
void SetNotifyCbDl(NrMacSchedulerUeInfoAi::NotifyCb notifyCb)
Set the notify callback function for downlink.
std::vector< NrMacSchedulerUeInfoAi::LcObservation > GetUeObservationsUl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get UE observations for uplink.
void UpdateAllUeWeightsDl(const NrMacSchedulerUeInfoAi::UeWeightsMap &ueWeights, const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Update weights of all UEs for downlink.
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.
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.
bool GetIsGameOverDl() const
Check if the downlink game is over.
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.
std::shared_ptr< NrMacSchedulerUeInfo > CreateUeRepresentation(const NrMacCschedSapProvider::CschedUeConfigReqParameters &params) const override
Create an UE representation of the type NrMacSchedulerUeInfoAi.
static TypeId GetTypeId()
GetTypeId.
void UpdateAllUeWeightsUl(const NrMacSchedulerUeInfoAi::UeWeightsMap &ueWeights, const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Update weights of all UEs for uplink.
std::vector< NrMacSchedulerUeInfoAi::LcObservation > GetUeObservationsDl(const std::vector< NrMacSchedulerNs3::UePtrAndBufferReq > &ueVector) const
Get UE observations 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.
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.
NrMacSchedulerOfdmaAi()
NrMacSchedulerOfdmaAi constructor.
Assign frequencies in 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.