Function TSP(nodenum: integer; TSPtype: smallint): single;
Obsolete function. Use TSP2 instead.
Calculates the optimum order to visit a list of nodes. TSP uses Lin's 3-optimum algorithm, which usually returns true optimum, if you have less than 20-30 nodes. With 100 nodes you should expect a cost no more than 1-2% higher than true optimum.
The cost between two nodes are calculated in both directions, but the average is used in the optimization.
Nodenum is the number of nodes in the optimization (2<=nodenum<=NodeListLimit).
TSPtype=0,10:
A route is calculated, which starts at the first node and ends at the last node in the list. The order of the other nodes are optimized.
TSPtype=1,11:
A round trip is calculated, where the order of all nodes are optimized.
TSPtype=2,12:
A trip is calculated, where only the first node is fixed. The last node on the route will be somewhere far from the first node. This method requires more computing time than type 0 and 1.
If TSPtype=10, 11 or 12 straight line distances are used in the optimization. This is a lot faster, but also less accurate.
The function returns the minimum cost.
At the same time the "extra" variable is calculated for the whole route. Get this with function TSPextra.
The new (optimum) order of the nodes can be retrieved with function NodeListGet.
If you enter a node number more than once, a short distance will be used for the distance between each occurrence.
With many nodes, the processing time increases a lot - especially for mode 0, 1 and 2.
Entering node number 0, triggers error -38 and so do nodes in a subnet.
Possible error codes: -10 -30 -38 -43
Versions: Standard Pro
ActiveX / VCL / CLX component: RWcalc