Ноги из моего недописанного скрипта, который, скорее всего, так и останется недописанным. Как бы то ни было, вот завершённая часть скрипта, которой, я бы хотел поделится.
Создаёт 7 файлов, из которых: 1 вспомогательный для вышеозначенного скрипта, 3 готовых к использованию INI файла с оптимальными путями под каждую компанию, и 3 матрицы для удобного визуального прослеживания путей.
#DEFINE #ENDL: CHAR(13), CHAR(10)
#DEFINE #INFINITY: 99999
#DEFINE HTAB(: STRCUT(" ", 0,
#DEFINE MATRIX_FILE_NAME: "_path_matrix"
#DEFINE ROUTE_FILE_NAME: "_route"
#DEFINE READABILITY: "aVertex_array_indices.ini"
STRSEPARATE("MMO:EIC:VRU", ":", $array_company)
STRSEPARATE("1-1:1-2:1-3:1-4:1-5:1-6:1-7:1-8", ":", $array_vertex)
STRSEPARATE("2-1:2-2:2-3:2-4:2-5:2-6:2-7:2-8", ":", $array_vertex)
STRSEPARATE("3-1:3-2:3-3:3-4:3-5:3-6:3-7:3-8", ":", $array_vertex)
STRSEPARATE("4-1:4-2:4-3:4-4:4-5", ":", $array_vertex)
STRSEPARATE("1-BL:2-BL:3-BL", ":", $array_vertex)
$size_array_vertex = ARRSIZE($array_vertex)
IF(TFCOUNT(READABILITY) - 1 != $size_array_vertex)
TFCLEAR(READABILITY)
FOR($count = 0, $count < $size_array_vertex)
INIWRITE(READABILITY, $array_vertex[$count], $count)
END_CYC
END_IF
SUB(_ADD_EDGE, $_1vertex, $_2vertex, $_weight)
$array_weight_matrix[INT(INIREAD(READABILITY, $_1vertex)) + INT(INIREAD(READABILITY, $_2vertex)) * $size_array_vertex] = $_weight
$array_weight_matrix[INT(INIREAD(READABILITY, $_2vertex)) + INT(INIREAD(READABILITY, $_1vertex)) * $size_array_vertex] = $_weight
END_SUB
FOR($count = 0, $count < ARRSIZE($array_company))
#DEFINE #DX6_WEIGHT: 0.9
#DEFINE #DX7_WEIGHT: 0.9
#DEFINE #DX8_WEIGHT: 0.9
#DEFINE #DBL_WEIGHT: 4
#DEFINE #DEF_WEIGHT: 2
$MMO_weight = 2
$EIC_weight = 2
$VRU_weight = 2
$MF5_weight = $MMO_weight - 0.1
$EF5_weight = $EIC_weight - 0.1
$VF5_weight = $VRU_weight - 0.1
SETVAR(STRCONCAT("$", $array_company[$count], "_weight"), 1)
SETVAR(STRCONCAT("$", STRCUT($array_company[$count], 1, 1), "F5_weight"), GETVAR(STRCONCAT("$", $array_company[$count], "_weight")))
FOR($i = 0, $i < POW($size_array_vertex, 2))
$array_weight_matrix[$i] = #INFINITY
FOR($k = 0, ($k < $size_array_vertex) and ($i < $size_array_vertex))
$array_path_matrix[$i*$size_array_vertex+$k] = $array_vertex[$k]
END_CYC
END_CYC
_ADD_EDGE("1-1", "1-2", $MMO_weight)
_ADD_EDGE("1-2", "1-3", $MMO_weight)
_ADD_EDGE("1-2", "1-4", $MMO_weight)
_ADD_EDGE("1-3", "1-4", $MMO_weight)
_ADD_EDGE("1-3", "2-3", #DEF_WEIGHT)
_ADD_EDGE("1-4", "3-4", #DEF_WEIGHT)
_ADD_EDGE("2-1", "2-2", $EIC_weight)
_ADD_EDGE("2-2", "2-3", $EIC_weight)
_ADD_EDGE("2-2", "2-4", $EIC_weight)
_ADD_EDGE("2-3", "2-4", $EIC_weight)
_ADD_EDGE("2-4", "3-3", #DEF_WEIGHT)
_ADD_EDGE("3-1", "3-2", $VRU_weight)
_ADD_EDGE("3-2", "3-3", $VRU_weight)
_ADD_EDGE("3-2", "3-4", $VRU_weight)
_ADD_EDGE("3-3", "3-4", $VRU_weight)
_ADD_EDGE("1-5", "1-6", $MMO_weight)
_ADD_EDGE("1-5", "1-7", #DX7_WEIGHT)
_ADD_EDGE("1-6", "1-8", #DX6_WEIGHT)
_ADD_EDGE("1-7", "1-8", #DX8_WEIGHT)
_ADD_EDGE("2-5", "2-6", $EIC_weight)
_ADD_EDGE("2-5", "2-7", #DX7_WEIGHT)
_ADD_EDGE("2-6", "2-8", #DX6_WEIGHT)
_ADD_EDGE("2-7", "2-8", #DX8_WEIGHT)
_ADD_EDGE("3-5", "3-6", $VRU_weight)
_ADD_EDGE("3-5", "3-7", #DX7_WEIGHT)
_ADD_EDGE("3-6", "3-8", #DX6_WEIGHT)
_ADD_EDGE("3-7", "3-8", #DX8_WEIGHT)
_ADD_EDGE("4-1", "1-4", $MMO_weight)
_ADD_EDGE("4-2", "2-4", $EIC_weight)
_ADD_EDGE("4-3", "3-4", $VRU_weight)
_ADD_EDGE("4-1", "4-2", #DEF_WEIGHT)
_ADD_EDGE("4-2", "4-3", #DEF_WEIGHT)
_ADD_EDGE("4-3", "4-1", #DEF_WEIGHT)
_ADD_EDGE("4-4", "4-1", $MMO_weight)
_ADD_EDGE("4-4", "4-2", $EIC_weight)
_ADD_EDGE("4-4", "4-3", $VRU_weight)
_ADD_EDGE("4-4", "1-5", $MMO_weight)
_ADD_EDGE("4-4", "2-5", $EIC_weight)
_ADD_EDGE("4-4", "3-5", $VRU_weight)
_ADD_EDGE("4-5", "1-5", $MF5_weight)
_ADD_EDGE("4-5", "2-5", $EF5_weight)
_ADD_EDGE("4-5", "3-5", $VF5_weight)
_ADD_EDGE("1-BL", "1-8", #DBL_WEIGHT)
_ADD_EDGE("2-BL", "2-8", #DBL_WEIGHT)
_ADD_EDGE("3-BL", "3-8", #DBL_WEIGHT)
_ADD_EDGE("1-BL", "2-BL", #DEF_WEIGHT)
_ADD_EDGE("2-BL", "3-BL", #DEF_WEIGHT)
_ADD_EDGE("3-BL", "1-BL", #DEF_WEIGHT)
FOR($k = 0, $k < $size_array_vertex)
FOR($i = 0, $i < $size_array_vertex)
FOR($j = 0, $j < $size_array_vertex)
IF($array_vertex[$i] != $array_vertex[$j])
IF($array_weight_matrix[$j*$size_array_vertex+$i] > $array_weight_matrix[$k*$size_array_vertex+$i] + $array_weight_matrix[$j*$size_array_vertex+$k])
$array_weight_matrix[$j*$size_array_vertex+$i] = $array_weight_matrix[$k*$size_array_vertex+$i] + $array_weight_matrix[$j*$size_array_vertex+$k]
$array_path_matrix[$i*$size_array_vertex+$j] = $array_path_matrix[$i*$size_array_vertex+$k]
END_IF
END_IF
END_CYC
END_CYC
END_CYC
$horizontal_line = HTAB(7)
FOR($i = 0, $i < $size_array_vertex)
$horizontal_line = STRCONCAT($horizontal_line, "[", $array_vertex[$i], "]", HTAB(1))
END_CYC
TFWRITE(STRCONCAT($array_company[$count], MATRIX_FILE_NAME, ".txt"), STRCONCAT($horizontal_line, #ENDL), 1)
FOR($i = 0, $i < $size_array_vertex)
$horizontal_line = STRCONCAT("[", $array_vertex[$i], "]", STRCUT(HTAB(6), 1, 6 - STRLEN($array_vertex[$i])))
FOR($k = 0, $k < $size_array_vertex)
$temp = $array_path_matrix[$i*$size_array_vertex+$k]
$horizontal_line = STRCONCAT($horizontal_line, $temp, STRCUT(HTAB(6), 1, 6 - STRLEN($temp) + ABS(3 - STRLEN($array_vertex[$k]))) )
END_CYC
TFWRITE(STRCONCAT($array_company[$count], MATRIX_FILE_NAME, ".txt"), STRCONCAT($horizontal_line, #ENDL), ($i*2) + 3)
END_CYC
FOR($i = 0, $i < $size_array_vertex)
FOR($k = 0, $k < $size_array_vertex)
IF($i != $k)
INIWRITE(STRCONCAT($array_company[$count], ROUTE_FILE_NAME, ".ini"), STRCONCAT($array_vertex[$i], ":", $array_vertex[$k]), $array_path_matrix[$i*$size_array_vertex+$k])
END_IF
END_CYC
END_CYC
END_CYC
HALT