<div dir="ltr">Hello all,<div><br></div><div>There is a piece of logic in the trsp algorithm that I suspect is a bug. It happens in the file GraphDefinition.cpp, line 426</div><div><br></div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px">
<div class="" id="LC426" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">            <span class="" style="font-weight:bold">if</span><span class="" style>(</span><span class="" style>m_lStartEdgeId</span> <span class="" style="font-weight:bold">==</span> <span class="" style>m_lEndEdgeId</span><span class="" style>)</span></div>
<div class="" id="LC427" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">            <span class="" style>{</span></div><div class="" id="LC428" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
                        <span class="" style="font-weight:bold">if</span><span class="" style>(</span><span class="" style>get_single_cost</span><span class="" style>(</span><span class="" style="color:rgb(0,153,153)">1000.0</span><span class="" style>,</span> <span class="" style>path</span><span class="" style>,</span> <span class="" style>path_count</span><span class="" style>))</span></div>
<div class="" id="LC429" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">                    <span class="" style>{</span></div><div class="" id="LC430" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
                                <span class="" style="font-weight:bold">return</span> <span class="" style="color:rgb(0,153,153)">0</span><span class="" style>;</span></div><div class="" id="LC431" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
                        <span class="" style>}</span></div><div class="" id="LC432" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">             <span class="" style>}</span></div>
<div class="" id="LC433" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">            <span class="" style="font-weight:bold">*</span><span class="" style>err_msg</span> <span class="" style="font-weight:bold">=</span> <span class="" style>(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">char</span> <span class="" style="font-weight:bold">*</span><span class="" style>)</span><span class="" style="color:rgb(221,17,68)">"Path Not Found"</span><span class="" style>;</span></div>
<div class="" id="LC434" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">            <span class="" style>deleteall</span><span class="" style>();</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">            <span class="" style="font-weight:bold">return</span> <span class="" style="font-weight:bold">-</span><span class="" style="color:rgb(0,153,153)">1</span><span class="" style>;</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style><br></span></div><div class="" id="LC435" style="padding-left:10px">
<font face="arial"><span style="white-space:normal">Is there any reason why the get_single_cost function get passed an absolute value. Even more is there any reason for the following clause conditions in the function get_single_cost?</span></font></div>
<div class="" id="LC435" style="padding-left:10px"><font face="arial"><span style="white-space:normal"><br></span></font></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal">GraphDefinition.cpp, line 493</span><br></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span class="" style><span class="" style="font-weight:bold">if</span><span class="" style>(</span><span class="" style>start_edge_info</span><span class="" style="font-weight:bold">-></span><span class="" style>m_dCost</span> <span class="" style="font-weight:bold">>=</span> <span class="" style="color:rgb(0,153,153)">0.0</span> <span class="" style="font-weight:bold">&&</span> <span class="" style>start_edge_info</span><span class="" style="font-weight:bold">-></span><span class="" style>m_dCost</span> <span class="" style="font-weight:bold">*</span> <span class="" style>(</span><span class="" style>m_dEndPart</span> <span class="" style="font-weight:bold">-</span> <span class="" style>m_dStartpart</span><span class="" style>)</span> <span class="" style="font-weight:bold"><=</span> <span class="" style>total_cost</span><span class="" style>)</span></span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style><span class="" style><br></span></span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style><span class="" style><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal">GraphDefinition.cpp, line 506</span><br>
</span></span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style><span class="" style><span class="" style="font-weight:bold">if</span><span class="" style>(</span><span class="" style>start_edge_info</span><span class="" style="font-weight:bold">-></span><span class="" style>m_dReverseCost</span> <span class="" style="font-weight:bold">>=</span> <span class="" style="color:rgb(0,153,153)">0.0</span> <span class="" style="font-weight:bold">&&</span> <span class="" style>start_edge_info</span><span class="" style="font-weight:bold">-></span><span class="" style>m_dReverseCost</span> <span class="" style="font-weight:bold">*</span> <span class="" style>(</span><span class="" style>m_dStartpart</span> <span class="" style="font-weight:bold">-</span> <span class="" style>m_dEndPart</span><span class="" style>)</span> <span class="" style="font-weight:bold"><=</span> <span class="" style>total_cost</span><span class="" style>)</span></span></span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style><span class="" style><span class="" style><br>
</span></span></span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal">Shouldn't we have the following clause instead ?</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style="font-weight:bold">if</span><span class="">(</span><span class="">start_edge_info</span><span class="" style="font-weight:bold">-></span><span class="">m_dCost</span> <span class="" style="font-weight:bold">>=</span> <span class="" style="color:rgb(0,153,153)">0.0</span><span class="">)</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span class="" style="font-weight:bold">if</span><span class="">(</span><span class="">start_edge_info</span><span class="" style="font-weight:bold">-></span><span class="">m_dReverseCost</span> <span class="" style="font-weight:bold">>=</span> <span class="" style="color:rgb(0,153,153)">0.0</span><span class="">)</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br>
</span></div><div class="" id="LC435" style="padding-left:10px"><font face="arial"><span style="white-space:normal">The issue is : it is possible to have the a route that starts and ends on the same segments and that the cost associated with the used portion of the segment is superior than 1000 (especially if you route on long segments and your cost is in meters).</span></font></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><br></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal">I have changed the line 493 ad 506 in my version of trsp so that it doesn't test against the total cost and it seems to work fine. Is what I report here a bug, or I am missing something in the way TRSP works?</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br>
</span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal">Regards,</span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br>
</span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><i>Fabien</i></span></div>
<div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br>
</span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br>
</span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px"><br></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br></span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br></span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br></span></div><div class="" id="LC435" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;padding-left:10px">
<span style="color:rgb(34,34,34);font-family:arial;font-size:small;line-height:normal;white-space:normal"><br></span></div></pre></div></div>