当前位置: 首页>>代码示例>>C++>>正文


C++ Counter::average方法代码示例

本文整理汇总了C++中Counter::average方法的典型用法代码示例。如果您正苦于以下问题:C++ Counter::average方法的具体用法?C++ Counter::average怎么用?C++ Counter::average使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Counter的用法示例。


在下文中一共展示了Counter::average方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
	//double simTime = 1e6;
	double simTime = 30;		// Run time set to 30 years
							    // let the system run for a max length of time 
	int simNum = 30;            // number of runs
								
	//Edited by Kiat Boon on 5/3/2016 to simulate M/M/1 queue
	unsigned int N = 1;      // number of servers
	char outputFileName[] = "N100gamma1LogNormal2.txt";

//	double mu = 1.0;         	

	int I=1, J=1, K=1;
	RngBase *arr[1], *ser[1], *abd[1];

	//for deciding to go urgent queue or non-urgent queue
	RngBase *decide[1];

	double decideValue;
	int countUrgent, countNonUrgent;
	int totalArr = 0;
	int totalAbd = 0;
	int totalRej = 0;
	int totalSer = 0;
	int totalUrgSer = 0;
	int totalNonUrgSer = 0;
	int totalUrgQueue = 0;						//amount of patients still in urgent queue at end of run
	int totalNonUrgQueue = 0;					//amount of patients still in non urgent queue at end of run
	int totalInServer = 0;						//amount of patients still in server at end of run

	double privHospCost = 49891.82;				//cost of surgery in private hospital: source from health-tourism.com, raffles hosp is 36700 USD
	double pubHospCost = 4978.85;				//cost of surgery in public hospital = (4729*272+5760*87)/(272+87)

	//****Note: All subsidies are assumed 10% co-insurance, so govt pays 90%****//

	double waitingCostInNonUrgQueue = .9*200*12;			//cost of waiting in non-urgent queue per yr
															//MediShield organ transplant for immunosuppressant subsidy is $200/mth
	double waitingCostInUrgQueue = .9*700*365;				//inpatient: 700/day

	double averageNonUrgSubsidy = .9*(650.0+1*1200+5.4*700);		//estimated average cost of subsidy per patient served from mediShield 
	double averageUrgSubsidy = .9*(1550.0+2*1200+7.2*700);			//Non-urg: 25th percentile of range, 200 to 2000
																				//Urg: 75th percentile of range, 200 to 2000
																				//Assume 10% of the time post-op in ICU
	//For overflow policy
	//double arrRate = 269.28;
	//int queueLength = 66;					    	//queue length to be set for overflow policy	
	//double incentiveProportion = 0;				    //percentage of incentive to be given to reduce arr rate

	//For incentive policy
	int queueLength = INT_MAX;
	double incentiveProportion = 0.22;
	double arrRate = 269.28*(1-seekPrivProportion(incentiveProportion)); 

	//no need to remove this section for overflow policy
	double incentive = (privHospCost-pubHospCost)*incentiveProportion;			   	//incentive to be given to each patient seeking private hospital		
	double totalIncentive = (269.28 - arrRate)*incentive*simTime;			        //expected total amount of incentive given to reduce queue length

	double serRate = 272;
	double lifeTime = 0.288;							//mean of 180.76 weeks
	//double lifeTime = 12;
	//double lifeTime = 1e8;

	double nonUrgentProportion = 0.231;						//proportion of patients in non-urgent queue: 1920/8325, table 1, sobolev
	double upgradeProportion = 0.513;						//proportion of patients to be upgraded
	vector<double> cs2(2);

	arr[0] = new ExpGen(arrRate);		
	//arr[0] = new DetGen(0.1);
	double ca2 = 1;
	

	/*NOTE: By default, ser[0] is exponential, but if ser[0] is not exponential, please change the service time generator in MS_Queue_Abd init()*/
	ser[0] = new ExpGen(serRate);
	//ser[0] = new DetGen(0.1);
	cs2[0] = 2.0;
	// ser[0] = new ErlangGen(2*mu, 2); 
	// cs2[0] = 0.5;
	// ser[1] = new DetGen(1.0); 
	// cs2[1] = 0.0;	
	//ser[1] = new ErlangGen(2*mu, 2); 
	//cs2[1] = 0.5;
	//ser[2] = new ExpGen(mu); 
	//cs2[2] = 1;
	//ser[3] = new HyperExp2Gen(1/0.169, 1/2.20327, .5915); 
	//cs2[3] = 3.0;
	//ser[4] = new LogNormalGen(1/mu, 3); 
	//cs2[4] = 3.0;

	abd[0] = new ExpGen(lifeTime);
	//abd[0] = new DetGen(1e8);								//so that patients will not abandon queue

	// abd[0] = new ErlangGen(3*alpha,3);
   // abd[0] = new HyperExp2Gen(1.0, 200.0, 0.9);
	//abd[0] = new HyperExp2Gen(0.2, 6.0, 0.9);
   // abd[0] = new HyperExp2Gen(1, 1/3.0, .5);
   // abd[0] = new HyperExp2Gen(alpha*0.3, 79*alpha/30, 0.7);
   // abd[1] = new ExpGen(2.0/3);
   // abd[0] = new UniformGen(0, 10);
   // abd[1] = new ExpGen(.25);
//.........这里部分代码省略.........
开发者ID:chinkiatboon,项目名称:sim-hosp,代码行数:101,代码来源:OverloadedDiffusion.cpp


注:本文中的Counter::average方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。