<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hello Tom.<br><br>The traveling salesman problem (TSP) is defined as follows:<br> "Given a list of cities and the distances between each pair of
 cities, find is the shortest possible route that visits each city and 
returns to the origin city?"<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">So, because of the "and returns to the original city" you wont be able to find any option allowing not to go back to the point of origin.<br>On [1] you can find a nice site about TSP:<br><br>[1] <a href="http://www.math.uwaterloo.ca/tsp/">http://www.math.uwaterloo.ca/tsp/</a><br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Regards<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Vicky<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 11, 2018 at 7:35 AM, tommaso <span dir="ltr"><<a href="mailto:tommasodb@googlemail.com" target="_blank">tommasodb@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, I'm testing the TSP feature using this example from the documentation:<br>
<br>
SELECT * FROM pgr_TSP(<br>
    $$<br>
    SELECT * FROM pgr_dijkstraCostMatrix(<br>
        'SELECT id, source, target, cost, reverse_cost FROM edge_table',<br>
        (SELECT array_agg(id) FROM edge_table_vertices_pgr WHERE id < 14),<br>
        directed := false<br>
    )<br>
    $$,<br>
    start_id := 7,<br>
    randomize := false<br>
);<br>
<br>
My problem is that the algorithm returns to the start point after visiting the last one, while in my use case this is not requested.<br>
There is a option to avoid this? Until now I could not find such a option in the documentation.<br>
Simply ignoring the last segment is not a solution, because in certain cases the order of the last and second the last points changes if the route goes back to the first point. So, I cannot predict which one is the desired last point.<br>
<br>
Regards, Tom<br>
______________________________<wbr>_________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.or<wbr>g</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/pgrouting-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/pgrouting-users</a></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><pre>Georepublic UG (haftungsbeschränkt)
Salzmannstraße 44, 
81739 München, Germany

Vicky Vergara
Operations Research

eMail: vicky@<a href="http://georepublic.de" target="_blank">georepublic.de</a>
Web: <a href="https://georepublic.info" target="_blank">https://georepublic.info</a>

Tel: +49 (089) 4161 7698-1
Fax: +49 (089) 4161 7698-9

Commercial register: Amtsgericht München, HRB 181428
CEO: Daniel Kastl

<span></span></pre></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>