Skip to content

Commit

Permalink
bug testing for GH
Browse files Browse the repository at this point in the history
  • Loading branch information
PGWelch committed Jul 6, 2016
1 parent a1efac2 commit 5531902
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ private static GraphHopper createHopper(boolean memoryMapped) {
return ret;
}

public CHMatrixGeneration(String graphFolder) {
this(graphFolder, false);
public CHMatrixGeneration(String graphFolder, String vehicleType) {
this(graphFolder, false,vehicleType);
}

public CHMatrixGeneration(String graphFolder, boolean memoryMapped) {
public CHMatrixGeneration(String graphFolder, boolean memoryMapped, String vehicleType) {
this.graphFolder = graphFolder;
this.hopper = createHopper(memoryMapped);
hopper.setGraphHopperLocation(this.graphFolder);
hopper.setEncodingManager(new EncodingManager(EncodingManager.CAR));
flagEncoder = hopper.getEncodingManager().getEncoder(EncodingManager.CAR);
// hopper.setEncodingManager(new EncodingManager(vehicleType));
hopper.importOrLoad();
flagEncoder = hopper.getEncodingManager().getEncoder(vehicleType);
encodingManager = hopper.getEncodingManager();

String vehicle = flagEncoder.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
import java.time.LocalDateTime;
import java.util.Arrays;

import com.graphhopper.routing.util.EncodingManager;
import com.graphhopper.util.shapes.GHPoint;
import com.opendoorlogistics.graphhopper.geocodes4profiling.USAGeocodes;
import com.opendoorlogistics.graphhopper.geocodes4profiling.UKGeocodes;

public class ProfileMatrixPerformance {
public static void main(String []args){
// String graphFolder = "C:\\temp\\TestGH0.5\\great-britain-latest.osm-gh";
String graphFolder = "C:\\temp\\TestGH0.5\\north-america-latest.osm-gh";
String graphFolder = "C:\\Data\\Graphhopper0.5\\great-britain-latest.osm-gh";
// String graphFolder = "C:\\temp\\TestGH0.5\\north-america-latest.osm-gh";
int n = 250;

//GHPoint [] pnts = UKGeocodes.createUKGeocodes();
GHPoint [] pnts = USAGeocodes.createUSAGeocodes();
GHPoint [] pnts = UKGeocodes.createUKGeocodes();
// GHPoint [] pnts = USAGeocodes.createUSAGeocodes();

pnts = Arrays.copyOf(pnts, Math.min(n, pnts.length));

// just take the problem points
pnts = new GHPoint[]{pnts[1],pnts[168]};
// pnts = new GHPoint[]{pnts[1],pnts[168]};


System.out.println(LocalDateTime.now() + " - loading matrix from:" + graphFolder);
CHMatrixGeneration ch = new CHMatrixGeneration(graphFolder, false);
CHMatrixGeneration ch = new CHMatrixGeneration(graphFolder, false, "bike");
System.out.println(LocalDateTime.now() + " - starting matrix profiling for " + pnts.length + " points");
MatrixResult result1 = ch.calculateMatrix(pnts,null);
System.out.println(result1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#################
### OSMReader ###

# No more than 3 encoders are allowed at once without changing another Graphhopper storage option...
graph.flagEncoders=car,foot,bike


# graph.dataaccess=MMAP_STORE_SYNC
graph.dataaccess=RAM_STORE

# use contraction hierarchies to speed things up. requires more RAM/disc space for holding the graph
# uncomment this if you need more control of you algorithm. then use graphhopper.chShortcuts(false, false)
prepare.chShortcuts=fastest

# advanced options:
# prepare.updates.periodic=3
# prepare.updates.lazy=10
# prepare.updates.neighbor=20
prepare.minOnewayNetworkSize=200

# increase from 1 to 5, to reduce way geometry e.g. for android
osmreader.wayPointMaxDistance=1

# possible options: car,foot,bike,mtb,racingbike (comma separated)
# when using two or three option together remeber to set "prepare.chShortcuts=no" above.
# There is also a new option bike2 which takes elevation data into account (like up-hill is slower than down-hill)
# and requires enabling graph.elevation.provider below, see #169
osmreader.acceptWay=car

# if you want to reduce storage size and you don't need instructions for a path uncomment this
osmreader.instructions=false

# To populate your graph with elevation data use SRTM, default is noop
# graph.elevation.provider=srtm
# default location for cache is used /tmp/srtm
# graph.elevation.cachedir=./srtmprovider/
# If you have a slow disk or plenty of RAM change the default MMAP to
# graph.elevation.dataaccess=RAM_STORE

# Location index lookup. Advanced customization. Resolution is in meter, the search specifies the 'radius' in number of tiles.
# E.g. decrease resolution for a faster lookup and increase region search for a more dynamic search and less 'location not found' results
# index.highResolution=300
# index.maxRegionSearch=4

# if you want to support jsonp response type you need to add it explicitely here:
#web.jsonpAllowed=true
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.junit.Before;
import org.junit.Test;

import com.graphhopper.routing.util.EncodingManager;
import com.graphhopper.util.shapes.GHPoint;
import com.opendoorlogistics.graphhopper.CHMatrixGeneration;
import com.opendoorlogistics.graphhopper.MatrixResult;
Expand All @@ -26,7 +27,7 @@ public class TestMatrixCalculation {
public void setUp() throws Exception {

String graphFolder = "C:\\temp\\TestGH0.5\\great-britain-latest.osm-gh";
dijsktra = new CHMatrixGeneration(graphFolder);
dijsktra = new CHMatrixGeneration(graphFolder, EncodingManager.CAR);

int n = 25;
GHPoint[] pnts = UKGeocodes.createUKGeocodes();
Expand Down

0 comments on commit 5531902

Please sign in to comment.