8#include "nr-mac-scheduler-ue-info-qos.h"
49 typedef std::unordered_map<uint8_t, double>
Weights;
91 typedef Callback<void,
92 const std::vector<LcObservation>&,
215 return (lAiMetric > rAiMetric);
232 for (
const auto& ueLcg : ue.first->m_dlLCG)
234 std::vector<uint8_t> ueActiveLCs = ueLcg.second->GetActiveLCIds();
236 for (
const auto lcId : ueActiveLCs)
240 NS_ASSERT_MSG(it != uePtr->m_weightsDl.end(),
"Weight not found for LC " << lcId);
241 weight += it->second;
263 return (lAiMetric > rAiMetric);
280 for (
const auto& ueLcg : ue.first->m_ulLCG)
282 std::vector<uint8_t> ueActiveLCs = ueLcg.second->GetActiveLCIds();
284 for (
const auto lcId : ueActiveLCs)
288 NS_ASSERT_MSG(it != uePtr->m_weightsUl.end(),
"Weight not found for LC " << lcId);
289 weight += it->second;
Representation of a beam id.
std::pair< UePtr, uint32_t > UePtrAndBufferReq
Pair between a pointer to NrMacSchedulerUeInfo and its buffer occupancy.
UE representation for a AI-based scheduler.
std::vector< LcObservation > GetUlObservation()
Get the current observation for uplink.
void ResetUlSchedInfo() override
Reset UL AI scheduler info.
static bool CompareUeWeightsUl(const NrMacSchedulerNs3::UePtrAndBufferReq &lue, const NrMacSchedulerNs3::UePtrAndBufferReq &rue)
comparison function object (i.e. an object that satisfies the requirements of Compare) which returns ...
void UpdateUlWeights(Weights &weights)
Update the weights for uplink.
NrMacSchedulerUeInfoAi(float alpha, uint16_t rnti, BeamId beamId, const GetRbPerRbgFn &fn)
NrMacSchedulerUeInfoAi constructor.
void UpdateDlWeights(Weights &weights)
Update the weights for downlink.
std::vector< LcObservation > GetDlObservation()
Get the current observation for downlink.
float GetDlReward()
Get the reward for downlink.
Weights m_weightsDl
Weights assigned to each flow for a UE in the downlink.
static bool CompareUeWeightsDl(const NrMacSchedulerNs3::UePtrAndBufferReq &lue, const NrMacSchedulerNs3::UePtrAndBufferReq &rue)
comparison function object (i.e. an object that satisfies the requirements of Compare) which returns ...
std::unordered_map< uint8_t, double > Weights
A hash map for weights.
static double CalculateUlWeight(const NrMacSchedulerNs3::UePtrAndBufferReq &ue)
Calculate the weight of a UE in the uplink.
void ResetDlSchedInfo() override
Reset DL AI scheduler info.
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.
float GetUlReward()
Get the reward for uplink.
static double CalculateDlWeight(const NrMacSchedulerNs3::UePtrAndBufferReq &ue)
Calculate the weight of a UE in the downlink.
std::function< void(const UeWeightsMap &)> UpdateAllUeWeightsFn
A function type for updating the weights of all UEs.
Weights m_weightsUl
Weights assigned to each flow for a UE in the uplink.
UE representation for a QoS-based scheduler.
void ResetUlSchedInfo() override
Reset UL QoS scheduler info.
void ResetDlSchedInfo() override
Reset DL QoS scheduler info.
A struct for an observation of a flow.