<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi Francis,<br><br></div>Thanks for considering my multicriteria problem on OSRM. I'm goign to introduce myself too : I'm a final year student in Computer Engineering and I'm about to finish my 5-year course at Polytech'Tours, in France. In our final year, we must complete a project among several fields of computer engineering. My project is to improve an already existing bicycle routing platform, GeoVelo, which turns out to use OSRM.<br><br></div>The main goal of my project is to make the application multiriteria, by adding one criteria and one bicriteria algorithm to OSRM. In addition to the time criterion already present, we've decided to add a cyclability criterion, which indicates the ability of a way to be accessed by bicycles. The criterion is an index number from 1 to 5, 1 being hard cyclability and 5 being great, and an optimal solution would have the minimal sum of cyclabilites of its segments.<br><br></div>As I said, we have succeeded to add this new criterion on the edges structures of OSRM and add the sum of cyclabilities in the JSON response. The next steps is to add an algorithm which would return the non-dominated solutions regarding these 2 criteria. We really want to return all the non-dominated solutions of a problem and not one solution that minimizes a weighted sum, as Mohammed suggested, as it would be another kind of monocriterion problem. In the example you considered we'd like to return all 4 solutions.<br><br></div>The algorithm we'll use was implemented in C++ in a previous final year project. It is an improved version of Label Setting algorithm, called LSAP, with an approximation of the Pareto front before the actual routing process. We approximate the Pareto front by setting lower and upper bounds on each node to help eliminate dominated solutions (this is done by  Bi-Dijkstra on each criterion). A second way to approximate the Pareto front is to create a graph of landmarks, which are the most used nodes of the original graph, that will increase the speed of labels calculations in routing.<br><br></div>I have 2 big steps to finish in my project, in the remaining month until the end of the year :<br></div>1) Keep the CH on the time criterion only in OSRM and insert the algorithm above in the routing part instead of the shortest_path function.<br></div>2) Take the monocriterion OSRM and make it routing on the cyclability criterion instead of time<br><br></div>To run tests, I've implemented a JS script which takes multiple random coordinates in a bounded OSM data map, pass the respective HTTP requests to the server and get the returned response data into files.<br><br></div>Here is a summary of how we dealt with the issues you pointed out :<br></div>- Lua scripts : we've added a cyclability calculation function in the already existing Lua script bicycle.lua, which check the OSM tags of ways and return a cyclability number.<br></div>- For each edge structure, we've added a cyclability member which is of unsigned char value.<br></div>- We kept the CH preprocessing of the graph with only time criterion, in order to speed up the routing and reduce the number of solutions. We just have to add the corresponding cyclability criterion to the created shortcuts in order to take them into account in the search process with the LSAP algorithm.<br></div>- Actually OSRM returns at most 2 solutions, the shortest path and a potential alternative; with the bicriteria algorithm we will write the set of non-dominated solutions to a formated result file.<br></div>- For now, we didn't implement the frontend part so the set of solutions will not be printed on a map.<br><br></div>I'm still struggling with the code to complete some tasks :<br></div>- insert the sum of cyclabilities in the shortcut edges; which classes are concerned with this?<br></div>- adjust the input of my algorithm to the input of OSRM search : my algorithm takes 2 files in inputs (one for the directed edges with source, target and the 2 criteria, oredered by source then target, and one for the nodes with ID and coordinates) <br></div>- ignore restrictions completely  because my algorithm doesn't take them into account<br><br></div>Sorry for the long mail. I'm quite in a urge to finish my project so I'd be really thankful for any help here.<br><br></div>Best regards.<br></div>Romain NKONGO.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-09 20:16 GMT+02:00 Mohammed Ayoub NEGGAZ <span dir="ltr"><<a href="mailto:am_neggaz@esi.dz" target="_blank">am_neggaz@esi.dz</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Francis,<div><br></div><div>I'm working on the dynamic case of the problem but I think I might help you.</div><div><br></div><div>What if you create a formula for your critera for example, for the costs that you gave you can define :</div><div><br></div><div>weight = (Travel Time * TT_Weight) + (Cost * C_Weight) where TT_ and C_Weight are factors and weight will allways give a scalar.</div><div><br></div><div>If we are interrested in travel time we define TT_Weight = 2 < C_Weight = 4 and then</div><div><br></div><div><span style="color:rgb(0,0,0);font-size:13px">A= (60 min, 30€) = 60*2 + 30*4 = 240</span><br style="color:rgb(0,0,0);font-size:13px"><div style="color:rgb(0,0,0);font-size:13px">B= (65 min, 25€) = 65*2 + 25*4 = 230<br></div><div style="color:rgb(0,0,0);font-size:13px">C= (85 min, 20€) = 85*2 + 20*4 = 250<br></div><div style="color:rgb(0,0,0);font-size:13px">D= (90 min, 15€) = 90*2 = 15*4 = 240</div></div><div style="color:rgb(0,0,0);font-size:13px"><br></div><div style="color:rgb(0,0,0);font-size:13px">The algorithm can respond with B which (he thinks) the best route if we prefere spending less than arriving in time.</div><div style="color:rgb(0,0,0);font-size:13px"><br></div><div style="color:rgb(0,0,0);font-size:13px">With this modelization, you need to define a static vector of weights (on for each property) and therefore you can use CH with Bi-Dijkstra provided by OSRM.</div><div style="color:rgb(0,0,0);font-size:13px"><br></div><div style="color:rgb(0,0,0);font-size:13px">I wish this can help you.</div><div style="color:rgb(0,0,0);font-size:13px"><br></div><div style="color:rgb(0,0,0);font-size:13px">Good luck in your work.</div><div style="color:rgb(0,0,0);font-size:13px"><br></div><div style="color:rgb(0,0,0);font-size:13px">With respect,</div><div style="color:rgb(0,0,0);font-size:13px"><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-04-09 17:28 GMT+01:00 Francis <span dir="ltr"><<a href="mailto:francisrute@gmail.com" target="_blank">francisrute@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi Romain,<br><br></div>I would also be pretty interested in a 
bicriteria (or multicriteria) OSRM version. What bicriteria algorithm would you like to use? <br>Let me first introduce myself. I'm involved in a SmartCities 
European Project in my city and we would like to provide routes that consider the minimization of multiple criteria simultaneously, like travel time, economic cost or CO2 emissions. I'm about to finish my phD in Multiobjective Shortest Path Problems and I'd love to apply some of the algorithms I have developed to that project. I do believe OSRM may be a great starting point for such a service. <br></div>I have started recently to inspect the source code. Let me point out some of the issues concerning an OSRM service that minimizes simultaneously more than one criterion:<br></div>- Multiple lua profiles could be necessary (one for each criterion).<br></div><div>- Edge weights are no longer a scalar value, but a vector of n dimensions (n- number of criteria).<br></div>- The preprocessing of the input graph and the routing algorithm (Contraction Hierarchies and bidirectional Dijkstra) must be adapted to the Multicriteria case, specifically, the preprocessing process were shortcuts are added as well as the search process were bidirectional Dijkstra's algorithm is employed to find the shortest path.<br></div>- Since the concept of optimum does not apply to Bicriteria or Multicriteria search, the new multiobjective algorithm would return a set of solutions, typically the set of Pareto or non-dominated solutions. <br></div>- Unless the two considered criteria are highly correlated (like travel time and distance, for example), the number of Pareto solutions is usually big (hundreds, thounsands...), so in order to make it practical for the user to choose one of the alternatives, something else from Multicriteria Decision Making would be necessary (Goal Programming, Compromise Search, tighten the concept of dominance...).<br></div><div>- The frontend receives and paints several routes.<br></div><div><br></div>I'm not sure how this would be interesting for the rest of the community, but I'd like to show an example of why this could be pretty useful.<br></div>Let me assume we are considering two criteria, travel time and the economic cost of the route (gas + tolls), and there are four possible routes:<br></div>A= (60 min, 30€)<br><div>B= (65 min, 25€)<br></div><div>C= (85 min, 20€)<br></div><div>D= (90 min, 15€)<br></div><div><div><div><div> where (x,y) = (travel time, economic cost)<br><br></div><div>With the current version of OSRM we obtain solution A, since it is the fastest of all. If we load an economic cost profile in OSRM, that labels each edge with the economic cost of traversing that edge, we obtain solution D, since it is the cheapest. What about if the user wants a solution with better trade-off? B and C would be good solutions too.<br></div><div>I think an OSRM version providing the extreme solutions for each criterion (fastest-A and most-economical-D in this case) and a small set of solutions with "good" trade-off between both criteria would be a very interesting feature for the project, although I'm not sure how this could be included, since it would involve many changes and the performance in continental maps is unknown. <br><br></div><div>Sorry for such a long mail.<br><br></div><div>PS: If someone is interested these are some academic references of papers dealing with this problem:<br>Preprocessing a multicriteria algorithm for routing:<br><a href="http://i11www.iti.uni-karlsruhe.de/extra/publications/dw-pps-09.pdf" target="_blank">http://i11www.iti.uni-karlsruhe.de/extra/publications/dw-pps-09.pdf</a><br></div><div>Algorithm that extends A* to the Multiobjective case, keeping the same theoretical properties than A*:<br><a href="http://dl.acm.org/citation.cfm?doid=1754399.1754400" target="_blank">http://dl.acm.org/citation.cfm?doid=1754399.1754400</a><br></div><div>Parallelization of that algorithm:<br><a href="http://algo2.iti.kit.edu/documents/Sanders%202013/ipdps.pdf" target="_blank">http://algo2.iti.kit.edu/documents/Sanders%202013/ipdps.pdf</a><br><br></div><div>Best regards,<br></div><div>Francisco J.<br></div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 31, 2015 at 2:00 PM,  <span dir="ltr"><<a href="mailto:osrm-talk-request@openstreetmap.org" target="_blank">osrm-talk-request@openstreetmap.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send OSRM-talk mailing list submissions to<br>
        <a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.openstreetmap.org/listinfo/osrm-talk" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:osrm-talk-request@openstreetmap.org" target="_blank">osrm-talk-request@openstreetmap.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:osrm-talk-owner@openstreetmap.org" target="_blank">osrm-talk-owner@openstreetmap.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of OSRM-talk digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. alternative route (Romain NKONGO)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 31 Mar 2015 11:10:14 +0200<br>
From: Romain NKONGO <<a href="mailto:romain.rnk49@gmail.com" target="_blank">romain.rnk49@gmail.com</a>><br>
To: Mailing list to discuss Project OSRM <<a href="mailto:osrm-talk@openstreetmap.org" target="_blank">osrm-talk@openstreetmap.org</a>><br>
Subject: [OSRM-talk] alternative route<br>
Message-ID:<br>
        <CAAwSghEqK-w+MQ+kdi3r9hPKvv6tuZ0FFT1Nq9cDH3t_wLOX=<a href="mailto:g@mail.gmail.com" target="_blank">g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello everyone,<br>
<br>
I've succeeded to add a new criterion called cyclability to OSRM, which is<br>
associated with each edge in the graph. It is created in bicycle.lua file<br>
and I managed to bring it all through the processing phase and to make a<br>
mean value on each segment of the shortest path. In the JSON, I now have a<br>
9th value for each element in route instructions and a mean value in route<br>
summary.<br>
<br>
Now I intend to add a bicriteria algorithm to the routing phase (based on<br>
Label Setting). Such an algorithm would return multiple paths as results to<br>
one viaroute query. The problem is the original implementation allows 2<br>
routes at most to be returned.<br>
<br>
Has anyone tried to increase the limit of routes returned? If not, what is<br>
the condition for an alternative route and is there at least a way to force<br>
OSRM to show an alternative route?<br>
<br>
Thanks in advance for the help.<br>
Romain NKONGO.<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20150331/1d449886/attachment-0001.html" target="_blank">http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20150331/1d449886/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<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" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
<br>
<br>
------------------------------<br>
<br>
End of OSRM-talk Digest, Vol 27, Issue 12<br>
*****************************************<br>
</blockquote></div><br></div>
<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" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
<br></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" target="_blank">https://lists.openstreetmap.org/listinfo/osrm-talk</a><br>
<br></blockquote></div><br></div>