Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Ripper committed May 28, 2024
1 parent 6ce2db9 commit 2c4ac44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/QAOA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ function retrieve(
backend = qiskit_aer.AerSimulator.from_backend(backend)
end

ising_hamiltonian = quadratic_program(sampler)
ising_qp = quadratic_program(sampler)
ising_hamiltonian = ising_qp[0]
ansatz = qiskit.circuit.library.QAOAAnsatz(
ising_hamiltonian,
reps = num_layers
Expand Down
5 changes: 2 additions & 3 deletions src/VQE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function QUBODrivers.sample(sampler::Optimizer{T}) where {T}
"evals" => Vector{Float64}(),
)

retrieve(sampler) do result, sample_results, qp_offset
retrieve(sampler) do result, sample_results
if MOI.get(sampler, MOI.ObjectiveSense()) == MOI.MAX_SENSE
α = -α
end
Expand Down Expand Up @@ -116,7 +116,6 @@ function retrieve(

ising_qp = quadratic_program(sampler)
ising_hamiltonian = ising_qp[0]
qp_offset = ising_qp[1]
ansatz = ansatz_instance(num_qubits = num_qubits)

# pass manager for the quantum circuit (optimize the circuit for the target device)
Expand Down Expand Up @@ -163,7 +162,7 @@ function retrieve(
sampling_result = qiskit_sampler.run(pylist([optimized_qc])).result()[0]
samples = sampling_result.data.meas.get_counts()

callback(result, samples, qp_offset)
callback(result, samples)

return nothing
end
Expand Down

0 comments on commit 2c4ac44

Please sign in to comment.