本文整理汇总了C++中hypergraph::EdgeSet::find方法的典型用法代码示例。如果您正苦于以下问题:C++ EdgeSet::find方法的具体用法?C++ EdgeSet::find怎么用?C++ EdgeSet::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hypergraph::EdgeSet
的用法示例。
在下文中一共展示了EdgeSet::find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeSimpleStars
//.........这里部分代码省略.........
// pop all "open" vertices
// pop all "vertices" in the backbone
// unfix the vertices in the backbone
int starNum=0;
for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
Star* s =*it;
HyperGraph::VertexSet backboneVertices = s->_lowLevelVertices;
HyperGraph::EdgeSet backboneEdges = s->_lowLevelEdges;
if (backboneEdges.empty())
continue;
// cerr << "optimizing backbone" << endl;
// one of these should be the gauge, to be simple we select the fisrt one in the backbone
OptimizableGraph::VertexSet gauge;
gauge.insert(*backboneVertices.begin());
s->gauge()=gauge;
s->optimizer()->push(backboneVertices);
s->optimizer()->setFixed(gauge,true);
s->optimizer()->initializeOptimization(backboneEdges);
s->optimizer()->computeInitialGuess();
s->optimizer()->optimize(backboneIterations);
s->optimizer()->setFixed(backboneVertices, true);
// cerr << "assignind edges.vertices not in bbone" << endl;
HyperGraph::EdgeSet otherEdges;
HyperGraph::VertexSet otherVertices;
std::multimap<HyperGraph::Vertex*, HyperGraph::Edge*> vemap;
for (HyperGraph::VertexSet::iterator bit=backboneVertices.begin(); bit!=backboneVertices.end(); bit++){
HyperGraph::Vertex* v=*bit;
for (HyperGraph::EdgeSet::iterator eit=v->edges().begin(); eit!=v->edges().end(); eit++){
OptimizableGraph::Edge* e = (OptimizableGraph::Edge*) *eit;
HyperGraph::EdgeSet::iterator feit=bact.freeEdges().find(e);
if (feit!=bact.freeEdges().end()){ // edge is admissible
otherEdges.insert(e);
bact.freeEdges().erase(feit);
for (size_t i=0; i<e->vertices().size(); i++){
OptimizableGraph::Vertex* ve= (OptimizableGraph::Vertex*)e->vertices()[i];
if (backboneVertices.find(ve)==backboneVertices.end()){
otherVertices.insert(ve);
vemap.insert(make_pair(ve,e));
}
}
}
}
}
// RAINER TODO maybe need a better solution than dynamic casting here??
OptimizationAlgorithmWithHessian* solverWithHessian = dynamic_cast<OptimizationAlgorithmWithHessian*>(s->optimizer()->solver());
if (solverWithHessian) {
s->optimizer()->push(otherVertices);
// cerr << "optimizing vertices out of bbone" << endl;
// cerr << "push" << endl;
// cerr << "init" << endl;
s->optimizer()->initializeOptimization(otherEdges);
// cerr << "guess" << endl;
s->optimizer()->computeInitialGuess();
// cerr << "solver init" << endl;
s->optimizer()->solver()->init();
// cerr << "structure" << endl;
if (!solverWithHessian->buildLinearStructure())
cerr << "FATAL: failure while building linear structure" << endl;
// cerr << "errors" << endl;
s->optimizer()->computeActiveErrors();
// cerr << "system" << endl;