# [pgrouting-users] Shortest path with edge-parameters affecting the whole path

Nicklas Avén nicklas.aven at jordogskog.no
Sun Dec 14 10:58:00 PST 2014

```On Sat, 2014-12-13 at 21:05 +0100, Nicklas Avén wrote:
> Hallo list
>
> I have a question that I don't know if it is a question worth a
> rtfm-answer or if it needs hacking the source to solve. I have tried to
> find any obvious answers but failed.
>
> The problem is in my case connected to transportation of timber. All
> roads have a classification of maximum aloud weight of the truck (or per
> axle to be more accurate). The result is that the cost (in money) for a
> transport is defined by the worst part of the path because that limits
> how much timber the truck can take. That might be just a bridge or a
> part of the road that is too weak to take a full loaded truck, which
> gives a higher price for the whole transport.
>
> This classification is a property of the edges. So the shortest path
> algorithms needs to carry the classification information about the, so
> far worst road part, as a parameter in the cost calculations.
>
> Is there any feature in pgrouting handling this?
>
> I have read some about Dijkstra and as far as I understand it should be
> quite straight forward to handle. What is needed is that not only the
> cost is stored for each resulting vertexes but also the worst
> classification to get to that vertex. Then that classification is
> inherited along the path until an even worse classification is found.
>
> So, first: Is something like this already implemented?
> Second, if not; Does the idea about how it could be solved make sense?
>

I realize my solution won't work. If, for instance in the beginning of
the path there is a part ow the road that can take very little weight,
that path might still be chosen since it in the beginning won't give
that big effect, but might give big consequences later if there is a
long way with better roads later.

So I think the only way for me might be to do the shortest path
calculations with all classes. So first do it with all edges, then with
all edges but the worst and then all except the worst and the second
worst and so on. At last I have to compare what path was the cheapest.

Thanks

Nicklas

> Thanks
>
> Nicklas Avén
>
>
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users
>

```