Search in sources :

Example 16 with GHBitSet

use of com.graphhopper.coll.GHBitSet in project graphhopper by graphhopper.

the class Measurement method printGraphDetails.

private void printGraphDetails(GraphHopperStorage g, String vehicleStr) {
    // graph size (edge, node and storage size)
    put("graph.nodes", g.getNodes());
    put("graph.edges", g.getAllEdges().length());
    put("graph.size_in_MB", g.getCapacity() / MB);
    put("graph.encoder", vehicleStr);
    final GHBitSet validEdges = getValidEdges(g);
    put("graph.valid_edges", validEdges.getCardinality());
}
Also used : GHBitSet(com.graphhopper.coll.GHBitSet)

Example 17 with GHBitSet

use of com.graphhopper.coll.GHBitSet in project graphhopper by graphhopper.

the class Measurement method measureGraphTraversal.

private void measureGraphTraversal(final Graph graph, final FlagEncoder encoder, int count) {
    final Random rand = new Random(seed);
    EdgeFilter outFilter = AccessFilter.outEdges(encoder.getAccessEnc());
    final EdgeExplorer outExplorer = graph.createEdgeExplorer(outFilter);
    MiniPerfTest miniPerf = new MiniPerfTest().setIterations(count).start((warmup, run) -> {
        int nodeId = rand.nextInt(maxNode);
        return GHUtility.count(outExplorer.setBaseNode(nodeId));
    });
    print("unit_tests.out_edge_state_next", miniPerf);
    final EdgeExplorer allExplorer = graph.createEdgeExplorer();
    miniPerf = new MiniPerfTest().setIterations(count).start((warmup, run) -> {
        int nodeId = rand.nextInt(maxNode);
        return GHUtility.count(allExplorer.setBaseNode(nodeId));
    });
    print("unit_tests.all_edge_state_next", miniPerf);
    final int maxEdgesId = graph.getAllEdges().length();
    GHBitSet allowedEdges = getValidEdges(graph);
    miniPerf = new MiniPerfTest().setIterations(count).start((warmup, run) -> {
        while (true) {
            int edgeId = rand.nextInt(maxEdgesId);
            if (allowedEdges.contains(edgeId))
                return graph.getEdgeIteratorState(edgeId, Integer.MIN_VALUE).getEdge();
        }
    });
    print("unit_tests.get_edge_state", miniPerf);
}
Also used : java.util(java.util) CustomProfile(com.graphhopper.routing.weighting.custom.CustomProfile) LoggerFactory(org.slf4j.LoggerFactory) Subnetwork(com.graphhopper.routing.ev.Subnetwork) SimpleDateFormat(java.text.SimpleDateFormat) BLOCK_AREA(com.graphhopper.util.Parameters.Routing.BLOCK_AREA) GarbageCollectorMXBean(java.lang.management.GarbageCollectorMXBean) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IntArrayList(com.carrotsearch.hppc.IntArrayList) LMConfig(com.graphhopper.routing.lm.LMConfig) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) Profile(com.graphhopper.config.Profile) ALT_ROUTE(com.graphhopper.util.Parameters.Algorithms.ALT_ROUTE) GHBitSetImpl(com.graphhopper.coll.GHBitSetImpl) ManagementFactory(java.lang.management.ManagementFactory) com.graphhopper.storage(com.graphhopper.storage) Jackson(com.graphhopper.jackson.Jackson) com.graphhopper(com.graphhopper) com.graphhopper.util(com.graphhopper.util) Logger(org.slf4j.Logger) LocationIndex(com.graphhopper.storage.index.LocationIndex) BBox(com.graphhopper.util.shapes.BBox) Landmark(com.graphhopper.util.Parameters.Landmark) Files(java.nio.file.Files) Helper(com.graphhopper.util.Helper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileWriter(java.io.FileWriter) Algorithms(com.graphhopper.util.Parameters.Algorithms) IOException(java.io.IOException) CHProfile(com.graphhopper.config.CHProfile) File(java.io.File) U_TURN_COSTS(com.graphhopper.util.Parameters.Routing.U_TURN_COSTS) GHBitSet(com.graphhopper.coll.GHBitSet) AtomicLong(java.util.concurrent.atomic.AtomicLong) GHUtility.readCountries(com.graphhopper.util.GHUtility.readCountries) Paths(java.nio.file.Paths) PrepareLandmarks(com.graphhopper.routing.lm.PrepareLandmarks) Weighting(com.graphhopper.routing.weighting.Weighting) CustomWeighting(com.graphhopper.routing.weighting.custom.CustomWeighting) PrepareContractionHierarchies(com.graphhopper.routing.ch.PrepareContractionHierarchies) Entry(java.util.Map.Entry) CH(com.graphhopper.util.Parameters.CH) GHPoint(com.graphhopper.util.shapes.GHPoint) com.graphhopper.routing.util(com.graphhopper.routing.util) LMProfile(com.graphhopper.config.LMProfile) GHBitSet(com.graphhopper.coll.GHBitSet) GHPoint(com.graphhopper.util.shapes.GHPoint)

Aggregations

GHBitSet (com.graphhopper.coll.GHBitSet)17 GHBitSetImpl (com.graphhopper.coll.GHBitSetImpl)10 GHPoint (com.graphhopper.util.shapes.GHPoint)7 IntArrayList (com.carrotsearch.hppc.IntArrayList)4 GHTBitSet (com.graphhopper.coll.GHTBitSet)2 CHProfile (com.graphhopper.config.CHProfile)2 LMProfile (com.graphhopper.config.LMProfile)2 Profile (com.graphhopper.config.Profile)2 AllEdgesIterator (com.graphhopper.routing.util.AllEdgesIterator)2 Weighting (com.graphhopper.routing.weighting.Weighting)2 CustomProfile (com.graphhopper.routing.weighting.custom.CustomProfile)2 BBox (com.graphhopper.util.shapes.BBox)2 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 IntArrayDeque (com.carrotsearch.hppc.IntArrayDeque)1 IntPredicate (com.carrotsearch.hppc.predicates.IntPredicate)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)1