User Manual, Developers Guide and API Documentation

ProportionalFair.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WNS (Wireless Network Simulator)                                           *
00003  * __________________________________________________________________________ *
00004  *                                                                            *
00005  * Copyright (C) 2004-2006                                                    *
00006  * Chair of Communication Networks (ComNets)                                  *
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany                                 *
00008  * phone: ++49-241-80-27910 (phone), fax: ++49-241-80-22242                   *
00009  * email: wns@comnets.rwth-aachen.de                                          *
00010  * www: http://wns.comnets.rwth-aachen.de                                     *
00011  ******************************************************************************/
00012 
00013 #ifndef WNS_SCHEDULER_STRATEGY_STATICPRIORITY_PROPORTIONALFAIR_HPP
00014 #define WNS_SCHEDULER_STRATEGY_STATICPRIORITY_PROPORTIONALFAIR_HPP
00015 
00016 #include <WNS/scheduler/strategy/Strategy.hpp>
00017 #include <WNS/scheduler/strategy/staticpriority/SubStrategy.hpp>
00018 #include <WNS/scheduler/SchedulingMap.hpp>
00019 #include <WNS/scheduler/queue/QueueInterface.hpp>
00020 #include <WNS/scheduler/RegistryProxyInterface.hpp>
00021 
00022 #include <WNS/distribution/Uniform.hpp>
00023 #include <WNS/StaticFactory.hpp>
00024 
00025 #include <queue>
00026 
00027 namespace wns { namespace scheduler { namespace strategy { namespace staticpriority {
00028 
00034                 class ProportionalFair
00035                     : public SubStrategy
00036                 {
00037                 public:
00038                     ProportionalFair(const wns::pyconfig::View& config);
00039 
00040                     ~ProportionalFair();
00041 
00044                     typedef std::pair<float, UserID> UserPreference;
00045 
00046                     virtual void
00047                     initialize();
00048 
00051                     std::priority_queue<UserPreference>
00052                     calculateUserPreferences(UserSet activeUsers, bool txStrategy) const;
00053 
00055                     std::map<UserID, float>
00056                     calculateBitsForConnections(const ConnectionSet& currentConnections);
00057 
00059                     virtual wns::scheduler::ConnectionID
00060                     getNextConnection(SchedulerStatePtr schedulerState, std::priority_queue<UserPreference> preferences);
00061 
00063                     void
00064                     updatePastDataRates(std::map<UserID, float> bitsBeforeThisFrame,
00065                                         std::map<UserID, float> bitsAfterThisFrame,
00066                                         simTimeType phaseLength);
00067 
00068                     virtual wns::scheduler::MapInfoCollectionPtr
00069                     doStartSubScheduling(SchedulerStatePtr schedulerState,
00070                                          wns::scheduler::SchedulingMapPtr schedulingMap);
00071 
00072                 protected:
00074                     ConnectionVector
00075                     getConnectionsForPrio(int currentPrio, const UserID user);
00077                     wns::scheduler::ConnectionID
00078                     getRandomConnection(ConnectionVector currentPrioConns);
00080                     int blockSize;
00082                     float historyWeight;
00084                     float scalingBetweenMaxTPandPFair;
00086                     bool rateFairness;
00087                     float maxRateOfSubchannel;
00088                     UserSet allUsers;
00089                     std::map<UserID, float> bitsForUsers;
00090                     std::map<UserID, float> bitsThisFrame;
00091                     std::map<UserID, float> pastDataRates;
00092                     std::map<UserID, wns::CandI> sinrs;
00094                     wns::distribution::Uniform* preferenceVariationDistribution;
00095                 };
00096             }}}}
00097 namespace std {
00098     template <>
00099     struct less<wns::scheduler::strategy::staticpriority::ProportionalFair::UserPreference>:
00100         public binary_function<wns::scheduler::strategy::staticpriority::ProportionalFair::UserPreference,
00101                                wns::scheduler::strategy::staticpriority::ProportionalFair::UserPreference,
00102                                bool>{
00105         bool operator()(const wns::scheduler::strategy::staticpriority::ProportionalFair::UserPreference & lhs,
00106                         const wns::scheduler::strategy::staticpriority::ProportionalFair::UserPreference & rhs) const
00107         {
00108             if(lhs.first == rhs.first) {
00109                 return lhs.second.getName() < rhs.second.getName();
00110             }
00111             return lhs.first < rhs.first;
00112         }
00113     };
00114 }
00115 #endif

Generated on Fri May 25 03:31:55 2012 for openWNS by  doxygen 1.5.5