intrazonal_cost_infill#

caf.toolkit.cost_utils.intrazonal_cost_infill(cost, multiplier=0.5, min_axis=1)[source]#

Infill the intra-zonal costs of a cost matrix.

The intra-zonal costs are usually the diagonal of a cost matrix. Standard TAG procedure for infilling these costs is to take half the minimum cost for each zone. By default, this function takes the minimum value from each row (ignoring 0s) and multiplies that by 0.5 to get the infill value for each intra-zonal. Note that if any costs already exist for the intra-zonals, they will be overwritten. The diagonal infill is calculated similar to: cost.min(axis=min_axis * multiplier

Parameters:
  • cost (ndarray) – The square, 2D cost matrix to infill.

  • multiplier (float) – The value to multiply the minimum values by to calculate the infill value.

  • min_axis (int) – The axis to calculate the minimum value across.

Returns:

A copy of the input cost, but with the diagonal infilled.

Return type:

infilled_cost