MatrixPreProcess

Top  Previous  Next

Very often an optimization will result in some links being traversed more than once (either in the same or opposite directions). If there are multiple locations along that same link, it won't matter if the locations are visited first or second time the link is traversed. At least not from an optimization point of view. But for humans it feels most natural if all stops along the same link is just after each other.

 

This method will update the matrix, so short and long distances between locations are preferred to two medium distances. It essentially takes the square-root of the normalized cost: Matrix(*) = sqrt( Matrix(*) / max(Matrix(*)) ).

 

Example: Costs 0.25 + 0.75 has the same total as 0.5 + 0.5. After processing we will now see that sqrt(0.25) + sqrt(0.75) < sqrt(0.5) + sqrt(0.5), so 0.25 and 0.75 are preferred to 2x 0.5.

 

Syntax: MatrixPreProcess(var mat: TMatrix)