bloqade.lanes.heuristics.physical.target_generator.LookaheadCongestionAwareTargetGenerator
classLookaheadCongestionAwareTargetGenerator¶source
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
| Name | Type | Default | Description |
|---|---|---|---|
direction_factor | float | 0.5 | |
shared_site_factor | float | 1.1 | |
K | int | 4 | |
gamma | float | 0.7 |
Attributes
| Name | Type | Description |
|---|---|---|
K | int | Lookahead horizon in stages. Must be ``>= 0``. Default 4. |
gamma | float | Per-stage discount factor for simulated future cost. Must be in ``(0, 1]``. Default 0.7. |
direction_factor | / shared_site_factor | Inherited; same semantics as :class:`CongestionAwareTargetGenerator`. |
methodgenerate¶source
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
| Name | Type | Description |
|---|---|---|
ctx | TargetContext |
Returns
list[dict[int, LocationAddress]]