GeneticUseCase
public struct GeneticUseCase
A genetic algorithm looks for a quantum circuit that includes a Gate.oracle(truthTable:target:controls:)
and solves a list of GeneticUseCase
instances. Each GeneticUseCase
defines the expected output
for the circuit
when its qubits are set to a given input
and the oracle gate is initialized with a particular truthTable
-
Errors throwed by
See moreGeneticUseCase.Circuit.init(input:output:)
Declaration
Swift
public enum InitError : Error
-
A
See moreGeneticUseCase
provides enough data to configure a circuit as well as the oracle gate inside the circuit.TruthTable
provides the data for the latterDeclaration
Swift
public struct TruthTable
-
A
See moreGeneticUseCase
provides enough data to configure a circuit as well as the oracle gate inside the circuit.Circuit
provides the data for the formerDeclaration
Swift
public struct Circuit
-
Data to configure the oracle gate inside the circuit
Declaration
Swift
public let truthTable: TruthTable
-
Data to configure a circuit
Declaration
Swift
public let circuit: Circuit
-
Initializes a
GeneticUseCase
instance.Throws
Declaration
Swift
public init(truthTable: [String], circuitInput: String? = nil, circuitOutput: String) throws
Parameters
truthTable
List of qubit combinations for which the
control
in aGate.controlledNot(target:control:)
is activated.circuitInput
0’s and 1’s that set the values of the qubits before applying any quantum gate. If not input is provided, qubits are set to 0.
circuitOutput
0’s and 1’s that specify the expected values of the qubits once the quantum gates are applied.
Return Value
A
GeneticUseCase
instance. -
Initializes a
GeneticUseCase
instance.Throws
Declaration
Swift
public init(emptyTruthTableQubitCount: Int, circuitInput: String? = nil, circuitOutput: String) throws
Parameters
emptyTruthTableQubitCount
An oracle gate with an empty truth table never activates the
control
in aGate.controlledNot(target:control:)
, so thetarget
never changes. However, it is still necessary to specify how many qubits the truth table handles.circuitInput
0’s and 1’s that set the values of the qubits before applying any quantum gate. If not input is provided, qubits are set to 0.
circuitOutput
0’s and 1’s that specify the expected values of the qubits once the quantum gates are applied.
Return Value
A
GeneticUseCase
instance.