PauliString for Amplitude State

Hello!

Is there a way to create a PauliString that will target a specific amplitude state? I know you can use qp.PauliZ(0) @ qp.PauliZ(1) to target two qubit, but wondering if there’s anything we can do at the binary amplitude state level. This would be for setting a cost hamiltonian for QAOA where I want to penalize a specific state.

Thank you!

Hi @movingwaters !

It’s great to see you in the Forum!

If I understand your question correctly, then the answer should be yes. The projector onto a specific bitstring is diagonal, so it is a sum of Pauli-Zs and identities:

|b\rangle\langle b|=\Pi_{j=0}^{n-1} (I_j + (-1)^{b_j} Z_j)/2

which is a valid QAOA cost Hamiltonian term.

Using qp.Projector won’t work in qp.qaoa.cost_layer. So, you can try to create a method that returns the relevant penalty and add that to the problem Hamiltonian. Try it out, and thanks again for your question! I’d be curious to hear what happens.

Best,

David

Okay great, thank you!