New experimental routing

This commit is contained in:
Victor Shcherb 2014-07-18 17:50:38 +02:00
parent aa68c75528
commit 2eca9ec77f
3 changed files with 23 additions and 6 deletions

View file

@ -136,11 +136,11 @@ public class BinaryRoutePlanner {
}
if (ctx.planRouteIn2Directions()) {
forwardSearch = (nonHeuristicSegmentsComparator.compare(graphDirectSegments.peek(), graphReverseSegments.peek()) < 0);
if (graphDirectSegments.size() * 2 > graphReverseSegments.size()) {
forwardSearch = false;
} else if (graphDirectSegments.size() < 2 * graphReverseSegments.size()) {
forwardSearch = true;
}
// if (graphDirectSegments.size() * 2 > graphReverseSegments.size()) {
// forwardSearch = false;
// } else if (graphDirectSegments.size() < 2 * graphReverseSegments.size()) {
// forwardSearch = true;
// }
} else {
// different strategy : use onedirectional graph
forwardSearch = onlyForward;

View file

@ -57,7 +57,8 @@ public class GeneralRouter implements VehicleRouter {
ACCESS("access"),
OBSTACLES("obstacle_time"),
ROUTING_OBSTACLES("obstacle"),
ONEWAY("oneway");
ONEWAY("oneway"),
PENALTY_TRANSITION("penalty_transition");
public final String nm;
RouteDataObjectAttribute(String name) {
nm = name;
@ -273,6 +274,11 @@ public class GeneralRouter implements VehicleRouter {
return getObjContext(RouteDataObjectAttribute.ONEWAY).evaluateInt(road, 0);
}
@Override
public float getPenaltyTransition(RouteDataObject road) {
return getObjContext(RouteDataObjectAttribute.PENALTY_TRANSITION).evaluateInt(road, 0);
}
@Override
public float defineRoutingSpeed(RouteDataObject road) {
return Math.min(defineVehicleSpeed(road), maxDefaultSpeed);
@ -323,6 +329,12 @@ public class GeneralRouter implements VehicleRouter {
}
}
float ts = getPenaltyTransition(segment.getRoad());
float prevTs = getPenaltyTransition(prev.getRoad());
if(prevTs != ts) {
if(ts > prevTs) return (ts - prevTs);
}
if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) {
double rt = getRoundaboutTurn();
if(rt > 0) {

View file

@ -22,6 +22,11 @@ public interface VehicleRouter {
*/
public int isOneWay(RouteDataObject road);
/**
* return penalty transition in seconds
*/
public float getPenaltyTransition(RouteDataObject road);
/**
* return delay in seconds (0 no obstacles)
*/