Skip to content

Qaoa penalty

qaoa_penalty

qaoa_penalty(
    num_qubits: CInt,
    params_list: CArray[CReal],
    hamiltonian: CArray[PauliTerm],
    target: QArray[QBit, Literal["num_qubits"]],
) -> None

[Qmod Classiq-library function]

Applies the penalty layer to the QAOA model.

This function adds a penalty term to the objective function of the QAOA model to enforce certain constraints (e.g., binary or integer variables) during the optimization process.

Parameters:

Name Type Description Default
num_qubits CInt

The number of qubits in the quantum circuit.

required
hamiltonian CArray[PauliTerm]

The Hamiltonian terms for the QAOA model.

required
target QArray[QBit, Literal['num_qubits']]

The target quantum array variable.

required