use of com.graphhopper.routing.weighting.FastestWeighting in project graphhopper by graphhopper.
the class PrepareContractionHierarchiesTest method testMultiplePreparationsIdenticalView.
@Test
public void testMultiplePreparationsIdenticalView() {
CarFlagEncoder tmpCarEncoder = new CarFlagEncoder();
BikeFlagEncoder tmpBikeEncoder = new BikeFlagEncoder();
EncodingManager tmpEncodingManager = new EncodingManager(tmpCarEncoder, tmpBikeEncoder);
// FastestWeighting would lead to different shortcuts due to different default speeds for bike and car
Weighting carWeighting = new ShortestWeighting(tmpCarEncoder);
Weighting bikeWeighting = new ShortestWeighting(tmpBikeEncoder);
List<Weighting> chWeightings = Arrays.asList(carWeighting, bikeWeighting);
GraphHopperStorage ghStorage = new GraphHopperStorage(chWeightings, dir, tmpEncodingManager, false, new GraphExtension.NoOpExtension()).create(1000);
initShortcutsGraph(ghStorage);
ghStorage.freeze();
for (Weighting w : chWeightings) {
checkPath(ghStorage, w, 7, 5, Helper.createTList(3, 9, 14, 16, 13, 12));
}
}
use of com.graphhopper.routing.weighting.FastestWeighting in project graphhopper by graphhopper.
the class PathTest method testFound.
@Test
public void testFound() {
GraphHopperStorage g = new GraphBuilder(carManager).create();
Path p = new Path(g, new FastestWeighting(encoder));
assertFalse(p.isFound());
assertEquals(0, p.getDistance(), 1e-7);
assertEquals(0, p.calcNodes().size());
g.close();
}
use of com.graphhopper.routing.weighting.FastestWeighting in project graphhopper by graphhopper.
the class LandmarkStorageTest method testWithOnewaySubnetworks.
@Test
public void testWithOnewaySubnetworks() {
// should not happen with subnetwork preparation
// create an indifferent problem: node 2 and 3 are part of two 'disconnected' subnetworks
ghStorage.edge(0, 1, 10, true);
ghStorage.edge(1, 2, 10, false);
ghStorage.edge(2, 3, 10, false);
ghStorage.edge(4, 5, 10, true);
ghStorage.edge(5, 2, 10, false);
LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2);
storage.setMinimumNodes(2);
storage.createLandmarks();
assertEquals(2, storage.getSubnetworksWithLandmarks());
assertEquals("[4, 0]", Arrays.toString(storage.getLandmarks(1)));
}
use of com.graphhopper.routing.weighting.FastestWeighting in project graphhopper by graphhopper.
the class LandmarkStorageTest method testWeightingConsistence.
@Test
public void testWeightingConsistence() {
// create an indifferent problem: shortest weighting can pass the speed==0 edge but fastest cannot (?)
ghStorage.edge(0, 1, 10, true);
ghStorage.edge(1, 2).setDistance(10).setFlags(encoder.setProperties(0.9, true, true));
ghStorage.edge(2, 3, 10, true);
LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2);
storage.setMinimumNodes(2);
storage.createLandmarks();
assertEquals(2, storage.getSubnetworksWithLandmarks());
assertEquals("[1, 0]", Arrays.toString(storage.getLandmarks(1)));
}
use of com.graphhopper.routing.weighting.FastestWeighting in project graphhopper by graphhopper.
the class LandmarkStorageTest method testWithSubnetworks2.
@Test
public void testWithSubnetworks2() {
// should not happen with subnetwork preparation
// 0 - 1 - 2 = 3 - 4
ghStorage.edge(0, 1, 10, true);
ghStorage.edge(1, 2, 10, true);
ghStorage.edge(2, 3, 10, false);
ghStorage.edge(3, 2, 10, false);
ghStorage.edge(3, 4, 10, true);
LandmarkStorage storage = new LandmarkStorage(ghStorage, new RAMDirectory(), new FastestWeighting(encoder), 2);
storage.setMinimumNodes(3);
storage.createLandmarks();
assertEquals(2, storage.getSubnetworksWithLandmarks());
assertEquals("[4, 0]", Arrays.toString(storage.getLandmarks(1)));
}
Aggregations