qgym.generators.circuit module
This module contains circuit generators for Scheduling
.
- class qgym.generators.circuit.BasicCircuitGenerator(seed=None)[source]
Bases:
CircuitGenerator
BasicCircuitGenerator
is a basic random circuit generation implementation.- __init__(seed=None)[source]
Init of the
BasicInteractionGenerator
.- Parameters:
seed (
Generator
|SupportsInt
|None
) – Seed to use.
- __next__()[source]
Create a new randomly generated circuit.
The length of the circuit is a random integer in the interval [n_qubits, max_length].
- __repr__()[source]
String representation of the
BasicCircuitGenerator
.- Return type:
- set_state_attributes(machine_properties=None, max_gates=0, **kwargs)[source]
Set the n_qubits and max_gates attributes.
- Parameters:
machine_properties (
Any
) –MachineProperties
containing at least the number of qubits of the machine.max_gates (
SupportsInt
) – Maximum number of gates allowed in the circuit.kwargs (
Any
) – Additional keyword arguments. These are not used.
- Return type:
- class qgym.generators.circuit.CircuitGenerator[source]
-
Abstract Base Class for circuit generation used for scheduling.
All interaction circuit generators should inherit from
CircuitGenerator
to be compatible with theScheduling
environment.- abstract __next__()[source]
Make a new circuit.
The __next__ method of a
CircuitGenerator
should generate a list of Gates.- Example circuit:
>>> circuit = [Gate("prep", 0,0), Gate("prep", 1,1), Gate("cnot", 0,1)]
- abstract set_state_attributes(**kwargs)[source]
Set attributes that the state can receive.
This method is called inside the scheduling environment to receive information about the state. The same keywords as for the the init of the
SchedulingState
are provided.- Return type:
- class qgym.generators.circuit.NullCircuitGenerator[source]
Bases:
CircuitGenerator
Generator class for generating empty circuits.
Useful for unit testing.
- __init__()[source]
Init of the
NullCircuitGenerator
- __repr__()[source]
String representation of the
NullCircuitGenerator
.- Return type:
- class qgym.generators.circuit.WorkshopCircuitGenerator(seed=None)[source]
Bases:
CircuitGenerator
WorkshopCircuitGenerator
is a simplified random circuit generation implementation.- __init__(seed=None)[source]
Init of the
WorkshopCircuitGenerator
.- Parameters:
seed (
Generator
|SupportsInt
|None
) – Seed to use.
- __next__()[source]
Create a new randomly generated circuit.
The length of the circuit is a random integer in the interval [n_qubits, max_length].
- __repr__()[source]
String representation of the
WorkshopCircuitGenerator
.- Return type: