Route

Top  Previous  Next

Function Route(Node1,Node2: integer): single;

 

Calculates the cost of the cheapest route from node1 to node2 according to Alpha, CostTime and CostDist. Returns the Cost.

 

Cheapest route is defined as the route, which minimizes this expression:

 

Cost = CostDist*distance + CostTime*time, where CostDist and CostTime >=0.

 

Either CostDist or CostTime should be >0.

 

If ExtraVarCreate has been called, an additional variable is calculated as

 

extra = extradist*distance + extratime*time.

 

Distance is defined according to the configuration file and time is always minutes.

 

If error -33 is returned, you can check function BestNode to see the node, which was nearest to node2.

 

Use OnRouteProgress event to track progress in very large networks. In small / medium sized networks it is not needed.

 

Possible error codes: -10 -30 -33

ActiveX / VCL / CLX component: RWcalc