49
49
import java .util .concurrent .atomic .AtomicLong ;
50
50
51
51
import static com .graphhopper .util .Helper .*;
52
+ import static com .graphhopper .util .Parameters .Algorithms .ALT_ROUTE ;
52
53
import static com .graphhopper .util .Parameters .Algorithms .DIJKSTRA_BI ;
53
54
54
55
/**
@@ -169,7 +170,7 @@ protected DataReader importData() throws IOException {
169
170
printLocationIndexQuery (g , hopper .getLocationIndex (), count );
170
171
if (runSlow ) {
171
172
printTimeOfRouteQuery (hopper , isCH , isLM , count / 20 , "routing" , vehicleStr ,
172
- true , false , -1 , true , false , false );
173
+ true , false , -1 , true , false , false , false );
173
174
}
174
175
175
176
if (hopper .getLMFactoryDecorator ().isEnabled ()) {
@@ -178,7 +179,7 @@ protected DataReader importData() throws IOException {
178
179
int activeLMCount = 12 ;
179
180
for (; activeLMCount > 3 ; activeLMCount -= 4 ) {
180
181
printTimeOfRouteQuery (hopper , isCH , isLM , count / 4 , "routingLM" + activeLMCount , vehicleStr ,
181
- true , false , activeLMCount , true , false , false );
182
+ true , false , activeLMCount , true , false , false , false );
182
183
}
183
184
184
185
// compareRouting(hopper, vehicleStr, count / 5);
@@ -193,7 +194,7 @@ protected DataReader importData() throws IOException {
193
194
// try just one constellation, often ~4-6 is best
194
195
int lmCount = 5 ;
195
196
printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCHLM" + lmCount , vehicleStr ,
196
- true , false , lmCount , true , false , false );
197
+ true , false , lmCount , true , false , false , false );
197
198
}
198
199
199
200
isLM = false ;
@@ -203,24 +204,26 @@ protected DataReader importData() throws IOException {
203
204
CHGraph lg = g .getCHGraph (chProfile );
204
205
fillAllowedEdges (lg .getAllEdges (), allowedEdges );
205
206
printMiscUnitPerfTests (lg , isCH , encoder , count * 100 , allowedEdges );
206
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH" , vehicleStr ,
207
- true , false , -1 , true , false , false );
208
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_with_hints" , vehicleStr ,
209
- true , true , -1 , true , false , false );
210
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_no_sod" , vehicleStr ,
211
- true , false , -1 , false , false , false );
212
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_no_instr" , vehicleStr ,
213
- false , false , -1 , true , false , false );
214
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_full" , vehicleStr ,
215
- true , true , -1 , true , false , true );
207
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH" , vehicleStr , true ,
208
+ false , -1 , true , false , false , false );
209
+ printTimeOfRouteQuery (hopper , isCH , isLM , count / 10 , "routingCH_alt" , vehicleStr , true ,
210
+ false , -1 , true , false , false , true );
211
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_with_hints" , vehicleStr , true ,
212
+ true , -1 , true , false , false , false );
213
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_no_sod" , vehicleStr , true ,
214
+ false , -1 , false , false , false , false );
215
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_no_instr" , vehicleStr , false ,
216
+ false , -1 , true , false , false , false );
217
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_full" , vehicleStr , true ,
218
+ true , -1 , true , false , true , false );
216
219
}
217
220
if (!hopper .getCHFactoryDecorator ().getEdgeBasedCHProfiles ().isEmpty ()) {
218
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_edge" , vehicleStr ,
219
- true , false , -1 , false , true , false );
220
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_edge_no_instr" , vehicleStr ,
221
- false , false , -1 , false , true , false );
222
- printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_edge_full" , vehicleStr ,
223
- true , true , -1 , false , true , true );
221
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_edge" , vehicleStr , true ,
222
+ false , -1 , false , true , false , false );
223
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_edge_no_instr" , vehicleStr , false ,
224
+ false , -1 , false , true , false , false );
225
+ printTimeOfRouteQuery (hopper , isCH , isLM , count , "routingCH_edge_full" , vehicleStr , true ,
226
+ true , -1 , false , true , true , false );
224
227
}
225
228
}
226
229
} catch (Exception ex ) {
@@ -453,12 +456,13 @@ private void printTimeOfRouteQuery(final GraphHopper hopper, final boolean ch, f
453
456
int count , String prefix , final String vehicle ,
454
457
final boolean withInstructions , final boolean withPointHints ,
455
458
final int activeLandmarks , final boolean sod , final boolean edgeBased ,
456
- final boolean simplify ) {
459
+ final boolean simplify , final boolean alternative ) {
457
460
final Graph g = hopper .getGraphHopperStorage ();
458
461
final AtomicLong maxDistance = new AtomicLong (0 );
459
462
final AtomicLong minDistance = new AtomicLong (Long .MAX_VALUE );
460
463
final AtomicLong distSum = new AtomicLong (0 );
461
464
final AtomicLong airDistSum = new AtomicLong (0 );
465
+ final AtomicLong altCount = new AtomicLong (0 );
462
466
final AtomicInteger failedCount = new AtomicInteger (0 );
463
467
final DistanceCalc distCalc = new DistanceCalcEarth ();
464
468
@@ -492,6 +496,9 @@ public int doCalc(boolean warmup, int run) {
492
496
put (Landmark .ACTIVE_COUNT , activeLandmarks ).
493
497
put ("instructions" , withInstructions );
494
498
499
+ if (alternative )
500
+ req .setAlgorithm (ALT_ROUTE );
501
+
495
502
if (withInstructions )
496
503
req .setPathDetails (Arrays .asList (Parameters .Details .AVERAGE_SPEED ));
497
504
@@ -555,10 +562,8 @@ else if (!toLowerCase(rsp.getErrors().get(0).getMessage()).contains("not found")
555
562
if (dist < minDistance .get ())
556
563
minDistance .set (dist );
557
564
558
- // extractTimeSum.addAndGet(p.getExtractTime());
559
- // long start = System.nanoTime();
560
- // size = p.calcPoints().getSize();
561
- // calcPointsTimeSum.addAndGet(System.nanoTime() - start);
565
+ if (alternative )
566
+ altCount .addAndGet (rsp .getAll ().size ());
562
567
}
563
568
564
569
return arsp .getPoints ().getSize ();
@@ -580,17 +585,13 @@ else if (!toLowerCase(rsp.getErrors().get(0).getMessage()).contains("not found")
580
585
put (prefix + ".distance_max" , maxDistance .get ());
581
586
put (prefix + ".visited_nodes_mean" , (float ) visitedNodesSum .get () / count );
582
587
put (prefix + ".visited_nodes_max" , (float ) maxVisitedNodes .get ());
583
-
584
- // put(prefix + ".extractTime", (float) extractTimeSum.get() / count / 1000000f);
585
- // put(prefix + ".calcPointsTime", (float) calcPointsTimeSum.get() / count / 1000000f);
586
- // put(prefix + ".calcDistTime", (float) calcDistTimeSum.get() / count / 1000000f);
588
+ put (prefix + ".alternative_rate" , (float ) altCount .get () / count );
587
589
print (prefix , miniPerf );
588
590
}
589
591
590
592
void print (String prefix , MiniPerfTest perf ) {
591
593
logger .info (prefix + ": " + perf .getReport ());
592
594
put (prefix + ".sum" , perf .getSum ());
593
- // put(prefix+".rms", perf.getRMS());
594
595
put (prefix + ".min" , perf .getMin ());
595
596
put (prefix + ".mean" , perf .getMean ());
596
597
put (prefix + ".max" , perf .getMax ());
0 commit comments