CalculateCost

Top  Previous  Next

This will update a Cost array index as a linear combination of length and time:

 

Cost(*,costindex) = weightlength * Length(*) + weighttime * Time(*, timeindex)

 

Syntax: CalculateCost(costindex: integer; weightlength, weighttime: TCost; timeindex: integer; maxspeed: TCost)

 

Call CreateArrayCost in advance to allocate the index.

 

Timeindex points to one of the arrays defined through CreateArrayTime. If weighttime = 0, value of timeindex is ignored.

 

If both weights are <> 0, we recommend setting weighttime = 1. This ensures the values can be interpreted as time easily and be used together with turn delays if needed.

 

If maxspeed is defined, then time is adjusted according to that.