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


C++ Monitor::getQuality方法代码示例

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


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

示例1: check_best_solution

void check_best_solution(vector<Ant*> *vec) {
	cout << "check_best_solution" << endl;
	if (vec->size() > 0) {
		if (best_cost == INVALID and best_coverage == INVALID) {
			best_cost = monitor.getCost(vec->at(0)->getCost());
			best_coverage = monitor.getCoverage(vec->at(0)->getCoverage());

			worse_cost = monitor.getCost(
					vec->at(POPULATION_SIZE - 1)->getCost());
			worse_coverage = monitor.getCoverage(
					vec->at(POPULATION_SIZE - 1)->getCoverage());
		}
		for (int i = 0; i < POPULATION_SIZE; i++) {
			vec->at(i)->setCost(monitor.getCost(vec->at(i)->getCost()));
			vec->at(i)->setCoverage(
					monitor.getCoverage(vec->at(i)->getCoverage()));

			if (vec->at(i)->getCost() > best_cost) {
				best_cost = vec->at(i)->getCost();
			} else if (vec->at(i)->getCost() < worse_cost) {
				worse_cost = vec->at(i)->getCost();
			}

			if (vec->at(i)->getCoverage() > best_coverage) {
				best_coverage = vec->at(i)->getCoverage();
			} else if (vec->at(i)->getCoverage() < worse_coverage) {
				worse_coverage = vec->at(i)->getCoverage();
			}
		}
		for (int i = 0; i < POPULATION_SIZE; i++) {
			double quality = monitor.getQuality(vec->at(i)->getCost());
			if (quality > best_solution) {
				best_solution = quality;
				best_route = vec->at(i)->getRoute();
			} else if (quality < worse_solution) {
				worse_solution = quality;
				worse_route = vec->at(i)->getRoute();
			}
			vec->at(i)->setQuality(quality);
		}
	}
}
开发者ID:zerokol,项目名称:MQFE,代码行数:42,代码来源:main.cpp


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