From 2c4ac445de88c19940d51a76bee90c3178299bad Mon Sep 17 00:00:00 2001 From: Pedro Ripper Date: Tue, 28 May 2024 00:32:00 -0300 Subject: [PATCH] More fixes --- src/QAOA.jl | 3 ++- src/VQE.jl | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/QAOA.jl b/src/QAOA.jl index 0f16449..3e14343 100644 --- a/src/QAOA.jl +++ b/src/QAOA.jl @@ -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 diff --git a/src/VQE.jl b/src/VQE.jl index 83151e1..86c4a4a 100644 --- a/src/VQE.jl +++ b/src/VQE.jl @@ -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 @@ -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) @@ -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