change Dijkstra's algorithm

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
manuel
Posts: 9
Joined: Monday 28 October, 2013 - 10:47

change Dijkstra's algorithm

Post by manuel »

Hi,

does anybody know how to change Dijkstra's algorithm? I´m trying to change the routing of my advanced transporters. If it isn´t possible to change the algorithm, does anybody have the programming code of it?
Thanks.

Manuel
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: change Dijkstra's algorithm

Post by MatthijsJongboer »

Hello Manuel,

The Dijkstra algorithm optimizes the tables to a single source shortest path.
When you want to change the routing in your network, this is also possible.
However, it would not be a routing according the Dijkstra algorithm anymore.

To make use of the existing implementation, have a look at the Network Controller Atom in the Library. Here you will find the dijkstra algorithm called in the function NetworkController_OptimizeNetwork. It optimizes two tables (a distance and a node table). This would be the place to implement your own algorithm which results in two optimized tables. You can use 4DScript to write the algorithm.

Perhaps you can shed some light on what you want to achieve and what algorithm you want to use?

Regards,
Matthijs
manuel
Posts: 9
Joined: Monday 28 October, 2013 - 10:47

Re: change Dijkstra's algorithm

Post by manuel »

hi,

i´m trying to get the fastest route (not the shortest). My advanced Transporter is really slow at corners, but the shortest route in the network consists of many corners. the advanced transporter would be much more faster, if he avoids this corners an drives an other route. I think i got to implement my own algorithm :cry: . thanks for your help!
User avatar
MatthijsJongboer
Posts: 200
Joined: Thursday 11 November, 2010 - 14:12

Re: change Dijkstra's algorithm

Post by MatthijsJongboer »

Hi Manual,
What you want to achieve is the combination of 2 variables resulting in 1 path. This is not possible with the Dijkstra algorithm. I would suggest to use only one variable (e.g. time) and create your tables accordingly. This will present quite some challenges depending on the level of detail you want to have. Having a single 'cost' for each node would simplify things.

Let us know what solution you come up with.
Gr. Matthijs
Post Reply