本文整理汇总了C++中Origin::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Origin::end方法的具体用法?C++ Origin::end怎么用?C++ Origin::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Origin
的用法示例。
在下文中一共展示了Origin::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Error
PathSet::PathSet(ODSetType setType, StarNetwork *net, ODMatrix *mat, ShortestPath *shPath,
PathCost *pathCost,
FPType zeroFlow, PathBasedFlowMove* flowMove,
PathBasedFlowMoveWithStep* flowMoveWithStep, PathBasedFlowMoveGP* flowMoveGP,
AONAssignment* aon) :
odSetList_(mat->getNbODPairs()),
size_(mat->getNbODPairs()), currPath_(NULL),
aon_(aon){
int odIndex = -1;
for (OriginIterator it = mat->begin(); it != mat->end(); ++it){
Origin* origin = *it;
for (PairODIterator jt = origin->begin(); jt != origin->end(); ++jt) {
PairOD* dest = *jt;
odIndex = dest->getODIndex();
if (setType == PEAPP3) {
odSetList_[odIndex] = new ODSet(odIndex, dest->getIndex(), origin->getIndex(),
pathCost, net, shPath,
zeroFlow, flowMove);
} else if (setType == WITH_STEP) {
odSetList_[odIndex] = new ODSetWithStep(odIndex, dest->getIndex(), origin->getIndex(),
pathCost, net, shPath, zeroFlow,
flowMoveWithStep);
} else if (setType == GPAPP3) {
odSetList_[odIndex] = new ODSetGPApp3(odIndex, dest->getIndex(), origin->getIndex(),
pathCost, net, shPath, zeroFlow,
flowMoveGP, mat);
} else {
throw Error("Unexpected OD set type.");
}
}
}
};
示例2: checkFeasibility
FPType Utils::checkFeasibility(StarNetwork *net, ODMatrix *mat){
std::vector<FPType> total(net->getNbNodes());
for (int i = 0; i < net->getNbNodes(); ++i) {
total[i] = 0.0;
}
// load demands
for (OriginIterator it = mat->begin(); it != mat->end(); ++it){
Origin* origin = *it;
for (PairODIterator jt = origin->begin(); jt != origin->end(); ++jt) {
PairOD* dest = *jt;
total[origin->getIndex()] += dest->getDemand();
total[dest->getIndex()] -= dest->getDemand();
}
}
//travers network and check
for (StarLink *link = net->beginOnlyLink(); link != NULL; link = net->getNextOnlyLink()) {
total[link->getNodeFromIndex()] -= link->getFlow();
total[link->getNodeToIndex()] += link->getFlow();
}
FPType maxVal = 0.0;
for (int i = 0; i < net->getNbNodes(); ++i) {
if (fabs(total[i]) > maxVal) maxVal = fabs(total[i]);
}
return maxVal;
};
示例3: print
void ODMatrix::print(){
std::cout << "nb pairs = " << nbODPairs_ << std::endl;
for (OriginIterator it = begin(); it != end(); ++it){
Origin* origin = *it;
std::cout << "Origin: " << origin->getIndex() << std::endl;
for (PairODIterator jt = origin->begin(); jt != origin->end(); ++jt) {
PairOD* dest = *jt;
dest->print();
}
};
};
示例4: generateRandomTollsOnShortestPath
void TollsManagement::generateRandomTollsOnShortestPath(TollContainerType& tolls,
FPType probabylity, TollType maxToll, ODMatrix* mat, ShortestPath *shPath){
for (OriginIterator it = mat->begin(); it != mat->end(); ++it) {
Origin* origin = *it;
shPath->calculate(origin->getIndex());
for (PairODIterator jt = origin->begin(); jt != origin->end(); ++jt) {
if (Utils::generateRndNumber(1.0) <= probabylity) {
PairOD* dest = *jt;
assignRndTolls(shPath, dest->getIndex(), tolls, probabylity, maxToll);
}
}
}
};
示例5: checkOFlowsFeasibility
FPType DAGraph::checkOFlowsFeasibility(){
int nbNodes = net_->getNbNodes();
FPType total[nbNodes];
for (int i = 0; i < nbNodes; ++i) {
total[i] = 0.0;
}
// load demands
for (OriginIterator it = mat_->begin(); it != mat_->end(); ++it){
Origin* origin = *it;
if (origin->getIndex() == originIndex_){
for (PairODIterator jt = origin->begin(); jt != origin->end(); ++jt) {
PairOD* dest = *jt;
FPType demand = dest->getDemand();
total[origin->getIndex()] += demand;
total[dest->getIndex()] -= demand;
}
break;
}
}
//travers network and check
int i = -1;
StarLink* link = NULL;
std::list<StarLink*> inLinks;
for (int j = 0; j < nodeSize_; ++j) {
i = nodeIndexes_[j];
getInLinks(i, inLinks);
for (std::list<StarLink*>::iterator it = inLinks.begin(); it != inLinks.end(); ++it){
link = *it;
total[link->getNodeFromIndex()] -= getOriginFlow(link->getIndex());
total[link->getNodeToIndex()] += getOriginFlow(link->getIndex());
}
}
FPType max = 0.0;
for (int i = 0; i < net_->getNbNodes(); ++i) {
if (fabs(total[i]) > max) {
max = fabs(total[i]);
}
}
return max;
};
示例6: setIndexes
void ODMatrix::setIndexes(){
int count = 0;
int originIndex = -1;
//
for (OriginIterator it = begin(); it != end(); ++it){
Origin* origin = *it;
originIndex = origin->getIndex();
for (PairODIterator jt = origin->begin(); jt != origin->end(); ++jt) {
PairOD* dest = *jt;
dest->setODIndex(count);
demandByIndex_.insert(std::make_pair<std::string, FPType>(
createKey(originIndex, dest->getIndex()),
dest->getDemand()));
++count;
}
}
nbODPairs_ = count;
std::cout << "nbODPairs = " << nbODPairs_ << std::endl;
};