<div dir="ltr"><div><div>Thanks a lot Daniel,<br><br></div>That gives me fuel for some exploration. I will play with the code to see if I get anywhere.<br><br></div>Guillaume<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 October 2015 at 18:02, Daniel Patterson <span dir="ltr"><<a href="mailto:daniel@mapbox.com" target="_blank">daniel@mapbox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Guillaume,</div><div><br></div><div>  Yes, that's basically correct, you've understood the rough structure.  We typically call the first graph, that looks like OSM, the "node-based-graph".  The graph that models all turns is referred to as the "edge-based-graph".  Somewhat confusing terminology, I know.</div><div><br></div><div>  The edge-based-graph edge weights are measured in deci-seconds.  Everything is routed based on travel time.</div><div><br></div><div>  The "speed * length" calculation happens slightly earlier in the process:</div><div><br></div><div>    <a href="https://github.com/Project-OSRM/osrm-backend/blob/develop/extractor/extraction_containers.cpp#L323-L337" target="_blank">https://github.com/Project-OSRM/osrm-backend/blob/develop/extractor/extraction_containers.cpp#L323-L337</a></div><div><br></div><div>  Unfortunately, the terminology used "distance/weight" is not consistent across the codebase, so it can be difficult to navigate.  Suffice to say, the traffic penalty is adding "deci-seconds" to the edge-based-edge-weight.</div><div><br></div><div>  To do per-node penalties, you would need to add a lookup table for each node, populate it, probably in the "node_function" in the Lua profile, then consult the lookup in the same place the traffic light penalty is currently added.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>daniel</div></font></span><div><div class="h5"><div><br></div><br><div><blockquote type="cite"><div>On Oct 21, 2015, at 2:26 PM, Guillaume Barreau <<a href="mailto:g.barreau@gmail.com" target="_blank">g.barreau@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div><div>Thanks Daniel and Patrick for your help,<br><br></div><div>I will have to pick your brains a little bit more I am afraid.<br></div><div><br></div>Having read this page: <a href="https://github.com/Project-OSRM/osrm-backend/wiki/Graph-representation" target="_blank">https://github.com/Project-OSRM/osrm-backend/wiki/Graph-representation</a> <br><br>I now understand that what OSRM models as a node is actually what I initially thought of as an edge (i.e. a piece of road connecting 2 intersections) and what OSRM calls an edge is a transition from one road segment (travelled in a particular direction) to another, so the edge ends up being a way of crossing a road intersection. This is kind of confusing at first, but I can see the benefits of doing that way in terms of handling intersections well. Please correct me if I haven't understood properly.<br><br></div><div>So in my case, the penalty would be associated with edges and not nodes. And all edges associated with the same physical interesection would get the same penalty (although this way of modelling has the advantage of allowing each turn to have a different penalty easily).<br><br></div><div>The code you pointed me to is called at the graph preparation phase, right? That is fine for my purposes, I am just clarifying.<br><br></div>This distance variable that is incremented it ends up representing the total penalties associated with crossing that particular intersection in a particular way and I assume it gets stored as the attribute of the corresponding edge in the graph. I was curious of when and how this distance (a penalty expressed in meters) then gets converted back into a time. <br><div><div><br></div><div>Thanks a lot for your time again,<br><br></div><div>Guillaume<br></div><br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 October 2015 at 15:56, Daniel Patterson <span dir="ltr"><<a href="mailto:daniel@mapbox.com" target="_blank">daniel@mapbox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Patrick, yes, that was what I meant to point at :-)<br>
<div><div><br>
> On Oct 21, 2015, at 12:44 PM, Patrick Niklaus <<a href="mailto:patrick.niklaus@student.kit.edu" target="_blank">patrick.niklaus@student.kit.edu</a>> wrote:<br>
><br>
> Hey Guillaume,<br>
><br>
> I think Daniel wanted to post a link to this line:<br>
><br>
> <a href="https://github.com/Project-OSRM/osrm-backend/blob/develop/extractor/edge_based_graph_factory.cpp#L417" rel="noreferrer" target="_blank">https://github.com/Project-OSRM/osrm-backend/blob/develop/extractor/edge_based_graph_factory.cpp#L417</a><br>
><br>
> All you need to do is to adapt the code to not only add penalties for<br>
> traffic signals but also your node.<br>
> Actually this code should be made more general as outlined in<br>
> <a href="https://github.com/Project-OSRM/osrm-backend/issues/1490" rel="noreferrer" target="_blank">https://github.com/Project-OSRM/osrm-backend/issues/1490</a><br>
><br>
> Best,<br>
> Patrick<br>
><br>
><br>
> On Wed, Oct 21, 2015 at 9:02 PM, Guillaume Barreau <<a href="mailto:g.barreau@gmail.com" target="_blank">g.barreau@gmail.com</a>> wrote:<br>
>> Hi Daniel,<br>
>><br>
>> Thanks a lot for this very fast reply. The url you sent appears to be<br>
>> broken. Could you please double-check it for me?<br>
>><br>
>> Thanks again,<br>
>><br>
>> Guillaume<br>
>><br>
>> On 21 October 2015 at 14:56, Daniel Patterson <<a href="mailto:daniel@mapbox.com" target="_blank">daniel@mapbox.com</a>> wrote:<br>
>>><br>
>>> Hi Guillaume,<br>
>>><br>
>>>  There is a function called for every node:<br>
>>><br>
>>><br>
>>> <a href="https://github.com/mapbox/inrix-processing/blob/master/regions.json#L198-L201" rel="noreferrer" target="_blank">https://github.com/mapbox/inrix-processing/blob/master/regions.json#L198-L201</a><br>
>>><br>
>>>  however, it doesn't feed back any specific per-node penalties.  It's<br>
>>> used to flag barriers and traffic lights right now.<br>
>>><br>
>>>  It could be adapted to do per-node penalty values, you would probably<br>
>>> need to modify the existing light penalty functionality and add a lookup for<br>
>>> your values, rather than using the global light penalty we have currently.<br>
>>><br>
>>> daniel<br>
>>><br>
>>> On Oct 21, 2015, at 11:46 AM, Guillaume Barreau <<a href="mailto:g.barreau@gmail.com" target="_blank">g.barreau@gmail.com</a>><br>
>>> wrote:<br>
>>><br>
>>> Hello,<br>
>>><br>
>>> I would like to OSRM for a research project but I have this unusual<br>
>>> requirement. I would want to be able to add time penalties at some sets of<br>
>>> vertices (defined by their id) that would be used to compute the fastest<br>
>>> routes in a table calculation. My input would therefore be a list of<br>
>>> (node_id,delays) to be added to the underlying graph. Is this feasible? I am<br>
>>> prepared to modify the code if needs be, I don't expect to be able to do<br>
>>> this with a config file. If it is feasible, could someone point me in the<br>
>>> right direction?<br>
>>><br>
>>> Thank you very much for your help,<br>
>>><br>
>>> Guillaume<br>
>>> _______________________________________________<br>
>>> OSRM-talk mailing list<br>
>>> <a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
>>> <a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> OSRM-talk mailing list<br>
>>> <a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
>>> <a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
>>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> OSRM-talk mailing list<br>
>> <a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
>> <a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
>><br>
><br>
> _______________________________________________<br>
> OSRM-talk mailing list<br>
> <a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
> <a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
<br>
<br>
_______________________________________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
</div></div></blockquote></div><br></div>
_______________________________________________<br>OSRM-talk mailing list<br><a href="mailto:OSRM-talk@openstreetmap.org" target="_blank">OSRM-talk@openstreetmap.org</a><br><a href="https://lists.openstreetmap.org/listinfo/osrm-talk" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
OSRM-talk mailing list<br>
<a href="mailto:OSRM-talk@openstreetmap.org">OSRM-talk@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/osrm-talk" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
<br></blockquote></div><br></div>