diff --git a/dwave/cloud/solver.py b/dwave/cloud/solver.py index 8f24b92a..9a54bf06 100644 --- a/dwave/cloud/solver.py +++ b/dwave/cloud/solver.py @@ -53,9 +53,6 @@ class Solver(object): """ - # Special flag to notify the system a solver needs access to special hardware - _PARAMETER_ENABLE_HARDWARE = 'use_hardware' - # Classes of problems the remote solver has to support (at least one of these) # in order for `Solver` to be able to abstract, or use, that solver _HANDLED_PROBLEM_TYPES = {"ising", "qubo"} @@ -126,11 +123,6 @@ def __init__(self, client, data): # Create a set of default parameters for the queries self._params = {} - # As a heuristic to guess if this is a hardware sampler check if - # the 'annealing_time_range' property is set. - if 'annealing_time_range' in self.properties: - self._params[self._PARAMETER_ENABLE_HARDWARE] = True - def __repr__(self): return "Solver(id={!r})".format(self.id) @@ -259,7 +251,7 @@ def _sample(self, type_, linear, quadratic, params): # Check the parameters before submitting for key in combined_params: - if key not in self.parameters and key != self._PARAMETER_ENABLE_HARDWARE: + if key not in self.parameters and not key.startswith('x_'): raise KeyError("{} is not a parameter of this solver.".format(key)) body = json.dumps({ diff --git a/tests/test_solver.py b/tests/test_solver.py index e745b1ed..a9174d23 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -14,7 +14,7 @@ from dwave.cloud.utils import evaluate_ising from dwave.cloud.qpu import Client -from dwave.cloud.exceptions import CanceledFutureError +from dwave.cloud.exceptions import CanceledFutureError, SolverFailureError import dwave.cloud.computation from tests import config @@ -44,6 +44,14 @@ def test_submit_invalid_parameter(self): with self.assertRaises(KeyError): solver.sample_ising({}, {}, not_a_parameter=True) + def test_submit_experimental_parameter(self): + """Ensure that the experimental parameters are populated.""" + with Client(**config) as client: + solver = client.get_solver() + assert 'x_test' not in solver.parameters + with self.assertRaises(SolverFailureError): + self.assertTrue(solver.sample_ising([0], {}, x_test=123).result()) + def test_read_connectivity(self): """Ensure that the edge set is populated.""" with Client(**config) as client: