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


C++ StarLink::getTime方法代码示例

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


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

示例1: calculate

FPType NonAdditivePC::calculate(Path *path, int odIndex) const{
	assert(path != NULL && odIndex >=0);
	TollType totalToll = 0;
	FPType totalTime = 0.0;
	for (StarLinkIterator it = path->begin(); it != path->end(); ++it) {
		StarLink* link = *it;
		totalTime += link->getTime();
		totalToll += tolls_[link->getIndex()];
	}
	return calculate(totalTime, totalToll, odIndex);
};
开发者ID:josmartin,项目名称:TAsK,代码行数:11,代码来源:NonAdditivePC.cpp

示例2: printMaxShPath

void DAGraph::printMaxShPath(int node){
	StarLink *prevMax = (nodes_[node])->maxLink;
	int prevNode = -1; 
	std::cout << "Cost = " << (nodes_[node])->maxDist << std::endl;
	FPType cost = 0.0;
	while (prevMax != NULL){
		prevNode = prevMax->getNodeFromIndex();
		cost += prevMax->getFlow() * prevMax->getTime();
		std::cout << "[" << prevMax->getNodeToIndex() << ", " << prevNode << "] " 
					<< prevMax->getFlow() << " - ";
		prevMax = (nodes_[prevNode])->maxLink;
	}
	std::cout << std::endl;
};	
开发者ID:jingzbu,项目名称:TAsK,代码行数:14,代码来源:DAGraph.cpp

示例3: buildMinMaxTrees

void DAGraph::buildMinMaxTrees(int destIndex){
	int index = -1;

	for (int i = 0; i < nodeSize_; ++i) {
		index = nodeIndexes_[i];
		nodes_[index]->minDist = std::numeric_limits<FPType>::infinity( );
		nodes_[index]->maxDist = 0.0;
	}
	nodes_[originIndex_]->minDist = 0.0; // set to zero for origin 
	
	// find shortest and longest paths with positive flow
	FPType dist = 0.0;
	FPType time = 0.0;
	int i = beginAscPass();
	
	assert(originIndex_ == i); //-- TODO: theoretically there might be 
					// an alternative top order that starts with another node -- 
					// not clear what to do in this case
	StarLink* link = NULL;
	for (; i != -1; i = getNextAscPass()) {
		std::list<StarLink*> &linksList = nodes_[i]->incomeLinks;
		for (std::list<StarLink*>::iterator it = linksList.begin(); it != linksList.end(); ++it) {
			link = *it;
			index = link->getNodeFromIndex();
			assert(nodes_[index] != NULL);
			time = link->getTime();
			dist = nodes_[index]->minDist + time; // min dist
			if (dist < nodes_[i]->minDist) {
				nodes_[i]->minDist = dist;
				nodes_[i]->minLink = link; 
			}
			dist = nodes_[index]->maxDist + time; // max dist
			if (dist >= nodes_[i]->maxDist) {
				nodes_[i]->maxDist = dist;
				nodes_[i]->maxLink = link; 
			}
		}
		
		if (i == destIndex) break;
	}
};
开发者ID:jingzbu,项目名称:TAsK,代码行数:41,代码来源:DAGraph.cpp


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