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

Bug fix in vqe_run when disp = True #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions grove/pyqaoa/maxcut_qaoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def maxcut_qaoa(graph, steps=1, rand_seed=None, connection=None, samples=None,
:param minimizer_kwargs: (Optional. Default=None). Minimizer optional arguments. If None set to
``{'method': 'Nelder-Mead', 'options': {'ftol': 1.0e-2, 'xtol': 1.0e-2, 'disp': False}``
:param vqe_option: (Optional. Default=None). VQE optional arguments. If None set to
``vqe_option = {'disp': print_fun, 'return_all': True, 'samples': samples}``
``vqe_option = {'disp': True, 'return_all': True, 'samples': samples}``

"""
if not isinstance(graph, nx.Graph) and isinstance(graph, list):
Expand All @@ -68,7 +68,7 @@ def maxcut_qaoa(graph, steps=1, rand_seed=None, connection=None, samples=None,
'options': {'ftol': 1.0e-2, 'xtol': 1.0e-2,
'disp': False}}
if vqe_option is None:
vqe_option = {'disp': print, 'return_all': True,
vqe_option = {'disp': True, 'return_all': True,
'samples': samples}

qaoa_inst = QAOA(connection, list(graph.nodes()), steps=steps, cost_ham=cost_operators,
Expand Down
2 changes: 1 addition & 1 deletion grove/pyvqe/vqe.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def vqe_run(self, variational_state_evolve, hamiltonian, initial_params,
returned if 'return_all=True' is set as a
vqe_run() option.
"""
self._disp_fun = disp if disp is not None else lambda x: None
self._disp_fun = print if disp is True else lambda x: None
iteration_params = []
expectation_vals = []
self._current_expectation = None
Expand Down