wy_qcos.transpiler.cmss.mapping.na.zac.placer package

Submodules

wy_qcos.transpiler.cmss.mapping.na.zac.placer.saplacer module

class wy_qcos.transpiler.cmss.mapping.na.zac.placer.saplacer.SAPlacer

基类:object

Class to find a qubit initial placement using Simulated Annealing (SA).

Description:

This class implements a simulated annealing based optimizer for determining the initial placement of logical qubits onto physical storage locations of a QPU. The optimization objective is to minimize the weighted interaction distance induced by two-qubit gates.

initialize_param()

Initialize simulated annealing hyper-parameters.

Description:

Set temperature schedule parameters, iteration limits, and bookkeeping variables for tracking the current and best solutions during the simulated annealing process.

preprocessing()

Preprocess gate information and hardware geometry.

Description:

Construct weighted interaction information for each logical qubit based on the gate execution order. In addition, compute nearest coupler indices and optimal storage positions for operation sites to enable fast cost evaluation.

run(qpu_config, n_qubit, list_gate)

Run simulated annealing to find an optimized initial placement.

参数:
  • qpu_config (dict) -- Hardware configuration of the QPU.

  • n_qubit (int) -- Number of logical qubits.

  • list_gate (list) -- Two-qubit gates grouped by execution stage.

make_movement()

Generate a random movement and compute its cost difference.

Description:

Randomly select a logical qubit and move it to a new storage position. If the target position is already occupied, perform a swap. Only the gates affected by this movement are used to compute the incremental cost difference.

recover()

Undo the last rejected movement.

init_sa_solution()

Generate an initial mapping based on readout error ranking.

get_cost()

Calculate the movement cost for a given mapping plan.

Description:

Cost is computed as Manhattan-like distance between consecutive stages for each atom movement. The objective is to minimize total movement steps. cost(mapping) = sum for gate in G2 (w_g * gCost(q0,q1)) where:gCost is movement steps for closest Rydberg zone site, w_g = max(0.1, 1-0.1(t-1)),where t is Rydberg stage

返回:

total movement cost across the mapping plan.

返回类型:

int

distance(posa, posb)

Compute effective interaction distance between two atoms.

get_steps(posa, posb)

Compute Manhattan distance between two physical positions.

update_temperature()

Update SA temperature according to adaptive schedule.

accept_worse_sol()

Metropolis criterion for accepting worse solutions.

update_optimal_sol()

Update the globally best solution found so far.

wy_qcos.transpiler.cmss.mapping.na.zac.placer.vmplacer module

class wy_qcos.transpiler.cmss.mapping.na.zac.placer.vmplacer.VertexMatchingPlacer(mapping, ag, near)

基类:object

Class to determine qubit layout using vertex matching.

Description:

This placer computes qubit-to-site mappings across circuit layers by solving a sequence of minimum-weight bipartite matching problems. It supports dynamic placement, qubit reuse, and lookahead-based cost estimation for neutral-atom architectures.

参数:
  • mapping (list)

  • ag (Graph)

  • near (dict)

run(qpu_cfg, qubit_mapping, list_gate, dynamic_placement, list_reuse_qubits)

Run the placement algorithm layer by layer.

Description:

For each circuit layer, this method alternates between placing two-qubit gates onto Rydberg sites and placing idle qubits back to storage sites. Both dynamic placement and qubit reuse are supported.

参数:
  • qpu_cfg (dict) -- Hardware configuration, including: - storage_area: list of storage site IDs - operate_area: list of Rydberg site IDs - coupler_map: mapping from Rydberg coupler to site pairs

  • qubit_mapping (dict) -- Initial logical-to-physical mapping at layer 0.

  • list_gate (list[list[tuple]]) -- Circuit gates grouped by layer. list_gate[l] = [(q0, q1), ...] for layer l.

  • dynamic_placement (bool) -- Whether qubits are allowed to move between layers. - True: dynamic remapping each layer - False: static placement

  • list_reuse_qubits (list[list[int]]) -- For each layer, list of qubits reused in the next layer.

filter_mapping(layer)

Compare reuse vs non-reuse mappings and keep the better one.

place_gate(list_qubit_mapping, list_two_gate_layer, layer, test_reuse)

Place two-qubit gates onto Rydberg sites using bipartite matching.

Description:

Each gate is matched to a Rydberg site pair by minimizing total atom movement distance, optionally prioritizing qubit reuse.

参数:
  • list_qubit_mapping (list[dict]) -- Previous mapping(s): - layer == 0: [mapping] - otherwise: [gate_mapping, qubit_mapping]

  • list_two_gate_layer (list[list[tuple]]) -- Current and (optional) next gate layer.

  • layer (int) -- Current circuit layer index.

  • test_reuse (bool) -- Whether qubit reuse is enforced in placement.

get_steps(posa, posb)

Compute Manhattan distance between two physical sites.

get_site_cost(site, gate, qubit_mapping)

Compute minimal assignment cost for a gate on a Rydberg site.

place_qubit(list_gate, layer, test_reuse)

Place idle qubits back to storage sites using matching.

参数:
  • list_gate (list) -- The gate list to placement.

  • layer (int) -- Current circuit layer index.

  • test_reuse (bool) -- Whether qubit reuse is enforced in placement.

Module contents