inverse mode, fixed false-positive bug

This commit is contained in:
Arndt Brenschede 2018-08-21 20:17:28 +02:00
parent 10931da3a7
commit aecb3f3707
5 changed files with 67 additions and 3 deletions

View file

@ -481,7 +481,7 @@ System.out.println( "bad TR candidate: " + id );
double targetCost = processTargetNode( rc ); double targetCost = processTargetNode( rc );
if ( targetCost < 0. || targetCost + cost >= 2000000000. ) if ( targetCost < 0. || targetCost + cost >= 2000000000. )
{ {
if ( rc.suspectNodes != null && priorityclassifier > 20 && !rc.inverseDirection ) if ( rc.suspectNodes != null && priorityclassifier > 20 && rc.inverseDirection == rc.inverseRouting )
{ {
rc.foundNodeBlock = true; rc.foundNodeBlock = true;
Long id = Long.valueOf( targetNode.getIdFromPos() ); Long id = Long.valueOf( targetNode.getIdFromPos() );

View file

@ -169,7 +169,7 @@ public final class RoutingContext
trafficSourceMinDist = expctxGlobal.getVariableValue( "trafficSourceMinDist", 3000.f ); trafficSourceMinDist = expctxGlobal.getVariableValue( "trafficSourceMinDist", 3000.f );
showspeed = 0.f != expctxGlobal.getVariableValue( "showspeed", 0.f ); showspeed = 0.f != expctxGlobal.getVariableValue( "showspeed", 0.f );
inverseRouting = 0.f != expctxGlobal.getVariableValue( "inverseRouting", 0.f ); inverseRouting = 0.f != expctxGlobal.getVariableValue( "inverseRouting", inverseRouting ? 1.f : 0.f );
int tiMode = (int)expctxGlobal.getVariableValue( "turnInstructionMode", 0.f ); int tiMode = (int)expctxGlobal.getVariableValue( "turnInstructionMode", 0.f );
if ( tiMode != 1 ) // automatic selection from coordinate source if ( tiMode != 1 ) // automatic selection from coordinate source

View file

@ -1017,6 +1017,7 @@ public class RoutingEngine extends Thread
if ( ! nodesCache.obtainNonHollowNode( nextNode ) ) if ( ! nodesCache.obtainNonHollowNode( nextNode ) )
{ {
nPathPossible++;
continue; // border node? continue; // border node?
} }
if ( nextNode == sourceNode ) if ( nextNode == sourceNode )
@ -1034,6 +1035,7 @@ public class RoutingEngine extends Thread
int gidx = path.treedepth + 1; int gidx = path.treedepth + 1;
if ( gidx >= guideTrack.nodes.size() ) if ( gidx >= guideTrack.nodes.size() )
{ {
nPathPossible++;
continue; continue;
} }
OsmPathElement guideNode = guideTrack.nodes.get( routingContext.inverseRouting ? guideTrack.nodes.size() - 1 - gidx : gidx ); OsmPathElement guideNode = guideTrack.nodes.get( routingContext.inverseRouting ? guideTrack.nodes.size() - 1 - gidx : gidx );
@ -1130,7 +1132,7 @@ public class RoutingEngine extends Thread
} }
// report oneway dead-ends as suspects // report oneway dead-ends as suspects
if ( routingContext.suspectNodes != null && path.priorityclassifier > 20 && currentNode.virgin && path.cost > 2000 && !routingContext.inverseDirection ) if ( routingContext.suspectNodes != null && path.priorityclassifier > 20 && currentNode.virgin && path.cost > 2000 && routingContext.inverseDirection == routingContext.inverseRouting && guideTrack == null )
{ {
int suspectPrio = 0; int suspectPrio = 0;
if ( nPathPossible == 0 && (!routingContext.foundNodeBlock) ) if ( nPathPossible == 0 && (!routingContext.foundNodeBlock) )

View file

@ -71,6 +71,7 @@ public class BadTRDetector
else else
{ {
rc.suspectNodes = suspectTRs; rc.suspectNodes = suspectTRs;
rc.inverseRouting = rand.nextBoolean();
} }
RoutingEngine re = new RoutingEngine( "mytrack", "mylog", args[0], wplist, rc ); RoutingEngine re = new RoutingEngine( "mytrack", "mylog", args[0], wplist, rc );

View file

@ -0,0 +1,61 @@
package btools.server;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class IssueArchiver
{
public static void main(String[] args) throws Exception
{
if ( args.length < 2 )
{
System.out.println( "usage : IssueArchiver <suspect-dir> <suspect-archive>" );
System.exit(1);
}
File suspectDir = new File( args[0] );
if ( !suspectDir.isDirectory() )
{
throw new IllegalArgumentException( "not a directory: " + suspectDir );
}
File suspectArchive = new File( args[1] );
if ( !suspectArchive.isDirectory() )
{
throw new IllegalArgumentException( "not a directory: " + suspectArchive );
}
File[] files = suspectDir.listFiles();
for ( File f : files )
{
String name = f.getName();
if ( name.startsWith( "suspects_" ) && name.endsWith( ".txt" ) )
{
BufferedReader br = new BufferedReader( new FileReader( f ) );
for(;;)
{
String line = br.readLine();
if ( line == null ) break;
StringTokenizer tk = new StringTokenizer( line );
long id = Long.parseLong( tk.nextToken() );
int prio = Integer.parseInt( tk.nextToken() );
File archiveEntry = new File( suspectArchive, "" + id );
if ( !archiveEntry.exists() )
{
archiveEntry.createNewFile();
}
}
br.close();
}
}
}
}