Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vqe][scipy_minimizer] Add argument to input x0 value #43

Open
gyu-don opened this issue Feb 2, 2019 · 1 comment
Open

[vqe][scipy_minimizer] Add argument to input x0 value #43

gyu-don opened this issue Feb 2, 2019 · 1 comment

Comments

@gyu-don
Copy link
Contributor

gyu-don commented Feb 2, 2019

Now, scipy optimizer wrapper set randomized parameter as x0 value.
However, user may know better initial value.

@gyu-don
Copy link
Contributor Author

gyu-don commented Sep 5, 2019

In current implementation of blueqat.vqe, when minimizer is called, a number of parameters is passed to minimizer.
This behaviour is reasonable if user doesn't know the detail of the ansatz.
However, if user knows the ansatz and wants to adjust parameters, this behaviour is inconvenient.

There are some ad-hoc workarounds.
Ignoring n_params is one of an easy workaround.

class ScipyMinimizer:
    def __init__(self, **kwargs):
        self.minimizer_options = kwargs
        self.params = [random.random() for _ in range(n_params)]
    def set_params(self, params):
        self.params = params
    def __call__(self, objective, n_params):
        assert n_params == len(self.params)
        reslt = scipy.optimize.minimize(objective, self.params, **self.minimizer_options)
        return result.x

But I have no idea for permanent measures for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant