⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsagent.h

📁 Bubble Oscillation Algorithm. It is used to implement balancing load traffic, which is similar to wh
💻 H
字号:
//////////////////////////////////////////////////////////////////////
//  Title:        Geographic Load Balancing for Cellular Networks 
//		          by emulating the behavior of air bubbles 
//
//  Description:  This project is for dynamically balancing the traffic load 
//                  over a cellular network with fully adaptive antennas by 
//		    emulating the behaviours of a bubble array. Since 
//                  we assume fully adaptive base station antenna in this  
//                  version, antenna agent and simulator are not needed. 
//
//  Copyright:    Copyright (c) 2003
//  Company:      Elec. Eng. Dept., Queen Mary, University of London
//  @author       Lin Du (lin.du@elec.qmul.ac.uk)
//  @version      1.0
//
//////////////////////////////////////////////////////////////////////

// BSAgent.h: interface for the BSAgent class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(BSAgent_H_INCLUDED)
#define BSAgent_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// Disable the warning message
#pragma warning(disable:4786)

#include <iostream>
#include <map>
#include <vector>

using namespace std;

#include "Constants.h"
#include "TestBed.h"
#include "BaseStation.h"
#include "TrafficUnit.h"

#include "MAS_DF.h"

#include "Evaluator.h"
#include "LocalOptimizer.h"

class TestBed;
class BaseStation;
class MAS_DF;

class Evaluator;
class LocalOptimizer;
class TrafficUnit;

typedef vector<TrafficUnit *> P_TU_V;

class BSAgent {
public:
  // Constructor and de-constructor
  BSAgent();
	BSAgent(BaseStation *bs, MAS_DF *df);
	virtual ~BSAgent();

  // Return the BS_ID of this base station agent
  int getID() const;

	// reset oscNum and initiate the bubble
	void reset();
 
	// Run bubble oscillation
	void run();

	// Commit the changes by exchange currScheme and nextScheme, and apply the currScheme to BS.
	void commit();

  // Return the current scheme
  P_TU_V &getCurrScheme();

  // Set friendship to all parts of BS agent
  friend class Evaluator;
  friend class LocalOptimizer;
  friend class BaseStation;

private:
  Evaluator      *evaluator;
  LocalOptimizer *optimizer;

  MAS_DF *df;
  BaseStation *bs;

  // ID
  int ID;

	// The number of oscillations
	int oscNum;

  // Return the possible Tu of this base station
  P_TU_V &getPossibleTU();
	// Return the ID of neighbour BS
	int getNeighbourID(int index) const;

  // Current local allocation scheme, update each time that we apply new scheme.
  P_TU_V *currScheme;
  // Next local allocation scheme, update each time that we apply new scheme.
  P_TU_V *nextScheme;

	// flag if the scheme need to be updated or not
	bool schemeUpdated;
	// flag if the agent need to hold on for one turn. (to avoid oscillate back without cooperation from others)
	bool holding;
};

#endif // !defined(BSAgent_H_INCLUDED)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -