Skip to content
This repository has been archived by the owner on Jan 26, 2023. It is now read-only.

Commit

Permalink
Fix 0.2.1 --> 0.2.2
Browse files Browse the repository at this point in the history
Subsampler kwargs passed down
  • Loading branch information
bellert committed Feb 9, 2018
1 parent 90d0b4d commit c5e58d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions python/dwave_qbsolv/dimod_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class QBSolv(dimod.TemplateSampler):
@dimod.decorators.qubo_index_labels(1)
def sample_qubo(self, Q, num_repeats=50, seed=None, algorithm=None,
verbosity=-1, timeout=2592000, solver_limit=None, solver=None,
target=None, find_max=False):
target=None, find_max=False, **sample_kwargs):
"""Sample low-energy states defined by a QUBO using qbsolv.
Note:
Expand Down Expand Up @@ -80,7 +80,7 @@ def sample_qubo(self, Q, num_repeats=50, seed=None, algorithm=None,
# pose the QUBO to qbsolv
samples, counts = run_qbsolv(Q=Q, num_repeats=num_repeats, seed=seed, algorithm=algorithm,
verbosity=verbosity, timeout=timeout, solver_limit=solver_limit,
solver=solver, target=target, find_max=find_max)
solver=solver, target=target, find_max=find_max, sample_kwargs=sample_kwargs)

# load the response
response = dimod.BinaryResponse()
Expand Down
4 changes: 2 additions & 2 deletions python/dwave_qbsolv/qbsolv_binding.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ log = logging.getLogger(__name__)

def run_qbsolv(Q, num_repeats=50, seed=17932241798878, verbosity=-1,
algorithm=None, timeout=2592000, solver_limit=None,
solver=None, target=None, find_max=False):
solver=None, target=None, find_max=False, sample_kwargs={}):
"""Entry point to `solve` method in the qbsolv library.
Arguments are described in the dimod wrapper.
Expand Down Expand Up @@ -62,7 +62,7 @@ def run_qbsolv(Q, num_repeats=50, seed=17932241798878, verbosity=-1,
params.sub_sampler = &solver_callback

def dimod_callback(Q, best_state):
result = solver.sample_qubo(Q)
result = solver.sample_qubo(Q, **sample_kwargs)
sample = next(result.samples())
for key, value in sample.items():
best_state[key] = value
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def build_extensions(self):

setup(
name='dwave_qbsolv',
version='0.2.1',
version='0.2.2',
packages=packages,
install_requires=['dimod>=0.3.1', 'cython'],
ext_modules=cythonize(extensions, language='c++'),
Expand Down

0 comments on commit c5e58d5

Please sign in to comment.