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

Public errors

  • Errors throwed by GeneticUseCase.Circuit.init(input:output:)

    See more

    Declaration

    Swift

    public enum InitError : Error

Public types

  • A GeneticUseCase provides enough data to configure a circuit as well as the oracle gate inside the circuit. TruthTable provides the data for the latter

    See more

    Declaration

    Swift

    public struct TruthTable
  • A GeneticUseCase provides enough data to configure a circuit as well as the oracle gate inside the circuit. Circuit provides the data for the former

    See more

    Declaration

    Swift

    public struct Circuit

Public properties

  • 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

Public init methods

  • Initializes a GeneticUseCase instance.

    Declaration

    Swift

    public init(truthTable: [String], circuitInput: String? = nil, circuitOutput: String) throws

    Parameters

    truthTable

    List of qubit combinations for which the control in a Gate.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.

    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 a Gate.controlledNot(target:control:), so the target 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.