Giter Club home page Giter Club logo

Comments (9)

rsln-s avatar rsln-s commented on June 9, 2024

@jmlarson1, thank you for raising this issue!

This is indeed a bug as the support for Qiskit simulation leveraging the parameterized QAOA circuit appears to have been lost. Somehow, this has escaped our test coverage, which is unfortunate.

The short of it is that simply instantiating parameterized QAOA circuit and passing it to get_qaoa_objective should work.

We will aim to resolve this soon (though possibly after the holidays).

from qokit.

jmlarson1 avatar jmlarson1 commented on June 9, 2024

Many of us, including @Shagun-G are interested in having this functionality

from qokit.

rsln-s avatar rsln-s commented on June 9, 2024

@jmlarson1 @Shagun-G @mmenickelly:
I added a quick hot fix in #30 that should address your needs. Here is a quick test that the implementation is correct:

import numpy as np
from qokit.parameter_utils import get_best_known_parameters_for_LABS_wrt_overlap_for_p
from qokit.qaoa_objective_labs import get_qaoa_labs_objective

N = 7
p = 8
gamma, beta = get_best_known_parameters_for_LABS_wrt_overlap_for_p(N, p)

f1 = get_qaoa_labs_objective(N, p, parameterization="gamma beta", simulator="auto")
f2 = get_qaoa_labs_objective(N, p, parameterization="gamma beta", simulator="qiskit")

assert np.isclose(f1(gamma, beta), f2(gamma, beta))

from qokit.

jmlarson1 avatar jmlarson1 commented on June 9, 2024

Thank you. I need to try a different build because I get an error:

Traceback (most recent call last):
  File "/home/jlarson/QOKit/ruslan_rocks.py", line 2, in <module>
    from qokit.parameter_utils import get_best_known_parameters_for_LABS_wrt_overlap_for_p
  File "/home/jlarson/QOKit/qokit/__init__.py", line 6, in <module>
    from .qaoa_objective import get_qaoa_objective
  File "/home/jlarson/QOKit/qokit/qaoa_objective.py", line 10, in <module>
    import numba.cuda
  File "/home/jlarson/.local/lib/python3.10/site-packages/numba/__init__.py", line 55, in <module>
    _ensure_critical_deps()
  File "/home/jlarson/.local/lib/python3.10/site-packages/numba/__init__.py", line 42, in _ensure_critical_deps
    raise ImportError("Numba needs NumPy 1.24 or less")
ImportError: Numba needs NumPy 1.24 or less

from qokit.

rsln-s avatar rsln-s commented on June 9, 2024

I would suggest trying to re-install from source in a clean venv/conda environment.

from qokit.

rsln-s avatar rsln-s commented on June 9, 2024

@jmlarson1 was your issue resolved by #30?

from qokit.

jmlarson1 avatar jmlarson1 commented on June 9, 2024

Yes! The example works for me. Thank you.

Is there some obvious way to pass the desired number of shots to the get_qaoa_labs_objective method? f1(gamma, beta, shots=1000) would be nice, and would seem to match qokit/qaoa_circuit_portfolio.py where one can
execute(circuit, backend, shots=n_trials).

But that doesn't work (and I don't even see that kwargs are passed to get_qaoa_labs_objective).

from qokit.

rsln-s avatar rsln-s commented on June 9, 2024

The simulator does not support emulating shot-based noise. Only exact expectation value is returned currently.

from qokit.

jmlarson1 avatar jmlarson1 commented on June 9, 2024

That is understandable. Is there a shot-based get_qaoa_labs_objective (without a simulator, perhaps)?

from qokit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.