Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Ripper committed May 28, 2024
1 parent c6d4010 commit a8a9c6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/QAOA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ function QUBODrivers.sample(sampler::Optimizer{T}) where {T}
)

retrieve(sampler) do result, sample_results
if MOI.get(sampler, MOI.ObjectiveSense()) == MOI.MAX_SENSE
α = -α
end

for key in sample_results.keys()
state = reverse(parse.(Int,split(pyconvert.(String, key),"")))
Expand Down
3 changes: 3 additions & 0 deletions src/VQE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ function QUBODrivers.sample(sampler::Optimizer{T}) where {T}
)

retrieve(sampler) do result, sample_results, qp_offset
if MOI.get(sampler, MOI.ObjectiveSense()) == MOI.MAX_SENSE
α = -α
end

for key in sample_results.keys()
state = reverse(parse.(Int,split(pyconvert.(String, key),"")))
Expand Down

0 comments on commit a8a9c6a

Please sign in to comment.