revrt.models.routing.RoutingOptionConfig#
- class RoutingOptionConfig(*, cost_layers: list[RoutingCostLayer] | None = None, friction_layers: list[RoutingFrictionLayer] | None = None, barrier_layers: list[RoutingBarrierLayer] | None = None, cost_multiplier_layer: str | None = None, cost_multiplier_scalar: float = 1)[source]#
Bases:
BaseModelConfig for one named routing option
Routing options are keyed by name, such as
"overhead"or"underground". Route tables may reference these option names instart_optionandend_optioncolumns.The rest of this docstring is inserted by Pydantic and can be ignored.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Methods
Attributes
Cost layers definitions
Friction layer definitions
Barrier layer definitions
Optional option-level layer multiplied onto final costs
Optional option-level scalar multiplied onto final costs
- cost_layers: list[RoutingCostLayer] | None#
Cost layers definitions
The cost layers are built and then summed to create the option’s base routing surface, which determines the cost output for each route. Specifically, the cost at each pixel is multiplied by the length that the route takes through the pixel, and all of these values are summed for each route to determine the final cost.
Important
If a pixel has a final cost of \(\leq 0\) and the invalid_costs_block_routing is set to
True, the pixel is treated as a barrier (i.e. no paths can ever cross this pixel).
- friction_layers: list[RoutingFrictionLayer] | None#
Friction layer definitions
Friction layers are multiplied onto the aggregated cost layer to influence routing but are NOT reported in final cost. These layers are first aggregated, and then the aggregated friction layer is applied to the aggregated cost. The cost at each pixel is therefore computed as:
\[C = (\sum_{i} c_i) * (1 + \sum_{j} f_j)\]where \(C\) is the final cost at each pixel, \(c_i\) are the individual cost layers, and \(f_j\) are the individual friction layers.
Note
\(\sum_{j} f_j\) is always clamped to be \(\gt -1\) to prevent zero or negative routing costs. In other words, \((1 + \sum_{j} f_j) > 0\) always holds. This means friction can scale costs to/away from zero but never cause the sign of the cost layer to flip (even if friction values themselves are negative). This means all “barrier” pixels (i.e. cost value \(\leq 0\)) will remain barriers after friction is applied (assuming invalid_costs_block_routing is set to
True).
- barrier_layers: list[RoutingBarrierLayer] | None#
Barrier layer definitions
Barrier layers define explicit routing barriers that routes should not cross. Unlike friction_layers, barrier layers do not add a penalty to the routing surface. Instead, any pixel matching a barrier definition is treated as blocked during routing. Barrier layers _can_ be relaxed to allow routing through them if no valid route can be found. This behavior can be configured.