Skip to content

bloqade.lanes.heuristics.physical.target_generator.CongestionAwareTargetGenerator

← Module overview

classCongestionAwareTargetGeneratorsource

bloqade.lanes.heuristics.physical.target_generator.CongestionAwareTargetGenerator

Bases: TargetGeneratorABC

Joint, longest-first, congestion-aware target generator.

Signature
class CongestionAwareTargetGenerator(direction_factor: float = 0.5, shared_site_factor: float = 1.1)

For each CZ pair, picks whether to move the control or the target based on schedule-time cost computed against a working placement that reflects all prior pairs’ committed moves and a running directional congestion record.

Per-lane weighting composes two orthogonal multiplicative factors (see _make_weight_fn):

  • direction_factor ** (N - M) — signed net of same-direction (N) minus opposite-direction (M) prior commits on the lane. With direction_factor < 1, net-positive traffic rewards AOD-parallel reuse and net-negative traffic penalises contention; balanced traffic (N == M) is neutral.
  • shared_site_factor — applied whenever an endpoint of the candidate lane is a site a prior committed path already traversed. Applies independently of direction_factor; the two signals compose multiplicatively.

Dijkstra requires non-negative edge weights. direction_factor must be strictly positive (the negative exponent is otherwise undefined); shared_site_factor must be >= 0. Defaults reflect the canonical tuning; empirical retuning is a follow-up.

Parameters

NameTypeDefaultDescription
direction_factorfloat0.5
shared_site_factorfloat1.1

Attributes

NameTypeDefaultDescription
direction_factorfloat0.5
shared_site_factorfloat1.1

methodgeneratesource

bloqade.lanes.heuristics.physical.target_generator.CongestionAwareTargetGenerator.generate

def generate(ctx: TargetContext) -> list[dict[int, LocationAddress]]

Parameters

NameTypeDescription
ctxTargetContext

Returns

list[dict[int, LocationAddress]]

source