use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMoscowTurnCosts.
@Test
public void testMoscowTurnCosts() {
List<Query> queries = new ArrayList<>();
queries.add(new Query(55.813357, 37.5958585, 55.811042, 37.594689, 1043.99, 12));
queries.add(new Query(55.813159, 37.593884, 55.811278, 37.594217, 1048, 13));
GraphHopper hopper = createHopper(MOSCOW, new Profile("car").setVehicle("car").setWeighting("fastest").setTurnCosts(true));
hopper.setMinNetworkSize(200);
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoParallel.
@Test
public void testMonacoParallel() throws InterruptedException {
GraphHopper hopper = createHopper(MONACO, new Profile("car").setVehicle("car").setWeighting("shortest"));
hopper.getReaderConfig().setMaxWayPointDistance(0);
hopper.getRouterConfig().setSimplifyResponse(false);
hopper.importOrLoad();
final List<Query> queries = createMonacoCarQueries();
List<Thread> threads = new ArrayList<>();
final AtomicInteger routeCount = new AtomicInteger(0);
// testing if algorithms are independent. should be. so test only two algorithms.
List<Function<Query, GHRequest>> requestFactories = Arrays.asList(q -> createRequest(q).setAlgorithm(DIJKSTRA_BI).setProfile("car"), q -> createRequest(q).setAlgorithm(ASTAR_BI).setProfile("car"));
int loops = 100;
for (int i = 0; i < loops; i++) {
for (Query query : queries) {
for (Function<Query, GHRequest> requestFactory : requestFactories) {
GHRequest req = requestFactory.apply(query);
Thread t = new Thread(() -> {
GHResponse res = hopper.route(req);
checkResponse(res, query);
routeCount.incrementAndGet();
});
t.start();
threads.add(t);
}
}
}
for (Thread t : threads) t.join();
assertEquals(loops * queries.size() * requestFactories.size(), routeCount.get());
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testOneWayCircleBug.
@Test
public void testOneWayCircleBug() {
// export from http://www.openstreetmap.org/export#map=19/51.37605/-0.53155
List<Query> queries = new ArrayList<>();
// going the bit longer way out of the circle
queries.add(new Query(51.376197, -0.531576, 51.376509, -0.530863, 153, 18));
// now exacle the opposite direction: going into the circle (shorter)
queries.add(new Query(51.376509, -0.530863, 51.376197, -0.531576, 75, 15));
GraphHopper hopper = createHopper(DIR + "/circle-bug.osm.gz", new Profile("car").setVehicle("car").setWeighting("shortest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testAndorra.
@Test
public void testAndorra() {
Profile profile = new Profile("car").setVehicle("car").setWeighting("shortest");
GraphHopper hopper = createHopper(ANDORRA, profile);
hopper.importOrLoad();
checkQueries(hopper, createAndorraQueries());
}
use of com.graphhopper.config.Profile in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testMonacoRacingBike.
@Test
public void testMonacoRacingBike() {
List<Query> queries = new ArrayList<>();
queries.add(new Query(43.730864, 7.420771, 43.727687, 7.418737, 2594, 111));
queries.add(new Query(43.727687, 7.418737, 43.74958, 7.436566, 3614, 184));
queries.add(new Query(43.728677, 7.41016, 43.739213, 7.427806, 2572, 135));
queries.add(new Query(43.733802, 7.413433, 43.739662, 7.424355, 1490, 84));
GraphHopper hopper = createHopper(MONACO, new Profile("racingbike").setVehicle("racingbike").setWeighting("fastest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
Helper.removeDir(new File(GH_LOCATION));
hopper = createHopper(MONACO, new Profile("racingbike").setVehicle("racingbike").setWeighting("fastest"), new Profile("bike").setVehicle("bike").setWeighting("fastest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
Aggregations