Skip to content

bloqade.lanes.heuristics.physical.target_generator.LookaheadCongestionAwareTargetGenerator

← Module overview

classLookaheadCongestionAwareTargetGeneratorsource

bloqade.lanes.heuristics.physical.target_generator.LookaheadCongestionAwareTargetGenerator

Bases: CongestionAwareTargetGenerator

Congestion-aware target picker with K-stage participation lookahead.

Signature
class LookaheadCongestionAwareTargetGenerator(direction_factor: float = 0.5, shared_site_factor: float = 1.1, K: int = 4, gamma: float = 0.7)

Extends CongestionAwareTargetGenerator by augmenting each pair’s cost with a discounted simulation of future-stage path costs. For each candidate direction (move ctrl or move tgt), the score is

cost = path_cost_now + sum_{k=1..K} gamma^k * stage_cost_k

where stage_cost_k simulates stage k ahead under the chosen commit and computes the per-pair cheapest-direction cost. The lower-total direction wins; path-length tiebreak is preserved from _choose_control.

With K=0 this reduces to CongestionAwareTargetGenerator.

The lookahead favours keeping qubits stable when they are reused in the next K stages — useful for hub-and-spoke patterns (single repeated control), GHZ ladders (chain neighbours), and magic-state factory cycles.

Parameters

NameTypeDefaultDescription
direction_factorfloat0.5
shared_site_factorfloat1.1
Kint4
gammafloat0.7

Attributes

NameTypeDescription
KintLookahead horizon in stages. Must be ``>= 0``. Default 4.
gammafloatPer-stage discount factor for simulated future cost. Must be in ``(0, 1]``. Default 0.7.
direction_factor/ shared_site_factorInherited; same semantics as :class:`CongestionAwareTargetGenerator`.

methodgeneratesource

bloqade.lanes.heuristics.physical.target_generator.LookaheadCongestionAwareTargetGenerator.generate

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

Same as parent’s generate(), but threads ctx.lookahead_cz_layers through state so _simulate_future_cost can read it.

Parameters

NameTypeDescription
ctxTargetContext

Returns

list[dict[int, LocationAddress]]

source