compute turn penalties in lua profiles

This commit is contained in:
Emil Tin
2013-02-23 08:33:33 +01:00
committed by DennisOSRM
parent 53af4ee39f
commit f9abfbf68a
7 changed files with 95 additions and 15 deletions
+12
View File
@@ -73,6 +73,8 @@ ignore_areas = true -- future feature
traffic_signal_penalty = 5
u_turn_penalty = 20
use_turn_restrictions = false
turn_penalty = 60
turn_bias = 1.4
-- End of globals
function get_exceptions(vector)
@@ -308,3 +310,13 @@ function way_function (way)
way.type = 1
return 1
end
function turn_function (angle)
-- compute turn penalty as angle^2, with a left/right bias
k = turn_penalty/(90.0*90.0)
if angle>=0 then
return angle*angle*k/turn_bias
else
return angle*angle*k*turn_bias
end
end
+8
View File
@@ -0,0 +1,8 @@
-- Testbot, with turn penalty
-- Used for testing turn penalties
require 'testbot'
function turn_function (angle)
return 200*math.abs(angle)/180 -- penalty
end