qgym.generators.interaction module
This module contains interaction generators for Routing
.
- class qgym.generators.interaction.BasicInteractionGenerator(max_length=10, seed=None)[source]
Bases:
InteractionGenerator
BasicInteractionGenerator
is an interaction generation implementation.Interactions are completely randomly generated using the
numpy.random.choice()
method.- __init__(max_length=10, seed=None)[source]
Init of the
BasicInteractionGenerator
.- Parameters:
max_length (
SupportsInt
) – Maximum length of the generated interaction circuits. Defaults to 10.seed (
Generator
|SupportsInt
|None
) – Seed to use.
- __repr__()[source]
String representation of the
BasicInteractionGenerator
.- Return type:
- class qgym.generators.interaction.InteractionGenerator[source]
Bases:
Iterator
[ndarray
[Any
,dtype
[int32
]]]Abstract Base Class for interaction circuit generation.
All interaction circuit generators should inherit from
InteractionGenerator
to be compatible with theRouting
environment.- abstract __next__()[source]
Make a new interaction circuit.
The
__next__
method of aInteractionGenerator
should generate andarray
of shape (len_circuit, 2) with dtypeint
. Each pair represents the indices of two qubits that have an interaction in the circuit.
- abstract set_state_attributes(**kwargs)[source]
Set attributes that the state can receive.
This method is called inside the routing environment to receive information about the state. The same keywords as for the the init of the
RoutingState
are provided.- Return type:
- class qgym.generators.interaction.NullInteractionGenerator[source]
Bases:
InteractionGenerator
Generator class for generating empty interaction circuits.
Useful for unit testing.
- __init__()[source]
Init of the
NullInteractionGenerator
- __repr__()[source]
String representation of the
NullInteractionGenerator
.- Return type: