Co-Simulation/Sumo/sumo-1.7.0/src/marouter/marouter_main.cpp
/**
 * Computes all pair shortest paths, saving them
 */
Computes all pair shortest paths, saving them
Computes all pair shortest paths saving them
void
computeAllPairs(RONet& net, OptionsCont& oc) {
    OutputDevice::createDeviceByOption("all-pairs-output");
    OutputDevice& outFile = OutputDevice::getDeviceByOption("all-pairs-output");
    typedef DijkstraRouter<ROEdge, ROVehicle> Dijkstra;
    Dijkstra router(ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &getTravelTime);
    ConstROEdgeVector into;
    const int numInternalEdges = net.getInternalEdgeNumber();
    const int numTotalEdges = (int)net.getEdgeNumber();
    for (int i = numInternalEdges; i < numTotalEdges; i++) {
        const Dijkstra::EdgeInfo& ei = router.getEdgeInfo(i);
        if (!ei.edge->isInternal()) {
            router.compute(ei.edge, nullptr, nullptr, 0, into);
            double fromEffort = router.getEffort(ei.edge, nullptr, 0);
            for (int j = numInternalEdges; j < numTotalEdges; j++) {
                double heuTT = router.getEdgeInfo(j).effort - fromEffort;
                outFile << heuTT;
            }
        }
    }
}
void computeAllPairs ( RONet & net , OptionsCont & oc ) { OutputDevice :: createDeviceByOption ( " " ) ; OutputDevice & outFile = OutputDevice :: getDeviceByOption ( " " ) ; typedef DijkstraRouter < ROEdge , ROVehicle > Dijkstra ; Dijkstra router ( ROEdge :: getAllEdges ( ) , oc . getBool ( " " ) , & getTravelTime ) ; ConstROEdgeVector into ; const int numInternalEdges = net . getInternalEdgeNumber ( ) ; const int numTotalEdges = ( int ) net . getEdgeNumber ( ) ; for ( int i = numInternalEdges ; i < numTotalEdges ; i ++ ) { const Dijkstra :: EdgeInfo & ei = router . getEdgeInfo ( i ) ; if ( ! ei . edge -> isInternal ( ) ) { router . compute ( ei . edge , nullptr , nullptr , 0 , into ) ; double fromEffort = router . getEffort ( ei . edge , nullptr , 0 ) ; for ( int j = numInternalEdges ; j < numTotalEdges ; j ++ ) { double heuTT = router . getEdgeInfo ( j ) . effort - fromEffort ; outFile << heuTT ; } } } }
Computes all pair shortest paths, saving them
Computes all pair shortest paths saving them
// build the router /*
                if (heuTT >
                        ei.edge->getDistanceTo(router.getEdgeInfo(j).edge)
                        && router.getEdgeInfo(j).traveltime != std::numeric_limits<double>::max()
                        ) {
                    std::cout << " heuristic failure: from=" << ei.edge->getID() << " to=" << router.getEdgeInfo(j).edge->getID()
                    << " fromEffort=" << fromEffort << " heuTT=" << heuTT << " airDist=" << ei.edge->getDistanceTo(router.getEdgeInfo(j).edge) << "\n";
                }
                */