diff --git a/QHyper/.github/workflows/release.yaml b/QHyper/.github/workflows/release.yaml new file mode 100644 index 0000000..5a0bce6 --- /dev/null +++ b/QHyper/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +name: Release to PyPI + +on: + push: + branches: + - production + +jobs: + pypi-build-and-publish: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build + run: | + python setup.py sdist bdist_wheel + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/QHyper/.github/workflows/tests.yaml b/QHyper/.github/workflows/tests.yaml new file mode 100644 index 0000000..7296254 --- /dev/null +++ b/QHyper/.github/workflows/tests.yaml @@ -0,0 +1,25 @@ +name: Test Knapsack + +on: push + +jobs: + test_knapsack: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements/dev.txt + + - name: Run pytest tests + run: | + pytest diff --git a/QHyper/.gitignore b/QHyper/.gitignore new file mode 100644 index 0000000..47a981a --- /dev/null +++ b/QHyper/.gitignore @@ -0,0 +1,18 @@ +venv/ +__pycache__/ +.ipynb_checkpoints/ +checkpoint.pth +.vscode + +docs/build +docs/source/generated/ + +paper + +.idea +/.idea + +/build/ +/dist/ +*.egg-info/ +.DS_Store diff --git a/QHyper/.readthedocs.yaml b/QHyper/.readthedocs.yaml new file mode 100644 index 0000000..d2aea1c --- /dev/null +++ b/QHyper/.readthedocs.yaml @@ -0,0 +1,28 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-24.04 + tools: + python: "3.12" + apt_packages: + - graphviz + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/source/conf.py + fail_on_warning: true + +# If using Sphinx, optionally build your docs in additional formats such as PDF +# formats: +# - pdf + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: requirements/dev.txt diff --git a/QHyper/LICENSE.txt b/QHyper/LICENSE.txt new file mode 100644 index 0000000..586a067 --- /dev/null +++ b/QHyper/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022-2025 ACC Cyfronet AGH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/QHyper/QHyper/__init__.py b/QHyper/QHyper/__init__.py new file mode 100644 index 0000000..24c1a89 --- /dev/null +++ b/QHyper/QHyper/__init__.py @@ -0,0 +1,7 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + +""" +API reference documentation for QHyper. +""" diff --git a/QHyper/QHyper/constraint.py b/QHyper/QHyper/constraint.py new file mode 100644 index 0000000..dc3f520 --- /dev/null +++ b/QHyper/QHyper/constraint.py @@ -0,0 +1,125 @@ +"""This module contains the Constraint class which is used to represent a, well, +constraint. It is used in the QUBO formulation to define the left and right +hand sides of the constraints, and the operator. + +.. rubric:: Main class + +.. autosummary:: + :toctree: generated + + Constraint -- implementation of the constraint. + +.. rubric:: Enum Classes + +.. autoclass:: MethodsForInequalities + + +.. rubric:: Functions + +.. autofunction:: get_number_of_constraints + +""" + +import uuid +from enum import Enum + +from QHyper.polynomial import Polynomial, PolynomialType + + +class MethodsForInequalities(Enum): + """Enum class with different methods for handling inequalities. + + There are two available methods for handling inequalities: + .. list-table:: + + * - SLACKS_LOG_2 + - UNBALANCED_PENALIZATION + * - the method uses slack variables in number of log2(n) + - the method uses unbalanced penalization + """ + SLACKS_LOG_2 = 0 + UNBALANCED_PENALIZATION = 1 + + +SLACKS_LOG_2 = MethodsForInequalities.SLACKS_LOG_2 +UNBALANCED_PENALIZATION = MethodsForInequalities.UNBALANCED_PENALIZATION + + +class Operator(Enum): + """Enum class with different operators. + """ + EQ = "==" + GE = ">=" + LE = "<=" + + +class Constraint: + """ + A class representing the constraint. + + Attributes + ---------- + lhs : PolynomialType + The left-hand side of the constraint. + rhs : PolynomialType, default 0 + The right-hand side of the constraint. + operator : Operator, default Operator.EQ + The operator of the constraint. It can be ==, >=, <=. + method_for_inequalities : MethodsForInequalities, optional + The method to be used for inequalities. It can be SLACKS_LOG_2 or + UNBALANCED_PENALIZATION. It is required when the operator is not ==. + label : str, optional + The label of the constraint. If not provided, it will be set to a + random string. + group : int, default -1 + The group of the constraint. It is used to group constraints together. + Example use is assigning same weight to the constraints with the same + group when creating qubo. + """ + + def __init__( + self, + lhs: PolynomialType, + rhs: PolynomialType = 0, + operator: Operator = Operator.EQ, + method_for_inequalities: MethodsForInequalities | None = None, + label: str = "", + group: int = -1, + ) -> None: + self.lhs = lhs if isinstance(lhs, Polynomial) else Polynomial(lhs) + self.rhs = rhs if isinstance(rhs, Polynomial) else Polynomial(rhs) + self.operator: Operator = operator + + if operator != Operator.EQ and method_for_inequalities is None: + raise Exception( + "Method for inequalities must be " + "provided when operator is not ==" + ) + self.method_for_inequalities = method_for_inequalities + self._set_label(label) + self.group = group + + def _set_label(self, label: str) -> None: + self.label = label or f"s{uuid.uuid4().hex}" + + def __repr__(self) -> str: + return f"{self.lhs} {self.operator.value} {self.rhs}" + + def get_variables(self) -> set[str]: + return self.lhs.get_variables() | self.rhs.get_variables() + + +def get_number_of_constraints(constraints: list[Constraint]) -> int: + """Returns the number of unique groups in the constraints list. + """ + + counter = 0 + visited = set() + + for c in constraints: + if c.group == -1: + counter += 1 + elif c.group not in visited: + visited.add(c.group) + counter += 1 + return counter diff --git a/QHyper/QHyper/converter.py b/QHyper/QHyper/converter.py new file mode 100644 index 0000000..d4ed691 --- /dev/null +++ b/QHyper/QHyper/converter.py @@ -0,0 +1,253 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +"""This module contains the Converter class with static methods for converting Problem objects to different formats. + +To use different solvers, but with the same Problem representation, some form +of conversion is needed. This module provides methods for converting Problem +objects to ConstrainedQuadraticModel, DiscreteQuadraticModel, and QUBO formats. + +.. autosummary:: + :toctree: generated + + Converter + +""" + + +from typing import cast + +import dimod +import re +import warnings +from dimod import ConstrainedQuadraticModel, DiscreteQuadraticModel +from QHyper.polynomial import Polynomial +from QHyper.constraint import ( + Constraint, SLACKS_LOG_2, UNBALANCED_PENALIZATION, Operator) +from QHyper.problems.base import Problem +import numpy as np + + +class ProblemWarning(Warning): + pass + + +class Converter: + @staticmethod + def calc_slack_coefficients(constant: int) -> list[int]: + num_slack = int(np.floor(np.log2(constant))) + slack_coefficients = [2**j for j in range(num_slack)] + if constant - 2**num_slack >= 0: + slack_coefficients.append(constant - 2**num_slack + 1) + return slack_coefficients + + @staticmethod + def use_slacks(const: int | float, label: str) -> Polynomial: + if const <= 0 or not int(const) == const: + raise ValueError("Const must be a positive integer") + const = int(const) + slack_coefficients = Converter.calc_slack_coefficients(const) + + return Polynomial( + {(f"{label}_{i}",): v + for i, v in enumerate(slack_coefficients)} + ) + + @staticmethod + def apply_slacks( + constraint: Constraint, weight: list[float] + ) -> Polynomial: + if len(weight) != 1: + raise ValueError("Weight must be a list of length 1") + + rhs_without_const, rhs_const = constraint.rhs.separate_const() + + lhs = constraint.lhs - rhs_without_const + slacks = Converter.use_slacks(rhs_const, constraint.label) + + return weight[0] * (lhs + slacks - rhs_const) ** 2 + + @staticmethod + def use_unbalanced_penalization( + constraint: Constraint, weight: list[float] + ) -> Polynomial: + lhs = constraint.lhs - constraint.rhs + return weight[0]*lhs + weight[1]*lhs**2 + + @staticmethod + def assign_penalty_weights_to_constraints( + constraints_weights: list[float], constraints: list[Constraint] + ) -> list[tuple[list[float], Constraint]]: + weights_constraints_list = [] + idx = 0 + group_to_weight: dict[int, list[float]] = {} + for constraint in constraints: + if constraint.method_for_inequalities == UNBALANCED_PENALIZATION: + if constraint.group == -1: + weights = constraints_weights[idx: idx + 2] + idx += 2 + elif constraint.group in group_to_weight: + weights = group_to_weight[constraint.group] + else: + weights = constraints_weights[idx: idx + 2] + group_to_weight[constraint.group] = weights + idx += 2 + + weights_constraints_list.append( + (weights, constraint) + ) + else: + if constraint.group == -1: + weights = [constraints_weights[idx]] + idx += 1 + elif constraint.group in group_to_weight: + weights = group_to_weight[constraint.group] + else: + weights = [constraints_weights[idx]] + group_to_weight[constraint.group] = weights + idx += 1 + weights_constraints_list.append((weights, constraint)) + return weights_constraints_list + + @staticmethod + def create_qubo(problem: Problem, penalty_weights: list[float]) -> Polynomial: + of_weight = penalty_weights[0] if len(penalty_weights) else 1 + result = float(of_weight) * problem.objective_function + + constraints_penalty_weights = penalty_weights[1:] + for weight, constraint in Converter.assign_penalty_weights_to_constraints( + constraints_penalty_weights, problem.constraints + ): + if constraint.operator == Operator.EQ: + result += float(weight[0]) * ( + constraint.lhs - constraint.rhs) ** 2 + continue + + lhs = constraint.lhs - constraint.rhs + if constraint.operator == Operator.GE: + lhs = -lhs + + if constraint.method_for_inequalities == SLACKS_LOG_2: + result += Converter.apply_slacks(constraint, weight) + elif (constraint.method_for_inequalities + == UNBALANCED_PENALIZATION): + result += Converter.use_unbalanced_penalization( + constraint, weight + ) + return result + + @staticmethod + def to_cqm(problem: Problem) -> ConstrainedQuadraticModel: + binary_polynomial = dimod.BinaryPolynomial( + problem.objective_function.terms, dimod.BINARY + ) + cqm = dimod.make_quadratic_cqm(binary_polynomial) + + variables = problem.objective_function.get_variables() + for constraint in problem.constraints: + variables.update(constraint.lhs.get_variables()) + + for variable in variables: + cqm.add_variable(dimod.BINARY, str(variable)) + + for i, constraint in enumerate(problem.constraints): + lhs = [tuple([*key, value]) + for key, value in constraint.lhs.terms.items()] + cqm.add_constraint(lhs, constraint.operator.value, label=i) + + return cqm + + @staticmethod + def to_dimod_qubo(problem: Problem, lagrange_multiplier: float = 10 + ) -> tuple[dict[tuple[str, ...], float], float]: + cqm = Converter.to_cqm(problem) + bqm, _ = dimod.cqm_to_bqm( + cqm, lagrange_multiplier=lagrange_multiplier) + return cast(tuple[dict[tuple[str, ...], float], float], + bqm.to_qubo()) # (qubo, offset) + + @staticmethod + def to_dqm(problem: Problem, cases: int = 1) -> DiscreteQuadraticModel: + """ + Convert problem to DQM format. + + Attributes + ---------- + problem : Problem + The problem to be solved. Objective funtion variables + should be written in the format (e.g. x10, yz1). + cases: int, default 1 + Number of variable cases (values) + 1 is denoting binary variable. + """ + + def binary_to_discrete(v: str) -> str: + for i in range(len(v)): + if v[i].isdigit(): + break + + prefix = v[:i] + numeric_part = v[i:] + + discrete_id = int(numeric_part) // cases + new_v = prefix + str(discrete_id) + + return new_v + + def extract_number(element) -> int: + match = re.search(r'(\d+)', element) + prefix = element[:match.start()] + number = int(match.group(1)) + + return (prefix, number) + + if problem.constraints: + warnings.warn( + "Defined problem has constraints. DQM does not support" + " constraints, it only supports objective functions!", + ProblemWarning + ) + + pattern = re.compile(r'^[a-zA-Z]+\d+$') + for variable in problem.objective_function.get_variables(): + if not pattern.match(variable): + raise ValueError( + f"Objective funtion variable '{variable}'" + "should be written in the format (e.g. x10, yz1)." + ) + + dqm = dimod.DiscreteQuadraticModel() + objective_function_variables = sorted( + problem.objective_function.get_variables(), key=extract_number) + + variables = [ + binary_to_discrete(str(v)) + for v in objective_function_variables[:: cases] + ] + cases_offset = cases == 1 + + for variable in variables: + if variable not in dqm.variables: + dqm.add_variable(cases + cases_offset, variable) + + for vars, bias in problem.objective_function.terms.items(): + s_i, *s_j = vars + x_i = binary_to_discrete(s_i) + xi_idx: int = cast(int, dqm.variables.index(x_i)) + if s_j: + x_j = binary_to_discrete(*s_j) + xj_idx: int = cast(int, dqm.variables.index(x_j)) + dqm.set_quadratic( + dqm.variables[xi_idx], + dqm.variables[xj_idx], + {(case, case): bias for case in range(cases + cases_offset)}, + ) + else: + dqm.set_linear( + dqm.variables[xi_idx], + [bias] * (cases + cases_offset), + ) + + return dqm diff --git a/QHyper/QHyper/optimizers/__init__.py b/QHyper/QHyper/optimizers/__init__.py new file mode 100644 index 0000000..ec7d490 --- /dev/null +++ b/QHyper/QHyper/optimizers/__init__.py @@ -0,0 +1,111 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + +""" +This module contains implementations of different optimizers. +Some of the optimizers are written from scratch based on popular algorithms, +while others are just a wrapper for existing solutions. +No optimizer is imported by deafult to reduce number of dependencies. +To use any optimizer you can import it directly like + +.. code-block:: python + + from QHyper.optimizers.random import Random + +or use function :py:func:`Optimizers.get` with the name of the optimizer. +Any optimizer that is in directory 'QHyper/custom' or 'custom' will be +also available in this function. + +.. rubric:: Optimization result dataclass + +.. autosummary:: + :toctree: generated + + OptimizationResult + OptimizationParameter + +.. rubric:: Interface + +.. autosummary:: + :toctree: generated + + Optimizer + +.. rubric:: Available optimizers + +.. autosummary:: + :toctree: generated + + scipy_minimizer.ScipyOptimizer -- Wrapper for the scipy.optimize.minimize function. + qml_gradient_descent.QmlGradientDescent -- Wrapper for the PennyLane gradient descent optimizers. + cem.CEM -- Cross-entropy method optimizer. + random.Random -- Random search optimizer. + grid_search.GridSearch -- Grid search optimizer. + dummy.Dummy -- Dummy optimizer. + +.. rubric:: Additional functions + +.. autoclass:: Optimizers + :members: + +""" +import copy +from typing import Type, Any + +from QHyper.util import search_for + +from QHyper.optimizers.base import ( # noqa: F401 + Optimizer, OptimizationResult, OptimizerError, OptimizationParameter) # noqa: F401 + +from .dummy import Dummy + + +class Optimizers: + custom_optimizers: None | dict[str, type] = None + + @staticmethod + def get(name: str) -> Type[Optimizer]: + """ + Get Optimizer class by name. + + The optimizer will be available by the 'name' attribute if defined or + by the class name. Letters case doesn't matter. + """ + + if Optimizers.custom_optimizers is None: + Optimizers.custom_optimizers = ( + search_for(Optimizer, 'QHyper/custom') + | search_for(Optimizer, 'custom')) + + name_ = name.lower() + + if name_ in Optimizers.custom_optimizers: + return Optimizers.custom_optimizers[name_] + elif name_ in ["scipy", "scipyminimizer"]: + from .scipy_minimizer import ScipyOptimizer + return ScipyOptimizer + elif name_ in ["random", "randomsearch"]: + from .random import Random + return Random + elif name_ in ["qml", "qmlgradientdescent"]: + from .qml_gradient_descent import QmlGradientDescent + return QmlGradientDescent + elif name_ in ["cem", "crossentropymethod"]: + from .cem import CEM + return CEM + elif name_ in ["grid", "gridsearch"]: + from .grid_search import GridSearch + return GridSearch + elif name_ in ["dummy"]: + return Dummy + else: + raise OptimizerError(f"Optimizer {name} not found") + + +def create_optimizer(config: dict[str, Any]) -> Optimizer: + config_ = copy.deepcopy(config) + opt_type = config_.pop('type') + + optimizer_class = Optimizers.get(opt_type) + return optimizer_class(**config_) diff --git a/QHyper/QHyper/optimizers/base.py b/QHyper/QHyper/optimizers/base.py new file mode 100644 index 0000000..b8853e2 --- /dev/null +++ b/QHyper/QHyper/optimizers/base.py @@ -0,0 +1,182 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +import abc +import dataclasses + +from abc import abstractmethod + +from typing import Callable +from typing_extensions import Self + + +@dataclasses.dataclass +class OptimizationParameter: + """ + Dataclass for storing bounds, steps and init values for parameters + that might be optimized. Most of the time some of this values are not + required, but it depends on the chosen optimization algorithm. + Check the documentation of the chosen algorithm to see which values are + required. + + Attributes + ---------- + min : list[float] + List of minimum values for each parameter. + max : list[float] + List of maximum values for each parameter. + step : list[float] + List of step values for each parameter. Used for example in the grid + search algorithm. For 0-th parameter the following values will be + generated: min[0], min[0] + step[0], min[0] + 2*step[0], ... + init : list[float] + List of initial values for each parameter. Some algorithms require + starting point to be set. + """ + + min: list[float] = dataclasses.field(default_factory=list) + max: list[float] = dataclasses.field(default_factory=list) + step: list[float] = dataclasses.field(default_factory=list) + init: list[float] = dataclasses.field(default_factory=list) + + def __post_init__(self) -> None: + self.min = list(self.min) + self.max = list(self.max) + self.step = list(self.step) + self.init = list(self.init) + + def assert_bounds(self) -> None: + """Check if bounds are correctly set. + """ + + if not self.min: + raise ValueError("Min bounds are required") + if not self.max: + raise ValueError("Max bounds are required") + if len(self.min) != len(self.max): + raise ValueError("Min and Max bounds must have the same length") + + def assert_step(self) -> None: + """Check if steps are correctly set. + """ + self.assert_bounds() + if len(self.step) == 0: + raise ValueError("Steps are required") + if len(self.min) != len(self.step): + raise ValueError("Steps must have the same length as bounds") + + def assert_init(self) -> None: + """Check if init values are correctly set. + """ + if len(self.init) == 0: + raise ValueError("Init are required") + + def assert_bounds_init(self) -> None: + """Check if bounds and init values are correctly set. + """ + self.assert_bounds() + self.assert_init() + if len(self.min) != len(self.init): + raise ValueError("Init must have the same length as bounds") + + def __add__(self, other: Self) -> 'OptimizationParameter': + min_ = self.min + other.min + max_ = self.max + other.max + step_ = self.step + other.step + init_ = self.init + other.init + return OptimizationParameter(min_, max_, step_, init_) + + def __len__(self) -> int: + if self.min: + return len(self.min) + if self.max: + return len(self.max) + if self.init: + return len(self.init) + return 0 + + def update(self, + min: list[float] | None = None, + max: list[float] | None = None, + step: list[float] | None = None, + init: list[float] | None = None) -> 'OptimizationParameter': + if min is None: + min = self.min.copy() + if max is None: + max = self.max.copy() + if step is None: + step = self.step.copy() + if init is None: + init = self.init.copy() + return OptimizationParameter(min, max, step, init) + + @property + def bounds(self) -> list[tuple[float, float]]: + return list(zip(self.min, self.max)) + + +class OptimizerError(Exception): + """ + Base class for exceptions in this module. + """ + ... + + +@dataclasses.dataclass +class OptimizationResult: + """ + Dataclass for storing the results of an optimization run. + + Attributes + ---------- + value : float + The minimum function value found by the optimization algorithm. + params : list[float] + The optimal point (function arguments) found by the optimization + algorithm. + history : list[list[OptimizationResult]] + The history of the optimization algorithm. Each element of the list + represents the results of the objective function at each + iteration - there can be multiple results per each iteration (epoch). + """ + + value: float + params: list[float] + history: list[list['OptimizationResult']] = dataclasses.field( + default_factory=list) + + +class Optimizer(abc.ABC): + """ + Base class for Optimizer. + + """ + + @abstractmethod + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter + ) -> OptimizationResult: + """ + Method that minimizes the given function using the + implemented optimization algorithm. + This method has to be implemented by the subclass. + + Parameters + ---------- + func : Callable[[list[float]], OptimizationResult] + The objective function to be minimized. + init : OptimizationParameter + The initial parameter for the optimization algorithm. + The required fields are defined by subclass. + + Returns + ------- + OptimizationResult + Result contains the minimum function value, the + corresponding optimal point, and the history of + the optimization. + """ diff --git a/QHyper/QHyper/optimizers/basinhopping.py b/QHyper/QHyper/optimizers/basinhopping.py new file mode 100644 index 0000000..947edf6 --- /dev/null +++ b/QHyper/QHyper/optimizers/basinhopping.py @@ -0,0 +1,85 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from scipy.optimize import basinhopping +import numpy as np +import numpy.typing as npt +from typing import Callable, Any + +from QHyper.optimizers import Optimizer + + +class Basinhopping(Optimizer): + """ + Class for the Basin-hopping algorithm for global optimization. + + Parameters + ---------- + bounds : list[tuple[float, float]] + A list of tuples specifying the lower and upper bounds for each dimension of the search space. + niter : int + The number of basin-hopping iterations to perform. + maxfun : int, optional + Maximum number of function evaluations. + Default is 200. + config : dict, optional + Additional configuration options for the basinhopping function. + Default is an empty dictionary. + + Attributes + ---------- + niter : int + The number of basin-hopping iterations to perform. + maxfun : int + Maximum number of function evaluations. + bounds : numpy.ndarray + An array of shape (n, 2) specifying the lower and upper bounds for each dimension of the search space. + config : dict + Additional configuration options for the basinhopping function. + """ + def __init__( + self, + bounds: list[tuple[float, float]], + niter: int, + maxfun: int = 200, + config: dict[str, Any] = {} + ) -> None: + self.niter = niter + self.maxfun = maxfun + self.bounds = np.array(bounds) + self.config = config + + def minimize( + self, + func: Callable[[npt.NDArray[np.float64]], float], + init: npt.NDArray[np.float64] + ) -> tuple[float, npt.NDArray[np.float64]]: + """ + Minimize the given function using the Basin-hopping algorithm. + + Parameters + ---------- + func : callable + The objective function to be minimized. + The function should take a single argument, which is a NumPy array of type np.float64, + and return a float value. + init : numpy.ndarray + The initial point for the optimization algorithm. + The array should have dtype np.float64. + + Returns + ------- + tuple + A tuple containing the minimum function value and the corresponding optimal point. + """ + raise NotImplementedError('Basinhopping will be changed in the future') + result = basinhopping( + func, init.flatten(), niter=self.niter, + minimizer_kwargs={ + 'options': {'maxfun': self.maxfun}, + 'bounds': self.bounds + }, **self.config) + + return result.fun, np.array(result.x).reshape(init.shape) diff --git a/QHyper/QHyper/optimizers/cem.py b/QHyper/QHyper/optimizers/cem.py new file mode 100644 index 0000000..5aa67e7 --- /dev/null +++ b/QHyper/QHyper/optimizers/cem.py @@ -0,0 +1,148 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from typing import Callable + +import numpy as np +from numpy.typing import NDArray + +from QHyper.optimizers.util import run_parallel + +from QHyper.optimizers.base import ( + Optimizer, OptimizationResult, OptimizerError, OptimizationParameter) + + +class CEM(Optimizer): + """Implementation of the Cross Entropy Method for hyperparameter tuning + + The Cross Entropy Method is a stochastic optimization algorithm that + iteratively samples candidate solutions from a multivariate normal + distribution. The mean and covariance of the distribution are updated + based on the best samples from the previous iteration. + This alogrithm requries the following parameters to be set: + - `min` and `max` bounds for each parameter + - `init` initial values for each parameter + + + Attributes + ---------- + verbose : bool, default False + Whether to print the optimization progress. + disable_tqdm : bool, default True + Whether to disable the tqdm progress bar. + epochs : int, default 5 + The number of epochs. + samples_per_epoch : int, default 100 + The number of samples per epoch. + elite_frac : float, default 0.1 + The fraction of elite samples that will be used to update the + mean and covariance for next epoch. + processes : int, default 1 + The number of processes to use for parallel computation. + n_elite : int + The number of elite samples. Calculated as + `samples_per_epoch * elite_frac`. + """ + + verbose: bool + disable_tqdm: bool + epochs: int + samples_per_epoch: int + elite_frac: float + processes: int + n_elite: int + + def __init__( + self, + verbose: bool = False, + disable_tqdm: bool = True, + epochs: int = 5, + samples_per_epoch: int = 100, + elite_frac: float = 0.1, + processes: int = 1, + ) -> None: + """ + Parameters + ---------- + + bounds : numpy.ndarray + verbose : bool, default False + disable_tqdm : bool, default True + epochs : int, default 5 + samples_per_epoch : int, default 100 + elite_frac : float, default 0.1 + processes : int, default 1 + """ + + self.verbose = verbose + self.disable_tqdm = disable_tqdm + self.epochs = epochs + self.samples_per_epoch = samples_per_epoch + self.elite_frac = elite_frac + self.processes = processes + + self.n_elite: int = max( + int(self.samples_per_epoch * self.elite_frac), 1) + + def _get_points( + self, mean: NDArray, cov: NDArray, init: OptimizationParameter + ) -> NDArray: + # TODO + hyperparams: list[NDArray] = [] + bounds = np.array(init.bounds) + + while len(hyperparams) < self.samples_per_epoch: + point = np.random.multivariate_normal(mean, cov) + if ( + (bounds[:, 0] <= point).all() + and (point < bounds[:, 1]).all() + ): + hyperparams.append(point) + + return np.vstack(hyperparams) + + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter, + ) -> OptimizationResult: + init.assert_bounds_init() + + mean = np.array(init.init) + cov = np.identity(len(mean)) + best_hyperparams = init.init + best_result = OptimizationResult(np.inf, init.init, []) + history: list[list[OptimizationResult]] = [] + + for i in range(self.epochs): + if self.verbose: + print(f'Epoch {i+1}/{self.epochs}') + + hyperparams = self._get_points(mean, cov, init) + results = run_parallel(func, hyperparams, self.processes, + self.disable_tqdm) + + elite_ids = np.array( + [x.value for x in results]).argsort()[:self.n_elite] + + elite_weights = [hyperparams[i].flatten() for i in elite_ids] + elite_weights = hyperparams[elite_ids] + + if self.verbose: + print(f'Values: {sorted([x.value for x in results])}') + + if results[elite_ids[0]].value < best_result.value: + if self.verbose: + print(f'New best result: {results[elite_ids[0]].value}') + + best_hyperparams = hyperparams[elite_ids[0]] + best_result = results[elite_ids[0]] + history.append([OptimizationResult(res.value, params, [[res]]) + for res, params in zip(results, hyperparams)]) + mean = np.mean(elite_weights, axis=0) + cov = np.cov(np.stack((elite_weights), axis=1), bias=True) + + return OptimizationResult( + best_result.value, best_hyperparams, history) diff --git a/QHyper/QHyper/optimizers/dummy.py b/QHyper/QHyper/optimizers/dummy.py new file mode 100644 index 0000000..19be48a --- /dev/null +++ b/QHyper/QHyper/optimizers/dummy.py @@ -0,0 +1,32 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from typing import Callable + +from QHyper.optimizers.base import ( + Optimizer, OptimizationResult, OptimizerError, OptimizationParameter) + + +class Dummy(Optimizer): + """ + Dummy optimizer. + + This optimizer is used as a default optimizer in the case + when no optimizer is selected. It simply evaluates the function. + It requires the initial point to be provided. + + """ + + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter | None, + ) -> OptimizationResult: + if init is None: + raise OptimizerError("Initial point must be provided.") + init.assert_init() + + result = func(init.init) + return OptimizationResult(result.value, result.params, [[result]]) diff --git a/QHyper/QHyper/optimizers/grid_search.py b/QHyper/QHyper/optimizers/grid_search.py new file mode 100644 index 0000000..d178295 --- /dev/null +++ b/QHyper/QHyper/optimizers/grid_search.py @@ -0,0 +1,87 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from typing import Callable +import numpy as np +from numpy.typing import NDArray + +from QHyper.optimizers.util import run_parallel +from QHyper.optimizers.base import ( + OptimizationResult, Optimizer, OptimizerError, OptimizationParameter) + + +class GridSearch(Optimizer): + """ + Grid search optimizer + + The grid search optimizer is a simple optimization algorithm that + searches through the entire parameter space by evaluating the function + at each point. + This alogrithm requries the following parameters to be set: + - `min` and `max` bounds for each parameter + - `step` step values for each parameter + Values for n-th parameter will be generated as: + min[n], min[n] + step[n], min[n] + 2*step[n], ... < max[n] + + Attributes + ---------- + verbose : bool, default False + Whether to print the optimization progress. + disable_tqdm : bool, default True + Whether to disable the tqdm progress bar. + processes : int, default 1 + The number of processes to use for parallel computation. + """ + + verbose: bool + disable_tqdm: bool + processes: int = 1 + + def __init__( + self, + verbose: bool = False, + disable_tqdm: bool = True, + processes: int = 1, + ) -> None: + self.verbose = verbose + self.disable_tqdm = disable_tqdm + self.processes = processes + + def _generate_grid(self, params: OptimizationParameter + ) -> list[list[float]]: + return np.stack( + np.meshgrid( + *[np.arange(min_, max_, step) + for min_, max_, step + in zip(params.min, params.max, params.step)] + ), axis=-1 + ).reshape(-1, len(params)) + + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter | None + ) -> OptimizationResult: + if init is None: + raise OptimizerError("Optimization parameter must be provided.") + init.assert_bounds() + init.assert_step() + + hyperparams = self._generate_grid(init) + results = run_parallel( + func, hyperparams, self.processes, self.disable_tqdm) + min_idx = np.argmin([result.value for result in results]) + + if self.verbose: + print(f"Best result: {results[min_idx].value}") + print(f"Values: {sorted([v.value for v in results])}") + + history = [OptimizationResult(res.value, params, [[res]]) + for res, params in zip(results, hyperparams)] + return OptimizationResult( + value=results[min_idx].value, + params=hyperparams[min_idx], + history=[history] + ) diff --git a/QHyper/QHyper/optimizers/qml_gradient_descent.py b/QHyper/QHyper/optimizers/qml_gradient_descent.py new file mode 100644 index 0000000..601334f --- /dev/null +++ b/QHyper/QHyper/optimizers/qml_gradient_descent.py @@ -0,0 +1,146 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from typing import Callable, Any, Type + +import pennylane as qml +from pennylane import numpy as np + +from QHyper.optimizers.base import ( + Optimizer, OptimizationResult, OptimizerError, OptimizationParameter) + + +QML_GRADIENT_DESCENT_OPTIMIZERS: dict[ + str, Type[qml.GradientDescentOptimizer]] = { + 'adam': qml.AdamOptimizer, + 'adagrad': qml.AdagradOptimizer, + 'rmsprop': qml.RMSPropOptimizer, + 'momentum': qml.MomentumOptimizer, + 'nesterov_momentum': qml.NesterovMomentumOptimizer, + 'sgd': qml.GradientDescentOptimizer, + 'qng': qml.QNGOptimizer, +} + + +class QmlGradientDescent(Optimizer): + """Gradient Descent Optimizer + + This minimizer is a wrapper for gradient descent optimizers + provided by PennyLane. + This alogrithm requries the following parameters to be set: + - `init` initial values for each parameter + + Attributes + ---------- + optimizer : qml.GradientDescentOptimizer + object of class GradientDescentOptimizer or inheriting from this class + steps : int, default 200 + number of optimization steps + stepsize : float, default 0.005 + stepsize for the optimizer + verbose : bool, default False + if set to True, additional information will be printed + """ + + optimizer: qml.GradientDescentOptimizer + steps: int + stepsize: float + verbose: bool + + def __init__( + self, + name: str = 'adam', + steps: int = 200, + stepsize: float = 0.005, + verbose: bool = False, + **kwargs: Any + ) -> None: + """ + Parameters + ---------- + name : str, default 'adam' + name of the gradient descent optimizer provided by PennyLane + steps : int, default 200 + number of optimization steps + stepsize : float, default 0.005 + stepsize for the optimizer + verbose : bool, default False + if set to True, additional information will be printed + **kwargs : Any + Additional arguments that will be passed to the PennyLane + optimizer. More infomation can be found in the PennyLane + documentation. + """ + if name not in QML_GRADIENT_DESCENT_OPTIMIZERS: + raise ValueError( + f'Optimizer {name} not found. ' + 'Available optimizers: ' + f'{list(QML_GRADIENT_DESCENT_OPTIMIZERS.keys())}' + ) + + self.optimizer = QML_GRADIENT_DESCENT_OPTIMIZERS[name]( + stepsize=stepsize, + **kwargs + ) + self.steps = steps + self.verbose = verbose + + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter + ) -> OptimizationResult: + init.assert_init() + if isinstance(self.optimizer, qml.QNGOptimizer): + raise OptimizerError( + 'QNG is not supported via optimizer, use qml_qaoa instead') + + def wrapper(params: list[float]) -> float: + return func(list(params)).value + + cost_history = [] + best_result = float('inf') + best_params = np.array(init.init, requires_grad=True) + params = np.array(init.init, requires_grad=True) + + if hasattr(self.optimizer, 'reset'): + self.optimizer.reset() # type: ignore + for i in range(self.steps): + params, cost = self.optimizer.step_and_cost(wrapper, params) + params = np.array(params, requires_grad=True) + + if cost < best_result: + best_params = params + best_result = cost + cost_history.append(OptimizationResult(float(cost), params)) + + if self.verbose: + print(f'Step {i+1}/{self.steps}: {float(cost)}') + + return OptimizationResult(best_result, best_params, [cost_history]) + + def minimize_expval_func( + self, func: qml.QNode, init: OptimizationParameter + ) -> OptimizationResult: + """ + Used in :py:class:`.QML_QAOA` to minimize the + expectation value function. + """ + + cost_history = [] + cost = float('inf') + params = np.array(init.init, requires_grad=True) + if hasattr(self.optimizer, 'reset'): + self.optimizer.reset() # type: ignore + for i in range(self.steps): + params, cost = self.optimizer.step_and_cost(func, params) + params = np.array(params, requires_grad=True) + + cost_history.append(OptimizationResult(float(cost), params)) + + if self.verbose: + print(f'Step {i+1}/{self.steps}: {float(cost)}') + + return OptimizationResult(cost, params, [cost_history]) diff --git a/QHyper/QHyper/optimizers/random.py b/QHyper/QHyper/optimizers/random.py new file mode 100644 index 0000000..83d6f64 --- /dev/null +++ b/QHyper/QHyper/optimizers/random.py @@ -0,0 +1,83 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from typing import Callable +from numpy.typing import NDArray + +import numpy as np + +from QHyper.optimizers.util import run_parallel + +from QHyper.optimizers.base import ( + Optimizer, OptimizationResult, OptimizerError, OptimizationParameter) + + +class Random(Optimizer): + """Random optimizer + + The random optimizer is a simple optimization algorithm that + generates random samples from the parameter space and evaluates + the function at each point. + This alogrithm requries the following parameters to be set: + - `min` and `max` bounds for each parameter + + Attributes + ---------- + verbose : bool, default False + Whether to print the optimization progress. + disable_tqdm : bool, default True + Whether to disable the tqdm progress bar. + number_of_samples : int, default 100 + The number of samples to generate. + processes : int, default 1 + The number of processes to use for parallel computation. + """ + + verbose: bool + disable_tqdm: bool + number_of_samples: int = 100 + processes: int = 1 + + def __init__( + self, + verbose: bool = False, + disable_tqdm: bool = True, + number_of_samples: int = 100, + processes: int = 1, + ) -> None: + self.verbose = verbose + self.disable_tqdm = disable_tqdm + self.number_of_samples = number_of_samples + self.processes = processes + + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter + ) -> OptimizationResult: + init.assert_bounds() + bounds = np.array(init.bounds) + + hyperparams = ( + (bounds[:, 1] - bounds[:, 0]) + * np.random.rand(self.number_of_samples, len(bounds)) + + bounds[:, 0]) + + results = run_parallel( + func, hyperparams, self.processes, self.disable_tqdm) + min_idx = np.argmin([result.value for result in results]) + + if self.verbose: + print(f"Best result: {results[min_idx].value}") + print(f"Values: {sorted([v.value for v in results])}") + + history = [OptimizationResult(res.value, params, [[res]]) + for res, params in zip(results, hyperparams)] + + return OptimizationResult( + value=results[min_idx].value, + params=hyperparams[min_idx], + history=[history], + ) diff --git a/QHyper/QHyper/optimizers/scipy_minimizer.py b/QHyper/QHyper/optimizers/scipy_minimizer.py new file mode 100644 index 0000000..dced774 --- /dev/null +++ b/QHyper/QHyper/optimizers/scipy_minimizer.py @@ -0,0 +1,108 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from numpy.typing import NDArray +from typing import Callable, Any + +import scipy +import numpy as np + +from QHyper.optimizers.base import ( + Optimizer, OptimizationResult, OptimizerError, OptimizationParameter) + + +class ScipyOptimizer(Optimizer): + """ + Class for the SciPy minimizer. + + This class is a wrapper for the SciPy minimizer. + It requires the following parameters to be set: + - `init` initial values for each parameter + - `min` and `max` bounds for each parameter + + Attributes + ---------- + verbose : bool, default False + Whether to print the optimization progress. + disable_tqdm : bool, default True + Whether to disable the tqdm progress bar. + maxfun : int + Maximum number of function evaluations. + kwargs : dict[str, Any] + Additional keyword arguments for the SciPy minimizer. + https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html + """ + + verbose: bool + disable_tqdm: bool + maxfun: int + kwargs: dict[str, Any] + + def __init__( + self, + verbose: bool = False, + disable_tqdm: bool = True, + maxfun: int = 200, + **kwargs: Any + ) -> None: + self.verbose = verbose + self.disable_tqdm = disable_tqdm + self.maxfun = maxfun + self.kwargs = kwargs + + def minimize( + self, + func: Callable[[list[float]], OptimizationResult], + init: OptimizationParameter + ) -> OptimizationResult: + """ + Minimize the given function using the SciPy minimize. + + Parameters + ---------- + func : callable + The objective function to be minimized. + The function should take a single argument, which is a NumPy array + of type np.float64, and return a float value. + init : numpy.ndarray + The initial point for the optimization algorithm. + The array should have dtype np.float64. + + Returns + ------- + tuple + A tuple containing the minimum function value and the + corresponding optimal point. + """ + init.assert_bounds_init() + + def wrapper(params: NDArray) -> float: + return func(params).value + + history: list[OptimizationResult] = [] + + def callback(intermediate_result): + if self.verbose: + print(f"Step {len(history)+1}/{self.maxfun}: " + f"{float(intermediate_result.fun)}") + history.append(OptimizationResult( + intermediate_result.fun, np.copy(intermediate_result.x))) + + if 'options' not in self.kwargs: + self.kwargs['options'] = {} + if 'maxfun' not in self.kwargs['options']: + self.kwargs['options']['maxfun'] = self.maxfun + result = scipy.optimize.minimize( + wrapper, init.init, + bounds=init.bounds, + callback=callback, + **self.kwargs + ) + if self.verbose: + print(f"Success: {result.success}. Message: {result.message}") + + return OptimizationResult( + result.fun, result.x, [history] + ) diff --git a/QHyper/QHyper/optimizers/util.py b/QHyper/QHyper/optimizers/util.py new file mode 100644 index 0000000..e5f4fd2 --- /dev/null +++ b/QHyper/QHyper/optimizers/util.py @@ -0,0 +1,24 @@ +import multiprocessing as mp +from typing import Callable + +from tqdm import tqdm + +from QHyper.optimizers.base import OptimizationResult + + +def run_parallel( + func: Callable[[list[float]], OptimizationResult], + args: list[list[float]], + processes: int, + disable_tqdm: bool = True +) -> list[OptimizationResult]: + if processes == 1: + results = [] + for arg in tqdm(args, disable=disable_tqdm): + result = func(arg) + results.append(result) + return results + + with mp.Pool(processes=processes) as pool: + return list(tqdm( + pool.imap(func, args), total=len(args), disable=disable_tqdm)) diff --git a/QHyper/QHyper/parser.py b/QHyper/QHyper/parser.py new file mode 100644 index 0000000..2e61ef7 --- /dev/null +++ b/QHyper/QHyper/parser.py @@ -0,0 +1,137 @@ +"""Module for parsing sympy expressions to :py:class:`~QHyper.polynomial.Polynomial`. + +This module provides a way to parse sympy expressions and string to +:py:class:`~QHyper.polynomial.Polynomial`. +It is not recommended to use this module for large polynomials as it is very +slow in comparison to creating Polynomial directly from the dict. + +.. rubric:: Functions + +.. autofunction:: from_str +.. autofunction:: from_sympy +.. autofunction:: to_sympy + +""" + +import ast +import sympy + +from QHyper.polynomial import Polynomial + + +class ParserException(Exception): + pass + + +class Parser(ast.NodeVisitor): + def __init__(self) -> None: + self.polynomial: Polynomial | None = None + + def visit_Expr(self, node: ast.Expr) -> None: + self.polynomial = self.visit(node.value) + + def visit_Constant(self, node: ast.Constant) -> Polynomial: + return Polynomial({tuple(): node.value}) + + def visit_Name(self, node: ast.Name) -> Polynomial: + return Polynomial({(node.id,): 1}) + + def visit_BinOp(self, node: ast.BinOp) -> Polynomial: + lhs = self.visit(node.left) + rhs = self.visit(node.right) + + if isinstance(node.op, ast.Add): + return lhs + rhs + + if isinstance(node.op, ast.Sub): + return lhs - rhs + + if isinstance(node.op, ast.Mult): + return lhs * rhs + + if isinstance(node.op, ast.Pow): + return lhs ** rhs + + raise ParserException(f"Unsupported operation: {lhs} {node.op} {rhs}") + + def visit_UnaryOp(self, node: ast.UnaryOp) -> Polynomial: + lhs = self.visit(node.operand) + + if isinstance(node.op, ast.USub): + return -lhs + + if isinstance(node.op, ast.UAdd): + return lhs + + raise ParserException(f"Unsupported operation: {node.op}{lhs}") + + +def to_sympy(poly: Polynomial) -> str: + """Method to convert a polynomial to a sympy expression. + Might be handy to display the polynomial in a more readable form. + + Parameters + ---------- + poly : Polynomial + The polynomial to be converted. + + Returns + ------- + str + The sympy expression. + """ + + polynomial = "" + for term, const in poly.terms.items(): + if const < 0: + polynomial += f"{const}*" + else: + polynomial += f"+{const}*" + polynomial += "*".join(term) + return sympy.parse_expr(polynomial, evaluate=False) + + +def from_str(equation: str) -> Polynomial: + """Method to parse a string to a polynomial. + Uses ast parser to parse the equation. This method is very slow in + comparison to creating Polynomial directly from the dict. Although, for + smaller polynomials, it is not noticeable. + + Parameters + ---------- + equation : str + The equation to be parsed in form of string. + + Returns + ------- + Polynomial + The parsed polynomial. + """ + + parser = Parser() + ast_tree = ast.parse(equation) + parser.visit(ast_tree) + if parser.polynomial is None: + raise ParserException(f"Failed to parse: {equation}") + + return parser.polynomial + + +def from_sympy(equation: sympy.core.Expr) -> Polynomial: + """Method to convert a sympy expression to a polynomial. + Uses ast parser to parse the equation. This method is very slow in + comparison to creating Polynomial directly from the dict. Although, for + smaller polynomials, it is not noticeable. + + Parameters + ---------- + equation : sympy.core.Expr + The sympy expression to be converted. + + Returns + ------- + Polynomial + The converted polynomial. + """ + + return from_str(str(sympy.expand(equation))) diff --git a/QHyper/QHyper/polynomial.py b/QHyper/QHyper/polynomial.py new file mode 100644 index 0000000..f0980a6 --- /dev/null +++ b/QHyper/QHyper/polynomial.py @@ -0,0 +1,227 @@ +""" Module for polynomial representation. +Implementation of the polynomials using dictionaries. Used in the whole system. + +.. rubric:: Main class + +.. autosummary:: + :toctree: generated + + Polynomial -- implementation of the polynomial. + + +.. rubric:: MyPy Type + +.. autoclass:: PolynomialType + +""" + +from dataclasses import dataclass, field +from collections import defaultdict + +from typing import overload + + +@dataclass +class Polynomial: + """ + Class for representing polynomials. + + A Polynomial is comprised of a dictionary where the keys are tuples + containing variables, and the values represent their coefficients. + Using dictionaries allows for efficient arithmetic operations + on Polynomials, simplification of terms, and extraction of relevant + information such as constants, degree, and variables. + The core functionality includes addition, subtraction, + multiplication, exponentiation, and negation. This representation + can store higher-order polynomials. The creation of a Polynomial + can be done manually by providing a dictionary or by translating + it from SymPy syntax. Additionally, users can implement the + translation into Polynomial from their own data source + + Attributes + ---------- + terms : dict[tuple[str, ...], float] + dictionary of terms and their coefficients, where the key is a tuple + of variables and the value is the coefficient of the term + For example, the polynomial 3*x + 2 + 4*x^2 is represented as + {('x',): 3, ('x', 'x'): 4, (): 2} + """ + + terms: dict[tuple[str, ...], float] = field(default_factory=dict) + + @overload + def __init__(self, terms: float | int) -> None: ... + + @overload + def __init__(self, terms: dict[tuple[str, ...], float]) -> None: ... + + def __init__(self, terms: dict[tuple[str, ...], float] | float | int + ) -> None: + if isinstance(terms, (float, int)): + terms = {tuple(): float(terms)} + else: + terms = terms.copy() if terms else {tuple(): 0} + + self.terms = defaultdict(float) + + non_zero_found = False + for term, coefficient in terms.items(): + if coefficient == 0: + continue + non_zero_found = True + self.terms[tuple(sorted(term))] += coefficient + + if not non_zero_found: + self.terms[tuple()] = 0.0 + + @overload + def __add__(self, other: float | int) -> 'Polynomial': ... + + @overload + def __add__(self, other: 'Polynomial') -> 'Polynomial': ... + + def __add__(self, other: 'Polynomial | float | int') -> 'Polynomial': + if isinstance(other, (float, int)): + return Polynomial({tuple(): float(other)}) + self + + if not isinstance(other, Polynomial): + raise TypeError(f"Unsupported operation: {self} + {other}") + + new_terms = self.terms.copy() + + for term, coefficient in other.terms.items(): + new_terms[term] += coefficient + + return Polynomial(new_terms) + + def __radd__(self, other: float | int) -> 'Polynomial': + return self + other + + @overload + def __sub__(self, other: float | int) -> 'Polynomial': ... + + @overload + def __sub__(self, other: 'Polynomial') -> 'Polynomial': ... + + def __sub__(self, other: 'Polynomial | float | int') -> 'Polynomial': + if isinstance(other, (float, int)): + return Polynomial({tuple(): float(other)}) - self + if not isinstance(other, Polynomial): + raise TypeError(f"Unsupported operation: {self} - {other}") + + new_terms = self.terms.copy() + + for term, coefficient in other.terms.items(): + new_terms[term] -= coefficient + + return Polynomial(new_terms) + + def __rsub__(self, other: float | int) -> 'Polynomial': + return -self + other + + @overload + def __mul__(self, other: float | int) -> 'Polynomial': ... + + @overload + def __mul__(self, other: 'Polynomial') -> 'Polynomial': ... + + def __mul__(self, other: 'Polynomial | float | int') -> 'Polynomial': + if isinstance(other, (float, int)): + return Polynomial({tuple(): float(other)}) * self + if not isinstance(other, Polynomial): + raise TypeError(f"Unsupported operation: {self} * {other}") + + new_terms = defaultdict(float) + + for variables1, coefficient1 in self.terms.items(): + for variables2, coefficient2 in other.terms.items(): + new_term = tuple(sorted(variables1 + variables2)) + new_coefficient = coefficient1 * coefficient2 + + new_terms[new_term] += new_coefficient + + return Polynomial(new_terms) + + def __rmul__(self, other: float | int) -> 'Polynomial': + return self * other + + def __pow__(self, power: 'Polynomial | int') -> 'Polynomial': + power_: int + + if isinstance(power, Polynomial): + const = power.terms.get(tuple(), 0) + if power.degree() != 0 or (int(const) != const): + raise ValueError(f"Unsupported operation: {self} ** {power}") + power_ = int(const) + elif not isinstance(power, int): + raise TypeError(f"Unsupported operation: {self} ** {power}") + else: + power_ = power + if power_ == 0: + return Polynomial({tuple(): 1}) + + result = self + for _ in range(power_ - 1): + result *= self + + return result + + def __neg__(self) -> 'Polynomial': + return Polynomial({ + term: -coefficient for term, coefficient in self.terms.items() + }) + + def __eq__(self, other: object) -> bool: + if isinstance(other, dict): + terms = other + elif isinstance(other, Polynomial): + terms = other.terms + else: + raise TypeError(f"Unsupported operation: {self} == {other}") + + return self.terms == terms + + def separate_const(self) -> tuple['Polynomial', float]: + """Method for separating constant term from the rest of the polynomial. + + For example, for polynomial 3*x + 2 + 4*x^2, the method will return + 3*x + 4*x^2 and 2 or in the actual representation: + {('x',): 3, ('x', 'x'): 4, (): 2} will be separated into + {('x',): 3, ('x', 'x'): 4} and {(): 2}. + + Returns + ------- + Polynomial + Polynomial without the constant term - empty tuple. + float + Constant term of the polynomial. + """ + + _terms = self.terms.copy() + constant = _terms.pop(tuple(), 0) + return Polynomial(_terms), constant + + def degree(self) -> int: + """Method for calculating the degree of the polynomial. + + Returns + ------- + int + The degree of the polynomial. + """ + if not self.terms: + return 0 + return max(len(term) for term in self.terms) + + def get_variables(self) -> set[str]: + """Method for extracting variables from the polynomial. + + Returns + ------- + set[str] + Set of variables used in the polynomial. + """ + return set(variable for term in self.terms for variable in term) + + +PolynomialType = Polynomial | float | int | dict[tuple[str, ...], float] diff --git a/QHyper/QHyper/problems/__init__.py b/QHyper/QHyper/problems/__init__.py new file mode 100644 index 0000000..574a68f --- /dev/null +++ b/QHyper/QHyper/problems/__init__.py @@ -0,0 +1,117 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + +""" +This module contains implementaions of different problems. +Problems are defined using :py:class:`~QHyper.polynomial.Polynomial` module. +No problem is imported by deafult to reduce number of dependencies. +To use any problem you can import it directly like + +.. code-block:: python + + from QHyper.problems.knapsack import KnapsackProblem + +or use function :py:func:`Problems.get` with the name of the problem. +Any problem that is in directory 'QHyper/custom' or 'custom' will be +also available in this function. + +.. rubric:: Interface + +.. autosummary:: + :toctree: generated + + Problem -- Base class for problems. + +.. rubric:: Available problems + +.. autosummary:: + :toctree: generated + + knapsack.KnapsackProblem -- Knapsack problem. + tsp.TravelingSalesmanProblem -- Traveling Salesman Problem. + maxcut.MaxCutProblem -- Max-Cut problem. + workflow_scheduling.WorkflowSchedulingProblem -- Workflow Scheduling problem. + community_detection.CommunityDetectionProblem -- Community Detection problem. + +.. rubric:: Additional functions + +.. autoclass:: Problems + :members: + +""" + +from typing import Type, Any +import copy + +from QHyper.util import search_for + +from QHyper.problems.base import Problem + + +class Problems: + custom_problems: None | dict[str, type] = None + + @staticmethod + def get(name: str) -> Type[Problem]: + """ + Get problem class by name. Used for creating Problem objects from config. + + The problem will be available by the 'name' attribute if defined or + by the class name. Letters case doesn't matter. + """ + + if Problems.custom_problems is None: + Problems.custom_problems = ( + search_for(Problem, 'QHyper/custom') + | search_for(Problem, 'custom')) + + name_ = name.lower() + + if name_ in Problems.custom_problems: + return Problems.custom_problems[name_] + elif name_ in ["knapsack", "knapsackproblem"]: + from .knapsack import KnapsackProblem + return KnapsackProblem + elif name_ in ["tsp", "travelingsalesmanproblem"]: + from .tsp import TravelingSalesmanProblem + return TravelingSalesmanProblem + elif name_ in ["maxcut", "maxcutproblem"]: + from .maxcut import MaxCutProblem + return MaxCutProblem + elif name_ in ["workflow_scheduling", "workflowschedulingproblem"]: + from .workflow_scheduling import WorkflowSchedulingProblem + return WorkflowSchedulingProblem + elif name_ in ["community_detection", "communitydetectionproblem"]: + from .community_detection import CommunityDetectionProblem + return CommunityDetectionProblem + else: + raise ValueError(f"Problem {name} not found") + + +class ProblemConfigException(Exception): + """Exception raised when problem configuration is incorrect""" + pass + + +def problem_from_config(config: dict[str, Any]) -> Problem: + """ + Create Problem object from provided configuration. + + Parameters + ---------- + config : dict[str. Any] + Configuration in form of dict + + Returns + ------- + Problem + Initialized Problem object + """ + config_ = copy.deepcopy(config) + if "type" not in config_: + raise ProblemConfigException("Problem type was not provided") + problem_type = config_.pop('type') + problem_class = Problems.get(problem_type) + + return problem_class(**config_) diff --git a/QHyper/QHyper/problems/base.py b/QHyper/QHyper/problems/base.py new file mode 100644 index 0000000..99e06be --- /dev/null +++ b/QHyper/QHyper/problems/base.py @@ -0,0 +1,71 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from abc import ABC +import numpy as np + +from QHyper.constraint import Constraint, Polynomial + + +class ProblemException(Exception): + pass + + +class Problem(ABC): + """Interface for different combinatorial optimization problems + + Objective function and constrians are the main components + and are represented as :py:class:`~QHyper.polynomial.Polynomial`. + Depending on the selcted solver, these parts can be used + separately or, e.g., as a Quadratic Unconstrained + Binary Optimization (QUBO) formularion. + + If the QUBO is provided, it should be passed to the + objective_function and the constraints should be empty. + Same applies for the situation when the problem doesn't + have constraints. + + Attributes + ---------- + objective_function: Polynomial + Objective_function represented as a + :py:class:`~QHyper.polynomial.Polynomial` + constraints : list[Polynomial], optional + List of constraints represented as a + :py:class:`~QHyper.polynomial.Polynomial` + """ + + objective_function: Polynomial + constraints: list[Constraint] = [] + + def get_score(self, result: np.record, penalty: float = 0) -> float: + """Returns score of the outcome provided as a binary string + + Necessary to evaluate results. It's not possible to calculate the + score based on the objective function directly, because that is + highly dependent on the problem. That's why this method requires + user to implement it. + This method is used in optimization process where evaluating QUBO + or expectation value is not enough. + + Parameters + ---------- + result : np.record + Outcome as a numpy record with variables as keys and their values. + Dtype is list of tuples with variable name and its value (0 or 1) + and tuple ('probability', ). + penalty : float, default 0 + Penalty for the constraint violation + + Returns + ------- + float + Returns float indicating the score, if function should be + maximized the returned value should be returned with negative sign + """ + raise NotImplementedError("Unimplemented") + + def __repr__(self) -> str: + return f"{self.__class__.__name__}" diff --git a/QHyper/QHyper/problems/community_detection.py b/QHyper/QHyper/problems/community_detection.py new file mode 100644 index 0000000..4d670f6 --- /dev/null +++ b/QHyper/QHyper/problems/community_detection.py @@ -0,0 +1,257 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from dataclasses import dataclass, field +from typing import Any, Iterable, Tuple, cast + +import networkx as nx +import numpy as np +import sympy +from QHyper.problems.base import Problem +from QHyper.constraint import Constraint +from QHyper.polynomial import Polynomial +from sympy.core.expr import Expr +from QHyper.parser import from_sympy + + +@dataclass +class Network: + graph: nx.Graph + resolution: float = 1.0 + weight: str | None = "weight" + community: list | None = None + full_modularity_matrix: np.ndarray | None = None + generalized_modularity_matrix: np.ndarray = field(init=False) + + def __post_init__(self) -> None: + if not self.community: + self.community = [*range(self.graph.number_of_nodes())] + if self.full_modularity_matrix is None: + self.full_modularity_matrix = self.calculate_full_modularity_matrix() + self.generalized_modularity_matrix = ( + self.calculate_generalized_modularity_matrix() + ) + + def calculate_full_modularity_matrix(self) -> np.ndarray: + adj_matrix: np.ndarray = nx.to_numpy_array(self.graph, weight=self.weight) + in_degree_matrix: np.ndarray = adj_matrix.sum(axis=1) + out_degree_matrix: np.ndarray = adj_matrix.sum(axis=0) + m: int = np.sum(adj_matrix) + return ( + adj_matrix + - self.resolution * np.outer(in_degree_matrix, out_degree_matrix) / m + ) + + def calculate_generalized_modularity_matrix(self) -> np.ndarray: + B_bis = self.full_modularity_matrix[self.community, :] + B_community = B_bis[:, self.community] + B_i = np.sum(B_community, axis=1) + B_j = np.sum(B_community.T, axis=1) + delta = np.eye(len(self.community), dtype=np.int32) + return 0.5 * (B_community + B_community.T) - 0.5 * delta * (B_i + B_j) + + def to_serializable(self) -> dict: + return { + "community": self.community, + "full_modularity_matrix": self.full_modularity_matrix, + "generalized_modularity_matrix": self.generalized_modularity_matrix, + } + + +class KarateClubNetwork(Network): + def __init__(self, resolution: float = 1): + super().__init__(nx.karate_club_graph(), resolution=resolution) + + +class BrainNetwork(Network): + def __init__( + self, + input_data_dir: str, + input_data_name: str, + delimiter: str = " ", + resolution: int = 1, + ): + adj_matrix = np.genfromtxt( + f"{input_data_dir}/{input_data_name}.csv", delimiter=delimiter + ) + super().__init__(nx.from_numpy_matrix(adj_matrix), resolution=resolution) + + +class CommunityDetectionProblem(Problem): + """ + Problem class instance + - objective function for network community detection + + Attributes + ---------- + cases: int + number of communities into which the graph shall be divided + (default 2) + G: networkx graph + networkx implementation of graph + B: networkx modularity matrix + networkx implementation of modularity matrix + + objective_function : Expression + objective function in SymPy syntax + constraints : list[Expression] + list of problem constraints in SymPy syntax, (default []) + variables : int + number of qubits in the circuit, equal to number of nodes + in the graph + """ + + def __init__( + self, + network_data: Network, + communities: int = 2, + one_hot_encoding: bool = True, + ) -> None: + """ + Parameters + ---------- + network_data: Network + representation of a network with graph and modularity matrix + communities: int + number of communities into which the graph shall be divided + (default 2) + one_hot_encoding: bool + decides if objective function should be encoded to one-hot + values + """ + self.G: nx.Graph = network_data.graph + self.one_hot_encoding: bool = one_hot_encoding + if one_hot_encoding: + self.B: np.ndarray = network_data.full_modularity_matrix + else: + self.B: np.ndarray = network_data.generalized_modularity_matrix + + if communities < 1: + raise Exception("Number of communities must be greater than or equal to 1") + self.community = network_data.community + self.cases: int = communities + self.resolution: float = network_data.resolution + + if self.one_hot_encoding: + self.variables: tuple[sympy.Symbol] = self._encode_discretes_to_one_hots() + self._set_objective_function() + self._set_one_hot_constraints(communities) + else: + self.variables: tuple[sympy.Symbol] = ( + self._get_discrete_variable_representation() + ) + self._set_objective_function() + + def _get_discrete_variable_representation( + self, + ) -> tuple[sympy.Symbol] | Any: + # return sympy.symbols(" ".join([f"x{i}" for i in range(len(self.community))])) + return sympy.symbols(" ".join([f"x{n}" for n in self.community])) + + def _set_objective_function(self) -> None: + equation: dict[tuple[str, ...], float] = {} + for i in range(len(self.B)): + for j in range(len(self.B)): + x_i, x_j = sympy.symbols(f"x{self.community[i]}"), sympy.symbols( + f"x{self.community[j]}" + ) + if self.one_hot_encoding: + if i >= j: + continue + for case_val in range(self.cases): + s_i = str(self._encode_discrete_to_one_hot(x_i, case_val)) + s_j = str(self._encode_discrete_to_one_hot(x_j, case_val)) + equation[(s_i, s_j)], equation[(s_j, s_i)] = ( + self.B[i, j], + self.B[j, i], + ) + else: + x_i, x_j = str(x_i), str(x_j) + equation[(x_i, x_j)] = self.B[i, j] + + equation = {key: -1 * val for key, val in equation.items()} + + nonzero_terms = sum(1 for v in equation.values() if not np.isclose(v, 0.0)) + if nonzero_terms == 0: + raise ValueError( + f"The objective function is a zero polynomial - all terms in the generalized modularity matrix are 0. Try different resolution (current: {self.resolution})" + ) + + self.objective_function = Polynomial(equation) + + def _encode_discrete_to_one_hot( + self, discrete_variable: sympy.Symbol, case_value: int + ) -> sympy.Symbol: + discrete_id = int(str(discrete_variable)[1:]) + id = discrete_id * self.cases + case_value + return sympy.symbols(f"s{id}") + + def _encode_discretes_to_one_hots(self) -> tuple[sympy.Symbol]: + one_hots: tuple[sympy.Symbol] = sympy.symbols( + " ".join( + [ + str(self._encode_discrete_to_one_hot(var, case_val)) + for var in self._get_discrete_variable_representation() + for case_val in range(self.cases) + ] + ) + ) + return one_hots + + def iter_variables_cases(self) -> Iterable[Tuple[sympy.Symbol, ...]]: + """s -> (s0,s1,s2,...sn-1), (sn,sn+1,sn+2,...s2n-1), ...""" + return zip(*[iter(self.variables)] * self.cases) + + def _set_one_hot_constraints(self, communities: int) -> None: + ONE_HOT_CONST = -1 + self.constraints: list[Constraint] = [] + # In the case of 1-to-1 mapping between discrete + # and binary variable values no one-hot constraints + if communities == ONE_HOT_CONST * -1: + return + + dummies: Iterable[Tuple[sympy.Symbol, ...]] + for dummies in self.iter_variables_cases(): + expression: Expr = cast(Expr, 0) + dummy: sympy.Symbol + for dummy in dummies: + expression += dummy + expression += ONE_HOT_CONST + self.constraints.append(Constraint(from_sympy(expression))) + + def decode_solution(self, solution: dict) -> dict: + ONE_HOT_VALUE = 1.0 + decoded_solution: dict = {} + + for variable, value in solution.items(): + id = int(variable[1:]) + if value == ONE_HOT_VALUE: + case_value = id % self.cases + variable_id = id // self.cases + decoded_solution[variable_id] = case_value + + return self.sort_decoded_solution(decoded_solution) + + def sort_encoded_solution(self, encoded_solution: dict) -> dict: + return { + str(k): encoded_solution[str(k)] + for k in self.variables + if str(k) in encoded_solution + } + + def sort_decoded_solution(self, decoded_solution: dict) -> dict: + keyorder = [int(str(v)[1:]) for v in self.variables] + return {k: decoded_solution[k] for k in keyorder if k in decoded_solution} + + def to_serializable(self) -> dict: + return { + # "graph": nx.adjacency_data(self.G), + # "resolution": self.resolution, + "community": self.community, + # "cases": self.cases, + # "one_hot_encoding": self.one_hot_encoding, + "variables": [str(v) for v in self.variables], + "objective_function": self.objective_function.terms + } diff --git a/QHyper/QHyper/problems/knapsack.py b/QHyper/QHyper/problems/knapsack.py new file mode 100644 index 0000000..4f4e718 --- /dev/null +++ b/QHyper/QHyper/problems/knapsack.py @@ -0,0 +1,189 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +""" +.. currentmodule:: QHyper.problems.knapsack +""" + +import random +import sympy +import numpy as np +from collections import namedtuple + +from QHyper.polynomial import Polynomial +from QHyper.problems.base import Problem +from QHyper.constraint import Constraint + +Item = namedtuple('Item', "weight value") + + +class Knapsack: + """Knapsack class + + Attributes + ---------- + max_weight: int + maximum weight of an item + max_item_value: int + maximum value of an item + items: list[Item] + list of items + """ + + def __init__( + self, + max_weight: int, + max_item_value: int, + items_amount: int, + item_weights: list[int], + item_values: list[int] + ) -> None: + """ + Parameters + ---------- + max_weight: int + maximum weight of an item + max_item_value: int + maximum value of an item + items_amount: int + items amount, used only for random knapsack + items: list[tuple[int, int]] + set items in knapsack + """ + self.items: list[Item] = [] + self.max_weight: int = max_weight + self.max_item_value: int = max_item_value + if item_weights and item_values: + if len(item_weights) != len(item_values): + raise ValueError( + "Weights and values must have the same length") + self.set_knapsack(item_weights, item_values) + else: + if items_amount < 1: + raise ValueError( + "Cannot create knapsack with less than one item") + self.generate_knapsack(items_amount) + + def generate_knapsack(self, items_amount: int) -> None: + for _ in range(items_amount): + self.items.append(Item( + random.randint(1, self.max_weight), + random.randint(1, self.max_item_value) + )) + + def set_knapsack(self, weights: list[int], values: list[int] + ) -> None: + self.items = [Item(weight, value) + for weight, value in zip(weights, values)] + + def __len__(self) -> int: + return len(self.items) + + +class KnapsackProblem(Problem): + """Objective function and constraints for the knapsack problem + + Parameters + ---------- + max_weight: int + maximum weight of an item + max_item_value: int, default 10 + maximum value of an item + items_amount: int, optional + items amount, used only for random knapsack. If not provided, + then item_weights and item_values must be specified + item_weights: list[int], optional + list of items weights + item_values: list[int], optional + list of items values + + Attributes + ---------- + objective_function : Polynomial + objective function in SymPy syntax wrapped in Expression class + constraints : list[Polynomial] + list of constraints in SymPy syntax wrapped in Expression class + knapsack: :py:class:`Knapsack` + Knapsack instance + """ + + def __init__( + self, + max_weight: int, + max_item_value: int = 10, + items_amount: int = 1, + item_weights: list[int] = [], + item_values: list[int] = [] + ) -> None: + self.knapsack = Knapsack(max_weight, max_item_value, + items_amount, item_weights, item_values) + self.variables: tuple[sympy.Symbol] = sympy.symbols(' '.join( + [f'x{i}' for i + in range(len(self.knapsack) + self.knapsack.max_weight)] + )) + self._set_objective_function() + self._set_constraints() + + def _set_objective_function(self) -> None: + """ + Create the objective function items on defined in SymPy syntax + """ + equation = Polynomial(0) + for i in range(len(self.knapsack.items)): + equation += Polynomial({(f"x{i}", ): self.knapsack.items[i].value}) + equation = -equation + + self.objective_function = equation + + def _set_constraints(self) -> None: + """ + Create constraints defined in SymPy syntax + """ + self.constraints: list[Constraint] = [] + equation = Polynomial(1) + for i in range(self.knapsack.max_weight): + equation -= Polynomial({(f'x{i+len(self.knapsack)}',): 1}) + self.constraints.append(Constraint(equation)) + equation = Polynomial(0) + for i in range(self.knapsack.max_weight): + equation += Polynomial({(f'x{i+len(self.knapsack)}', ): (i+1)}) + for i in range(len(self.knapsack.items)): + equation -= Polynomial({(f"x{i}",): self.knapsack.items[i].weight}) + self.constraints.append(Constraint(equation)) + + def get_score(self, result: np.record, penalty: float = 0) -> float: + """Returns score for the provided numpy recor + + Parameters + ---------- + result : np.record + Outcome as a numpy record with variables as keys and their values. + Dtype is list of tuples with variable name and its value (0 or 1) + and tuple ('probability', ). + penalty : float, default 0 + Penalty for the constraint violation + + Returns + ------- + float + Returns negated sum of value of picked items or 0 if knapsack + isn't correct + """ + sum = 0 + weight = 0 + for i, item in enumerate(self.knapsack.items): + if result[f'x{i}'] == 1: + sum += item.value + weight += item.weight + if weight > self.knapsack.max_weight: + return penalty + + for i in range(self.knapsack.max_weight): + if result[f'x{i + len(self.knapsack)}'] == 1 and i + 1 != weight: + return penalty + if weight != 0 and result[f'x{weight + len(self.knapsack) - 1}'] != 1: + return penalty + + return -sum diff --git a/QHyper/QHyper/problems/maxcut.py b/QHyper/QHyper/problems/maxcut.py new file mode 100644 index 0000000..84444e0 --- /dev/null +++ b/QHyper/QHyper/problems/maxcut.py @@ -0,0 +1,59 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +import numpy as np +import sympy + +from QHyper.polynomial import Polynomial + +from QHyper.problems.base import Problem + + +class MaxCutProblem(Problem): + """MaxCut problem + + Parameters + ---------- + edges : list[tuple[int, int]] + List of edges in the graph + + Attributes + ---------- + objective_function: Polynomial + Objective_function represented as a Polynomial + constraints : list[Polynomial] + For MaxCut problem, there are no constraints, so it's empty list + edges : list[tuple[int, int]] + List of edges in the graph + """ + + def __init__(self, edges: list[tuple[int, int]]) -> None: + self.edges = edges + self.variables = sympy.symbols( + " ".join( + [f"x{i}" for i in range(max(v for edge in edges + for v in edge) + 1)] + ) + ) + + self._set_objective_function() + self.constraints = [] + + def _set_objective_function(self) -> None: + equation = Polynomial(0) + + for e in self.edges: + + x_i = f"x{e[0]}" + x_j = f"x{e[1]}" + equation -= Polynomial({(x_i,): 1, (x_j,): 1, (x_i, x_j): -2}) + self.objective_function = equation + + def get_score(self, result: np.record, penalty: float = 0) -> float: + sum = 0 + for e in self.edges: + x_i, x_j = int(result[f"x{e[0]}"]), int(result[f"x{e[1]}"]) + sum += x_i * (1 - x_j) + x_j * (1 - x_i) + return -sum diff --git a/QHyper/QHyper/problems/tsp.py b/QHyper/QHyper/problems/tsp.py new file mode 100644 index 0000000..d70b0d5 --- /dev/null +++ b/QHyper/QHyper/problems/tsp.py @@ -0,0 +1,207 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +import itertools + +import sympy +import numpy as np + +from typing import cast +from QHyper.constraint import Constraint + +from QHyper.parser import from_sympy +from QHyper.polynomial import Polynomial +from QHyper.problems.base import Problem + + +class TSP: + """Traveling Salesman Problem + + Attributes + ---------- + number_of_cities : int + cities count + cities_coords : list[tuple[float, float]] + coordinates of the cities + distance_matrix : list[list[float]] + matrix of distances between cities + normalized_distance_matrix : list[list[float]] + normalized to (0, 1] matrix of distances between cities + """ + + def __init__( + self, + number_of_cities: int, + coords_range: tuple[int, int] = (0, 10000), + cities_coords: list[tuple[float, float]] = [], + ) -> None: + """ + Parameters + ---------- + number_of_cities : int + cities count + coords_range : tuple[float, float] + range of coordinates of the cities + cities_coords : list[tuple[float, float]] + predefined coordinates of the cities + """ + self.number_of_cities: int = number_of_cities + if cities_coords: + self.cities_coords = cities_coords + else: + self.cities_coords = self.get_cities(coords_range) + self.distance_matrix: list[ + list[float]] = self.calculate_distance_matrix() + self.normalized_distance_matrix: list[ + list[float]] = self.normalize_distance_matrix() + + def get_cities(self, coords_range) -> list[tuple[float, float]]: + cities_coords = np.random.randint( + coords_range[0], coords_range[1], + size=(self.number_of_cities, 2)) + return cast(list[tuple[float, float]], cities_coords) + + def calculate_distance_between_points( + self, point_A: tuple[float, float], point_B: tuple[float, float] + ) -> float: + return cast( + float, + np.sqrt((point_A[0] - point_B[0]) ** 2 + + (point_A[1] - point_B[1]) ** 2) + ) + + def calculate_distance_matrix(self) -> list[list[float]]: + distance_matrix = np.zeros( + (self.number_of_cities, self.number_of_cities)) + for i in range(self.number_of_cities): + for j in range(i, self.number_of_cities): + distance_matrix[i][j] = self.calculate_distance_between_points( + self.cities_coords[i], self.cities_coords[j]) + distance_matrix[j][i] = distance_matrix[i][j] + return cast(list[list[float]], distance_matrix) + + def normalize_distance_matrix(self) -> list[list[float]]: + return cast( + list[list[float]], + np.divide(self.distance_matrix, np.max(self.distance_matrix)) + ) + + +class TravelingSalesmanProblem(Problem): + """ + Class defining objective function and constraints for TSP + + Parameters + ---------- + number_of_cities : int + Number of cities + cities_coords : list[tuple[float, float]], default [] + List of cities coordinates. If not provided, random cities + coordinates are generated. + + Attributes + ---------- + objective_function : Polynomial + Objective function represented as a Polynomial + constraints : list[Polynomial] + List of constraints represented as a Polynomials + tsp_instance: :py:class:`TSP` + TSP problem instace + """ + + def __init__( + self, + number_of_cities: int, + cities_coords: list[tuple[float, float]] = [], + ) -> None: + self.tsp_instance = TSP( + number_of_cities, cities_coords=cities_coords) + self.variables: tuple[sympy.Symbol] = sympy.symbols( + ' '.join([f'x{i}' for i in range(number_of_cities ** 2)])) + self.objective_function = self._get_objective_function() + self.constraints = self._get_constraints() + + def _calc_bit(self, i: int, t: int) -> int: + return i + t * self.tsp_instance.number_of_cities + + def _get_objective_function(self) -> Polynomial: + equation = Polynomial(0) + for i, j in itertools.permutations( + range(0, self.tsp_instance.number_of_cities), 2 + ): + curr = Polynomial(0) + for t in range(self.tsp_instance.number_of_cities): + inc_t = t + 1 + if inc_t == self.tsp_instance.number_of_cities: + inc_t = 0 + curr += Polynomial({(f"x{self._calc_bit(i, t)}", + f"x{self._calc_bit(j, inc_t)}"): 1}) + equation += ( + self.tsp_instance.normalized_distance_matrix[i][j] * curr + ) + return equation + + def _get_constraints(self) -> list[Constraint]: + constraints: list[Constraint] = [] + for i in range(self.tsp_instance.number_of_cities): + equation = Polynomial(1) + for t in range(self.tsp_instance.number_of_cities): + equation -= Polynomial({(f"x{self._calc_bit(i, t)}",): 1}) + constraints.append(Constraint(equation, group=0)) + + for t in range(self.tsp_instance.number_of_cities): + equation = Polynomial(1) + for i in range(self.tsp_instance.number_of_cities): + equation -= Polynomial({(f"x{self._calc_bit(i, t)}",): 1}) + constraints.append(Constraint(equation, group=1)) + return constraints + + def _get_distance(self, order_result: np.ndarray) -> float: + dist: float = 0 + tab = [] + for result in order_result: + tab.append(list(result).index(1)) + + for i in range(len(tab)): + j = i - 1 + dist += ( + self.tsp_instance.normalized_distance_matrix[tab[i]][tab[j]] + ) + return dist + + def _valid(self, order_result: np.ndarray) -> bool: + return cast(bool, ( + order_result.sum(0) == 1).all() + and (order_result.sum(1) == 1).all() + ) + + def get_score(self, result: np.record, penalty: float = 0) -> float: + """Returns length of the route for provided numpy record. + + Parameters + ---------- + result : np.record + Outcome as a numpy record with variables as keys and their values. + Dtype is list of tuples with variable name and its value (0 or 1) + and tuple ('probability', ). + penalty : float, default 0 + Penalty for the constraint violation + + Returns + ------- + float + Returns length of the route, or 0 if route wasn't correct + """ + order_result = np.zeros((self.tsp_instance.number_of_cities, + self.tsp_instance.number_of_cities)) + + for i in range(self.tsp_instance.number_of_cities): + for j in range(self.tsp_instance.number_of_cities): + order_result[i][j] = result[ + f"x{i*self.tsp_instance.number_of_cities + j}"] + + if not self._valid(order_result): + return penalty # Bigger value that possible distance + return self._get_distance(order_result) diff --git a/QHyper/QHyper/problems/workflow_scheduling.py b/QHyper/QHyper/problems/workflow_scheduling.py new file mode 100644 index 0000000..11e6655 --- /dev/null +++ b/QHyper/QHyper/problems/workflow_scheduling.py @@ -0,0 +1,359 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +import math +from collections import defaultdict +from dataclasses import dataclass + +import networkx as nx +import pandas as pd +import sympy +from wfcommons import Instance +from wfcommons.utils import read_json + +from networkx.classes.reportviews import NodeView + +from sympy.core.expr import Expr +from typing import cast + +from QHyper.constraint import Constraint, Operator, UNBALANCED_PENALIZATION +from QHyper.parser import from_sympy +from QHyper.polynomial import Polynomial +from QHyper.problems.base import Problem, ProblemException + + +@dataclass +class TargetMachine: + name: str + memory: int + cpu: dict[str, float] + price: float + memory_cost_multiplier: float + + +class Workflow: + def __init__(self, tasks_file: str, machines_file: str, deadline: float) -> None: + self.wf_instance = Instance(tasks_file) + self.tasks = self._get_tasks() + self.machines = self._get_machines(machines_file) + self.deadline = deadline + self._set_paths() + self.time_matrix, self.cost_matrix = self._calc_dataframes() + self.task_names = self.time_matrix.index + self.machine_names = self.time_matrix.columns + + def _get_tasks(self) -> NodeView: + return self.wf_instance.workflow.nodes(data=True) + + def _get_machines(self, machines_file: str) -> dict[str, TargetMachine]: + target_machines = read_json(machines_file) + return { + machine["name"]: TargetMachine(**machine) + for machine in target_machines["machines"] + } + + def _set_paths(self) -> None: + all_paths = [] + for root in self.wf_instance.roots(): + for leaf in self.wf_instance.leaves(): + paths = nx.all_simple_paths(self.wf_instance.workflow, root, leaf) + all_paths.extend(paths) + + self.paths = all_paths + + def _calc_dataframes(self) -> tuple[pd.DataFrame, pd.DataFrame]: + costs, runtimes = {}, {} + for machine_name, machine_details in self.machines.items(): + machine_cost, machine_runtime = [], [] + for task_name, task in self.tasks: + old_machine = task["task"].machine + number_of_operations = ( + task["task"].runtime * old_machine.cpu_speed * old_machine.cpu_cores + ) + # todo can this overflow? + real_runtime = number_of_operations / ( + machine_details.cpu["speed"] * machine_details.cpu["count"] + ) + machine_runtime.append(real_runtime) + machine_cost.append(real_runtime * machine_details.price) + costs[machine_name] = machine_cost + runtimes[machine_name] = machine_runtime + + time_df = pd.DataFrame(data=runtimes, index=self.wf_instance.workflow.nodes) + cost_df = pd.DataFrame(data=costs, index=self.wf_instance.workflow.nodes) + + return time_df, cost_df + + +def calc_slack_coefficients(constant: int) -> list[int]: + num_slack = int(math.floor(math.log2(constant))) + slack_coefficients = [2**j for j in range(num_slack)] + if constant - 2**num_slack >= 0: + slack_coefficients.append(constant - 2**num_slack + 1) + return slack_coefficients + + +class WorkflowSchedulingProblem(Problem): + """Workflow Scheduling Problem + + Parameters + ---------- + encoding : str + Encoding used for the problem (one-hot or binary) + tasks_file : str + Path to the tasks file + machines_file : str + Path to the machines file + deadline : float + Deadline for the workflow + + Attributes + ---------- + objective_function: Polynomial + Objective_function represented as a Polynomial + constraints : list[Polynomial] + List of constraints represented as a Polynomials + """ + + def __new__( + cls, encoding: str, tasks_file: str, machines_file: str, deadline: float + ) -> 'WorkflowSchedulingOneHot | WorkflowSchedulingBinary': + workflow = Workflow(tasks_file, machines_file, deadline) + + if encoding == "one-hot": + return WorkflowSchedulingOneHot(workflow) + elif encoding == "binary": + return WorkflowSchedulingBinary(workflow) + raise ProblemException(f"Unsupported encoding: {encoding}") + + +class WorkflowSchedulingOneHot(Problem): + def __init__(self, workflow: Workflow): + self.workflow = workflow + self.variables: tuple[sympy.Symbol] = sympy.symbols(" ".join([ + f"x{i}" for i in range( + len(self.workflow.tasks) * len(self.workflow.machines) + ) + ])) + self._set_objective_function() + self._set_constraints() + + def _set_objective_function(self) -> None: + expression: Expr = cast(Expr, 0) + for task_id, task_name in enumerate(self.workflow.time_matrix.index): + for machine_id, machine_name in enumerate( + self.workflow.time_matrix.columns + ): + cost = self.workflow.cost_matrix[machine_name][task_name] + expression += ( + cost + * self.variables[ + machine_id + task_id * len(self.workflow.time_matrix.columns) + ] + ) + + self.objective_function = from_sympy(expression) + + def _set_constraints(self) -> None: + self.constraints: list[Constraint] = [] + + # machine assignment constraint + for task_id in range(len(self.workflow.time_matrix.index)): + expression: Expr = cast(Expr, 0) + for machine_id in range(len(self.workflow.time_matrix.columns)): + expression += self.variables[ + machine_id + task_id * len(self.workflow.time_matrix.columns) + ] + self.constraints.append( + Constraint(from_sympy(expression), Polynomial(1))) + + # deadline constraint + for path in self.workflow.paths: + expression = cast(Expr, 0) + for task_id, task_name in enumerate(self.workflow.time_matrix.index): + for machine_id, machine_name in enumerate( + self.workflow.time_matrix.columns + ): + if task_name in path: + time = self.workflow.time_matrix[machine_name][task_name] + expression += ( + time + * self.variables[ + machine_id + + task_id * len(self.workflow.time_matrix.columns) + ] + ) + + # todo add constraints unbalanced penalization + self.constraints.append( + Constraint( + from_sympy(expression), + Polynomial(self.workflow.deadline), + Operator.LE, + UNBALANCED_PENALIZATION, + ) + ) + + def decode_solution(self, solution: dict) -> dict: + decoded_solution = {} + for variable, value in solution.items(): + _, id = variable[0], int(variable[1:]) # todo add validation + if value == 1.0: + machine_id = id % len(self.workflow.machines) + task_id = id // len(self.workflow.machines) + decoded_solution[ + self.workflow.time_matrix.index[task_id] + ] = self.workflow.time_matrix.columns[machine_id] + + return decoded_solution + + def get_deadlines(self) -> tuple[float, float]: # todo test this function + """Calculates the minimum and maximum path runtime + for the whole workflow.""" + + flat_runtimes = [ + (runtime, name) + for n, machine_runtimes in self.workflow.time_matrix.items() + for runtime, name in zip(machine_runtimes, self.workflow.task_names) + ] + + max_path_runtime = 0.0 + min_path_runtime = 0.0 + + for path in self.workflow.paths: + max_runtime: defaultdict[str, float] = defaultdict(lambda: 0.0) + min_runtime: defaultdict[str, float] = defaultdict(lambda: math.inf) + + for runtime, name in flat_runtimes: + if name not in path: + continue + max_runtime[name] = max(max_runtime[name], runtime) + min_runtime[name] = min(min_runtime[name], runtime) + max_path_runtime = max(max_path_runtime, sum(max_runtime.values())) + min_path_runtime = max(min_path_runtime, sum(min_runtime.values())) + + return min_path_runtime, max_path_runtime + + def get_score(self, result: str, penalty: float = 0) -> float: + x = [int(val) for val in result] + + return penalty + + +class WorkflowSchedulingBinary(Problem): + def __init__(self, workflow: Workflow): + self.workflow = workflow + self.variables: tuple[sympy.Symbol] = sympy.symbols( + " ".join( + [ + f"x{i}" + for i in range( + len(self.workflow.tasks) + * math.ceil(math.log2(len(self.workflow.machines))) + ) + ] + ) + ) + self._set_binary_representation() + self._set_objective_function() + self._set_constraints() + + def _set_binary_representation(self) -> None: + num_of_machines = len(self.workflow.machines) + len_machine_encoding = math.ceil(math.log2(num_of_machines)) + + self.machines_binary_representation = { + machine_name: bin(machine_id)[2:].zfill(len_machine_encoding) + for machine_name, machine_id in zip( + self.workflow.machine_names, range(len(self.workflow.machines)) + ) + } + + def _set_objective_function(self) -> None: + expression = cast(Expr, 0) + for _, task_name in enumerate(self.workflow.time_matrix.index): + for _, machine_name in enumerate(self.workflow.time_matrix.columns): + current_term = cast(Expr, 1) + task_id = self.workflow.time_matrix.index.get_loc(task_name) + variable_id = task_id * (len(self.workflow.tasks) - 1) + for el in self.machines_binary_representation[machine_name]: + if el == "0": + current_term *= 1 - self.variables[variable_id] + elif el == "1": + current_term *= self.variables[variable_id] + variable_id += 1 + expression += ( + self.workflow.cost_matrix.loc[task_name, machine_name] + * current_term + ) + + self.objective_function = from_sympy(expression) + + def _set_constraints(self) -> None: + self.constraints: list[Constraint] = [] + + for path in self.workflow.paths: + expression: sympy.Expr = sympy.Expr(0) + for _, task_name in enumerate(path): + for _, machine_name in enumerate(self.workflow.time_matrix.columns): + current_term = cast(Expr, 1) + task_id = self.workflow.time_matrix.index.get_loc(task_name) + assert isinstance(task_id, int) + + variable_id = task_id * (len(self.workflow.tasks) - 1) + for el in self.machines_binary_representation[machine_name]: + if el == "0": + current_term *= 1 - self.variables[variable_id] + elif el == "1": + current_term *= self.variables[variable_id] + variable_id += 1 + expression += ( + self.workflow.time_matrix.loc[task_name, machine_name] + * current_term + ) + + # todo add constraints unbalanced penalization + self.constraints.append( + Constraint( + from_sympy(expression), + Polynomial(self.workflow.deadline), + Operator.LE, + UNBALANCED_PENALIZATION, + ) + ) + + def get_score(self, result: str, penalty: float = 0) -> float: + decoded_solution = {} + machine_encoding_len = math.ceil(math.log2(len(self.workflow.machines))) + for task_id, task_name in enumerate(self.workflow.task_names): + decoded_solution[task_name] = int( + result[ + task_id * machine_encoding_len : task_id * machine_encoding_len + + machine_encoding_len + ], + 2, + ) + + for path in self.workflow.paths: + path_time = 0 + for task_name in path: + machine_name = self.workflow.time_matrix.columns[ + decoded_solution[task_name] + ] + path_time += self.workflow.time_matrix.loc[task_name, machine_name] + + if path_time > self.workflow.deadline: + return penalty + + cost_of_used_machines = 0 + for task_id, task_name in enumerate(self.workflow.task_names): + machine_name = self.workflow.time_matrix.columns[ + decoded_solution[task_name] + ] + cost_of_used_machines += self.workflow.cost_matrix.loc[ + task_name, machine_name + ] + + return cost_of_used_machines diff --git a/QHyper/QHyper/solvers/__init__.py b/QHyper/QHyper/solvers/__init__.py new file mode 100644 index 0000000..d5d53ac --- /dev/null +++ b/QHyper/QHyper/solvers/__init__.py @@ -0,0 +1,236 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + +""" +This module contains implementations of different solvers. +In QHyper exists three types of solvers: classical, quantum annealing and +gate-based. +Some of them are written from scratch based on popular algorithms, while +others are just a wrapper for existing solutions. +No solver is imported by deafult to reduce number of dependencies. +To use any solver you can import it directly like + +.. code-block:: python + + from QHyper.solver.gate_based.pennylane.qaoa import QAOA + +or use function :py:func:`Solvers.get` with the name, category, and platform. +Any solver that is in directory 'QHyper/custom' or 'custom' will be +also available in this function. + +.. rubric:: Interface + +.. autosummary:: + :toctree: generated/ + + Solver -- Base class for solvers. + SolverResult -- Dataclass for storing results + + +.. rubric:: Classical Solvers + +.. autosummary:: + :toctree: generated/ + + classical.gurobi.Gurobi -- Gurobi solver. + + +.. rubric:: Quantum Annealing Solvers + +.. autosummary:: + :toctree: generated/ + + quantum_annealing.dwave.cqm.CQM -- CQM solver. + quantum_annealing.dwave.dqm.DQM -- DQM solver. + quantum_annealing.dwave.advantage.Advantage -- Advantage solver. + + +.. rubric:: Gate-based solvers + +.. autosummary:: + :toctree: generated/ + + gate_based.pennylane.qaoa.QAOA -- QAOA solver. + gate_based.pennylane.qml_qaoa.QML_QAOA -- QML QAOA solver. + gate_based.pennylane.wf_qaoa.WF_QAOA -- Weight Free QAOA solver. + gate_based.pennylane.h_qaoa.H_QAOA -- Hyper QAOA solver. + + +.. rubric:: Hyper-optimizer + +Not really a solver, but a class that can be used to optimize the hyperparameters +of another solver. It is a wrapper around the solver class. + +.. autosummary:: + :toctree: generated/ + + hyper_optimizer.HyperOptimizer -- Hyper-optimizer. + +.. rubric:: Additional functions + +.. autoclass:: Solvers + :members: +""" + +import copy +import dataclasses + + +from typing import Type, Any + +from QHyper.problems import problem_from_config, ProblemConfigException +from QHyper.util import search_for + +from QHyper.optimizers import Optimizer, create_optimizer, OptimizationParameter + +from QHyper.solvers.base import ( # noqa F401 + Solver, SolverResult, SolverConfigException) +from QHyper.solvers.hyper_optimizer import HyperOptimizer + + +class Solvers: + custom_solvers: None | dict[str, type] = None + + @staticmethod + def get(name: str, category: str = '', platform: str = '') -> Type[Solver]: + """ + Get solver class by name, category, and platform. + + The name is required, other paramters might be required + if there would be more than one solver with the same name. + The solver will be available by the 'name' attribute if defined or + by the class name. Letters case doesn't matter. + + """ + + if Solvers.custom_solvers is None: + Solvers.custom_solvers = ( + search_for(Solver, 'QHyper/custom') + | search_for(Solver, 'custom')) + + # In the future, the category and platform might be required for some + # solvers + if category == "custom": + if name in Solvers.custom_solvers: + return Solvers.custom_solvers[name] + else: + raise FileNotFoundError( + f"Solver {name} not found in custom solvers" + ) + + name_ = name.lower() + if name_ in ["qaoa"]: + from .gate_based.pennylane.qaoa import QAOA + return QAOA + elif name_ in ["qml_qaoa"]: + from .gate_based.pennylane.qml_qaoa import QML_QAOA + return QML_QAOA + elif name_ in ["wf_qaoa"]: + from .gate_based.pennylane.wf_qaoa import WF_QAOA + return WF_QAOA + elif name_ in ["h_qaoa"]: + from .gate_based.pennylane.h_qaoa import H_QAOA + return H_QAOA + elif name_ in ["gurobi"]: + from .classical.gurobi.gurobi import Gurobi + return Gurobi + elif name_ in ["cqm"]: + from .quantum_annealing.dwave.cqm import CQM + return CQM + elif name_ in ["dqm"]: + from .quantum_annealing.dwave.dqm import DQM + return DQM + elif name_ in ["advantage"]: + from .quantum_annealing.dwave.advantage import Advantage + return Advantage + else: + raise SolverConfigException(f"Solver {name} not found") + + +def solver_from_config(config: dict[str, Any]) -> Solver | HyperOptimizer: + """ + Alternative way of creating solver. + Expect dict with two keys: + - type - type of solver + - args - arguments which will be passed to Solver instance + + Parameters + ---------- + problem : Problem + The problem to be solved + config : dict[str. Any] + Configuration in form of dict + + Returns + ------- + Solver + Initialized Solver object + """ + + config = copy.deepcopy(config) + + try: + problem_config = config.pop('problem') + except KeyError: + raise ProblemConfigException( + 'Problem configuration was not provided') + problem = problem_from_config(problem_config) + + error_msg = "" + + if 'solver' not in config: + raise SolverConfigException("Solver configuration was not provided") + if 'name' not in config['solver']: + raise SolverConfigException("Solver name was not provided") + + try: + solver_class = Solvers.get( + config['solver']['name'], + config['solver'].get('category', ''), + config['solver'].get('platform', '') + ) + except FileNotFoundError: + raise SolverConfigException( + f"Solver {config['solver']['name']} not found" + ) + + for field in dataclasses.fields(solver_class): + if not field.init: + continue + + if field.name not in config['solver']: + continue + + if field.type == Optimizer: + config['solver'][field.name] = create_optimizer( + config['solver'][field.name] + ) + elif field.type == OptimizationParameter: + config['solver'][field.name] = OptimizationParameter( + **config['solver'][field.name] + ) + + try: + error_msg = "Solver configuration was not provided" + solver_config = config.pop('solver') + error_msg = "Solver name was not provided" + solver_name = solver_config.pop('name') + solver_category = solver_config.pop('category', '') + solver_platform = solver_config.pop('platform', '') + solver_class = Solvers.get( + solver_name, solver_category, solver_platform) + except KeyError: + raise SolverConfigException(error_msg) + + solver = solver_class.from_config(problem, solver_config) + + hyper_optimizer_config = config.pop('hyper_optimizer', None) + + if hyper_optimizer_config: + optimizer_config = hyper_optimizer_config.pop('optimizer') + optimizer = create_optimizer(optimizer_config) + hyper_optimizer = HyperOptimizer( + optimizer, solver, **hyper_optimizer_config) + return hyper_optimizer + return solver diff --git a/QHyper/QHyper/solvers/base.py b/QHyper/QHyper/solvers/base.py new file mode 100644 index 0000000..fdbac6d --- /dev/null +++ b/QHyper/QHyper/solvers/base.py @@ -0,0 +1,133 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from abc import abstractmethod, ABC +from dataclasses import dataclass, field +import numpy as np + +from typing import Any, Optional + +from QHyper.problems.base import Problem +from QHyper.optimizers import OptimizationResult + + +class SolverConfigException(Exception): + pass + + +class SolverException(Exception): + pass + + +# class SamplesetDataHandler + + +@dataclass +class SamplesetData: + """ + Class for storing additional sampleset information. + Attributes + ---------- + dwave_sampleset_metadata : np.ndarray + Record array containing metadata obtained from D-Wave: + - qpu_sampling_time_us, + - qpu_anneal_time_per_sample_us, + - qpu_readout_time_per_sample_us, + - qpu_access_time_us, + - qpu_access_overhead_time_us, + - qpu_programming_time_us, + - qpu_delay_time_per_sample_us, + - total_post_processing_time_us, + - post_processing_overhead_time_us, + + The time units are microseconds (us) according to the D-Wave Docs (July 2025): + https://docs.dwavequantum.com/en/latest/quantum_research/operation_timing.html. + + + time_measurements : np.ndarray + Record array containining information about time measurements of: + - find_clique_embedding_time_s - in case of clique embedding: + first call to that function after installment results + in the embedding search (might take minutes), next calls are accessing the clique + emedding cache file, + or + - find_heuristic_embedding_time_s - in case of heuristic embedding: search for heuristic embedding, + - fixed_embedding_composite_time_s - creating FixedEmbeddingComposite object, + - sample_func_time_s - method execution of the .sample function - communication with the solver itself. + (https://dwave-systemdocs.readthedocs.io/en/link_fix/reference/composites/generated/dwave.system.composites.FixedEmbeddingComposite.sample.html#dwave.system.composites.FixedEmbeddingComposite.sample), + + """ + dwave_sampleset_metadata: np.ndarray | None = None + time_measurements: np.ndarray | None = None + dwave_sampleset: dict | None = None + timing: dict | None = None + problem_id: str | int | float = None + community_hash: str | int | None = None + chain_strength: float | None = None + chain_break_fraction: float | None = None + chain_break_method: str | None = None + embedding: dict | None = None + warnings: dict | None = None + community: list[int] | None = None + +@dataclass +class SolverResult: + """ + Class for storing results of the solver. + + Attributes + ---------- + probabilities : np.recarray + Record array with the results of the solver. Contains column for each + variable and the probability of the solution. + params : dict[Any, Any] + Dictionary with the best parameters for the solver. + history : list[list[float]] + History of the solver. Each element of the list represents the values + of the objective function at each iteration - there can be multiple + results per each iteration (epoch). + sampleset_info : Optional[SamplesetData] + Additional information about the sampleset in case of sampling-based + methods such as with quantum annealing. + """ + probabilities: np.recarray + params: dict[Any, Any] + history: list[list[OptimizationResult]] = field(default_factory=list) + sampleset_info: Optional[SamplesetData] = None + + +class Solver(ABC): + """ + Abstract base class for solvers. + + Attributes + ---------- + problem : Problem + The problem to be solved. + """ + + problem: Problem + + def __init__(self, problem: Problem): + self.problem = problem + + @classmethod + def from_config(cls, problem: Problem, config: dict[str, Any]) -> 'Solver': + return cls(problem, **config) + + @abstractmethod + def solve( + self, + ) -> SolverResult: + """ + Parameters are specified in solver implementation. + + Returns + ------- + SolverResult + Result of the solver. + """ + + ... diff --git a/QHyper/QHyper/solvers/classical/__init__.py b/QHyper/QHyper/solvers/classical/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/QHyper/solvers/classical/gurobi/__init__.py b/QHyper/QHyper/solvers/classical/gurobi/__init__.py new file mode 100644 index 0000000..a403e97 --- /dev/null +++ b/QHyper/QHyper/solvers/classical/gurobi/__init__.py @@ -0,0 +1 @@ +from .gurobi import Gurobi diff --git a/QHyper/QHyper/solvers/classical/gurobi/gurobi.py b/QHyper/QHyper/solvers/classical/gurobi/gurobi.py new file mode 100644 index 0000000..36a8cbe --- /dev/null +++ b/QHyper/QHyper/solvers/classical/gurobi/gurobi.py @@ -0,0 +1,104 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from typing import Any, Optional + +from dataclasses import dataclass + +import numpy as np +import gurobipy as gp +from QHyper.problems.base import Problem +from QHyper.solvers.base import Solver, SolverResult +from QHyper.polynomial import Polynomial +from QHyper.constraint import Operator + + +def polynomial_to_gurobi(gurobi_vars: dict[str, Any], poly: Polynomial) -> Any: + cost_function_1: float = 0 + for vars, coeff in poly.terms.items(): + tmp = 1 + for v in vars: + tmp *= gurobi_vars[v] + cost_function_1 += tmp * coeff + return cost_function_1 + + +@dataclass +class Gurobi(Solver): # todo works only for quadratic expressions + """ + Gurobi solver class. + + Attributes + ---------- + problem : Problem + The problem to be solved. + model_name : str, optional + The name of the gurobi model. + mip_gap : float | None, optional + The MIP gap. + suppress_output : bool, optional, default=True + If True, the solver's output will be suppressed. + threads : int, optional, default=1 + The number of threads to be used by the solver. + """ + + problem: Problem + model_name: str = "" + mip_gap: float | None = None + suppress_output: bool = True + threads: int = 1 + + def solve(self) -> Any: + if self.suppress_output: + env = gp.Env(empty=True) + env.setParam("OutputFlag", 0) + env.start() + else: + env = None + + gpm = gp.Model(self.model_name, env=env) + + if self.mip_gap: + gpm.Params.MIPGap = self.mip_gap + + gpm.setParam('Threads', self.threads) + + all_vars = self.problem.objective_function.get_variables() + for con in self.problem.constraints: + all_vars |= con.get_variables() + + vars = { + str(var_name): gpm.addVar(vtype=gp.GRB.BINARY, name=str(var_name)) + for var_name in all_vars + } + + objective_function = polynomial_to_gurobi( + vars, self.problem.objective_function + ) + gpm.setObjective(objective_function, gp.GRB.MINIMIZE) + + for i, constraint in enumerate(self.problem.constraints): + lhs = polynomial_to_gurobi(vars, constraint.lhs) + rhs = polynomial_to_gurobi(vars, constraint.rhs) + if constraint.operator == Operator.EQ: + gpm.addConstr(lhs == rhs, f"constr_{i}") + elif constraint.operator == Operator.LE: + gpm.addConstr(lhs <= rhs, f"constr_{i}") + elif constraint.operator == Operator.GE: + gpm.addConstr(lhs >= rhs, f"constr_{i}") + + gpm.update() + gpm.optimize() + + allvars = gpm.getVars() + solution = {} + for v in allvars: + solution[v.VarName] = v.X + + recarray = np.recarray( + (1, ), dtype=[(var, 'i4') for var in vars]+[('probability', 'f8')]) + recarray[0] = *(solution[var] for var in vars), 1.0 + + return SolverResult(recarray, {}, []) diff --git a/QHyper/QHyper/solvers/gate_based/__init__.py b/QHyper/QHyper/solvers/gate_based/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/QHyper/solvers/gate_based/pennylane/__init__.py b/QHyper/QHyper/solvers/gate_based/pennylane/__init__.py new file mode 100644 index 0000000..2fffc06 --- /dev/null +++ b/QHyper/QHyper/solvers/gate_based/pennylane/__init__.py @@ -0,0 +1,9 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from .qaoa import QAOA +from .h_qaoa import H_QAOA +from .wf_qaoa import WF_QAOA +from .qml_qaoa import QML_QAOA diff --git a/QHyper/QHyper/solvers/gate_based/pennylane/h_qaoa.py b/QHyper/QHyper/solvers/gate_based/pennylane/h_qaoa.py new file mode 100644 index 0000000..f7cc306 --- /dev/null +++ b/QHyper/QHyper/solvers/gate_based/pennylane/h_qaoa.py @@ -0,0 +1,165 @@ +import pennylane as qml +from pennylane import numpy as np + +from typing import Callable + +from dataclasses import dataclass, field + +from QHyper.problems.base import Problem +from QHyper.optimizers import ( + OptimizationResult, Optimizer, Dummy, OptimizationParameter) + +from QHyper.solvers.base import SolverResult +from QHyper.solvers.gate_based.pennylane.qaoa import QAOA + +from QHyper.util import weighted_avg_evaluation + + +@dataclass +class H_QAOA(QAOA): + """ + Different implementation of QAOA. + This implementation uses different function to evaluate the hamiltonian - + this function doesn't return expectation value but the score of the + solution. Another difference is that this implementation update the penalty weights + of the problem in the optimization process of QAOA. + + Attributes + ---------- + problem : Problem + The problem to be solved. + layers : int + Number of layers. + gamma : OptimizationParameter + Vector of gamma angles used in cost Hamiltonian. Size of the vector + should be equal to the number of layers. + beta : OptimizationParameter + Vector of beta angles used in mixing Hamiltonian. Size of the vector + should be equal to the number of layers. + optimizer : Optimizer + Optimizer used in the classical part of the algorithm. + penalty_weights : OptimizationParameter + Penalty Weights used for converting Problem to QUBO. They connect cost function + with constraints. If not specified, all penalty weights are set to 1. But + unlike in QAOA, this parameter is updated during optimization. + limit_results : int | None, default None + Specifies how many results should be considered in the evaluation of + the objective function. If None, all results are considered. + penalty : float, default 0 + When calculating the score of the solution, the penalty is the score + for the solution that doesn't satisfy the constraints. + backend : str, default 'default.qubit' + Backend for PennyLane. + mixer : str, default 'pl_x_mixer' + Mixer name. Currently only 'pl_x_mixer' is supported. + qubo_cache : dict[tuple[float, ...], qml.Hamiltonian] + Cache for QUBO. + dev : qml.devices.LegacyDevice + PennyLane device instance. + """ + + problem: Problem + layers: int + gamma: OptimizationParameter + beta: OptimizationParameter + penalty_weights: OptimizationParameter + optimizer: Optimizer + limit_results: int | None = None + penalty: float = 0 + backend: str = "default.qubit" + mixer: str = "pl_x_mixer" + qubo_cache: dict[tuple[float, ...], qml.Hamiltonian] = field( + default_factory=dict, init=False) + dev: qml.devices.LegacyDevice | None = field(default=None, init=False) + + def __init__( + self, + problem: Problem, + layers: int, + gamma: OptimizationParameter, + beta: OptimizationParameter, + penalty_weights: OptimizationParameter, + penalty: float, + backend: str = "default.qubit", + mixer: str = "pl_x_mixer", + limit_results: int | None = None, + optimizer: Optimizer = Dummy(), + ) -> None: + self.problem = problem + self.optimizer = optimizer + self.gamma = gamma + self.beta = beta + self.penalty_weights = penalty_weights + self.penalty = penalty + self.limit_results = limit_results + self.layers = layers + self.backend = backend + self.mixer = mixer + self.qubo_cache = {} + + def get_expval_circuit(self) -> Callable[[list[float], + list[float]], float]: + def wrapper(params: list[float]) -> float: + angles = params[:2*self.layers] + penalty_weights = params[2*self.layers:] + + penalty_weights_ = [] + + for weight in penalty_weights: + if isinstance(weight, np.numpy_boxes.ArrayBox): + penalty_weights_.append(weight._value) + else: + penalty_weights_.append(weight) + penalty_weights = penalty_weights_ + + cost_operator = self.create_cost_operator(self.problem, penalty_weights) + self.dev = qml.device(self.backend, wires=cost_operator.wires) + probs_func = self.get_probs_func(self.problem, penalty_weights) + + probs = probs_func(angles) + if isinstance(probs, np.numpy_boxes.ArrayBox): + probs = probs._value + + dtype = [ + (wire, 'i4') for wire in self.dev.wires]+[('probability', 'f8')] + recarray = np.recarray((len(probs),), dtype=dtype) + for i, probability in enumerate(probs): + solution = format(i, "b").zfill(self._get_num_of_wires()) + recarray[i] = *solution, probability + + result = weighted_avg_evaluation( + recarray, self.problem.get_score, self.penalty, + limit_results=self.limit_results + ) + return OptimizationResult(result, params) + return wrapper + + def solve(self, penalty_weights: list[float] | None = None, + gamma: list[float] | None = None, + beta: list[float] | None = None) -> SolverResult: + if penalty_weights is not None: + penalty_weights = self.penalty_weights.update(init=penalty_weights) + else: + penalty_weights = self.penalty_weights + gamma_ = self.gamma if gamma is None else self.gamma.update(init=gamma) + beta_ = self.beta if beta is None else self.beta.update(init=beta) + + params = gamma_ + beta_ + self.penalty_weights + + opt_res = self.optimizer.minimize( + self.get_expval_circuit(), params) + + angles = opt_res.params[:2*self.layers] + penalty_weights_res = opt_res.params[2*self.layers:] + + gamma_res = angles[:len(angles) // 2] + beta_res = angles[len(angles) // 2:] + + return SolverResult( + self.run_with_probs(self.problem, angles, penalty_weights_res), + { + 'gamma': gamma_res, 'beta': beta_res, + 'penalty_weights': penalty_weights_res + }, + opt_res.history, + ) diff --git a/QHyper/QHyper/solvers/gate_based/pennylane/qaoa.py b/QHyper/QHyper/solvers/gate_based/pennylane/qaoa.py new file mode 100644 index 0000000..e626ba8 --- /dev/null +++ b/QHyper/QHyper/solvers/gate_based/pennylane/qaoa.py @@ -0,0 +1,232 @@ +import pennylane as qml +from pennylane import numpy as np + +from typing import Callable, cast + +from dataclasses import dataclass, field + +from QHyper.problems.base import Problem +from QHyper.optimizers import ( + OptimizationResult, Optimizer, Dummy, OptimizationParameter) + +from QHyper.converter import Converter +from QHyper.polynomial import Polynomial +from QHyper.solvers.base import Solver, SolverResult + + +@dataclass +class QAOA(Solver): + """ + Clasic QAOA implementation. + + Attributes + ---------- + problem : Problem + The problem to be solved. + layers : int + Number of layers. + gamma : OptimizationParameter + Vector of gamma angles used in cost Hamiltonian. Size of the vector + should be equal to the number of layers. + beta : OptimizationParameter + Vector of beta angles used in mixing Hamiltonian. Size of the vector + should be equal to the number of layers. + optimizer : Optimizer + Optimizer used in the classical part of the algorithm. + penalty_weights : list[float] | None + Penalty weights used for converting Problem to QUBO. They connect cost function + with constraints. If not specified, all penalty weights are set to 1. + backend : str + Backend for PennyLane. + mixer : str + Mixer name. Currently only 'pl_x_mixer' is supported. + qubo_cache : dict[tuple[float, ...], qml.Hamiltonian] + Cache for QUBO. + dev : qml.devices.LegacyDevice + PennyLane device instance. + """ + + problem: Problem + layers: int + gamma: OptimizationParameter + beta: OptimizationParameter + optimizer: Optimizer + penalty_weights: list[float] | None = None + backend: str = "default.qubit" + mixer: str = "pl_x_mixer" + qubo_cache: dict[tuple[float, ...], qml.Hamiltonian] = field( + default_factory=dict, init=False) + dev: qml.devices.LegacyDevice | None = field(default=None, init=False) + + def __init__( + self, + problem: Problem, + layers: int, + gamma: OptimizationParameter, + beta: OptimizationParameter, + penalty_weights: list[float] | None = None, + optimizer: Optimizer = Dummy(), + backend: str = "default.qubit", + mixer: str = "pl_x_mixer" + ) -> None: + self.problem = problem + self.optimizer = optimizer + self.gamma = gamma + self.beta = beta + self.penalty_weights = penalty_weights + self.layers = layers + self.backend = backend + self.mixer = mixer + self.qubo_cache = {} + + def _get_num_of_wires(self) -> int: + if self.dev is None: + raise ValueError("Device not initialized") + return len(self.dev.wires) + + def create_cost_operator(self, problem: Problem, + penalty_weights: list[float] + ) -> qml.Hamiltonian: + if tuple(penalty_weights) not in self.qubo_cache: + qubo = Converter.create_qubo(problem, penalty_weights) + self.qubo_cache[tuple( + penalty_weights)] = self._create_cost_operator(qubo) + return self.qubo_cache[tuple(penalty_weights)] + + def _create_cost_operator(self, qubo: Polynomial) -> qml.Hamiltonian: + result: qml.Hamiltonian | None = None + const = 0 + + for variables, coeff in qubo.terms.items(): + if not variables: + const += coeff + continue + + summand: qml.Hamiltonian | None = None + for var in variables: + if summand and str(var) in summand.wires: + continue + encoded_var = cast( + qml.Hamiltonian, + 0.5 * qml.Identity(str(var)) - 0.5 * qml.PauliZ(str(var)) + ) + + summand = (summand @ encoded_var if summand + else coeff * encoded_var) + result = result + summand if result else summand + + assert result is not None + return (result + const * qml.Identity(result.wires[0])).simplify() + + def _hadamard_layer(self, cost_operator: qml.Hamiltonian) -> None: + for i in cost_operator.wires: + qml.Hadamard(str(i)) + + def _create_mixing_hamiltonian(self, cost_operator: qml.Hamiltonian + ) -> qml.Hamiltonian: + return qml.qaoa.x_mixer([str(v) for v in cost_operator.wires]) + + def _circuit( + self, + angles: list[float], + cost_operator: qml.Hamiltonian, + ) -> None: + def qaoa_layer(gamma: list[float], beta: list[float]) -> None: + qml.qaoa.cost_layer(gamma, cost_operator) + qml.qaoa.mixer_layer( + beta, self._create_mixing_hamiltonian(cost_operator)) + gamma, beta = angles[:len(angles) // 2], angles[len(angles) // 2:] + self._hadamard_layer(cost_operator) + qml.layer(qaoa_layer, self.layers, gamma, beta) + + def get_expval_circuit( + self, penalty_weights: list[float] + ) -> Callable[[list[float]], OptimizationResult]: + cost_operator = self.create_cost_operator(self.problem, penalty_weights) + + self.dev = qml.device(self.backend, wires=cost_operator.wires) + + @qml.qnode(self.dev) + def expval_circuit(angles: list[float]) -> OptimizationResult: + self._circuit(angles, cost_operator) + return cast(float, qml.expval(cost_operator)) + + def wrapper(angles: list[float]) -> OptimizationResult: + return OptimizationResult( + expval_circuit(angles), angles + ) + + return wrapper + + def get_probs_func( + self, problem: Problem, penalty_weights: list[float] + ) -> Callable[[list[float]], list[float]]: + """Returns function that takes angles and returns probabilities + + Parameters + ---------- + penalty_weights : list[float] + Penalty weights for converting Problem to QUBO + + Returns + ------- + Callable[[list[float]], float] + Returns function that takes angles and returns probabilities + """ + cost_operator = self.create_cost_operator(problem, penalty_weights) + + self.dev = qml.device(self.backend, wires=cost_operator.wires) + + @qml.qnode(self.dev) + def probability_circuit(angles: list[float]) -> list[float]: + self._circuit(angles, cost_operator) + return cast( + list[float], qml.probs(wires=cost_operator.wires) + ) + + return probability_circuit + + def run_with_probs( + self, + problem: Problem, + angles: list[float], + penalty_weights: list[float], + ) -> np.recarray: + probs = self.get_probs_func(problem, penalty_weights)(angles) + + recarray = np.recarray((len(probs),), + dtype=[(wire, 'i4') for wire in + self.dev.wires]+[('probability', 'f8')]) + for i, probability in enumerate(probs): + solution = format(i, "b").zfill(self._get_num_of_wires()) + recarray[i] = *solution, probability + return recarray + + def _run_optimizer(self, penalty_weights: list[float], + angles: OptimizationParameter) -> OptimizationResult: + return self.optimizer.minimize( + self.get_expval_circuit(penalty_weights), angles) + + def solve(self, penalty_weights: list[float] | None = None, + gamma: list[float] | None = None, + beta: list[float] | None = None) -> SolverResult: + if penalty_weights is None and self.penalty_weights is None: + penalty_weights = [1.] * (len(self.problem.constraints) + 1) + penalty_weights = (self.penalty_weights if penalty_weights is None + else penalty_weights) + + assert penalty_weights is not None + gamma_ = self.gamma if gamma is None else self.gamma.update(init=gamma) + beta_ = self.beta if beta is None else self.beta.update(init=beta) + + angles = gamma_ + beta_ + opt_res = self._run_optimizer(penalty_weights, angles) + + gamma_res = opt_res.params[:len(opt_res.params) // 2] + beta_res = opt_res.params[len(opt_res.params) // 2:] + + return SolverResult( + self.run_with_probs(self.problem, opt_res.params, penalty_weights), + {'gamma': gamma_res, 'beta': beta_res}, + opt_res.history, + ) diff --git a/QHyper/QHyper/solvers/gate_based/pennylane/qml_qaoa.py b/QHyper/QHyper/solvers/gate_based/pennylane/qml_qaoa.py new file mode 100644 index 0000000..7cc5356 --- /dev/null +++ b/QHyper/QHyper/solvers/gate_based/pennylane/qml_qaoa.py @@ -0,0 +1,88 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +from dataclasses import dataclass, field + +from typing import Any, cast, Callable + +import pennylane as qml + +from QHyper.problems.base import Problem +from QHyper.optimizers.qml_gradient_descent import QmlGradientDescent +from QHyper.optimizers import ( + OptimizationResult, Optimizer, OptimizationParameter) + +from QHyper.solvers.gate_based.pennylane.qaoa import QAOA + + +@dataclass +class QML_QAOA(QAOA): + """ + QAOA implementation with additonal support for PennyLane optimizers. + + Attributes + ---------- + problem : Problem + The problem to be solved. + layers : int + Number of layers. + gamma : OptimizationParameter + Vector of gamma angles used in cost Hamiltonian. Size of the vector + should be equal to the number of layers. + beta : OptimizationParameter + Vector of beta angles used in mixing Hamiltonian. Size of the vector + should be equal to the number of layers. + optimizer : Optimizer + Optimizer used in the classical part of the algorithm. + penalty_weights : list[float] | None + Penalty weights used for converting Problem to QUBO. They connect cost function + with constraints. If not specified, all penalty weights are set to 1. + backend : str + Backend for PennyLane. + mixer : str + Mixer name. Currently only 'pl_x_mixer' is supported. + qubo_cache : dict[tuple[float, ...], qml.Hamiltonian] + Cache for QUBO. + dev : qml.devices.LegacyDevice + PennyLane device instance. + """ + problem: Problem + layers: int + gamma: OptimizationParameter + beta: OptimizationParameter + optimizer: Optimizer + penalty_weights: list[float] | None = None + mixer: str = "pl_x_mixer" + backend: str = "default.qubit" + qubo_cache: dict[tuple[float, ...], qml.Hamiltonian] = field( + default_factory=dict, init=False) + dev: qml.devices.LegacyDevice | None = field(default=None, init=False) + + def __post_init__(self) -> None: + if not isinstance(self.optimizer, QmlGradientDescent): + raise ValueError(f"Optimizer {self.optimizer} not supported") + + def get_expval_circuit( + self, penalty_weights: list[float] + ) -> Callable[[list[float]], OptimizationResult]: + cost_operator = self.create_cost_operator( + self.problem, penalty_weights) + + self.dev = qml.device(self.backend, wires=cost_operator.wires) + + @qml.qnode(self.dev) + def expval_circuit(angles: list[float]) -> Any: + self._circuit(angles, cost_operator) + return qml.expval(cost_operator) + + return expval_circuit + + def _run_optimizer( + self, + penalty_weights: list[float], + angles: OptimizationParameter + ) -> OptimizationResult: + return self.optimizer.minimize_expval_func( + cast(qml.QNode, self.get_expval_circuit(penalty_weights)), angles) diff --git a/QHyper/QHyper/solvers/gate_based/pennylane/wf_qaoa.py b/QHyper/QHyper/solvers/gate_based/pennylane/wf_qaoa.py new file mode 100644 index 0000000..4e51af6 --- /dev/null +++ b/QHyper/QHyper/solvers/gate_based/pennylane/wf_qaoa.py @@ -0,0 +1,121 @@ +import pennylane as qml +from pennylane import numpy as np + +from typing import Callable + +from dataclasses import dataclass, field + +from QHyper.problems.base import Problem +from QHyper.optimizers import OptimizationResult, Optimizer, Dummy, OptimizationParameter + +from QHyper.util import weighted_avg_evaluation + +from QHyper.solvers.gate_based.pennylane.qaoa import QAOA + + +@dataclass +class WF_QAOA(QAOA): + """ + Different implementation of QAOA. + This implementation uses different function to evaluate the hamiltonian - + this function doesn't return expectation value but the score of the + solution. + + Attributes + ---------- + problem : Problem + The problem to be solved. + layers : int + Number of layers. + gamma : OptimizationParameter + Vector of gamma angles used in cost Hamiltonian. Size of the vector + should be equal to the number of layers. + beta : OptimizationParameter + Vector of beta angles used in mixing Hamiltonian. Size of the vector + should be equal to the number of layers. + optimizer : Optimizer + Optimizer used in the classical part of the algorithm. + penalty_weights : list[float] | None + Penalty weights used for converting Problem to QUBO. They connect cost function + with constraints. If not specified, all penalty weights are set to 1. + limit_results : int | None, default None + Specifies how many results should be considered in the evaluation of + the objective function. If None, all results are considered. + penalty : float, default 0 + When calculating the score of the solution, the penalty is the score + for the solution that doesn't satisfy the constraints. + backend : str, default 'default.qubit' + Backend for PennyLane. + mixer : str, default 'pl_x_mixer' + Mixer name. Currently only 'pl_x_mixer' is supported. + qubo_cache : dict[tuple[float, ...], qml.Hamiltonian] + Cache for QUBO. + dev : qml.devices.LegacyDevice + PennyLane device instance. + """ + + problem: Problem + layers: int + gamma: OptimizationParameter + beta: OptimizationParameter + optimizer: Optimizer + penalty_weights: list[float] | None + penalty: float = 0 + backend: str = "default.qubit" + mixer: str = "pl_x_mixer" + limit_results: int | None = None + qubo_cache: dict[tuple[float, ...], qml.Hamiltonian] = field( + default_factory=dict, init=False) + dev: qml.devices.LegacyDevice | None = field(default=None, init=False) + + def __init__( + self, + problem: Problem, + layers: int, + gamma: OptimizationParameter, + beta: OptimizationParameter, + penalty_weights: list[float] | None = None, + penalty: float = 0, + backend: str = "default.qubit", + mixer: str = "pl_x_mixer", + limit_results: int | None = None, + optimizer: Optimizer = Dummy(), + ) -> None: + self.problem = problem + self.optimizer = optimizer + self.gamma = gamma + self.beta = beta + self.penalty = penalty + self.penalty_weights = penalty_weights + self.limit_results = limit_results + self.layers = layers + self.backend = backend + self.mixer = mixer + self.qubo_cache = {} + + def get_expval_circuit(self, penalty_weights: list[float] + ) -> Callable[[list[float]], float]: + cost_operator = self.create_cost_operator(self.problem, penalty_weights) + + self.dev = qml.device(self.backend, wires=cost_operator.wires) + + probs_func = self.get_probs_func(self.problem, penalty_weights) + + def wrapper(angles: list[float]) -> float: + probs = probs_func(angles) + if isinstance(probs, np.numpy_boxes.ArrayBox): + probs = probs._value + + dtype = [ + (wire, 'i4') for wire in self.dev.wires]+[('probability', 'f8')] + recarray = np.recarray((len(probs),), dtype=dtype) + for i, probability in enumerate(probs): + solution = format(i, "b").zfill(self._get_num_of_wires()) + recarray[i] = *solution, probability + + result = weighted_avg_evaluation( + recarray, self.problem.get_score, self.penalty, + limit_results=self.limit_results + ) + return OptimizationResult(result, angles) + return wrapper diff --git a/QHyper/QHyper/solvers/hyper_optimizer.py b/QHyper/QHyper/solvers/hyper_optimizer.py new file mode 100644 index 0000000..8cd07d7 --- /dev/null +++ b/QHyper/QHyper/solvers/hyper_optimizer.py @@ -0,0 +1,109 @@ +from dataclasses import dataclass, field + +from numpy.typing import NDArray +from typing import Any +from QHyper.optimizers import OptimizationResult, Optimizer, OptimizationParameter +from QHyper.solvers import Solver, SolverResult +from QHyper.problems import Problem +from QHyper.util import weighted_avg_evaluation + + +class HyperOptimizerProperty: + def __init__(self, name: str, min_value: list[float], + max_value: list[float], initial_value: list[float]) -> None: + self.name = name + self.min_value = min_value + self.max_value = max_value + self.initial_value = initial_value + + if len(min_value) != len(max_value): + raise ValueError( + "min_value and max_value must have the same length") + if len(min_value) != len(initial_value): + raise ValueError( + "min_value and initial_value must have the same length") + + def get_bounds(self) -> list[tuple[float, float]]: + return list(zip(self.min_value, self.max_value)) + + +@dataclass +class HyperOptimizer: + """ Class for hyperparameter optimization + + HyperOptimizer is a class that allows to use the optimizers and + find the best parameters for a given solver. + + Parameters + ---------- + optimizer : Optimizer + The optimizer to use for optimization + solver : Solver + The solver to use for optimization + properties : dict[str, OptimizationParameter] + The properties to optimize. Their keys must match the properties + of the solver. + history : list[SolverResult] + The history of the optimization process + best_params : OptimizationResult + The best parameters found during optimization + """ + + optimizer: Optimizer + solver: Solver + properties: dict[str, OptimizationParameter] = field(default_factory=dict) + history: list[SolverResult] = field(default_factory=list) + best_params: OptimizationResult = field(init=False) + + def __init__(self, optimizer: Optimizer, solver: Solver, **properties: Any) -> None: + self.optimizer = optimizer + self.solver = solver + self.properties = {} + self.history = [] + + for property, values in properties.items(): + self.properties[property] = OptimizationParameter(**values) + + @property + def problem(self) -> Problem: + return self.solver.problem + + def parse_params(self, params: NDArray) -> dict[str, list[float]]: + parsed_params = {} + + param_index = 0 + for property, opt_param in self.properties.items(): + parsed_params[property] = params[ + param_index:param_index + len(opt_param)] + param_index += len(opt_param) + return parsed_params + + def run_solver(self, params: NDArray) -> SolverResult: + return self.solver.solve(**self.parse_params(params)) + + def _optimization_function(self, params: NDArray) -> OptimizationResult: + result = self.run_solver(params) + + value = weighted_avg_evaluation( + result.probabilities, self.solver.problem.get_score, + ) + self.history.append(result) + + return OptimizationResult( + value=value, + params=params, + history=[] + ) + + def solve(self) -> OptimizationResult: + initial_params = sum(self.properties.values(), OptimizationParameter()) + + self.best_params = self.optimizer.minimize( + self._optimization_function, initial_params) + return self.best_params + + def run_with_best_params(self) -> SolverResult: + if self.best_params is None: + raise ValueError( + "Run hyper optimization first. Call solve() method") + return self.run_solver(self.best_params.params) diff --git a/QHyper/QHyper/solvers/quantum_annealing/__init__.py b/QHyper/QHyper/solvers/quantum_annealing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/QHyper/solvers/quantum_annealing/dwave/__init__.py b/QHyper/QHyper/solvers/quantum_annealing/dwave/__init__.py new file mode 100644 index 0000000..0d62ce2 --- /dev/null +++ b/QHyper/QHyper/solvers/quantum_annealing/dwave/__init__.py @@ -0,0 +1,3 @@ +from .advantage import Advantage +from .dqm import DQM +from .cqm import CQM diff --git a/QHyper/QHyper/solvers/quantum_annealing/dwave/advantage.py b/QHyper/QHyper/solvers/quantum_annealing/dwave/advantage.py new file mode 100644 index 0000000..082cd53 --- /dev/null +++ b/QHyper/QHyper/solvers/quantum_annealing/dwave/advantage.py @@ -0,0 +1,365 @@ +import os +from typing import Any, Callable, Dict +import numpy as np +import numpy.typing as npt +from dataclasses import dataclass +from collections import defaultdict + +from QHyper.problems.base import Problem +from QHyper.solvers.base import Solver, SolverResult, SamplesetData +from QHyper.converter import Converter +from QHyper.constraint import Polynomial + +from dwave.system import DWaveSampler +from dwave.system.composites import FixedEmbeddingComposite +from dimod import BinaryQuadraticModel +from dwave.embedding.pegasus import find_clique_embedding +from minorminer import find_embedding +from dwave.system import LeapHybridBQMSampler +import warnings +import pickle +import dwave.inspector +from dwave.inspector.adapters import enable_data_capture + +from enum import Enum + +import time +import dimod + + +DWAVE_API_TOKEN = os.environ.get("DWAVE_API_TOKEN") + + +def enable_DWave_inspector_results_data_capture(): + """Enables DWave Inspector sampler's results saving in local memory.""" + enable_data_capture() + + +class TimeUnits(str, Enum): + S = "s" + US = "us" + + +class Timing: + FIND_CLIQUE_EMBEDDING = f"find_clique_embedding_time_{TimeUnits.S}" + FIND_HEURISTIC_EMBEDDING = f"find_heuristic_embedding_time_{TimeUnits.S}" + FIXED_EMBEDDING_COMPOSITE = f"fixed_embedding_composite_time_{TimeUnits.S}" + SAMPLE_FUNCTION = f"sample_func_time_{TimeUnits.S}" + + +@dataclass +class Advantage(Solver): + """ + Class for solving a problem using Advantage + + Attributes + ---------- + problem : Problem + The problem to be solved. + num_reads: int, default 1 + The number of times the solver is run. + chain_strength: float or None, default None + The coupling strength between qubits. + hyper_optimizer: Optimizer or None, default None + The optimizer for hyperparameters. + params_inits: dict[str, Any], default {} + The initial parameter settings. + use_clique_embedding: bool, default False + Find clique for the embedding + **config: Any + Config for the D-Wave solver. Documentation available at https://docs.dwavequantum.com + """ + + problem: Problem + penalty_weights: list[float] | None = None + version: str | None = None + region: str | None = None + num_reads: int = 1 + chain_strength: float | None = None + token: str | None = None + + def __init__( + self, + problem: Problem, + penalty_weights: list[float] | None = None, + version: str | None = None, + region: str | None = None, + num_reads: int = 1, + chain_strength: float | None = None, + use_clique_embedding: bool = False, + token: str | None = None, + elapse_times: bool = False, + **config: Any, + ) -> None: + self.problem = problem + self.penalty_weights = penalty_weights + self.num_reads = num_reads + self.chain_strength = chain_strength + self.use_clique_embedding = use_clique_embedding + self.version = version + self.region = region + if (self.version and not self.region) or (self.region and not self.version): + raise ValueError("Both 'version' and 'region' must be specified together.") + if self.version and self.region: + self.sampler = DWaveSampler( + solver=self.version, region=self.region, + token=token or DWAVE_API_TOKEN, **config) + else: + self.sampler = DWaveSampler(token=token or DWAVE_API_TOKEN, **config) + self.token = token + self.elapse_times = elapse_times + self.times: Dict = {} + + if use_clique_embedding: + args = self.penalty_weights if self.penalty_weights else [] + qubo = Converter.create_qubo(self.problem, args) + qubo_terms, offset = convert_qubo_keys(qubo) + bqm = BinaryQuadraticModel.from_qubo(qubo_terms, offset=offset) + + self.embedding = execute_timed( + lambda: find_clique_embedding( + bqm.to_networkx_graph(), + target_graph=self.sampler.to_networkx_graph(), + ), + self.elapse_times, + self.times, + Timing.FIND_CLIQUE_EMBEDDING, + ) + + enable_DWave_inspector_results_data_capture() + + def solve( + self, + penalty_weights: list[float] | None = None, + return_metadata: bool = False, + saving_path: str | None = None, + label: str | None = None + ) -> Any: + if penalty_weights is None and self.penalty_weights is None: + penalty_weights = [1.0] * (len(self.problem.constraints) + 1) + penalty_weights = ( + self.penalty_weights if penalty_weights is None else penalty_weights + ) + + qubo = Converter.create_qubo(self.problem, penalty_weights) + qubo_terms, offset = convert_qubo_keys(qubo) + bqm = BinaryQuadraticModel.from_qubo(qubo_terms, offset=offset) + + label = f"{label}_" + f"n={str(self.problem.G.number_of_nodes())}_" + f"comm_hash={str(hash(tuple(self.problem.community)))}_" + + if not self.use_clique_embedding: + self.embedding = execute_timed( + lambda: find_embedding( + bqm.to_networkx_graph(), + self.sampler.to_networkx_graph(), + ), + self.elapse_times, + self.times, + Timing.FIND_HEURISTIC_EMBEDDING, + ) + + embedding_compose = execute_timed( + lambda: FixedEmbeddingComposite(self.sampler, self.embedding), + self.elapse_times, + self.times, + Timing.FIXED_EMBEDDING_COMPOSITE, + ) + + # Additional sampling info + return_embedding = True + + start = time.perf_counter() + sampleset = embedding_compose.sample( + bqm, + num_reads=self.num_reads, + chain_strength=self.chain_strength, + return_embedding=return_embedding, + warnings=dwave.system.warnings.SAVE, + label=label+str(hash(tuple(qubo_terms.items()))) + ) + # Promise is supposed to be returned, needs resolving + sampleset.resolve() + end = time.perf_counter() + if self.elapse_times: + self.times[Timing.SAMPLE_FUNCTION] = end - start + + first = next(sampleset.data(sorted_by=["energy"], name="Sample", index=True)) + + chain_break_fraction = first.chain_break_fraction + + # There might a case when the problem solution failed and there is no info in return + try: + problem_id = sampleset.info["problem_id"] + embedding_context = sampleset.info["embedding_context"] + chain_strength_extracted = embedding_context["chain_strength"] + chain_break_method = embedding_context["chain_break_method"] + embedding_extracted = embedding_context["embedding"] + timing = sampleset.info["timing"] + warnings_sampleset = sampleset.info.get("warnings", {}) + except Exception as e: + print(f"Could not extract info from sampleset.info: {e}") + problem_id = None + embedding_context = None + chain_break_method = None + embedding_extracted = None + timing = None + warnings_sampleset = None + + + label += f"_id={problem_id}" + + try: + pickle_bytes = pickle.dumps(sampleset.to_serializable()) + with open(f"{saving_path}_{label}_serializable.pkl" if saving_path else f"{label}_sampleset_adv_serializable.pkl", "wb") as f: + f.write(pickle_bytes) + except Exception as e: + print(f"Could not save serializable sampleset to .pkl file: {e}") + + result = np.recarray( + (len(sampleset),), + dtype=( + [(v, int) for v in sampleset.variables] + + [("probability", float)] + + [("energy", float)] + ), + ) + + num_of_shots = sampleset.record.num_occurrences.sum() + for i, solution in enumerate(sampleset.data()): + for var in sampleset.variables: + result[var][i] = solution.sample[var] + + result["probability"][i] = solution.num_occurrences / num_of_shots + result["energy"][i] = solution.energy + + + + if return_metadata and (not "timing" in sampleset.info or not sampleset.info["timing"]): + warnings.warn( + "No timing information available for the sampleset " + + f" for problem with community: {self.problem.community}" + + f" problem_id: {problem_id}", UserWarning + ) + + if return_metadata: + if "timing" in sampleset.info and sampleset.info["timing"]: + dwave_sampleset_metadata=time_dict_to_ndarray( + add_time_units_to_dwave_timing_info( + sampleset.info["timing"], TimeUnits.US + ) + ) + else: + dwave_sampleset_metadata=None + sampleset_info = SamplesetData( + dwave_sampleset_metadata=dwave_sampleset_metadata, + time_measurements=time_dict_to_ndarray(self.times), + dwave_sampleset=sampleset, + timing=timing, + problem_id=problem_id, + community_hash=hash(tuple(self.problem.community)), + chain_strength=chain_strength_extracted, + chain_break_fraction=chain_break_fraction, + chain_break_method=chain_break_method, + embedding=embedding_extracted, + warnings=warnings_sampleset, + community=self.problem.community, + ) + else: + sampleset_info = None + + return SolverResult( + result, {"penalty_weights": penalty_weights}, [], sampleset_info + ) + + def prepare_solver_result( + self, result: defaultdict, arguments: npt.NDArray + ) -> SolverResult: + sorted_keys = sorted( + result.keys(), key=lambda x: int("".join(filter(str.isdigit, x))) + ) + values = "".join(str(result[key]) for key in sorted_keys) + probabilities = {values: 100.0} + parameters = {values: arguments} + + return SolverResult(probabilities, parameters) + + +def convert_qubo_keys(qubo: Polynomial) -> tuple[dict[tuple, float], float]: + new_qubo = defaultdict(float) + offset = 0.0 + + qubo, offset = qubo.separate_const() + for k, v in qubo.terms.items(): + if len(k) == 1: + new_key = (k[0], k[0]) + elif len(k) > 2: + raise ValueError("Only supports quadratic model") + else: + new_key = k + + new_qubo[new_key] += v + + return (new_qubo, offset) + + +def execute_timed( + func: Callable, measure_time: bool, times_dict: Dict, key: str +) -> Any: + """ + Execute a function with optional timing measurement. + + Parameters: + ----------- + func : callable + The function to execute and potentially time. + measure_time : bool + Whether to measure execution time. + times_dict : dict + Dictionary where timing results will be stored. + key : str + Key to use for storing the timing result. + Returns: + -------- + The result of func executed. + """ + if measure_time: + start_time = time.perf_counter() + result = func() + times_dict[key] = time.perf_counter() - start_time + return result + else: + return func() + + +def time_dict_to_ndarray(sampleset_info_times: dict[str, float]) -> np.ndarray: + dtype = [(key, float) for key in sampleset_info_times] + result = np.recarray((), dtype=dtype) + for key, value in sampleset_info_times.items(): + setattr(result, key, value) + + return result + + +def add_time_units_to_dwave_timing_info( + dwave_sampleset_info_timing: dict[str, float], time_unit: TimeUnits = TimeUnits.US +) -> dict[str, float]: + """ + Add time units to the D-Wave timing info. + + Parameters: + ----------- + dwave_sampleset_info_timing : dict[str, float] + DWave dictionary with timing information. + time_unit : TimeUnits, optional + The time unit to append to the keys (default by DWave docs is TimeUnits.US). + + Returns: + -------- + np.ndarray + A record array with the timing information and units. + """ + dwave_keys_with_unit = [ + key + f"_{time_unit.value}" for key in dwave_sampleset_info_timing.keys() + ] + return dict(zip(dwave_keys_with_unit, dwave_sampleset_info_timing.values())) + diff --git a/QHyper/QHyper/solvers/quantum_annealing/dwave/cqm.py b/QHyper/QHyper/solvers/quantum_annealing/dwave/cqm.py new file mode 100644 index 0000000..02673a9 --- /dev/null +++ b/QHyper/QHyper/solvers/quantum_annealing/dwave/cqm.py @@ -0,0 +1,70 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +import os +import numpy as np +from dwave.system import LeapHybridCQMSampler + +from dataclasses import dataclass + +from QHyper.converter import Converter +from QHyper.problems import Problem +from QHyper.solvers import Solver, SolverResult + + +DWAVE_API_TOKEN = os.environ.get('DWAVE_API_TOKEN') + + +@dataclass +class CQM(Solver): + """ + Class for solving a problem using the + Constrained Quadratic Model (CQM) approach. + + Attributes + ---------- + problem : Problem + The problem to be solved. + time : float + The maximum time allowed for the CQM solver. + """ + + problem: Problem + time: float + token: str | None = None + + def solve(self) -> SolverResult: + """ + Solve the problem using the CQM approach. + + Returns + ------- + Any + The solution to the problem. + """ + converter = Converter() + cqm = converter.to_cqm(self.problem) + sampler = LeapHybridCQMSampler(token=self.token or DWAVE_API_TOKEN) + solutions = sampler.sample_cqm(cqm, self.time).aggregate() + + recarray = np.recarray( + (len(solutions),), + dtype=([(v, int) for v in solutions.variables] + + [('probability', float)] + + [('energy', float)] + + [('is_feasible', bool)]) + ) + + num_of_shots = solutions.record.num_occurrences.sum() + for i, solution in enumerate(solutions.data()): + for var in solutions.variables: + recarray[var][i] = solution.sample[var] + + recarray['probability'][i] = ( + solution.num_occurrences / num_of_shots) + recarray['energy'][i] = solution.energy + recarray['is_feasible'][i] = solution.is_feasible + + return SolverResult(recarray, {}, []) diff --git a/QHyper/QHyper/solvers/quantum_annealing/dwave/dqm.py b/QHyper/QHyper/solvers/quantum_annealing/dwave/dqm.py new file mode 100644 index 0000000..b52cb85 --- /dev/null +++ b/QHyper/QHyper/solvers/quantum_annealing/dwave/dqm.py @@ -0,0 +1,62 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + + +import os +import numpy as np + +from dataclasses import dataclass + +from dwave.system import LeapHybridDQMSampler +from QHyper.problems import Problem +from QHyper.solvers import Solver, SolverResult +from QHyper.converter import Converter + + +DWAVE_API_TOKEN = os.environ.get('DWAVE_API_TOKEN') + + +@dataclass +class DQM(Solver): + """ + DQM solver class. + + Attributes + ---------- + problem : Problem + The problem to be solved. + time : float + Maximum run time in seconds + cases: int, default 1 + Number of variable cases (values) + 1 is denoting binary variable. + """ + + problem: Problem + time: float + cases: int = 1 + token: str | None = None + + def solve(self) -> SolverResult: + dqm = Converter.to_dqm(self.problem, self.cases) + sampler = LeapHybridDQMSampler(token=self.token or DWAVE_API_TOKEN) + solutions = sampler.sample_dqm(dqm, self.time) + + recarray = np.recarray( + (len(solutions),), + dtype=([(v, int) for v in solutions.variables] + + [('probability', float)] + + [('energy', float)]) + ) + + num_of_shots = solutions.record.num_occurrences.sum() + for i, solution in enumerate(solutions.data()): + for var in solutions.variables: + recarray[var][i] = solution.sample[var] + + recarray['probability'][i] = ( + solution.num_occurrences / num_of_shots) + recarray['energy'][i] = solution.energy + + return SolverResult(recarray, {}, []) diff --git a/QHyper/QHyper/solvers/quantum_annealing/dwave/results_handler.py b/QHyper/QHyper/solvers/quantum_annealing/dwave/results_handler.py new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/QHyper/util.py b/QHyper/QHyper/util.py new file mode 100644 index 0000000..27481b4 --- /dev/null +++ b/QHyper/QHyper/util.py @@ -0,0 +1,220 @@ +# This work was supported by the EuroHPC PL infrastructure funded at the +# Smart Growth Operational Programme (2014-2020), Measure 4.2 +# under the grant agreement no. POIR.04.02.00-00-D014/20-00 + +""" +This module contains utility functions that are used across the project. + +.. rubric:: Functions + +.. autofunction:: weighted_avg_evaluation +.. autofunction:: sort_solver_results +.. autofunction:: add_evaluation_to_results +.. autofunction:: search_for + +""" + + +import importlib +import importlib.util +import pathlib +import os +import inspect +import re + +import numpy as np +import numpy.typing as npt + +from typing import Callable, NewType, Any + +Array1D = NewType("Array1D", npt.NDArray) +Array2D = NewType("Array2D", npt.NDArray) +ArrayND = NewType("ArrayND", npt.NDArray) + + +def weighted_avg_evaluation( + results: np.recarray, + score_function: Callable[[np.record, float], float], + penalty: float = 0, + limit_results: int | None = None, + normalize: bool = True, +) -> float: + """Calculate weighted average evaluation of results. + + Example: + + .. code-block:: python + + results = solver.solve() + score = weighted_avg_evaluation( + results.probabilities, solver.problem.get_score, penalty=3, + limit_results=100, normalize=True) + + + Parameters + ---------- + results : np.recarray + Results to evaluate. It should contain variables and probability. + score_function : Callable[[np.record, float], float] + Function to evaluate results. Most often it's a problem's get_score + method. + penalty : float, optional + Penalty for the constraint violation, by default 0 + limit_results : int, optional + Number of results to evaluate, by default None + normalize : bool, optional + Normalize the score, by default True, applicable when the limit is set + + Returns + ------- + float + Weighted average evaluation of results. + """ + + score: float = 0 + + sorted_results = sort_solver_results(results, limit_results) + if normalize: + scaler = 1 / sorted_results.probability.sum() + else: + scaler = 1 + for rec in sorted_results: + score += scaler * rec.probability * score_function(rec, penalty) + return score + + +def sort_solver_results( + results: np.recarray, + limit_results: int | None = None, +) -> np.recarray: + """Sort solver results by probability. + + Example: + + .. code-block:: python + + results = solver.solve() + sorted_results = sort_solver_results(results.probabilities, 100) + + Parameters + ---------- + results : np.recarray + Results to sort. It should contain variables and probability. + limit_results : int, optional + Number of results to return, by default None + + Returns + ------- + np.recarray + Sorted results. + """ + + limit_results = limit_results or len(results) + results_ = np.sort(results, order='probability') + return results_[::-1][:limit_results] + + +def add_evaluation_to_results( + results: np.recarray, + score_function: Callable[[np.record, float], float], + penalty: float = 0, +) -> np.recarray: + """Add evaluation to results. + + Example: + + .. code-block:: python + + results = solver.solve() + add_evaluation_to_results( + results.probabilities, solver.problem.get_score) + + Parameters + ---------- + results : np.recarray + Results to evaluate. It should contain variables and probability. + score_function : Callable[[np.record, float], float] + Function to evaluate results. Most often it's a problem's get_score + method. + penalty : float, optional + Penalty for the constraint violation, by default 0 + + Returns + ------- + np.recarray + Results with evaluation added. Can be found under 'evaluation' key. + """ + + if 'evaluation' in results.dtype.names: + return results + + new_dtype = np.dtype(results.dtype.descr + [('evaluation', 'f8')]) + new_results = np.empty(results.shape, dtype=new_dtype) + new_results['evaluation'] = [score_function(x, penalty) for x in results] + + for dtype in results.dtype.names: + new_results[dtype] = results[dtype] + + return new_results + + +def get_class_name(cls: type) -> str: + if hasattr(cls, 'name'): + return cls.name + return cls.__name__ + + +def search_for(class_type: type, path: str) -> dict[str, type]: + """This function searches for classes of a given type in a given path. + + If class contains a name attribute, it will be used as a key in the + returned dictionary. Otherwise, the class name will be used. + Either way, the key will be lowercased. + + Parameters + ---------- + class_type : type + Type of the class to search for e.g. Problem, Solver. + path : str + Path to the file or directory to search in. + + Returns + ------- + dict[str, type] + Dictionary of found classes with their names as keys and classes as + values. + """ + + cwd = os.getcwd() + _path = pathlib.Path(path) + classes = {} + if _path.is_file(): + if _path.name.endswith('.py') and _path.name != '__init__.py': + module_name = _path.name[:-3] + module_path = os.path.join(cwd, _path) + + try: + spec = importlib.util.spec_from_file_location( + module_name, module_path) + assert spec is not None + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + + for _, obj in inspect.getmembers(module): + if ( + inspect.isclass(obj) + and issubclass(obj, class_type) + and obj != class_type + ): + class_name = get_class_name(obj) + classes[class_name.lower()] = obj + print(f"Imported {obj} from {module_path}" + f" as {class_name}") + + except Exception as e: + print(f"Failed to import {module_name} from {_path}: {e}") + + elif _path.is_dir(): + for item in _path.iterdir(): + classes |= search_for(class_type, str(item)) + return classes diff --git a/QHyper/README.md b/QHyper/README.md new file mode 100644 index 0000000..3b3493d --- /dev/null +++ b/QHyper/README.md @@ -0,0 +1,65 @@ + +

+ qhyper_logo +

+ +QHyper is a Python library that provides a unified interface for experimenting with quantum-related optimization solvers. It allows users to specify combinatorial optimization problems, select solvers, manage problem hyperparameters, and standardize output for ease of use. + +## Introduction + +QHyper is a library, which is aimed at users working on +computational experiments with a variety of quantum combinatorial optimization solvers. +The library offers a simple and extensible interface for formulating combinatorial +optimization problems, selecting and running solvers, +and optimizing hyperparameters. The supported solver set includes variational +gate-based algorithms, quantum annealers, and classical solutions. +The solvers can be combined with provided local and global (hyper)optimizers. +The main features of the library are its extensibility on different levels of use +as well as a straightforward and flexible experiment configuration format. + +## Documentation + +The latest documentation can be found on [Readthedocs](https://qhyper.readthedocs.io/en/latest/). + +## Installation + +To install QHyper, use the following command (ensure that you have Python 3.12 installed before running the command). + +``` bash +pip install qhyper +``` +The latest version of QHyper can be downloaded and installed directly from github. But please be careful, this version may not be released yet and may contain bugs. +```bash +pip install git+https://github.com/qc-lab/QHyper +``` + + +## Key features + +- **Quantum algorithm emphasis:** QHyper is designed for researchers and developers exploring quantum optimization algorithms, providing an environment for implementing quantum and hybrid quantum-classical solvers. + +- **Classical solver support:** While the focus is on quantum algorithms, QHyper also enables seamless integration of classical solvers, ensuring a unified platform for comparative experiments. + +- **Simplified experimentation:** With QHyper, the experimentation process is made more accessible. The users can define, execute, and analyze experiments efficiently due to the unified formats of inputs and outputs, and possibility of using configuration files. + +- **Modularity and extensibility:** One of QHyper's core strengths is easy extensibility. Adding new problems, solvers, or optimizers is straightforward, empowering users to contribute and customize the library to suit their research needs. + +- **Hyperparameters optimization:** QHyper offers easily configurable hyperoptimizers for converting constrained optimization problems into unconstrained forms required by some quantum solvers. + + +## Architecture + +The architecture of QHyper is presented on a diagram below: + + + +The main components are: + +* [Problems](https://qhyper.readthedocs.io/en/latest/generated/QHyper.problems.html) - classes that describe different types of problems, such as the Knapsack Problem or the Traveling Salesman Problem. + +* [Solvers](https://qhyper.readthedocs.io/en/latest/generated/QHyper.solvers.html) - Classes that define different types of solvers, e.g., quantum/hybrid solvers like the Quantum Approximate Optimization Algorithm or the Constrained Quadratic Model, but also classical solvers like Gurobi. + +* [Optimizers](https://qhyper.readthedocs.io/en/latest/generated/QHyper.optimizers.html) - Classes that implement different types of (hyper)optimizers. + +Each abstract class allows adding new implementatons which will be compatible with the rest of the system. + diff --git a/QHyper/demo/QHyper b/QHyper/demo/QHyper new file mode 100644 index 0000000..ff20af7 --- /dev/null +++ b/QHyper/demo/QHyper @@ -0,0 +1 @@ +../QHyper \ No newline at end of file diff --git a/QHyper/demo/defining_problems.ipynb b/QHyper/demo/defining_problems.ipynb new file mode 100644 index 0000000..6574b03 --- /dev/null +++ b/QHyper/demo/defining_problems.ipynb @@ -0,0 +1,355 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "d2ef8369", + "metadata": {}, + "source": [ + "
\n", + "⚠️ Links are not working in the notebook. Please visit documentation for better experience.\n", + "
" + ] + }, + { + "cell_type": "markdown", + "id": "9ddc0815", + "metadata": {}, + "source": [ + "# Defining custom problems and optimizers" + ] + }, + { + "cell_type": "markdown", + "id": "133ad48e", + "metadata": {}, + "source": [ + "## A user-defined class\n", + "\n", + "A big advantage of using QHyper is the ability to run experiments from a configuration file.\n", + "However, this only allows to use predefined problems, optimizers and solvers. In this notebook, we present a concise example illustrating how to define a custom problem, although the same principles apply to custom optimizers and solvers. We have chosen to highlight problem definition, as it is likely one of the most practical and valuable use cases for QHyper." + ] + }, + { + "cell_type": "markdown", + "id": "b6e03f38", + "metadata": {}, + "source": [ + ".. note::\n", + " Any custom [Problem](../../generated/QHyper.problems.rst), [Optimizer](../../generated/QHyper.optimizers.rst) or [Solver](../../generated/QHyper.solvers.rst) class should be implemented in the directory named `custom` or `QHyper/custom`. It is required that these classes inherit from their base classes and implement required methods. The new class will be available in configuration files by its attribute name if provided or by its class name." + ] + }, + { + "cell_type": "markdown", + "id": "dc7f157c", + "metadata": {}, + "source": [ + "## Creating a custom problem" + ] + }, + { + "cell_type": "markdown", + "id": "0764e41b", + "metadata": {}, + "source": [ + "Assume we want to minimize $\\underbrace{-2x_0 - 5x_1 - x_0x_1}_{cost function}$ subject to $\\underbrace{x_0 + x_1 = 1}_{constraint\\ eq}$ and $\\underbrace{5x_0 + 2x_1 \\leq 5}_{constraint\\ le}$" + ] + }, + { + "cell_type": "markdown", + "id": "ff95e859", + "metadata": {}, + "source": [ + "In QHyper, every problem needs to be a subclass of the [Problem class](../../generated/QHyper.problems.rst).\n", + "\n", + "In general, the cost function and every constraint should be expressed as dict-based [Polynomials](../../generated/QHyper.polynomial.rst), but usually it is easier to initially express them in a more user-friendly format (such as SymPy syntax), and then convert it them into Polynomials. A Polynomial is comprised of a dictionary where the keys are tuples containing variables, and the values represent their coefficients.\n", + "\n", + "To define the constraints, the [Constraint](../../generated/QHyper.constraint.rst) class is used. Each constraint involves Polynomials on the left-hand side (lhs) and right-hand side (rhs), a comparison operator, and optional data such as a method for handling inequalities, a label, and a group identifier." + ] + }, + { + "cell_type": "markdown", + "id": "60f6ea6a", + "metadata": {}, + "source": [ + ".. note::\n", + " QHyper always assumes that the objective is to **minimize** the cost function." + ] + }, + { + "cell_type": "markdown", + "id": "b2293dff", + "metadata": {}, + "source": [ + "### Using Dict syntax" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "8bb4617a", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "\n", + "from QHyper.problems.base import Problem\n", + "from QHyper.constraint import Constraint, Operator, UNBALANCED_PENALIZATION\n", + "from QHyper.polynomial import Polynomial\n", + "\n", + "class CustomProblem(Problem):\n", + " def __init__(self) -> None:\n", + " self.objective_function = self._create_objective_function()\n", + " self.constraints = self._create_constraints()\n", + "\n", + " def _create_objective_function(self) -> Polynomial:\n", + " # Express the cost function as a dict. The keys are tuples containing variables, and the values represent the coefficients.\n", + " objective_function = {('x0',): -2.0, ('x1',): -5.0, ('x0', 'x1'): -1.0}\n", + " \n", + " # Create a Polynomial based on the objective function.\n", + " return Polynomial(objective_function)\n", + "\n", + " def _create_constraints(self) -> list[Constraint]:\n", + " # To add a new constraint, define the left-hand-side, and right-hand-side of the constraint.\n", + " # Also, specify the comparison operator and in the case of inequality opertor --- the method for handling the inequality.\n", + " \n", + " constraints = [\n", + " Constraint(lhs={('x0',): 1.0, ('x1',): 1.0}, rhs={(): 1},\n", + " operator=Operator.EQ),\n", + " Constraint(lhs={('x0',): 5.0, ('x1',): 2.0}, rhs={(): 5}, \n", + " operator=Operator.LE,\n", + " method_for_inequalities=UNBALANCED_PENALIZATION)\n", + " ]\n", + " return constraints\n", + "\n", + " def get_score(self, result: np.record, penalty: float = 0) -> float:\n", + " # This function is used by solvers to evaluate the quality of the result (business value).\n", + " \n", + " # If the constraints are satisfied return the value of the objective function.\n", + " if result['x0'] + result['x1'] == 1 and 5 * result['x0'] + 2 * result['x1'] <= 5:\n", + " return -2 * result['x0'] - 5 * result['x1'] - result['x0'] * result['x1']\n", + " \n", + " # Otherwise return some arbitrary penalty\n", + " return penalty" + ] + }, + { + "cell_type": "markdown", + "id": "05a6f423", + "metadata": {}, + "source": [ + "### Using SymPy syntax" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "f1b53678", + "metadata": {}, + "outputs": [], + "source": [ + "import sympy\n", + "import numpy as np\n", + "from QHyper.problems.base import Problem\n", + "from QHyper.constraint import Constraint, Operator, UNBALANCED_PENALIZATION\n", + "from QHyper.polynomial import Polynomial\n", + "from QHyper.parser import from_sympy\n", + "\n", + "\n", + "class CustomProblem(Problem):\n", + " def __init__(self) -> None:\n", + " # Define the necessary SymPy variables.\n", + " num_variables = 2\n", + " self.x = sympy.symbols(f'x0:{num_variables}')\n", + " self.objective_function = self._create_objective_function()\n", + " self.constraints = self._create_constraints()\n", + "\n", + " def _create_objective_function(self) -> Polynomial:\n", + " # Define the cost function.\n", + " objective_function = -2 * self.x[0] - 5 * self.x[1] - self.x[0] * self.x[1]\n", + " \n", + " # Return the cost function parsed into a Polynomial\n", + " return from_sympy(objective_function)\n", + "\n", + " def _create_constraints(self) -> list[Constraint]:\n", + " # To add a new constraint, define the left-hand-side, and right-hand-side of the constraint.\n", + " # Also, specify the comparison operator and in the case of inequality opertor --- the method for handling the inequality.\n", + " \n", + " return [ \n", + " Constraint( \n", + " lhs=from_sympy(self.x[0] + self.x[1]),\n", + " rhs=1,\n", + " operator=Operator.EQ\n", + " ),\n", + " Constraint(\n", + " lhs=from_sympy(5 * self.x[0] + 2 * self.x[1]),\n", + " rhs=5,\n", + " operator=Operator.LE,\n", + " method_for_inequalities=UNBALANCED_PENALIZATION,\n", + " )\n", + " ]\n", + "\n", + " def get_score(self, result: np.record, penalty: float = 0) -> float:\n", + " # This function is used by solvers to evaluate the quality of the result (business value).\n", + " \n", + " # If the constraints are satisfied return the value of the objective function.\n", + " if result['x0'] + result['x1'] == 1 and 5 * result['x0'] + 2 * result['x1'] <= 5:\n", + " return -2 * result['x0'] - 5 * result['x1'] - result['x0'] * result['x1']\n", + " \n", + " # Otherwise return some arbitrary penalty\n", + " return penalty" + ] + }, + { + "cell_type": "markdown", + "id": "d8497900", + "metadata": {}, + "source": [ + ".. note::\n", + " For bigger problem instances, SymPy syntax is significantly slower than the Dict syntax." + ] + }, + { + "cell_type": "markdown", + "id": "53718472", + "metadata": {}, + "source": [ + "To explore solvers for tackling this problem, check out this [tutorial](../solver_configuration.rst)." + ] + }, + { + "cell_type": "markdown", + "id": "6e2daea4", + "metadata": {}, + "source": [ + "## Creating a custom optimizer" + ] + }, + { + "cell_type": "markdown", + "id": "927f0c37", + "metadata": {}, + "source": [ + "In order to define a custom optimizer, it is necessary to inherit from the [Optimizer](../../generated/generated/QHyper.optimizers.Optimizer.rst) base class and implement the `minimize` method." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "4394fcb9", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "\n", + "from typing import Callable\n", + "\n", + "from QHyper.optimizers.base import (\n", + " Optimizer, OptimizationResult, OptimizerError, OptimizationParameter)\n", + "\n", + "\n", + "class CustomOptimizer(Optimizer):\n", + "\n", + " def minimize(\n", + " self,\n", + " func: Callable[[list[float]], OptimizationResult],\n", + " init: OptimizationParameter | None,\n", + " steps: int = 10,\n", + " step_size: float = 1.,\n", + " ) -> OptimizationResult:\n", + " \n", + " # Check if initial parameters are valid\n", + " if init is None:\n", + " raise OptimizerError(\"Initial point must be provided.\")\n", + " init.assert_init()\n", + " \n", + " # Initialize current parameter and its function value\n", + " current_param = init.init[0]\n", + " current_value = func(current_param)\n", + " history = []\n", + " \n", + " for _ in range(steps):\n", + " # Propose a new candidate by random perturbation\n", + " candidate_param = current_param + np.random.uniform(-step_size, step_size)\n", + " candidate_value = func(candidate_param)\n", + " \n", + " # Accept the candidate if it improves the objective\n", + " if candidate_value < current_value:\n", + " current_param, current_value = candidate_param, candidate_value\n", + " \n", + " # Record the result of this optimization step\n", + " current_optimization_result = OptimizationResult(value=candidate_value, \n", + " params=[candidate_param])\n", + " history.append(current_optimization_result)\n", + "\n", + " # Return the best objective function value found after optimization \n", + " # as well as the corresponding parameter and the history of optimization trials\n", + " return OptimizationResult(value=current_value,\n", + " params=[current_param],\n", + " history=[history])\n" + ] + }, + { + "cell_type": "markdown", + "id": "c6a51509", + "metadata": {}, + "source": [ + "The following example demonstrates how to use the optimizer with a simple function `f` as the objective." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "dee58c0a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "OptimizationResult(value=0.012911237077660507, params=[1.8863723753761414], history=[[OptimizationResult(value=5.80830991335693, params=[-0.410043550095502], history=[]), OptimizationResult(value=5.255084670119016, params=[-0.29239714493780866], history=[]), OptimizationResult(value=2.5763099383389783, params=[0.39491123661680994], history=[]), OptimizationResult(value=3.976884436512944, params=[0.005787263977851342], history=[]), OptimizationResult(value=0.4254175872601739, params=[1.3477595633049313], history=[]), OptimizationResult(value=1.3004339816666544, params=[0.8596342772309165], history=[]), OptimizationResult(value=0.022387632127825227, params=[1.8503750283949059], history=[]), OptimizationResult(value=0.28655020941040277, params=[1.4646961522551862], history=[]), OptimizationResult(value=0.012911237077660507, params=[1.8863723753761414], history=[]), OptimizationResult(value=0.025056148831267524, params=[2.15829134161813], history=[])]])" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def f(x):\n", + " return (x - 2)**2\n", + "\n", + "custom_optimizer = CustomOptimizer()\n", + "init = OptimizationParameter(init=[0])\n", + "custom_optimizer.minimize(f, init)" + ] + }, + { + "cell_type": "markdown", + "id": "edf71b12", + "metadata": {}, + "source": [ + "Another example of a straightforward implementation of a custom optimizer is a [Dummy](../../generated/generated/QHyper.optimizers.dummy.Dummy.rst) optimizer which just evaluates the function." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/QHyper/demo/typical_use_cases.ipynb b/QHyper/demo/typical_use_cases.ipynb new file mode 100644 index 0000000..5eaf80c --- /dev/null +++ b/QHyper/demo/typical_use_cases.ipynb @@ -0,0 +1,393 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Typical use cases" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Problem configuration\n", + "\n", + "In this notebook, we provide examples of different solver configurations a for a sample Knapsack Problem with three items. The goal is to put the selected items in the knapsack to achieve the maximal value with total weight not exceeding the `max_weight`. The `item_weights` and `item_values` fields specify the weight and value of each item, respectively.\n", + "\n", + "```yaml\n", + "problem:\n", + " type: KnapsackProblem\n", + " max_weight: 2\n", + " item_weights: [1, 1, 1]\n", + " item_values: [2, 2, 1]\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "vscode": { + "languageId": "raw" + } + }, + "source": [ + "## Configuration for the QAOA\n", + "The configuration below shows how to create a QAOA instance with 5 layers and a local gradient descent optimizer (`QmlGradientDescent`) --- by default the `adam` optimizer.\n", + "\n", + "The `gamma` and `beta` keys indicate variational parameters searched by specified optimizer, while the `penalty_weights` refer to the initial penalty weights in the objective function of the Knapsack Problem." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "qaoa_config_yaml = \"\"\"\n", + "problem:\n", + " type: KnapsackProblem\n", + " max_weight: 2\n", + " item_weights: [1, 1, 1]\n", + " item_values: [2, 2, 1]\n", + "solver:\n", + " category: gate_based\n", + " platform: pennylane\n", + " name: QAOA\n", + " layers: 5\n", + " gamma:\n", + " init: [0.5, 0.5, 0.5, 0.5, 0.5]\n", + " beta:\n", + " init: [1., 1., 1., 1., 1.]\n", + " optimizer: \n", + " type: QmlGradientDescent\n", + " penalty_weights: [1, 2.5, 2.5]\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import yaml\n", + "from QHyper.solvers import solver_from_config\n", + "\n", + "qaoa_config = yaml.safe_load(qaoa_config_yaml)\n", + "solver = solver_from_config(qaoa_config)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "rec.array([(0, 0, 0, 0, 0, 0.01925662), (0, 0, 0, 0, 1, 0.00499353),\n", + " (0, 0, 0, 1, 0, 0.06602495), (0, 0, 0, 1, 1, 0.00135034),\n", + " (0, 0, 1, 0, 0, 0.00929764), (0, 0, 1, 0, 1, 0.00077379),\n", + " (0, 0, 1, 1, 0, 0.0150905 ), (0, 0, 1, 1, 1, 0.00105546),\n", + " (0, 1, 0, 0, 0, 0.01907666), (0, 1, 0, 0, 1, 0.0119462 ),\n", + " (0, 1, 0, 1, 0, 0.01663426), (0, 1, 0, 1, 1, 0.0009503 ),\n", + " (0, 1, 1, 0, 0, 0.0058822 ), (0, 1, 1, 0, 1, 0.11219791),\n", + " (0, 1, 1, 1, 0, 0.01533116), (0, 1, 1, 1, 1, 0.00056568),\n", + " (1, 0, 0, 0, 0, 0.01907666), (1, 0, 0, 0, 1, 0.0119462 ),\n", + " (1, 0, 0, 1, 0, 0.01663426), (1, 0, 0, 1, 1, 0.0009503 ),\n", + " (1, 0, 1, 0, 0, 0.0058822 ), (1, 0, 1, 0, 1, 0.11219791),\n", + " (1, 0, 1, 1, 0, 0.01533116), (1, 0, 1, 1, 1, 0.00056568),\n", + " (1, 1, 0, 0, 0, 0.00744606), (1, 1, 0, 0, 1, 0.07094647),\n", + " (1, 1, 0, 1, 0, 0.01561782), (1, 1, 0, 1, 1, 0.0122494 ),\n", + " (1, 1, 1, 0, 0, 0.00071473), (1, 1, 1, 0, 1, 0.25909813),\n", + " (1, 1, 1, 1, 0, 0.00251099), (1, 1, 1, 1, 1, 0.14840486)],\n", + " dtype=[('x0', '\n", + "In order to run the code below, you need to have access to the D-Wave Advantage device. Obtain a token at D-Wave Leap.\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "advantage_config_yaml = \"\"\"\n", + "problem:\n", + " type: knapsack\n", + " max_weight: 2\n", + " item_weights: [1, 1, 1]\n", + " item_values: [2, 2, 1]\n", + "solver:\n", + " category: quantum_annealing\n", + " platform: d_wave\n", + " name: Advantage\n", + " num_reads: 100\n", + "hyper_optimizer:\n", + " optimizer: \n", + " type: grid\n", + " penalty_weights: \n", + " min: [1, 1, 1]\n", + " max: [3, 3, 3]\n", + " step: [1, 1, 1]\n", + "\"\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "import yaml\n", + "from QHyper.solvers import solver_from_config\n", + "\n", + "config = yaml.safe_load(advantage_config_yaml)\n", + "\n", + "hyper_optimizer = solver_from_config(config)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "rec.array([(1, 1, 0, 0, 1, 0.52, -4.), (1, 0, 1, 0, 1, 0.04, -3.),\n", + " (1, 1, 1, 0, 1, 0.1 , -3.), (1, 1, 1, 1, 1, 0.13, -3.),\n", + " (0, 1, 1, 0, 1, 0.1 , -3.), (1, 1, 0, 1, 0, 0.01, -2.),\n", + " (1, 0, 0, 1, 0, 0.02, -2.), (0, 1, 0, 1, 0, 0.08, -2.)],\n", + " dtype=[('x0', 'NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/QHyper/docs/source/_static/.gitkeep b/QHyper/docs/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/docs/source/_static/classes_optimizers.dot b/QHyper/docs/source/_static/classes_optimizers.dot new file mode 100644 index 0000000..335eafc --- /dev/null +++ b/QHyper/docs/source/_static/classes_optimizers.dot @@ -0,0 +1,15 @@ +digraph "classes_optimizers" { +rankdir=BT +charset="utf-8" +"QHyper.optimizers.base.Optimizer" [color="black", fontcolor="black", label="Optimizer", shape="record", style="solid"]; +"QHyper.optimizers.qml_gradient_descent.QmlGradientDescent" [color="black", fontcolor="black", label="QmlGradientDescent", shape="record", style="solid"]; +"QHyper.optimizers.scipy_minimizer.ScipyOptimizer" [color="black", fontcolor="black", label="ScipyOptimizer", shape="record", style="solid"]; +"QHyper.optimizers.basinhopping.Basinhopping" [color="black", fontcolor="black", label="Basinhopping", shape="record", style="solid"]; +"QHyper.optimizers.cem.CEM" [color="black", fontcolor="black", label="CEM", shape="record", style="solid"]; +"QHyper.optimizers.random.Random" [color="black", fontcolor="black", label="Random", shape="record", style="solid"]; +"QHyper.optimizers.basinhopping.Basinhopping" -> "QHyper.optimizers.base.Optimizer" [arrowhead="empty", arrowtail="none"]; +"QHyper.optimizers.cem.CEM" -> "QHyper.optimizers.base.Optimizer" [arrowhead="empty", arrowtail="none"]; +"QHyper.optimizers.qml_gradient_descent.QmlGradientDescent" -> "QHyper.optimizers.base.Optimizer" [arrowhead="empty", arrowtail="none"]; +"QHyper.optimizers.random.Random" -> "QHyper.optimizers.base.Optimizer" [arrowhead="empty", arrowtail="none"]; +"QHyper.optimizers.scipy_minimizer.ScipyOptimizer" -> "QHyper.optimizers.base.Optimizer" [arrowhead="empty", arrowtail="none"]; +} diff --git a/QHyper/docs/source/_static/classes_problems.dot b/QHyper/docs/source/_static/classes_problems.dot new file mode 100644 index 0000000..d9a875d --- /dev/null +++ b/QHyper/docs/source/_static/classes_problems.dot @@ -0,0 +1,17 @@ +digraph "classes_problems" { +rankdir=BT +charset="utf-8" +"QHyper.problems.knapsack.Knapsack" [color="black", fontcolor="black", label="Knapsack", shape="record", style="solid"]; +"QHyper.problems.knapsack.KnapsackProblem" [color="black", fontcolor="black", label="KnapsackProblem", shape="record", style="solid"]; +"QHyper.problems.base.Problem" [color="black", fontcolor="black", label="Problem", shape="record", style="solid"]; +"QHyper.problems.tsp.TSP" [color="black", fontcolor="black", label="TSP", shape="record", style="solid"]; +"QHyper.problems.tsp.TSPProblem" [color="black", fontcolor="black", label="TSPProblem", shape="record", style="solid"]; +"QHyper.problems.workflow_scheduling.Workflow" [color="black", fontcolor="black", label="Workflow", shape="record", style="solid"]; +"QHyper.problems.workflow_scheduling.WorkflowSchedulingProblem" [color="black", fontcolor="black", label="WorkflowSchedulingProblem", shape="record", style="solid"]; +"QHyper.problems.knapsack.KnapsackProblem" -> "QHyper.problems.base.Problem" [arrowhead="empty", arrowtail="none"]; +"QHyper.problems.tsp.TSPProblem" -> "QHyper.problems.base.Problem" [arrowhead="empty", arrowtail="none"]; +"QHyper.problems.workflow_scheduling.WorkflowSchedulingProblem" -> "QHyper.problems.base.Problem" [arrowhead="empty", arrowtail="none"]; +"QHyper.problems.knapsack.Knapsack" -> "QHyper.problems.knapsack.KnapsackProblem" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="knapsack", style="solid"]; +"QHyper.problems.tsp.TSP" -> "QHyper.problems.tsp.TSPProblem" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="tsp_instance", style="solid"]; +"QHyper.problems.workflow_scheduling.Workflow" -> "QHyper.problems.workflow_scheduling.WorkflowSchedulingProblem" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="workflow", style="solid"]; +} diff --git a/QHyper/docs/source/_static/classes_solvers.dot b/QHyper/docs/source/_static/classes_solvers.dot new file mode 100644 index 0000000..8b8cae5 --- /dev/null +++ b/QHyper/docs/source/_static/classes_solvers.dot @@ -0,0 +1,19 @@ +digraph "classes_solvers" { +rankdir=BT +charset="utf-8" +"QHyper.solvers.cqm.cqm.CQM" [color="black", fontcolor="black", label="CQM", shape="record", style="solid"]; +"QHyper.solvers.gurobi.gurobi.Gurobi" [color="black", fontcolor="black", label="Gurobi", shape="record", style="solid"]; +"QHyper.solvers.vqa.pqc.h_qaoa.HQAOA" [color="black", fontcolor="black", label="HQAOA", shape="record", style="solid"]; +"QHyper.solvers.vqa.pqc.base.PQC" [color="black", fontcolor="black", label="PQC", shape="record", style="solid"]; +"QHyper.solvers.vqa.pqc.qaoa.QAOA" [color="black", fontcolor="black", label="QAOA", shape="record", style="solid"]; +"QHyper.solvers.base.Solver" [color="black", fontcolor="black", label="Solver", shape="record", style="solid"]; +"QHyper.solvers.vqa.base.VQA" [color="black", fontcolor="black", label="VQA", shape="record", style="solid"]; +"QHyper.solvers.vqa.pqc.wf_qaoa.WFQAOA" [color="black", fontcolor="black", label="WFQAOA", shape="record", style="solid"]; +"QHyper.solvers.cqm.cqm.CQM" -> "QHyper.solvers.base.Solver" [arrowhead="empty", arrowtail="none"]; +"QHyper.solvers.gurobi.gurobi.Gurobi" -> "QHyper.solvers.base.Solver" [arrowhead="empty", arrowtail="none"]; +"QHyper.solvers.vqa.base.VQA" -> "QHyper.solvers.base.Solver" [arrowhead="empty", arrowtail="none"]; +"QHyper.solvers.vqa.pqc.h_qaoa.HQAOA" -> "QHyper.solvers.vqa.pqc.qaoa.QAOA" [arrowhead="empty", arrowtail="none"]; +"QHyper.solvers.vqa.pqc.qaoa.QAOA" -> "QHyper.solvers.vqa.pqc.base.PQC" [arrowhead="empty", arrowtail="none"]; +"QHyper.solvers.vqa.pqc.wf_qaoa.WFQAOA" -> "QHyper.solvers.vqa.pqc.qaoa.QAOA" [arrowhead="empty", arrowtail="none"]; +"QHyper.solvers.vqa.pqc.base.PQC" -> "QHyper.solvers.vqa.base.VQA" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="pqc", style="solid"]; +} diff --git a/QHyper/docs/source/_static/custom.css b/QHyper/docs/source/_static/custom.css new file mode 100644 index 0000000..1237135 --- /dev/null +++ b/QHyper/docs/source/_static/custom.css @@ -0,0 +1,3 @@ +.not-in-docs { + display: none; +} diff --git a/QHyper/docs/source/_static/logo.png b/QHyper/docs/source/_static/logo.png new file mode 100644 index 0000000..584f116 Binary files /dev/null and b/QHyper/docs/source/_static/logo.png differ diff --git a/QHyper/docs/source/_static/qhyper_architecture.svg b/QHyper/docs/source/_static/qhyper_architecture.svg new file mode 100644 index 0000000..697f9c8 --- /dev/null +++ b/QHyper/docs/source/_static/qhyper_architecture.svg @@ -0,0 +1,4 @@ + + + +







































\ No newline at end of file diff --git a/QHyper/docs/source/_templates/autosummary/attribute.rst b/QHyper/docs/source/_templates/autosummary/attribute.rst new file mode 100644 index 0000000..ee1f504 --- /dev/null +++ b/QHyper/docs/source/_templates/autosummary/attribute.rst @@ -0,0 +1,9 @@ +:orphan: + +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoattribute:: {{ objname }} + :noindex: diff --git a/QHyper/docs/source/_templates/autosummary/class.rst b/QHyper/docs/source/_templates/autosummary/class.rst new file mode 100644 index 0000000..6d00b31 --- /dev/null +++ b/QHyper/docs/source/_templates/autosummary/class.rst @@ -0,0 +1,10 @@ +{{ name }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :no-inherited-members: + :no-special-members: + diff --git a/QHyper/docs/source/_templates/autosummary/method.rst b/QHyper/docs/source/_templates/autosummary/method.rst new file mode 100644 index 0000000..6dce222 --- /dev/null +++ b/QHyper/docs/source/_templates/autosummary/method.rst @@ -0,0 +1,8 @@ +:orphan: + +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. automethod:: {{ objname }} \ No newline at end of file diff --git a/QHyper/docs/source/_templates/autosummary/module.rst b/QHyper/docs/source/_templates/autosummary/module.rst new file mode 100644 index 0000000..6b95bac --- /dev/null +++ b/QHyper/docs/source/_templates/autosummary/module.rst @@ -0,0 +1,6 @@ +{{ fullname | escape | underline }} + +.. currentmodule:: {{ module }} + +.. automodule:: {{ fullname }} + \ No newline at end of file diff --git a/QHyper/docs/source/_templates/autosummary/property.rst b/QHyper/docs/source/_templates/autosummary/property.rst new file mode 100644 index 0000000..184aa22 --- /dev/null +++ b/QHyper/docs/source/_templates/autosummary/property.rst @@ -0,0 +1,8 @@ +:orphan: + +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoproperty:: {{ objname }} diff --git a/QHyper/docs/source/api.rst b/QHyper/docs/source/api.rst new file mode 100644 index 0000000..6b53f56 --- /dev/null +++ b/QHyper/docs/source/api.rst @@ -0,0 +1,27 @@ +API +================================== + +Here is the list of all the modules in the QHyper package. + +.. automodule:: QHyper + :members: + +.. rubric:: Core Modules + +.. autosummary:: + :toctree: generated + + problems + optimizers + solvers + +.. rubric:: Simple Modules + +.. autosummary:: + :toctree: generated + + polynomial -- Module that contains the class for a polynomial implementation + constraint -- Module that implements the constraints + parser -- Module for parsing from and to sympy (in the future there might be more formats) + converter -- Module that contains the converter class with methods to convert a problem to a different form required by the solvers + util -- Module that contains utility functions diff --git a/QHyper/docs/source/conf.py b/QHyper/docs/source/conf.py new file mode 100644 index 0000000..804bf02 --- /dev/null +++ b/QHyper/docs/source/conf.py @@ -0,0 +1,77 @@ +import os +import sys + +# sys.path.append(os.path.join(os.path.dirname(__file__), '../../')) +sys.path.insert(0, os.path.abspath('../../')) + +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'QHyper' +copyright = '2024, Cyfronet' +author = 'Cyfronet' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.intersphinx', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', + 'sphinx_autodoc_typehints', + 'numpydoc', + 'sphinx.ext.graphviz', + 'sphinx.ext.autosectionlabel', + 'sphinx_copybutton', + 'nbsphinx', + 'sphinx_tabs.tabs', +] +autosummary_generate = True +autodoc_inherit_docstrings = True # If no docstring, inherit from base class +set_type_checking_flag = True # Enable 'expensive' imports for sphinx_autodoc_typehints + +# autodoc_typehints = 'none' + +pygments_style = 'sphinx' + +templates_path = ['_templates'] +exclude_patterns = [] + +# numpydoc_show_class_members = False +autosectionlabel_prefix_document = True +html_sourcelink_suffix = '' +numpydoc_show_class_members = False +html_static_path = ['_static'] +html_css_files = ['custom.css'] + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "pydata_sphinx_theme" + +html_logo = "_static/logo.png" +add_module_names = False +html_theme_options = { + "logo": { + "text": "QHyper", + }, + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/qc-lab/QHyper", + "icon": "fa-brands fa-github", + }, + ], +} + +html_sidebars = { + "usage": [], + "contribution": [], +} diff --git a/QHyper/docs/source/contribution.rst b/QHyper/docs/source/contribution.rst new file mode 100644 index 0000000..e8f2df3 --- /dev/null +++ b/QHyper/docs/source/contribution.rst @@ -0,0 +1,156 @@ +================== +Contribution Guide +================== + +Thank you for considering contributing to our project! Your contributions are greatly appreciated. To ensure a smooth and effective contribution process, please follow the guidelines outlined below. + +Setup Process +------------- + +1. **Clone the Repository:** + +Begin by cloning the repository to your local machine using Git: + +.. code-block:: bash + + git clone https://github.com/qc-lab/QHyper.git + +2. **Create a Virtual Environment:** + +We recommend using a virtual environment to isolate your project's dependencies. Create and activate a virtual environment: + +.. code-block:: bash + + python -m venv venv + source venv/bin/activate + + +3. **Install Production Requirements:** + +Install the project's production dependencies using pip: + +.. code-block:: bash + + pip install -r requirements/prod.txt + +.. note:: + + ``requirements/dev.txt`` is not required for general contributions unless you plan to build the documentation locally. + +4. **Development Environment Setup Complete:** + +Your development environment is now set up and ready. + + +Updating Documentation +---------------------- + +If you want to update the project's documentation, follow these steps: + +1. **Development Environment Setup:** + +Install additonal dependencies for building the documentation: + +.. code-block:: bash + + pip install -r requirements/dev.txt + +2. **Modify Documentation Files:** + +Make the necessary changes to the documentation files located in the ``docs/source`` directory. + +3. **Build documentation locally:** + +Go into ``docs`` dir: + +.. code-block:: bash + + cd docs + +And run following command to build documentation: + +.. code-block:: bash + + make html + +Make sure that there are no errors. You will able to view the documentation in your browser by opening the ``docs/build/html/index.html`` file. + +.. note:: + You may want to remove docs/build before running this commands to ensure that you're building the documentation from scratch. + +4. **Documentation Update Complete:** + +Your documentation changes are ready for submission. + + +New release +----------- + +If new changes hit main branch, it will trigger Read the Docs and will update the `main `_ release. +If new changes will be pushed to `production` branch, then the main page of the documentation will be updated. Additionaly new version of library will be created in Pypi. Remember to update `version` in `setup.py`. + + +Contribution Rules +------------------ + +When contributing to this project, please adhere to the following rules: + +1. **Use MyPy Typing:** + +Ensure that you use type hints following MyPy conventions to enhance code readability and maintainability. + +2. **Limit Line Length:** + +Keep lines of code and comments to a maximum of 80 characters in length to ensure code readability. + +3. **Test Before Creating a Pull Request:** + +Before creating a pull request, make sure that all tests pass without errors. + +Submitting Your Contribution +---------------------------- + +When you're ready to submit your contribution, please follow these steps: + +1. **Create a Branch:** + +Create a new branch with a descriptive name for your contribution. This makes it easier for reviewers to understand the purpose of your changes: + +.. code-block:: bash + + git checkout -b your-branch-name + +2. **Commit Your Changes:** + +Make your changes, commit them, and provide a clear and concise commit message that describes your modifications: + +.. code-block:: bash + + git add . + git commit -m "Your descriptive commit message" + +3. **Push Your Branch:** + +Push your branch to the remote repository: + +.. code-block:: bash + + git push origin your-branch-name + +4. **Create a Pull Request (PR):** + +Go to the project's repository on GitHub and create a pull request. Ensure that you provide a detailed description of your changes and any related issues. + +5. **Review and Collaborate:** + +Collaborate with reviewers to address feedback and make any necessary improvements to your contribution. + +6. **Merge Your Pull Request:** + +Once your pull request has been reviewed and approved, it will be merged into the main project branch. + +7. **Thank You:** + +Congratulations on your contribution! Thank you for helping improve the project. + +By following these guidelines, you'll help ensure a smooth contribution process and maintain the quality of the project. Your contributions are valuable, and we appreciate your efforts to make this project better! diff --git a/QHyper/docs/source/index.rst b/QHyper/docs/source/index.rst new file mode 100644 index 0000000..2b37d9c --- /dev/null +++ b/QHyper/docs/source/index.rst @@ -0,0 +1,77 @@ +.. documentation master file, created by + sphinx-quickstart on Thu Oct 27 13:27:51 2022. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +.. meta:: + :google-site-verification: -BAN3UWgNz2CPUt5v5AcQpDH8GJc0kX0VdKh2Kfj89I + + +QHyper documentation +================================== + +| QHyper is a Python library that provides a unified interface for experimenting with quantum-related optimization solvers. +| It allows users to specify combinatorial optimization problems, select solvers, manage problem hyperparameters, and standardize output for ease of use. + +Installation +^^^^^^^^^^^^ +To install QHyper, use the following command (ensure that you have Python 3.12 installed before running the command). + +.. code-block:: bash + + pip install qhyper + + +Key features +------------ + +- **Quantum algorithm emphasis:** QHyper is designed for researchers and developers exploring quantum optimization algorithms, providing an environment for implementing quantum and hybrid quantum-classical solvers. + +- **Classical solver support:** While the focus is on quantum algorithms, QHyper also enables seamless integration of classical solvers, ensuring a unified platform for comparative experiments. + +- **Simplified experimentation:** With QHyper, the experimentation process is made more accessible. The users can define, execute, and analyze experiments efficiently due to the unified formats of inputs and outputs, and possibility of using configuration files. + +- **Modularity and extensibility:** One of QHyper's core strengths is easy extensibility. Adding new problems, solvers, or optimizers is straightforward, empowering users to contribute and customize the library to suit their research needs. + +- **Hyperparameters optimization:** QHyper offers easily configurable hyperoptimizers for converting constrained optimization problems into unconstrained forms required by some quantum solvers. + + +Architecture +------------ + +The architecture of QHyper is presented on a diagram below: + +.. raw:: html + + + +The main components are: + +* :doc:`Problems ` - classes that describe different types of problems, such as the Knapsack Problem or the Traveling Salesman Problem. + +* :doc:`Solvers ` - Classes that define different types of solvers, e.g., quantum/hybrid solvers like the Quantum Approximate Optimization Algorithm or the Constrained Quadratic Model, but also classical solvers like Gurobi. + +* :doc:`Optimizers ` - Classes that implement different types of (hyper)optimizers. + +Each abstract class allows adding new implementatons which will be compatible with the rest of the system. + + +.. toctree:: + :hidden: + + Home + +.. toctree:: + :hidden: + + user_guide/index + +.. toctree:: + :hidden: + + contribution + +.. toctree:: + :hidden: + + api \ No newline at end of file diff --git a/QHyper/docs/source/reference.txt b/QHyper/docs/source/reference.txt new file mode 100644 index 0000000..fa95f16 --- /dev/null +++ b/QHyper/docs/source/reference.txt @@ -0,0 +1,10 @@ +.. _reference: + +Reference +========= + +.. autosummary:: + :toctree: reference/ + :recursive: + + QHyper diff --git a/QHyper/docs/source/user_guide/demo b/QHyper/docs/source/user_guide/demo new file mode 100644 index 0000000..3ba9c6b --- /dev/null +++ b/QHyper/docs/source/user_guide/demo @@ -0,0 +1 @@ +../../../demo \ No newline at end of file diff --git a/QHyper/docs/source/user_guide/index.rst b/QHyper/docs/source/user_guide/index.rst new file mode 100644 index 0000000..24d1569 --- /dev/null +++ b/QHyper/docs/source/user_guide/index.rst @@ -0,0 +1,24 @@ +Usage Guide +=========== + +Practical instructions for conducting experiments using QHyper. + +.. toctree:: + + Home + + +.. toctree:: + :maxdepth: 1 + :caption: Get started: + + install + +.. toctree:: + :maxdepth: 1 + :caption: Tutorials: + + solver_configuration + + demo/typical_use_cases + demo/defining_problems diff --git a/QHyper/docs/source/user_guide/install.rst b/QHyper/docs/source/user_guide/install.rst new file mode 100644 index 0000000..4536e5c --- /dev/null +++ b/QHyper/docs/source/user_guide/install.rst @@ -0,0 +1,83 @@ +Installation & first steps +========================== + +Installation +------------ + +To get started, install the `QHyper` library using pip. Open your terminal or command prompt and run the following command (make sure you are using Python 3.12): + +.. code-block:: bash + + pip install qhyper + + +Getting Started +--------------- + +1. **Import an optimization problem:** + +Here, we will solve the Knapsack Problem, but check out the :doc:`API<../generated/QHyper.problems>` for other available problems. + +.. code-block:: python + + from QHyper.problems.knapsack import KnapsackProblem + problem = KnapsackProblem(max_weight=2, + item_weights=[1, 1, 1], + item_values=[2, 2, 1]) + + +2. **Create a solver:** + +Use the library's classes to create a solver. + +.. code-block:: python + + from QHyper.solvers.gate_based.pennylane import QAOA + from QHyper.optimizers import OptimizationParameter + from QHyper.optimizers.qml_gradient_descent import QmlGradientDescent + + solver = QAOA(problem, + layers=5, + gamma=OptimizationParameter(init=[0.25, 0.25, 0.25, 0.25, 0.25]), + beta=OptimizationParameter(init=[-0.5, -0.5, -0.5, -0.5, -0.5]), + optimizer=QmlGradientDescent(), + penalty_weights=[1, 2.5, 2.5], + ) + + +3. **Run experiments:** + +Run the solver. + +.. code-block:: python + + solver_results = solver.solve() + +4. **Show the results:** + +Sort and display top 5 results. + +.. code-block:: python + + from QHyper.util import sort_solver_results + + sorted_results = sort_solver_results( + solver_results.probabilities, limit_results=5) + + print(sorted_results.dtype.names) + for result in sorted_results: + print(result) + + # ('x0', 'x1', 'x2', 'x3', 'x4', 'probability') + # (1, 1, 0, 0, 1, 0.24827694) + # (0, 1, 1, 0, 1, 0.18271937) + # (1, 0, 1, 0, 1, 0.18271937) + # (1, 1, 1, 0, 1, 0.15528488) + # (1, 1, 1, 1, 1, 0.03339847) + + +**Summary** + +You have successfully installed the QHyper library and set up your first experiment. + +Check out more advanced the tutorials: :doc:`solver_configuration`, :doc:`demo/typical_use_cases`, and :doc:`demo/defining_problems`. diff --git a/QHyper/docs/source/user_guide/solver_configuration.rst b/QHyper/docs/source/user_guide/solver_configuration.rst new file mode 100644 index 0000000..b805f05 --- /dev/null +++ b/QHyper/docs/source/user_guide/solver_configuration.rst @@ -0,0 +1,681 @@ +============================= +Solver configuration tutorial +============================= + +Solver types +------------ + +| The basic solver definition requires the specification of its type. +| Currently supported solver types are: + +* quantum annealing + + * :py:class:`Advantage<.Advantage>` for the `D-Wave Advantage Solver `_ (currently the default advantage_system5.4. is supported); + * :py:class:`CQM<.CQM>` for the `D-Wave Constrained Quadratic Model Hybrid Solver `_; + * :py:class:`DQM<.DQM>` for the `D-Wave Discrete Quadratic Model Hybrid Solver `_; + * `Note`: for all the above solvers the D-Wave `token `_ is required. + +* gate-based + + * :py:class:`QAOA<.QAOA>` for the `Quantum Approximate Optimization Algorithm (QAOA) `_; + * :py:class:`WF_QAOA<.WF_QAOA>` for the `Weight-free Quantum Approximate Optimization Algorithm `_; + +* classical + + * :py:class:`Gurobi<.Gurobi>` for the classical `Gurobi Optimizer `_; + * `Note`: for larger problem instances Gurobi `license `_ is required. + +Problem definition +------------------ + +This tutorial assumes the following sample optimization problem definition: + +.. tabs:: + + .. code-tab:: python + + from QHyper.problems.knapsack import KnapsackProblem + problem = KnapsackProblem(max_weight=2, + item_weights=[1, 1, 1], + item_values=[2, 2, 1]) + + .. code-tab:: yaml + + problem: + type: KnapsackProblem + max_weight: 2 + item_weights: [1, 1, 1] + item_values: [2, 2, 1] + + .. code-tab:: py JSON + + { + "problem": { + "type": "KnapsackProblem", + "max_weight": 2, + "item_weights": [1, 1, 1], + "item_values": [2, 2, 1], + } + } + + +This specifies the `Knapsack Problem `_: fill a knapsack with three items, each characterized with a weight and cost, to maximize the total value without exceeding ``max_weight``. + + +Configuring quantum annealing solvers: D-Wave +--------------------------------------------- + + +The initial penalty weights for constrained problems +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Some solvers, such as the `D-Wave Advantage` hybrid solver, require the problem definition in the `Quadratic Unconstrained Binary Optimization (QUBO) `_ form. QHyper automatically creates the QUBO, e.g., for the Knapsack Problem: + +.. math:: + f(\boldsymbol{x}, \boldsymbol{y}) = + - \alpha_0 \underbrace{\sum_{i = 1}^N c_i x_i}_{\text{cost function}} + \alpha_1 \underbrace{(1 - \sum_{i=1}^W y_i)^2}_{\text{constraint encoding}} + \alpha_2 \underbrace{(\sum_{i=1}^W iy_i - \sum_{i=1}^N w_ix_i)^2}_{\text{weight constraint}}, + +where + * :math:`\alpha_j` are the penalty weights (i.e. Lagrangian multipliers, hyperparameters of the optimized function); + * :math:`N=3` is the number of available items; + * :math:`W=` ``max_weight`` is the maximum weight of the knapsack; + * :math:`c_i` and :math:`w_i` are the values and weights specified in ``item_values`` and ``item_weights`` lists of the configuration; + * The goal is to optimize :math:`\boldsymbol{x} = [x_i]_N` which is a Boolean vector, where :math:`x_i = 1` if and only if the item :math:`i` was selected to be inserted into the knapsack; + * :math:`\boldsymbol{y} = [y_i]_W` is a one-hot vector where :math:`y_i = 1` if and only if the weight of the knapsack is equal to :math:`i`. + + +To define the function properly, you need to set three penalty terms :math:`\alpha_j`, which act as hyperparameters. +These penalties are used to combine the cost function and constraints. The first constraint ensure that the problem encoding is correct, and the second that the total weight in the knapsack does not exceed the ``max_weight`` limit. + + +D-Wave Advantage solver +^^^^^^^^^^^^^^^^^^^^^^^ + +In the example below, the solver used is the D-Wave Advantage quantum annealing system and the constraint penalties (:math:`\alpha_j`) are set using the ``penalty_weights`` keyword argument. The ``num_reads`` argument is the amount of samples. + +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.quantum_annealing.dwave import Advantage + + solver = Advantage(problem, + penalty_weights=[1, 2.5, 2.5], + num_reads=10) + + .. code-tab:: yaml + + solver: + category: quantum_annealing + platform: dwave + name: Advantage + penalty_weights: [1, 2.5, 2.5] + num_reads: 10 + + .. code-tab:: json + + { + "solver": { + "category": "quantum_annealing", + "platform": "dwave", + "name": "Advantage", + "penalty_weights": [1, 2.5, 2.5], + "num_reads": 10 + } + } + + +Adding a hyperoptimizer +^^^^^^^^^^^^^^^^^^^^^^^ + +| Since guessing the correct penalty weights is often a difficult task, there is also an option to define a :py:class:`HyperOptimizer<.HyperOptimizer>` to search for the appropriate settings. + +| In the example below, :py:class:`GridSearch<.GridSearch>` optimizer is applied to find the proper penalty weights for the knapsack QUBO formulation. The penalty weights are searched within specified bounds (``min``, ``max``) and incremented by a specified ``step`` size. + +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.hyper_optimizer import HyperOptimizer + from QHyper.optimizers.grid_search import GridSearch + from QHyper.solvers.quantum_annealing.dwave import Advantage + + hyper_optimizer = HyperOptimizer( + optimizer=GridSearch(), + solver=Advantage(problem), + penalty_weights={"min": [1, 1, 1], "max": [2.1, 2.1, 2.1], "step": [1, 1, 1]} + ) + + + .. code-tab:: yaml + + solver: + category: quantum_annealing + platform: dwave + name: Advantage + hyper_optimizer: + optimizer: + type: GridSearch + penalty_weights: + min: [1, 1, 1] + max: [2.1, 2.1, 2.1] + step: [1, 1, 1] + + .. code-tab:: json + + { + "solver": { + "category": "quantum_annealing", + "platform": "dwave", + "name": "Advantage" + }, + "hyper_optimizer": { + "optimizer": { + "type": "GridSearch" + }, + "penalty_weights": { + "min": [1, 1, 1], + "max": [2.1, 2.1, 2.1], + "step": [1, 1, 1] + } + } + } + + + +Configuring gate-based solvers: QAOA +------------------------------------ + +| A typical example of the QAOA configuration is presented below. +| The quantum circuit consists of 5 ``layers``. The variational parameters ``gamma`` and ``beta`` are specified using ``OptimizationParameters``. +| A local :py:class:`QmlGradientDescent<.QmlGradientDescent>` ``optimizer`` (by default `Adam gradient descent `_) with the default settings is used. +| Problem's penalty weights are defined in ``penalty_weights``. + +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.gate_based.pennylane import QAOA + from QHyper.optimizers import OptimizationParameter + from QHyper.optimizers.qml_gradient_descent import QmlGradientDescent + + solver = QAOA(problem, + layers=5, + gamma=OptimizationParameter(init=[0.25, 0.25, 0.25, 0.25, 0.25]), + beta=OptimizationParameter(init=[-0.5, -0.5, -0.5, -0.5, -0.5]), + optimizer=QmlGradientDescent(), + penalty_weights=[1, 2.5, 2.5], + ) + + .. code-tab:: yaml + + solver: + category: gate_based + platform: pennylane + name: QAOA + layers: 5 + gamma: + init: [0.25, 0.25, 0.25, 0.25, 0.25] + beta: + init: [-0.5, -0.5, -0.5, -0.5, -0.5] + optimizer: + type: QmlGradientDescent + penalty_weights: [1, 2.5, 2.5] + + .. code-tab:: json + + { + "solver": { + "category": "gate_based", + "platform": "pennylane", + "name": "QAOA", + "layers": 5, + "gamma": { + "init": [0.25, 0.25, 0.25, 0.25, 0.25] + }, + "beta": { + "init": [-0.5, -0.5, -0.5, -0.5, -0.5] + }, + "optimizer": { + "type": "QmlGradientDescent" + }, + "penalty_weights": [1, 2.5, 2.5] + } + } + + +It is possible to further customize the :py:class:`QAOA<.QAOA>` with additional keyword arguments (see the QHyper API documentation). Below is presented an example of setting the `Pennylane simulator +type `_ using the ``backend`` keyword. + +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.gate_based.pennylane import QAOA + from QHyper.optimizers import OptimizationParameter + from QHyper.optimizers.qml_gradient_descent import QmlGradientDescent + + solver = QAOA(problem, + layers=5, + gamma=OptimizationParameter(init=[0.25, 0.25, 0.25, 0.25, 0.25]), + beta=OptimizationParameter(init=[-0.5, -0.5, -0.5, -0.5, -0.5]), + optimizer=QmlGradientDescent(), + backend="default.qubit", + penalty_weights=[1, 2.5, 2.5], + ) + + + .. code-tab:: yaml + + solver: + category: gate_based + platform: pennylane + name: QAOA + layers: 5 + gamma: + init: [0.25, 0.25, 0.25, 0.25, 0.25] + beta: + init: [-0.5, -0.5, -0.5, -0.5, -0.5] + optimizer: + type: QmlGradientDescent + backend: default.qubit + penalty_weights: [1, 2.5, 2.5] + + .. code-tab:: json + + { + "solver": { + "category": "gate_based", + "platform": "pennylane", + "name": "QAOA", + "layers": 5, + "gamma": { + "init": [0.25, 0.25, 0.25, 0.25, 0.25] + }, + "beta": { + "init": [-0.5, -0.5, -0.5, -0.5, -0.5] + }, + "optimizer": { + "type": "QmlGradientDescent" + }, + "backend": "default.qubit", + "penalty_weights": [1, 2.5, 2.5] + } + } + + + +Customizing optimizers +^^^^^^^^^^^^^^^^^^^^^^ + +Customizing the ``optimizer`` settings is also possible. Below, a more detailed sample configuration is shown. Please note that adding all +native function options is possible (e.g., ``stepsize`` in this example is native +from `Adam gradient descent `_). + +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.gate_based.pennylane import QAOA + from QHyper.optimizers import OptimizationParameter + from QHyper.optimizers.qml_gradient_descent import QmlGradientDescent + + solver = QAOA(problem, + layers=5, + gamma=OptimizationParameter(init=[0.25, 0.25, 0.25, 0.25, 0.25]), + beta=OptimizationParameter(init=[-0.5, -0.5, -0.5, -0.5, -0.5]), + optimizer=QmlGradientDescent(name='adam', + steps=200, + stepsize=0.005), + penalty_weights=[1, 2.5, 2.5] + ) + + .. code-tab:: yaml + + solver: + category: gate_based + platform: pennylane + name: QAOA + layers: 5 + gamma: + init: [0.25, 0.25, 0.25, 0.25, 0.25] + beta: + init: [-0.5, -0.5, -0.5, -0.5, -0.5] + optimizer: + type: QmlGradientDescent + name: adam + steps: 200 + stepsize: 0.005 + backend: default.qubit + penalty_weights: [1, 2.5, 2.5] + + .. code-tab:: json + + { + "solver": { + "category": "gate_based", + "platform": "pennylane", + "name": "QAOA", + "layers": 5, + "gamma": { + "init": [0.25, 0.25, 0.25, 0.25, 0.25] + }, + "beta": { + "init": [-0.5, -0.5, -0.5, -0.5, -0.5] + }, + "optimizer": { + "type": "QmlGradientDescent", + "name": "adam", + "steps": 200, + "stepsize": 0.005 + }, + "backend": "default.qubit", + "penalty_weights": [1, 2.5, 2.5] + } + } + + +Configuring a classical solver: Gurobi +-------------------------------------- +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.classical.gurobi import Gurobi + + solver = Gurobi(problem) + + .. code-tab:: yaml + + solver: + category: classical + platform: gurobi + name: Gurobi + + .. code-tab:: json + + { + "solver": { + "category": "classical", + "platform": "gurobi", + "name": "Gurobi" + } + } + + + +Combining optimizers and hyperoptimizers +---------------------------------------- + +It is also possible to make use of both the ``optimizer`` and the ``HyperOptimizer`` functionalities. The example below is similar to that in `Customizing optimizers`_. However, as in `Adding a hyperoptimizer`_, penalty weights are searched by the ``HyperOptimizer`` within specified bounds. In this example it is done using the Cross Entropy Search method (defined as :py:class:`cem<.CEM>`). ``processes``, ``samples_per_epoch``, and ``epochs`` are parameters specific for ``CEM``. + +.. note:: The `CEM` method is computationally expensive and may require a significant amount of time to complete (~5 min). + + +.. tabs:: + + .. code-tab:: python + + from QHyper.solvers.gate_based.pennylane import WF_QAOA + from QHyper.optimizers import OptimizationParameter + from QHyper.optimizers.scipy_minimizer import ScipyOptimizer + from QHyper.solvers.hyper_optimizer import HyperOptimizer + from QHyper.optimizers.cem import CEM + + solver = WF_QAOA(problem, + layers=5, + gamma=OptimizationParameter(min=[0.0, 0.0, 0.0, 0.0, 0.0], + init=[0.5, 0.5, 0.5, 0.5, 0.5], + max=[6.28, 6.28, 6.28, 6.28, 6.28]), + beta=OptimizationParameter(min=[0.0, 0.0, 0.0, 0.0, 0.0], + init=[1.0, 1.0, 1.0, 1.0, 1.0], + max=[6.28, 6.28, 6.28, 6.28, 6.28]), + optimizer=ScipyOptimizer(), + backend="default.qubit", + penalty_weights=[1, 2.5, 2.5], + ) + + hyper_optimizer = HyperOptimizer( + optimizer=CEM(processes=4, + samples_per_epoch=100, + epochs=5), + solver=solver, + penalty_weights={ + "min": [1, 1, 1], + "max": [5, 5, 5], + "init": [1, 2.5, 2.5] + } + ) + + .. code-tab:: yaml + + solver: + category: gate_based + platform: pennylane + name: WF_QAOA + layers: 5 + gamma: + min: [0, 0, 0, 0, 0] + init: [0.5, 0.5, 0.5, 0.5, 0.5] + max: [6.28, 6.28, 6.28, 6.28, 6.28] + beta: + min: [0, 0, 0, 0, 0] + init: [1., 1., 1., 1., 1.] + max: [6.28, 6.28, 6.28, 6.28, 6.28] + optimizer: + type: scipy + backend: default.qubit + hyper_optimizer: + optimizer: + type: cem + processes: 4 + samples_per_epoch: 100 + epochs: 5 + penalty_weights: + min: [1, 1, 1] + max: [5, 5, 5] + init: [1, 2.5, 2.5] + + .. code-tab:: json + + { + "solver": { + "category": "gate_based", + "platform": "pennylane", + "name": "WF_QAOA", + "layers": 5, + "gamma": { + "min": [0.0, 0.0, 0.0, 0.0, 0.0], + "init": [0.5, 0.5, 0.5, 0.5, 0.5], + "max": [6.28, 6.28, 6.28, 6.28, 6.28] + }, + "beta": { + "min": [0.0, 0.0, 0.0, 0.0, 0.0], + "init": [1.0, 1.0, 1.0, 1.0, 1.0], + "max": [6.28, 6.28, 6.28, 6.28, 6.28] + }, + "optimizer": { + "type": "scipy" + }, + "backend": "default.qubit" + }, + "hyper_optimizer": { + "optimizer": { + "type": "cem", + "processes": 4, + "samples_per_epoch": 100, + "epochs": 5 + }, + "penalty_weights": { + "min": [1, 1, 1], + "max": [5, 5, 5], + "init": [1, 2.5, 2.5] + } + } + } + + + +Supported optimizers +-------------------- + +A variety of (hyper)optimizers is supported. In QHyper the ``optimizer`` (both in a solver and in a hyperoptimizer) can be set up using keyword arguments given below. + +.. note:: + Please note that additional keyword arguments for each ``optimizer`` configuration can be taken directly from the native function definition (refer to the indicated API documentation). + +* :py:class:`.QmlGradientDescent`: customizable gradient descent set of optimizers from Pennylane (see below) +* :py:class:`.ScipyOptimizer`: `Scipy gradient descent set of optimizers `_ +* :py:class:`.Random`: Random optimizer (see QHyper API doc) +* :py:class:`.GridSearch`: Grid search optimizer (see QHyper API doc) +* :py:class:`.CEM`: Cross Entropy Optimizer (see QHyper API doc) +* :py:class:`.Dummy`: Dummy optimizer (see QHyper API doc) + +Additionally, the ``QmlGradientDescent`` set of optimizers can be further specified (e.g. ``adam`` configuration was shown in point 6 above) using following keyword arguments (for details see `Pennylane documentation `_ ): + +* ``adam``: qml.AdamOptimizer; +* ``adagrad``: qml.AdagradOptimizer; +* ``rmsprop``: qml.RMSPropOptimizer; +* ``momentum``: qml.MomentumOptimizer; +* ``nesterov_momentum``: qml.NesterovMomentumOptimizer; +* ``sgd``: qml.GradientDescentOptimizer; +* ``qng``: qml.QNGOptimizer. + +Running solvers and hyperoptimizers +----------------------------------- + +Running a pure solver: + +.. tabs:: + + .. code-tab:: py + + solver.solve() + + .. code-tab:: py Python using YAML + + ''' + Note: the solver and problem configs should be + in a single .yaml file. + --- + solver: + ... + problem: + ... + ''' + + import yaml + from QHyper.solvers import solver_from_config + + with open(".yaml", "r") as file: + solver_config = yaml.safe_load(file) + solver = solver_from_config(solver_config) + solver.solve() + + + .. code-tab:: py Python using JSON + + ''' + Note: there are two ways to use the JSON config: + + 1. The solver and problem configs can be + read from a single .json file. + { + "solver": + { ... }, + "problem": + { ... } + } + + 2. Directly in Python code, JSON syntax + can be assigned to a variable for further use. + solver_config = { + "solver": + { ... }, + "problem": + { ... } + } + ''' + + import json + from QHyper.solvers import solver_from_config + + # Uncomment if reading data from a file + # with open(".json", "r") as file: + # solver_config = json.load(file) + solver = solver_from_config(solver_config) + solver.solve() + +Running a hyperoptimizer: + +.. tabs:: + + .. code-tab:: py + + hyper_optimizer.solve() + hyper_optimizer.run_with_best_params() + + .. code-tab:: py Python using YAML + + ''' + Note: the solver, problem, and hyper_optimizer configs + should be in the same .yaml file. + --- + solver: + ... + problem: + ... + hyper_optimizer: + ... + ''' + + import yaml + from QHyper.solvers import solver_from_config + + with open(".yaml", "r") as file: + hyperoptimizer_config = yaml.safe_load(file) + hyper_optimizer = solver_from_config(hyperoptimizer_config) + hyper_optimizer.solve() + hyper_optimizer.run_with_best_params() + + + + .. code-tab:: py Python using JSON + + ''' + Note: there are two ways to use the JSON config: + + 1. The solver, problem, and hyper optimizer configs + can be read from a single .json file. + { + "solver": + { ... }, + "problem": + { ... }, + "hyper_optimizer": + { ... } + } + + 2. Directly in Python code, JSON syntax + can be assigned to a variable for further use. + hyper_optimizer_config = { + "solver": + { ... }, + "problem": + { ... }, + "hyper_optimizer": + { ... } + } + ''' + + import json + from QHyper.solvers import solver_from_config + + # Uncomment if reading data from a file + # with open(".json", "r") as file: + # hyper_optimizer_config = json.load(file) + hyper_optimizer = solver_from_config(hyper_optimizer_config) + hyper_optimizer.solve() + hyper_optimizer.run_with_best_params() + +You can explore how to evaluate the results by visiting the :doc:`demo/typical_use_cases` demo. diff --git a/QHyper/mypy.ini b/QHyper/mypy.ini new file mode 100644 index 0000000..18b9df3 --- /dev/null +++ b/QHyper/mypy.ini @@ -0,0 +1,24 @@ +[mypy] +warn_redundant_casts = True +warn_unused_ignores = True + +# Needed because of bug in MyPy +disallow_subclassing_any = False + +mypy_path = stubs + +exclude = QHyper/hyperoptimizers + +disallow_untyped_calls = True +disallow_untyped_defs = True +check_untyped_defs = True +warn_return_any = True +no_implicit_optional = True +strict_optional = True +ignore_missing_imports = True + +[mypy-scipy.*] +ignore_missing_imports = True + +[mypy-pennylane.*] +ignore_missing_imports = True diff --git a/QHyper/optimizers/base.py b/QHyper/optimizers/base.py index 23af6a7..b8853e2 100644 --- a/QHyper/optimizers/base.py +++ b/QHyper/optimizers/base.py @@ -8,7 +8,8 @@ from abc import abstractmethod -from typing import Callable, Self +from typing import Callable +from typing_extensions import Self @dataclasses.dataclass diff --git a/QHyper/polynomial.py b/QHyper/polynomial.py index 60befba..f0980a6 100644 --- a/QHyper/polynomial.py +++ b/QHyper/polynomial.py @@ -64,11 +64,16 @@ def __init__(self, terms: dict[tuple[str, ...], float] | float | int self.terms = defaultdict(float) + non_zero_found = False for term, coefficient in terms.items(): if coefficient == 0: continue + non_zero_found = True self.terms[tuple(sorted(term))] += coefficient + if not non_zero_found: + self.terms[tuple()] = 0.0 + @overload def __add__(self, other: float | int) -> 'Polynomial': ... @@ -204,6 +209,8 @@ def degree(self) -> int: int The degree of the polynomial. """ + if not self.terms: + return 0 return max(len(term) for term in self.terms) def get_variables(self) -> set[str]: diff --git a/QHyper/problems/community_detection.py b/QHyper/problems/community_detection.py index 29e5e4c..50b756d 100644 --- a/QHyper/problems/community_detection.py +++ b/QHyper/problems/community_detection.py @@ -22,34 +22,35 @@ class Network: resolution: float = 1.0 weight: str | None = "weight" community: list | None = None - full_modularity_matrix: np.ndarray = field(init=False) + full_modularity_matrix: np.ndarray | None = None generalized_modularity_matrix: np.ndarray = field(init=False) def __post_init__(self) -> None: if not self.community: self.community = [*range(self.graph.number_of_nodes())] - ( - self.full_modularity_matrix, - self.generalized_modularity_matrix, - ) = self.calculate_modularity_matrix() + if self.full_modularity_matrix is None: + self.full_modularity_matrix = self.calculate_full_modularity_matrix() + self.generalized_modularity_matrix = ( + self.calculate_generalized_modularity_matrix() + ) - def calculate_modularity_matrix(self) -> np.ndarray: + def calculate_full_modularity_matrix(self) -> np.ndarray: adj_matrix: np.ndarray = nx.to_numpy_array(self.graph, weight=self.weight) in_degree_matrix: np.ndarray = adj_matrix.sum(axis=1) out_degree_matrix: np.ndarray = adj_matrix.sum(axis=0) m: int = np.sum(adj_matrix) - full_modularity_matrix = ( + return ( adj_matrix - self.resolution * np.outer(in_degree_matrix, out_degree_matrix) / m ) - B_bis = full_modularity_matrix[self.community, :] + def calculate_generalized_modularity_matrix(self) -> np.ndarray: + B_bis = self.full_modularity_matrix[self.community, :] B_community = B_bis[:, self.community] B_i = np.sum(B_community, axis=1) B_j = np.sum(B_community.T, axis=1) delta = np.eye(len(self.community), dtype=np.int32) - B_g = 0.5*( B_community + B_community.T ) - 0.5 * delta * (B_i + B_j) - return full_modularity_matrix, B_g + return 0.5 * (B_community + B_community.T) - 0.5 * delta * (B_i + B_j) class KarateClubNetwork(Network): @@ -131,15 +132,16 @@ def __init__( self._set_objective_function() self._set_one_hot_constraints(communities) else: - self.variables: tuple[ - sympy.Symbol - ] = self._get_discrete_variable_representation() + self.variables: tuple[sympy.Symbol] = ( + self._get_discrete_variable_representation() + ) self._set_objective_function() def _get_discrete_variable_representation( self, ) -> tuple[sympy.Symbol] | Any: - return sympy.symbols(" ".join([f"x{i}" for i in range(len(self.community))])) + # return sympy.symbols(" ".join([f"x{i}" for i in range(len(self.community))])) + return sympy.symbols(" ".join([f"x{n}" for n in self.community])) def _set_objective_function(self) -> None: equation: dict[tuple[str, ...], float] = {} @@ -164,6 +166,12 @@ def _set_objective_function(self) -> None: equation = {key: -1 * val for key, val in equation.items()} + nonzero_terms = sum(1 for v in equation.values() if not np.isclose(v, 0.0)) + if nonzero_terms == 0: + raise ValueError( + f"The objective function is a zero polynomial - all terms in the generalized modularity matrix are 0. Try different resolution (current: {self.resolution})" + ) + self.objective_function = Polynomial(equation) def _encode_discrete_to_one_hot( diff --git a/QHyper/requirements/dev.txt b/QHyper/requirements/dev.txt new file mode 100644 index 0000000..1ca10c7 --- /dev/null +++ b/QHyper/requirements/dev.txt @@ -0,0 +1,12 @@ +-r prod.txt + +pydata-sphinx-theme~=0.16.0 +sphinx-copybutton~=0.5.2 +sphinx_autodoc_typehints~=3.0.0 +Sphinx~=8.1.3 +numpydoc~=1.8 +graphviz~=0.20 +nbsphinx~=0.9 +ipykernel~=6.29 +sphinx-tabs~=3.4.7 +pytest diff --git a/QHyper/requirements/prod.txt b/QHyper/requirements/prod.txt new file mode 100644 index 0000000..ad58b1b --- /dev/null +++ b/QHyper/requirements/prod.txt @@ -0,0 +1,10 @@ +numpy==1.26 +PennyLane==0.38 +tqdm +sympy==1.13 +dwave-system +gurobipy +types-tqdm +pandas +autoray==0.6.11 +git+https://github.com/wfcommons/wfcommons.git@main diff --git a/QHyper/results/id_2_sampleset_adv.npy b/QHyper/results/id_2_sampleset_adv.npy new file mode 100644 index 0000000..8c997de Binary files /dev/null and b/QHyper/results/id_2_sampleset_adv.npy differ diff --git a/QHyper/results/id_2_sampleset_adv.pkl b/QHyper/results/id_2_sampleset_adv.pkl new file mode 100644 index 0000000..38159ad Binary files /dev/null and b/QHyper/results/id_2_sampleset_adv.pkl differ diff --git a/QHyper/results/id_2_sampleset_adv_serializable.pkl b/QHyper/results/id_2_sampleset_adv_serializable.pkl new file mode 100644 index 0000000..cef71e8 Binary files /dev/null and b/QHyper/results/id_2_sampleset_adv_serializable.pkl differ diff --git a/QHyper/results/id_3_sampleset_adv.npy b/QHyper/results/id_3_sampleset_adv.npy new file mode 100644 index 0000000..c8a2a5f Binary files /dev/null and b/QHyper/results/id_3_sampleset_adv.npy differ diff --git a/QHyper/results/id_3_sampleset_adv.pkl b/QHyper/results/id_3_sampleset_adv.pkl new file mode 100644 index 0000000..6986fce Binary files /dev/null and b/QHyper/results/id_3_sampleset_adv.pkl differ diff --git a/QHyper/results/id_3_sampleset_adv_serializable.pkl b/QHyper/results/id_3_sampleset_adv_serializable.pkl new file mode 100644 index 0000000..e33d32b Binary files /dev/null and b/QHyper/results/id_3_sampleset_adv_serializable.pkl differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.npy b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.npy new file mode 100644 index 0000000..d707c68 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.npy differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.pkl b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.pkl new file mode 100644 index 0000000..ab7b00b Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.pkl differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983_serializable.pkl b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983_serializable.pkl new file mode 100644 index 0000000..dae2683 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983_serializable.pkl differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.npy b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.npy new file mode 100644 index 0000000..62faa60 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.npy differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.pkl b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.pkl new file mode 100644 index 0000000..f8c7a07 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.pkl differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d_serializable.pkl b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d_serializable.pkl new file mode 100644 index 0000000..d3dc0cf Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d_serializable.pkl differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.npy b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.npy new file mode 100644 index 0000000..1e32620 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.npy differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.pkl b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.pkl new file mode 100644 index 0000000..a8bc132 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.pkl differ diff --git a/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece_serializable.pkl b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece_serializable.pkl new file mode 100644 index 0000000..3a27b03 Binary files /dev/null and b/QHyper/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece_serializable.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.npy b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.npy new file mode 100644 index 0000000..f83500c Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.npy differ diff --git a/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.pkl b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.pkl new file mode 100644 index 0000000..057f64d Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f_serializable.pkl b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f_serializable.pkl new file mode 100644 index 0000000..5f90262 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f_serializable.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.npy b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.npy new file mode 100644 index 0000000..b384902 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.npy differ diff --git a/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.pkl b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.pkl new file mode 100644 index 0000000..7695a35 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762_serializable.pkl b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762_serializable.pkl new file mode 100644 index 0000000..1af5544 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762_serializable.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.npy b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.npy new file mode 100644 index 0000000..9c4b563 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.npy differ diff --git a/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.pkl b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.pkl new file mode 100644 index 0000000..b65496c Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6_serializable.pkl b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6_serializable.pkl new file mode 100644 index 0000000..ee935e4 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6_serializable.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.npy b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.npy new file mode 100644 index 0000000..b5f6cfe Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.npy differ diff --git a/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.pkl b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.pkl new file mode 100644 index 0000000..79f78a2 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.pkl differ diff --git a/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0_serializable.pkl b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0_serializable.pkl new file mode 100644 index 0000000..5aff4f7 Binary files /dev/null and b/QHyper/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0_serializable.pkl differ diff --git a/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.npy b/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.npy new file mode 100644 index 0000000..53e578a Binary files /dev/null and b/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.npy differ diff --git a/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.pkl b/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.pkl new file mode 100644 index 0000000..4d1f635 Binary files /dev/null and b/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.pkl differ diff --git a/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402_serializable.pkl b/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402_serializable.pkl new file mode 100644 index 0000000..fb4b37f Binary files /dev/null and b/QHyper/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402_serializable.pkl differ diff --git a/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.npy b/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.npy new file mode 100644 index 0000000..3dc9508 Binary files /dev/null and b/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.npy differ diff --git a/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.pkl b/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.pkl new file mode 100644 index 0000000..d1ac6b1 Binary files /dev/null and b/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.pkl differ diff --git a/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl b/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl new file mode 100644 index 0000000..4b08914 Binary files /dev/null and b/QHyper/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl differ diff --git a/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.npy b/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.npy new file mode 100644 index 0000000..4b7a192 Binary files /dev/null and b/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.npy differ diff --git a/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.pkl b/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.pkl new file mode 100644 index 0000000..17393fa Binary files /dev/null and b/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.pkl differ diff --git a/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df_serializable.pkl b/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df_serializable.pkl new file mode 100644 index 0000000..ea42e2d Binary files /dev/null and b/QHyper/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df_serializable.pkl differ diff --git a/QHyper/results/sampleset_adv.npy b/QHyper/results/sampleset_adv.npy new file mode 100644 index 0000000..d341076 Binary files /dev/null and b/QHyper/results/sampleset_adv.npy differ diff --git a/QHyper/results/sampleset_adv.pkl b/QHyper/results/sampleset_adv.pkl new file mode 100644 index 0000000..b006831 Binary files /dev/null and b/QHyper/results/sampleset_adv.pkl differ diff --git a/QHyper/results/sampleset_adv_serializable.pkl b/QHyper/results/sampleset_adv_serializable.pkl new file mode 100644 index 0000000..9b6ff10 Binary files /dev/null and b/QHyper/results/sampleset_adv_serializable.pkl differ diff --git a/QHyper/results/t.ipynb b/QHyper/results/t.ipynb new file mode 100644 index 0000000..9ecf993 --- /dev/null +++ b/QHyper/results/t.ipynb @@ -0,0 +1,3244 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 22, + "id": "274afc65", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The autoreload extension is already loaded. To reload it, use:\n", + " %reload_ext autoreload\n" + ] + } + ], + "source": [ + "import networkx as nx\n", + "\n", + "from QHyper.problems.community_detection import CommunityDetectionProblem, Network\n", + "from QHyper.solvers.quantum_annealing.dwave.advantage import Advantage\n", + "\n", + "import numpy as np\n", + "import pickle\n", + "\n", + "%load_ext autoreload\n", + "%autoreload 2" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "6d6f570b", + "metadata": {}, + "outputs": [], + "source": [ + "from dwave.inspector.adapters import enable_data_capture\n", + "\n", + "\n", + "enable_data_capture()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "aa1b2d30", + "metadata": {}, + "outputs": [], + "source": [ + "G = nx.powerlaw_cluster_graph(40, 1, 0.01)\n", + "network = Network(graph=G)\n", + "problem = CommunityDetectionProblem(network_data=network, communities=2, one_hot_encoding=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "a54cdc6c", + "metadata": {}, + "outputs": [], + "source": [ + "adv = Advantage(problem=problem, num_reads=100, use_clique_embedding=True, elapse_times=True, chain_strength=0.0001)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "4de7b5f9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Could not save sampleset to .json file: 'SampleSet' object has no attribute 'to_file'\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\basia\\Desktop\\Praca_Inzynierska_2024\\QHyper\\QHyper\\solvers\\quantum_annealing\\dwave\\advantage.py:243: UserWarning: No timing information available for the sampleset. \n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "id = 9\n", + "res = adv.solve(return_metadata=True, saving_path=f\"id_{id}_sampleset_adv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "4b50ef7a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.float64(0.9)" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.chain_break_fraction" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "48e5b695", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "StructuredSolver(name='Advantage_system4.1', graph_id='01d07086e1')\n" + ] + } + ], + "source": [ + "from dwave.inspector import storage\n", + "from dwave.inspector.storage import get_problem, problemdata\n", + "\n", + "\n", + "problem_data = storage.get_problem(res.sampleset_info.problem_id)\n", + "\n", + "response = problem_data.response\n", + "solver = problem_data.solver\n", + "print(response)\n", + "print(solver)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "b46ff5b6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "{'f49fda51-0bdf-47d9-8dab-e6c3296ca0c4': }\n" + ] + } + ], + "source": [ + "from dwave.inspector.storage import get_problem, problemdata\n", + "\n", + "\n", + "pd = get_problem(res.sampleset_info.problem_id)\n", + "print(pd.response)\n", + "print(problemdata)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "c2ef60ac", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'type': dwave.system.warnings.EnergyScaleWarning,\n", + " 'message': 'Some biases are 10^3 times stronger than others',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [(181, 180),\n", + " (2940, 180),\n", + " (182, 181),\n", + " (183, 182),\n", + " (196, 195),\n", + " (2955, 195),\n", + " (197, 196),\n", + " (198, 197),\n", + " (151, 150),\n", + " (2970, 150),\n", + " (152, 151),\n", + " (153, 152),\n", + " (166, 165),\n", + " (2985, 165),\n", + " (167, 166),\n", + " (168, 167),\n", + " (211, 210),\n", + " (3000, 210),\n", + " (212, 211),\n", + " (213, 212),\n", + " (226, 225),\n", + " (3015, 225),\n", + " (227, 226),\n", + " (228, 227),\n", + " (241, 240),\n", + " (242, 241),\n", + " (3540, 242),\n", + " (256, 255),\n", + " (257, 256),\n", + " (3555, 257),\n", + " (271, 270),\n", + " (272, 271),\n", + " (3511, 272),\n", + " (3510, 3511),\n", + " (286, 285),\n", + " (287, 286),\n", + " (3526, 287),\n", + " (3525, 3526),\n", + " (301, 300),\n", + " (302, 301),\n", + " (3481, 302),\n", + " (3480, 3481),\n", + " (316, 315),\n", + " (317, 316),\n", + " (3496, 317),\n", + " (3495, 3496),\n", + " (331, 330),\n", + " (332, 331),\n", + " (3451, 332),\n", + " (3450, 3451),\n", + " (346, 345),\n", + " (347, 346),\n", + " (3466, 347),\n", + " (3465, 3466),\n", + " (361, 360),\n", + " (362, 361),\n", + " (3421, 362),\n", + " (3420, 3421),\n", + " (376, 375),\n", + " (377, 376),\n", + " (3436, 377),\n", + " (3435, 3436),\n", + " (391, 390),\n", + " (392, 391),\n", + " (3391, 392),\n", + " (3390, 3391),\n", + " (406, 405),\n", + " (407, 406),\n", + " (3406, 407),\n", + " (3405, 3406),\n", + " (421, 420),\n", + " (3361, 421),\n", + " (3360, 3361),\n", + " (436, 435),\n", + " (3376, 436),\n", + " (3375, 3376),\n", + " (451, 450),\n", + " (3332, 451),\n", + " (3331, 3332),\n", + " (3331, 3330),\n", + " (466, 465),\n", + " (3347, 466),\n", + " (3346, 3347),\n", + " (3346, 3345),\n", + " (481, 480),\n", + " (3302, 481),\n", + " (3301, 3302),\n", + " (3301, 3300),\n", + " (496, 495),\n", + " (3317, 496),\n", + " (3316, 3317),\n", + " (3316, 3315),\n", + " (511, 510),\n", + " (3272, 511),\n", + " (3271, 3272),\n", + " (3271, 3270),\n", + " (526, 525),\n", + " (3287, 526),\n", + " (3286, 3287),\n", + " (3286, 3285),\n", + " (541, 540),\n", + " (3242, 541),\n", + " (3241, 3242),\n", + " (3241, 3240),\n", + " (556, 555),\n", + " (3257, 556),\n", + " (3256, 3257),\n", + " (3256, 3255),\n", + " (571, 570),\n", + " (3212, 571),\n", + " (3211, 3212),\n", + " (3211, 3210),\n", + " (586, 585),\n", + " (3227, 586),\n", + " (3226, 3227),\n", + " (3226, 3225),\n", + " (3182, 600),\n", + " (3181, 3182),\n", + " (3181, 3180),\n", + " (3197, 615),\n", + " (3196, 3197),\n", + " (3196, 3195),\n", + " (3153, 630),\n", + " (3151, 3150),\n", + " (3152, 3153),\n", + " (3152, 3151),\n", + " (3168, 645),\n", + " (3166, 3165),\n", + " (3167, 3168),\n", + " (3167, 3166),\n", + " (3032, 660),\n", + " (3031, 3032),\n", + " (3031, 3030),\n", + " (3047, 675),\n", + " (3046, 3047),\n", + " (3046, 3045),\n", + " (3060, 120),\n", + " (3061, 3060),\n", + " (3062, 3061),\n", + " (3063, 3062),\n", + " (3075, 135),\n", + " (3076, 3075),\n", + " (3077, 3076),\n", + " (3078, 3077),\n", + " (3090, 90),\n", + " (3091, 3090),\n", + " (3092, 3091),\n", + " (3093, 3092),\n", + " (3105, 105),\n", + " (3106, 3105),\n", + " (3107, 3106),\n", + " (3108, 3107)]}},\n", + " {'type': dwave.system.warnings.TooFewSamplesWarning,\n", + " 'message': 'Number of ground states found is within sampling error',\n", + " 'level': 30,\n", + " 'data': {'number_of_ground_states': np.int64(1),\n", + " 'num_reads': np.int64(100),\n", + " 'sampling_error_rate': np.float64(10.0)}},\n", + " {'type': dwave.system.warnings.ChainStrengthWarning,\n", + " 'message': 'Some quadratic biases are stronger than the given chain strength',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [('x1', 'x0'),\n", + " ('x2', 'x0'),\n", + " ('x2', 'x1'),\n", + " ('x3', 'x0'),\n", + " ('x3', 'x1'),\n", + " ('x3', 'x2'),\n", + " ('x4', 'x0'),\n", + " ('x4', 'x1'),\n", + " ('x4', 'x2'),\n", + " ('x4', 'x3'),\n", + " ('x5', 'x0'),\n", + " ('x5', 'x1'),\n", + " ('x5', 'x2'),\n", + " ('x5', 'x3'),\n", + " ('x5', 'x4'),\n", + " ('x6', 'x0'),\n", + " ('x6', 'x1'),\n", + " ('x6', 'x2'),\n", + " ('x6', 'x3'),\n", + " ('x6', 'x4'),\n", + " ('x6', 'x5'),\n", + " ('x7', 'x0'),\n", + " ('x7', 'x1'),\n", + " ('x7', 'x2'),\n", + " ('x7', 'x3'),\n", + " ('x7', 'x4'),\n", + " ('x7', 'x5'),\n", + " ('x7', 'x6'),\n", + " ('x8', 'x0'),\n", + " ('x8', 'x1'),\n", + " ('x8', 'x2'),\n", + " ('x8', 'x3'),\n", + " ('x8', 'x4'),\n", + " ('x8', 'x5'),\n", + " ('x8', 'x6'),\n", + " ('x8', 'x7'),\n", + " ('x9', 'x0'),\n", + " ('x9', 'x1'),\n", + " ('x9', 'x2'),\n", + " ('x9', 'x3'),\n", + " ('x9', 'x4'),\n", + " ('x9', 'x5'),\n", + " ('x9', 'x6'),\n", + " ('x9', 'x7'),\n", + " ('x9', 'x8'),\n", + " ('x10', 'x0'),\n", + " ('x10', 'x1'),\n", + " ('x10', 'x2'),\n", + " ('x10', 'x3'),\n", + " ('x10', 'x4'),\n", + " ('x10', 'x5'),\n", + " ('x10', 'x6'),\n", + " ('x10', 'x7'),\n", + " ('x10', 'x8'),\n", + " ('x10', 'x9'),\n", + " ('x11', 'x0'),\n", + " ('x11', 'x1'),\n", + " ('x11', 'x2'),\n", + " ('x11', 'x3'),\n", + " ('x11', 'x4'),\n", + " ('x11', 'x5'),\n", + " ('x11', 'x6'),\n", + " ('x11', 'x7'),\n", + " ('x11', 'x8'),\n", + " ('x11', 'x9'),\n", + " ('x11', 'x10'),\n", + " ('x12', 'x0'),\n", + " ('x12', 'x1'),\n", + " ('x12', 'x2'),\n", + " ('x12', 'x3'),\n", + " ('x12', 'x4'),\n", + " ('x12', 'x5'),\n", + " ('x12', 'x6'),\n", + " ('x12', 'x7'),\n", + " ('x12', 'x8'),\n", + " ('x12', 'x9'),\n", + " ('x12', 'x10'),\n", + " ('x12', 'x11'),\n", + " ('x13', 'x0'),\n", + " ('x13', 'x1'),\n", + " ('x13', 'x2'),\n", + " ('x13', 'x3'),\n", + " ('x13', 'x4'),\n", + " ('x13', 'x5'),\n", + " ('x13', 'x6'),\n", + " ('x13', 'x7'),\n", + " ('x13', 'x8'),\n", + " ('x13', 'x9'),\n", + " ('x13', 'x10'),\n", + " ('x13', 'x11'),\n", + " ('x13', 'x12'),\n", + " ('x14', 'x0'),\n", + " ('x14', 'x1'),\n", + " ('x14', 'x2'),\n", + " ('x14', 'x3'),\n", + " ('x14', 'x4'),\n", + " ('x14', 'x5'),\n", + " ('x14', 'x6'),\n", + " ('x14', 'x7'),\n", + " ('x14', 'x8'),\n", + " ('x14', 'x9'),\n", + " ('x14', 'x10'),\n", + " ('x14', 'x11'),\n", + " ('x14', 'x12'),\n", + " ('x14', 'x13'),\n", + " ('x15', 'x0'),\n", + " ('x15', 'x1'),\n", + " ('x15', 'x2'),\n", + " ('x15', 'x3'),\n", + " ('x15', 'x4'),\n", + " ('x15', 'x5'),\n", + " ('x15', 'x6'),\n", + " ('x15', 'x7'),\n", + " ('x15', 'x8'),\n", + " ('x15', 'x9'),\n", + " ('x15', 'x10'),\n", + " ('x15', 'x11'),\n", + " ('x15', 'x12'),\n", + " ('x15', 'x13'),\n", + " ('x15', 'x14'),\n", + " ('x16', 'x0'),\n", + " ('x16', 'x1'),\n", + " ('x16', 'x2'),\n", + " ('x16', 'x3'),\n", + " ('x16', 'x4'),\n", + " ('x16', 'x5'),\n", + " ('x16', 'x6'),\n", + " ('x16', 'x7'),\n", + " ('x16', 'x8'),\n", + " ('x16', 'x9'),\n", + " ('x16', 'x10'),\n", + " ('x16', 'x11'),\n", + " ('x16', 'x12'),\n", + " ('x16', 'x13'),\n", + " ('x16', 'x14'),\n", + " ('x16', 'x15'),\n", + " ('x17', 'x0'),\n", + " ('x17', 'x1'),\n", + " ('x17', 'x2'),\n", + " ('x17', 'x3'),\n", + " ('x17', 'x4'),\n", + " ('x17', 'x5'),\n", + " ('x17', 'x6'),\n", + " ('x17', 'x7'),\n", + " ('x17', 'x8'),\n", + " ('x17', 'x9'),\n", + " ('x17', 'x10'),\n", + " ('x17', 'x11'),\n", + " ('x17', 'x12'),\n", + " ('x17', 'x13'),\n", + " ('x17', 'x14'),\n", + " ('x17', 'x15'),\n", + " ('x17', 'x16'),\n", + " ('x18', 'x0'),\n", + " ('x18', 'x1'),\n", + " ('x18', 'x2'),\n", + " ('x18', 'x3'),\n", + " ('x18', 'x4'),\n", + " ('x18', 'x5'),\n", + " ('x18', 'x6'),\n", + " ('x18', 'x7'),\n", + " ('x18', 'x8'),\n", + " ('x18', 'x9'),\n", + " ('x18', 'x10'),\n", + " ('x18', 'x11'),\n", + " ('x18', 'x12'),\n", + " ('x18', 'x13'),\n", + " ('x18', 'x14'),\n", + " ('x18', 'x15'),\n", + " ('x18', 'x16'),\n", + " ('x18', 'x17'),\n", + " ('x19', 'x0'),\n", + " ('x19', 'x1'),\n", + " ('x19', 'x2'),\n", + " ('x19', 'x3'),\n", + " ('x19', 'x4'),\n", + " ('x19', 'x5'),\n", + " ('x19', 'x6'),\n", + " ('x19', 'x7'),\n", + " ('x19', 'x8'),\n", + " ('x19', 'x9'),\n", + " ('x19', 'x10'),\n", + " ('x19', 'x11'),\n", + " ('x19', 'x12'),\n", + " ('x19', 'x13'),\n", + " ('x19', 'x14'),\n", + " ('x19', 'x15'),\n", + " ('x19', 'x16'),\n", + " ('x19', 'x17'),\n", + " ('x19', 'x18'),\n", + " ('x20', 'x0'),\n", + " ('x20', 'x1'),\n", + " ('x20', 'x2'),\n", + " ('x20', 'x3'),\n", + " ('x20', 'x4'),\n", + " ('x20', 'x5'),\n", + " ('x20', 'x6'),\n", + " ('x20', 'x7'),\n", + " ('x20', 'x8'),\n", + " ('x20', 'x9'),\n", + " ('x20', 'x10'),\n", + " ('x20', 'x11'),\n", + " ('x20', 'x12'),\n", + " ('x20', 'x13'),\n", + " ('x20', 'x14'),\n", + " ('x20', 'x15'),\n", + " ('x20', 'x16'),\n", + " ('x20', 'x17'),\n", + " ('x20', 'x18'),\n", + " ('x20', 'x19'),\n", + " ('x21', 'x0'),\n", + " ('x21', 'x1'),\n", + " ('x21', 'x2'),\n", + " ('x21', 'x3'),\n", + " ('x21', 'x4'),\n", + " ('x21', 'x5'),\n", + " ('x21', 'x6'),\n", + " ('x21', 'x7'),\n", + " ('x21', 'x8'),\n", + " ('x21', 'x9'),\n", + " ('x21', 'x10'),\n", + " ('x21', 'x11'),\n", + " ('x21', 'x12'),\n", + " ('x21', 'x13'),\n", + " ('x21', 'x14'),\n", + " ('x21', 'x15'),\n", + " ('x21', 'x16'),\n", + " ('x21', 'x17'),\n", + " ('x21', 'x18'),\n", + " ('x21', 'x19'),\n", + " ('x21', 'x20'),\n", + " ('x22', 'x0'),\n", + " ('x22', 'x1'),\n", + " ('x22', 'x2'),\n", + " ('x22', 'x3'),\n", + " ('x22', 'x4'),\n", + " ('x22', 'x5'),\n", + " ('x22', 'x6'),\n", + " ('x22', 'x7'),\n", + " ('x22', 'x8'),\n", + " ('x22', 'x9'),\n", + " ('x22', 'x10'),\n", + " ('x22', 'x11'),\n", + " ('x22', 'x12'),\n", + " ('x22', 'x13'),\n", + " ('x22', 'x14'),\n", + " ('x22', 'x15'),\n", + " ('x22', 'x16'),\n", + " ('x22', 'x17'),\n", + " ('x22', 'x18'),\n", + " ('x22', 'x19'),\n", + " ('x22', 'x20'),\n", + " ('x22', 'x21'),\n", + " ('x23', 'x0'),\n", + " ('x23', 'x1'),\n", + " ('x23', 'x2'),\n", + " ('x23', 'x3'),\n", + " ('x23', 'x4'),\n", + " ('x23', 'x5'),\n", + " ('x23', 'x6'),\n", + " ('x23', 'x7'),\n", + " ('x23', 'x8'),\n", + " ('x23', 'x9'),\n", + " ('x23', 'x10'),\n", + " ('x23', 'x11'),\n", + " ('x23', 'x12'),\n", + " ('x23', 'x13'),\n", + " ('x23', 'x14'),\n", + " ('x23', 'x15'),\n", + " ('x23', 'x16'),\n", + " ('x23', 'x17'),\n", + " ('x23', 'x18'),\n", + " ('x23', 'x19'),\n", + " ('x23', 'x20'),\n", + " ('x23', 'x21'),\n", + " ('x23', 'x22'),\n", + " ('x24', 'x0'),\n", + " ('x24', 'x1'),\n", + " ('x24', 'x2'),\n", + " ('x24', 'x3'),\n", + " ('x24', 'x4'),\n", + " ('x24', 'x5'),\n", + " ('x24', 'x6'),\n", + " ('x24', 'x7'),\n", + " ('x24', 'x8'),\n", + " ('x24', 'x9'),\n", + " ('x24', 'x10'),\n", + " ('x24', 'x11'),\n", + " ('x24', 'x12'),\n", + " ('x24', 'x13'),\n", + " ('x24', 'x14'),\n", + " ('x24', 'x15'),\n", + " ('x24', 'x16'),\n", + " ('x24', 'x17'),\n", + " ('x24', 'x18'),\n", + " ('x24', 'x19'),\n", + " ('x24', 'x20'),\n", + " ('x24', 'x21'),\n", + " ('x24', 'x22'),\n", + " ('x24', 'x23'),\n", + " ('x25', 'x0'),\n", + " ('x25', 'x1'),\n", + " ('x25', 'x2'),\n", + " ('x25', 'x3'),\n", + " ('x25', 'x4'),\n", + " ('x25', 'x5'),\n", + " ('x25', 'x6'),\n", + " ('x25', 'x7'),\n", + " ('x25', 'x8'),\n", + " ('x25', 'x9'),\n", + " ('x25', 'x10'),\n", + " ('x25', 'x11'),\n", + " ('x25', 'x12'),\n", + " ('x25', 'x13'),\n", + " ('x25', 'x14'),\n", + " ('x25', 'x15'),\n", + " ('x25', 'x16'),\n", + " ('x25', 'x17'),\n", + " ('x25', 'x18'),\n", + " ('x25', 'x19'),\n", + " ('x25', 'x20'),\n", + " ('x25', 'x21'),\n", + " ('x25', 'x22'),\n", + " ('x25', 'x23'),\n", + " ('x25', 'x24'),\n", + " ('x26', 'x0'),\n", + " ('x26', 'x1'),\n", + " ('x26', 'x2'),\n", + " ('x26', 'x3'),\n", + " ('x26', 'x4'),\n", + " ('x26', 'x5'),\n", + " ('x26', 'x6'),\n", + " ('x26', 'x7'),\n", + " ('x26', 'x8'),\n", + " ('x26', 'x9'),\n", + " ('x26', 'x10'),\n", + " ('x26', 'x11'),\n", + " ('x26', 'x12'),\n", + " ('x26', 'x13'),\n", + " ('x26', 'x14'),\n", + " ('x26', 'x15'),\n", + " ('x26', 'x16'),\n", + " ('x26', 'x17'),\n", + " ('x26', 'x18'),\n", + " ('x26', 'x19'),\n", + " ('x26', 'x20'),\n", + " ('x26', 'x21'),\n", + " ('x26', 'x22'),\n", + " ('x26', 'x23'),\n", + " ('x26', 'x24'),\n", + " ('x26', 'x25'),\n", + " ('x27', 'x0'),\n", + " ('x27', 'x1'),\n", + " ('x27', 'x2'),\n", + " ('x27', 'x3'),\n", + " ('x27', 'x4'),\n", + " ('x27', 'x5'),\n", + " ('x27', 'x6'),\n", + " ('x27', 'x7'),\n", + " ('x27', 'x8'),\n", + " ('x27', 'x9'),\n", + " ('x27', 'x10'),\n", + " ('x27', 'x11'),\n", + " ('x27', 'x12'),\n", + " ('x27', 'x13'),\n", + " ('x27', 'x14'),\n", + " ('x27', 'x15'),\n", + " ('x27', 'x16'),\n", + " ('x27', 'x17'),\n", + " ('x27', 'x18'),\n", + " ('x27', 'x19'),\n", + " ('x27', 'x20'),\n", + " ('x27', 'x21'),\n", + " ('x27', 'x22'),\n", + " ('x27', 'x23'),\n", + " ('x27', 'x24'),\n", + " ('x27', 'x25'),\n", + " ('x27', 'x26'),\n", + " ('x28', 'x0'),\n", + " ('x28', 'x1'),\n", + " ('x28', 'x2'),\n", + " ('x28', 'x3'),\n", + " ('x28', 'x4'),\n", + " ('x28', 'x5'),\n", + " ('x28', 'x6'),\n", + " ('x28', 'x7'),\n", + " ('x28', 'x8'),\n", + " ('x28', 'x9'),\n", + " ('x28', 'x10'),\n", + " ('x28', 'x11'),\n", + " ('x28', 'x12'),\n", + " ('x28', 'x13'),\n", + " ('x28', 'x14'),\n", + " ('x28', 'x15'),\n", + " ('x28', 'x16'),\n", + " ('x28', 'x17'),\n", + " ('x28', 'x18'),\n", + " ('x28', 'x19'),\n", + " ('x28', 'x20'),\n", + " ('x28', 'x21'),\n", + " ('x28', 'x22'),\n", + " ('x28', 'x23'),\n", + " ('x28', 'x24'),\n", + " ('x28', 'x25'),\n", + " ('x28', 'x26'),\n", + " ('x28', 'x27'),\n", + " ('x29', 'x0'),\n", + " ('x29', 'x1'),\n", + " ('x29', 'x2'),\n", + " ('x29', 'x3'),\n", + " ('x29', 'x4'),\n", + " ('x29', 'x5'),\n", + " ('x29', 'x6'),\n", + " ('x29', 'x7'),\n", + " ('x29', 'x8'),\n", + " ('x29', 'x9'),\n", + " ('x29', 'x10'),\n", + " ('x29', 'x11'),\n", + " ('x29', 'x12'),\n", + " ('x29', 'x13'),\n", + " ('x29', 'x14'),\n", + " ('x29', 'x15'),\n", + " ('x29', 'x16'),\n", + " ('x29', 'x17'),\n", + " ('x29', 'x18'),\n", + " ('x29', 'x19'),\n", + " ('x29', 'x20'),\n", + " ('x29', 'x21'),\n", + " ('x29', 'x22'),\n", + " ('x29', 'x23'),\n", + " ('x29', 'x24'),\n", + " ('x29', 'x25'),\n", + " ('x29', 'x26'),\n", + " ('x29', 'x27'),\n", + " ('x29', 'x28'),\n", + " ('x30', 'x0'),\n", + " ('x30', 'x1'),\n", + " ('x30', 'x2'),\n", + " ('x30', 'x3'),\n", + " ('x30', 'x4'),\n", + " ('x30', 'x5'),\n", + " ('x30', 'x6'),\n", + " ('x30', 'x7'),\n", + " ('x30', 'x8'),\n", + " ('x30', 'x9'),\n", + " ('x30', 'x10'),\n", + " ('x30', 'x11'),\n", + " ('x30', 'x12'),\n", + " ('x30', 'x13'),\n", + " ('x30', 'x14'),\n", + " ('x30', 'x15'),\n", + " ('x30', 'x16'),\n", + " ('x30', 'x17'),\n", + " ('x30', 'x18'),\n", + " ('x30', 'x19'),\n", + " ('x30', 'x20'),\n", + " ('x30', 'x21'),\n", + " ('x30', 'x22'),\n", + " ('x30', 'x23'),\n", + " ('x30', 'x24'),\n", + " ('x30', 'x25'),\n", + " ('x30', 'x26'),\n", + " ('x30', 'x27'),\n", + " ('x30', 'x28'),\n", + " ('x30', 'x29'),\n", + " ('x31', 'x0'),\n", + " ('x31', 'x1'),\n", + " ('x31', 'x2'),\n", + " ('x31', 'x3'),\n", + " ('x31', 'x4'),\n", + " ('x31', 'x5'),\n", + " ('x31', 'x6'),\n", + " ('x31', 'x7'),\n", + " ('x31', 'x8'),\n", + " ('x31', 'x9'),\n", + " ('x31', 'x10'),\n", + " ('x31', 'x11'),\n", + " ('x31', 'x12'),\n", + " ('x31', 'x13'),\n", + " ('x31', 'x14'),\n", + " ('x31', 'x15'),\n", + " ('x31', 'x16'),\n", + " ('x31', 'x17'),\n", + " ('x31', 'x18'),\n", + " ('x31', 'x19'),\n", + " ('x31', 'x20'),\n", + " ('x31', 'x21'),\n", + " ('x31', 'x22'),\n", + " ('x31', 'x23'),\n", + " ('x31', 'x24'),\n", + " ('x31', 'x25'),\n", + " ('x31', 'x26'),\n", + " ('x31', 'x27'),\n", + " ('x31', 'x28'),\n", + " ('x31', 'x29'),\n", + " ('x31', 'x30'),\n", + " ('x32', 'x0'),\n", + " ('x32', 'x1'),\n", + " ('x32', 'x2'),\n", + " ('x32', 'x3'),\n", + " ('x32', 'x4'),\n", + " ('x32', 'x5'),\n", + " ('x32', 'x6'),\n", + " ('x32', 'x7'),\n", + " ('x32', 'x8'),\n", + " ('x32', 'x9'),\n", + " ('x32', 'x10'),\n", + " ('x32', 'x11'),\n", + " ('x32', 'x12'),\n", + " ('x32', 'x13'),\n", + " ('x32', 'x14'),\n", + " ('x32', 'x15'),\n", + " ('x32', 'x16'),\n", + " ('x32', 'x17'),\n", + " ('x32', 'x18'),\n", + " ('x32', 'x19'),\n", + " ('x32', 'x20'),\n", + " ('x32', 'x21'),\n", + " ('x32', 'x22'),\n", + " ('x32', 'x23'),\n", + " ('x32', 'x24'),\n", + " ('x32', 'x25'),\n", + " ('x32', 'x26'),\n", + " ('x32', 'x27'),\n", + " ('x32', 'x28'),\n", + " ('x32', 'x29'),\n", + " ('x32', 'x30'),\n", + " ('x32', 'x31'),\n", + " ('x33', 'x0'),\n", + " ('x33', 'x1'),\n", + " ('x33', 'x2'),\n", + " ('x33', 'x3'),\n", + " ('x33', 'x4'),\n", + " ('x33', 'x5'),\n", + " ('x33', 'x6'),\n", + " ('x33', 'x7'),\n", + " ('x33', 'x8'),\n", + " ('x33', 'x9'),\n", + " ('x33', 'x10'),\n", + " ('x33', 'x11'),\n", + " ('x33', 'x12'),\n", + " ('x33', 'x13'),\n", + " ('x33', 'x14'),\n", + " ('x33', 'x15'),\n", + " ('x33', 'x16'),\n", + " ('x33', 'x17'),\n", + " ('x33', 'x18'),\n", + " ('x33', 'x19'),\n", + " ('x33', 'x20'),\n", + " ('x33', 'x21'),\n", + " ('x33', 'x22'),\n", + " ('x33', 'x23'),\n", + " ('x33', 'x24'),\n", + " ('x33', 'x25'),\n", + " ('x33', 'x26'),\n", + " ('x33', 'x27'),\n", + " ('x33', 'x28'),\n", + " ('x33', 'x29'),\n", + " ('x33', 'x30'),\n", + " ('x33', 'x31'),\n", + " ('x33', 'x32'),\n", + " ('x34', 'x0'),\n", + " ('x34', 'x1'),\n", + " ('x34', 'x2'),\n", + " ('x34', 'x3'),\n", + " ('x34', 'x4'),\n", + " ('x34', 'x5'),\n", + " ('x34', 'x6'),\n", + " ('x34', 'x7'),\n", + " ('x34', 'x8'),\n", + " ('x34', 'x9'),\n", + " ('x34', 'x10'),\n", + " ('x34', 'x11'),\n", + " ('x34', 'x12'),\n", + " ('x34', 'x13'),\n", + " ('x34', 'x14'),\n", + " ('x34', 'x15'),\n", + " ('x34', 'x16'),\n", + " ('x34', 'x17'),\n", + " ('x34', 'x18'),\n", + " ('x34', 'x19'),\n", + " ('x34', 'x20'),\n", + " ('x34', 'x21'),\n", + " ('x34', 'x22'),\n", + " ('x34', 'x23'),\n", + " ('x34', 'x24'),\n", + " ('x34', 'x25'),\n", + " ('x34', 'x26'),\n", + " ('x34', 'x27'),\n", + " ('x34', 'x28'),\n", + " ('x34', 'x29'),\n", + " ('x34', 'x30'),\n", + " ('x34', 'x31'),\n", + " ('x34', 'x32'),\n", + " ('x34', 'x33'),\n", + " ('x35', 'x0'),\n", + " ('x35', 'x1'),\n", + " ('x35', 'x2'),\n", + " ('x35', 'x3'),\n", + " ('x35', 'x4'),\n", + " ('x35', 'x5'),\n", + " ('x35', 'x6'),\n", + " ('x35', 'x7'),\n", + " ('x35', 'x8'),\n", + " ('x35', 'x9'),\n", + " ('x35', 'x10'),\n", + " ('x35', 'x11'),\n", + " ('x35', 'x12'),\n", + " ('x35', 'x13'),\n", + " ('x35', 'x14'),\n", + " ('x35', 'x15'),\n", + " ('x35', 'x16'),\n", + " ('x35', 'x17'),\n", + " ('x35', 'x18'),\n", + " ('x35', 'x19'),\n", + " ('x35', 'x20'),\n", + " ('x35', 'x21'),\n", + " ('x35', 'x22'),\n", + " ('x35', 'x23'),\n", + " ('x35', 'x24'),\n", + " ('x35', 'x25'),\n", + " ('x35', 'x26'),\n", + " ('x35', 'x27'),\n", + " ('x35', 'x28'),\n", + " ('x35', 'x29'),\n", + " ('x35', 'x30'),\n", + " ('x35', 'x31'),\n", + " ('x35', 'x32'),\n", + " ('x35', 'x33'),\n", + " ('x35', 'x34'),\n", + " ('x36', 'x0'),\n", + " ('x36', 'x1'),\n", + " ('x36', 'x2'),\n", + " ('x36', 'x3'),\n", + " ('x36', 'x4'),\n", + " ('x36', 'x5'),\n", + " ('x36', 'x6'),\n", + " ('x36', 'x7'),\n", + " ('x36', 'x8'),\n", + " ('x36', 'x9'),\n", + " ('x36', 'x10'),\n", + " ('x36', 'x11'),\n", + " ('x36', 'x12'),\n", + " ('x36', 'x13'),\n", + " ('x36', 'x14'),\n", + " ('x36', 'x15'),\n", + " ('x36', 'x16'),\n", + " ('x36', 'x17'),\n", + " ('x36', 'x18'),\n", + " ('x36', 'x19'),\n", + " ('x36', 'x20'),\n", + " ('x36', 'x21'),\n", + " ('x36', 'x22'),\n", + " ('x36', 'x23'),\n", + " ('x36', 'x24'),\n", + " ('x36', 'x25'),\n", + " ('x36', 'x26'),\n", + " ('x36', 'x27'),\n", + " ('x36', 'x28'),\n", + " ('x36', 'x29'),\n", + " ('x36', 'x30'),\n", + " ('x36', 'x31'),\n", + " ('x36', 'x32'),\n", + " ('x36', 'x33'),\n", + " ('x36', 'x34'),\n", + " ('x36', 'x35'),\n", + " ('x37', 'x0'),\n", + " ('x37', 'x1'),\n", + " ('x37', 'x2'),\n", + " ('x37', 'x3'),\n", + " ('x37', 'x4'),\n", + " ('x37', 'x5'),\n", + " ('x37', 'x6'),\n", + " ('x37', 'x7'),\n", + " ('x37', 'x8'),\n", + " ('x37', 'x9'),\n", + " ('x37', 'x10'),\n", + " ('x37', 'x11'),\n", + " ('x37', 'x12'),\n", + " ('x37', 'x13'),\n", + " ('x37', 'x14'),\n", + " ('x37', 'x15'),\n", + " ('x37', 'x16'),\n", + " ('x37', 'x17'),\n", + " ('x37', 'x18'),\n", + " ('x37', 'x19'),\n", + " ('x37', 'x20'),\n", + " ('x37', 'x21'),\n", + " ('x37', 'x22'),\n", + " ('x37', 'x23'),\n", + " ('x37', 'x24'),\n", + " ('x37', 'x25'),\n", + " ('x37', 'x26'),\n", + " ('x37', 'x27'),\n", + " ('x37', 'x28'),\n", + " ('x37', 'x29'),\n", + " ('x37', 'x30'),\n", + " ('x37', 'x31'),\n", + " ('x37', 'x32'),\n", + " ('x37', 'x33'),\n", + " ('x37', 'x34'),\n", + " ('x37', 'x35'),\n", + " ('x37', 'x36'),\n", + " ('x38', 'x0'),\n", + " ('x38', 'x1'),\n", + " ('x38', 'x2'),\n", + " ('x38', 'x3'),\n", + " ('x38', 'x4'),\n", + " ('x38', 'x5'),\n", + " ('x38', 'x6'),\n", + " ('x38', 'x7'),\n", + " ('x38', 'x8'),\n", + " ('x38', 'x9'),\n", + " ('x38', 'x10'),\n", + " ('x38', 'x11'),\n", + " ('x38', 'x12'),\n", + " ('x38', 'x13'),\n", + " ('x38', 'x14'),\n", + " ('x38', 'x15'),\n", + " ('x38', 'x16'),\n", + " ('x38', 'x17'),\n", + " ('x38', 'x18'),\n", + " ('x38', 'x19'),\n", + " ('x38', 'x20'),\n", + " ('x38', 'x21'),\n", + " ('x38', 'x22'),\n", + " ('x38', 'x23'),\n", + " ('x38', 'x24'),\n", + " ('x38', 'x25'),\n", + " ('x38', 'x26'),\n", + " ('x38', 'x27'),\n", + " ('x38', 'x28'),\n", + " ('x38', 'x29'),\n", + " ('x38', 'x30'),\n", + " ('x38', 'x31'),\n", + " ('x38', 'x32'),\n", + " ('x38', 'x33'),\n", + " ('x38', 'x34'),\n", + " ('x38', 'x35'),\n", + " ('x38', 'x36'),\n", + " ('x38', 'x37'),\n", + " ('x39', 'x0'),\n", + " ('x39', 'x1'),\n", + " ('x39', 'x2'),\n", + " ('x39', 'x3'),\n", + " ('x39', 'x4'),\n", + " ('x39', 'x5'),\n", + " ('x39', 'x6'),\n", + " ('x39', 'x7'),\n", + " ('x39', 'x8'),\n", + " ('x39', 'x9'),\n", + " ('x39', 'x10'),\n", + " ('x39', 'x11'),\n", + " ('x39', 'x12'),\n", + " ('x39', 'x13'),\n", + " ('x39', 'x14'),\n", + " ('x39', 'x15'),\n", + " ('x39', 'x16'),\n", + " ('x39', 'x17'),\n", + " ('x39', 'x18'),\n", + " ('x39', 'x19'),\n", + " ('x39', 'x20'),\n", + " ('x39', 'x21'),\n", + " ('x39', 'x22'),\n", + " ('x39', 'x23'),\n", + " ('x39', 'x24'),\n", + " ('x39', 'x25'),\n", + " ('x39', 'x26'),\n", + " ('x39', 'x27'),\n", + " ('x39', 'x28'),\n", + " ('x39', 'x29'),\n", + " ('x39', 'x30'),\n", + " ('x39', 'x31'),\n", + " ('x39', 'x32'),\n", + " ('x39', 'x33'),\n", + " ('x39', 'x34'),\n", + " ('x39', 'x35'),\n", + " ('x39', 'x36'),\n", + " ('x39', 'x37'),\n", + " ('x39', 'x38')]}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (180, 181, 182, 183, 2940),\n", + " 'source_variables': ['x0'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (195, 196, 197, 198, 2955),\n", + " 'source_variables': ['x1'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (150, 151, 152, 153, 2970),\n", + " 'source_variables': ['x2'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (165, 166, 167, 168, 2985),\n", + " 'source_variables': ['x3'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (210, 211, 212, 213, 3000),\n", + " 'source_variables': ['x4'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (225, 226, 227, 228, 3015),\n", + " 'source_variables': ['x5'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (240, 241, 242, 3540),\n", + " 'source_variables': ['x6'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (255, 256, 257, 3555),\n", + " 'source_variables': ['x7'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (270, 271, 272, 3510, 3511),\n", + " 'source_variables': ['x8'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (285, 286, 287, 3525, 3526),\n", + " 'source_variables': ['x9'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (300, 301, 302, 3480, 3481),\n", + " 'source_variables': ['x10'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (315, 316, 317, 3495, 3496),\n", + " 'source_variables': ['x11'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (330, 331, 332, 3450, 3451),\n", + " 'source_variables': ['x12'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (345, 346, 347, 3465, 3466),\n", + " 'source_variables': ['x13'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (360, 361, 362, 3420, 3421),\n", + " 'source_variables': ['x14'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (375, 376, 377, 3435, 3436),\n", + " 'source_variables': ['x15'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (390, 391, 392, 3390, 3391),\n", + " 'source_variables': ['x16'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (405, 406, 407, 3405, 3406),\n", + " 'source_variables': ['x17'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (435, 436, 3375, 3376),\n", + " 'source_variables': ['x19'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (450, 451, 3330, 3331, 3332),\n", + " 'source_variables': ['x20'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (465, 466, 3345, 3346, 3347),\n", + " 'source_variables': ['x21'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (480, 481, 3300, 3301, 3302),\n", + " 'source_variables': ['x22'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (495, 496, 3315, 3316, 3317),\n", + " 'source_variables': ['x23'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (510, 511, 3270, 3271, 3272),\n", + " 'source_variables': ['x24'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (525, 526, 3285, 3286, 3287),\n", + " 'source_variables': ['x25'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (555, 556, 3255, 3256, 3257),\n", + " 'source_variables': ['x27'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (570, 571, 3210, 3211, 3212),\n", + " 'source_variables': ['x28'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (585, 586, 3225, 3226, 3227),\n", + " 'source_variables': ['x29'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (600, 3180, 3181, 3182),\n", + " 'source_variables': ['x30'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (615, 3195, 3196, 3197),\n", + " 'source_variables': ['x31'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (645, 3165, 3166, 3167, 3168),\n", + " 'source_variables': ['x33'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (660, 3030, 3031, 3032),\n", + " 'source_variables': ['x34'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (675, 3045, 3046, 3047),\n", + " 'source_variables': ['x35'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (120, 3060, 3061, 3062, 3063),\n", + " 'source_variables': ['x36'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (135, 3075, 3076, 3077, 3078),\n", + " 'source_variables': ['x37'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (90, 3090, 3091, 3092, 3093),\n", + " 'source_variables': ['x38'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (105, 3105, 3106, 3107, 3108),\n", + " 'source_variables': ['x39'],\n", + " 'sample_index': 0}},\n", + " {'type': UserWarning,\n", + " 'message': 'All samples have broken chains',\n", + " 'level': 30,\n", + " 'data': {}}]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.warnings" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "d4c2274c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "Serving Inspector on http://127.0.0.1:18000/?problemId=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "'http://127.0.0.1:18000/?problemId=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import dwave.inspector\n", + "\n", + "\n", + "dwave.inspector.show(res.sampleset_info.dwave_sampleset)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "14c5103f", + "metadata": {}, + "outputs": [], + "source": [ + "from dimod import SampleSet\n", + "\n", + "\n", + "id = 4\n", + "with open(f\"id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl\", \"rb\") as f:\n", + " l = pickle.load(f)\n", + "\n", + "\n", + "ls = SampleSet.from_serializable(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "7cc0ed7b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "SampleSet(rec.array([([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1], 0.82051282, 1, 0.925),\n", + " ([0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0], -2.5 , 1, 0.925),\n", + " ([1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0], -4.5 , 1, 0.9 ),\n", + " ([0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1], -3.48717949, 1, 0.875),\n", + " ([1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1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 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0], -6.87179487, 1, 0.925),\n", + " ([1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1], -2.44871795, 1, 0.9 )],\n", + " dtype=[('sample', 'i1', (40,)), ('energy', ', 'message': 'Some biases are 10^3 times stronger than others', 'level': 30, 'data': {'source_interactions': [[181, 180], [2940, 180], [182, 181], [183, 182], [196, 195], [2955, 195], [197, 196], [198, 197], [151, 150], [2970, 150], [152, 151], [153, 152], [166, 165], [2985, 165], [167, 166], [168, 167], [211, 210], [3000, 210], [212, 211], [213, 212], [226, 225], [3015, 225], [227, 226], [228, 227], [241, 240], [242, 241], [3540, 242], [256, 255], [257, 256], [3555, 257], [271, 270], [272, 271], [3511, 272], [3510, 3511], [286, 285], [287, 286], [3526, 287], [3525, 3526], [301, 300], [302, 301], [3481, 302], [3480, 3481], [316, 315], [317, 316], [3496, 317], [3495, 3496], [331, 330], [332, 331], [3451, 332], [3450, 3451], [346, 345], [347, 346], [3466, 347], [3465, 3466], [361, 360], [362, 361], [3421, 362], [3420, 3421], [376, 375], [377, 376], [3436, 377], [3435, 3436], [391, 390], [392, 391], [3391, 392], [3390, 3391], [406, 405], [407, 406], [3406, 407], [3405, 3406], [421, 420], [3361, 421], [3360, 3361], [436, 435], [3376, 436], [3375, 3376], [451, 450], [3332, 451], [3331, 3332], [3331, 3330], [466, 465], [3347, 466], [3346, 3347], [3346, 3345], [481, 480], [3302, 481], [3301, 3302], [3301, 3300], [496, 495], [3317, 496], [3316, 3317], [3316, 3315], [511, 510], [3272, 511], [3271, 3272], [3271, 3270], [526, 525], [3287, 526], [3286, 3287], [3286, 3285], [541, 540], [3242, 541], [3241, 3242], [3241, 3240], [556, 555], [3257, 556], [3256, 3257], [3256, 3255], [571, 570], [3212, 571], [3211, 3212], [3211, 3210], [586, 585], [3227, 586], [3226, 3227], [3226, 3225], [3182, 600], [3181, 3182], [3181, 3180], [3197, 615], [3196, 3197], [3196, 3195], [3153, 630], [3151, 3150], [3152, 3153], [3152, 3151], [3168, 645], [3166, 3165], [3167, 3168], [3167, 3166], [3032, 660], [3031, 3032], [3031, 3030], [3047, 675], [3046, 3047], [3046, 3045], [3060, 120], [3061, 3060], [3062, 3061], [3063, 3062], [3075, 135], [3076, 3075], [3077, 3076], [3078, 3077], [3090, 90], [3091, 3090], [3092, 3091], [3093, 3092], [3105, 105], [3106, 3105], [3107, 3106], [3108, 3107]]}}, {'type': , 'message': 'Number of ground states found is within sampling error', 'level': 30, 'data': {'number_of_ground_states': 1, 'num_reads': 100, 'sampling_error_rate': 10.0}}, {'type': , 'message': 'Some quadratic biases are stronger than the given chain strength', 'level': 30, 'data': {'source_interactions': [['x1', 'x0'], ['x2', 'x0'], ['x2', 'x1'], ['x3', 'x0'], ['x3', 'x1'], ['x3', 'x2'], ['x4', 'x0'], ['x4', 'x1'], ['x4', 'x2'], ['x4', 'x3'], ['x5', 'x0'], ['x5', 'x1'], ['x5', 'x2'], ['x5', 'x3'], ['x5', 'x4'], ['x6', 'x0'], ['x6', 'x1'], ['x6', 'x2'], ['x6', 'x3'], ['x6', 'x4'], ['x6', 'x5'], ['x7', 'x0'], ['x7', 'x1'], ['x7', 'x2'], ['x7', 'x3'], ['x7', 'x4'], ['x7', 'x5'], ['x7', 'x6'], ['x8', 'x0'], ['x8', 'x1'], ['x8', 'x2'], ['x8', 'x3'], ['x8', 'x4'], ['x8', 'x5'], ['x8', 'x6'], ['x8', 'x7'], ['x9', 'x0'], ['x9', 'x1'], ['x9', 'x2'], ['x9', 'x3'], ['x9', 'x4'], ['x9', 'x5'], ['x9', 'x6'], ['x9', 'x7'], ['x9', 'x8'], ['x10', 'x0'], ['x10', 'x1'], ['x10', 'x2'], ['x10', 'x3'], ['x10', 'x4'], ['x10', 'x5'], ['x10', 'x6'], ['x10', 'x7'], ['x10', 'x8'], ['x10', 'x9'], ['x11', 'x0'], ['x11', 'x1'], ['x11', 'x2'], ['x11', 'x3'], ['x11', 'x4'], ['x11', 'x5'], ['x11', 'x6'], ['x11', 'x7'], ['x11', 'x8'], ['x11', 'x9'], ['x11', 'x10'], ['x12', 'x0'], ['x12', 'x1'], ['x12', 'x2'], ['x12', 'x3'], ['x12', 'x4'], ['x12', 'x5'], ['x12', 'x6'], ['x12', 'x7'], ['x12', 'x8'], ['x12', 'x9'], ['x12', 'x10'], ['x12', 'x11'], ['x13', 'x0'], ['x13', 'x1'], ['x13', 'x2'], ['x13', 'x3'], ['x13', 'x4'], ['x13', 'x5'], ['x13', 'x6'], ['x13', 'x7'], ['x13', 'x8'], ['x13', 'x9'], ['x13', 'x10'], ['x13', 'x11'], ['x13', 'x12'], ['x14', 'x0'], ['x14', 'x1'], ['x14', 'x2'], ['x14', 'x3'], ['x14', 'x4'], ['x14', 'x5'], ['x14', 'x6'], ['x14', 'x7'], ['x14', 'x8'], ['x14', 'x9'], ['x14', 'x10'], ['x14', 'x11'], ['x14', 'x12'], ['x14', 'x13'], ['x15', 'x0'], ['x15', 'x1'], ['x15', 'x2'], ['x15', 'x3'], ['x15', 'x4'], ['x15', 'x5'], ['x15', 'x6'], ['x15', 'x7'], ['x15', 'x8'], ['x15', 'x9'], ['x15', 'x10'], ['x15', 'x11'], ['x15', 'x12'], ['x15', 'x13'], ['x15', 'x14'], ['x16', 'x0'], ['x16', 'x1'], ['x16', 'x2'], ['x16', 'x3'], ['x16', 'x4'], ['x16', 'x5'], ['x16', 'x6'], ['x16', 'x7'], ['x16', 'x8'], ['x16', 'x9'], ['x16', 'x10'], ['x16', 'x11'], ['x16', 'x12'], ['x16', 'x13'], ['x16', 'x14'], ['x16', 'x15'], ['x17', 'x0'], ['x17', 'x1'], ['x17', 'x2'], ['x17', 'x3'], ['x17', 'x4'], ['x17', 'x5'], ['x17', 'x6'], ['x17', 'x7'], ['x17', 'x8'], ['x17', 'x9'], ['x17', 'x10'], ['x17', 'x11'], ['x17', 'x12'], ['x17', 'x13'], ['x17', 'x14'], ['x17', 'x15'], ['x17', 'x16'], ['x18', 'x0'], ['x18', 'x1'], ['x18', 'x2'], ['x18', 'x3'], ['x18', 'x4'], ['x18', 'x5'], ['x18', 'x6'], ['x18', 'x7'], ['x18', 'x8'], ['x18', 'x9'], ['x18', 'x10'], ['x18', 'x11'], ['x18', 'x12'], ['x18', 'x13'], ['x18', 'x14'], ['x18', 'x15'], ['x18', 'x16'], ['x18', 'x17'], ['x19', 'x0'], ['x19', 'x1'], ['x19', 'x2'], ['x19', 'x3'], ['x19', 'x4'], ['x19', 'x5'], ['x19', 'x6'], ['x19', 'x7'], ['x19', 'x8'], ['x19', 'x9'], ['x19', 'x10'], ['x19', 'x11'], ['x19', 'x12'], ['x19', 'x13'], ['x19', 'x14'], ['x19', 'x15'], ['x19', 'x16'], ['x19', 'x17'], ['x19', 'x18'], ['x20', 'x0'], ['x20', 'x1'], ['x20', 'x2'], ['x20', 'x3'], ['x20', 'x4'], ['x20', 'x5'], ['x20', 'x6'], ['x20', 'x7'], ['x20', 'x8'], ['x20', 'x9'], ['x20', 'x10'], ['x20', 'x11'], ['x20', 'x12'], ['x20', 'x13'], ['x20', 'x14'], ['x20', 'x15'], ['x20', 'x16'], ['x20', 'x17'], ['x20', 'x18'], ['x20', 'x19'], ['x21', 'x0'], ['x21', 'x1'], ['x21', 'x2'], ['x21', 'x3'], ['x21', 'x4'], ['x21', 'x5'], ['x21', 'x6'], ['x21', 'x7'], ['x21', 'x8'], ['x21', 'x9'], ['x21', 'x10'], ['x21', 'x11'], ['x21', 'x12'], ['x21', 'x13'], ['x21', 'x14'], ['x21', 'x15'], ['x21', 'x16'], ['x21', 'x17'], ['x21', 'x18'], ['x21', 'x19'], ['x21', 'x20'], ['x22', 'x0'], ['x22', 'x1'], ['x22', 'x2'], ['x22', 'x3'], ['x22', 'x4'], ['x22', 'x5'], ['x22', 'x6'], ['x22', 'x7'], ['x22', 'x8'], ['x22', 'x9'], ['x22', 'x10'], ['x22', 'x11'], ['x22', 'x12'], ['x22', 'x13'], ['x22', 'x14'], ['x22', 'x15'], ['x22', 'x16'], ['x22', 'x17'], ['x22', 'x18'], ['x22', 'x19'], ['x22', 'x20'], ['x22', 'x21'], ['x23', 'x0'], ['x23', 'x1'], ['x23', 'x2'], ['x23', 'x3'], ['x23', 'x4'], ['x23', 'x5'], ['x23', 'x6'], ['x23', 'x7'], ['x23', 'x8'], ['x23', 'x9'], ['x23', 'x10'], ['x23', 'x11'], ['x23', 'x12'], ['x23', 'x13'], ['x23', 'x14'], ['x23', 'x15'], ['x23', 'x16'], ['x23', 'x17'], ['x23', 'x18'], ['x23', 'x19'], ['x23', 'x20'], ['x23', 'x21'], ['x23', 'x22'], ['x24', 'x0'], ['x24', 'x1'], ['x24', 'x2'], ['x24', 'x3'], ['x24', 'x4'], ['x24', 'x5'], ['x24', 'x6'], ['x24', 'x7'], ['x24', 'x8'], ['x24', 'x9'], ['x24', 'x10'], ['x24', 'x11'], ['x24', 'x12'], ['x24', 'x13'], ['x24', 'x14'], ['x24', 'x15'], ['x24', 'x16'], ['x24', 'x17'], ['x24', 'x18'], ['x24', 'x19'], ['x24', 'x20'], ['x24', 'x21'], ['x24', 'x22'], ['x24', 'x23'], ['x25', 'x0'], ['x25', 'x1'], ['x25', 'x2'], ['x25', 'x3'], ['x25', 'x4'], ['x25', 'x5'], ['x25', 'x6'], ['x25', 'x7'], ['x25', 'x8'], ['x25', 'x9'], ['x25', 'x10'], ['x25', 'x11'], ['x25', 'x12'], ['x25', 'x13'], ['x25', 'x14'], ['x25', 'x15'], ['x25', 'x16'], ['x25', 'x17'], ['x25', 'x18'], ['x25', 'x19'], ['x25', 'x20'], ['x25', 'x21'], ['x25', 'x22'], ['x25', 'x23'], ['x25', 'x24'], ['x26', 'x0'], ['x26', 'x1'], ['x26', 'x2'], ['x26', 'x3'], ['x26', 'x4'], ['x26', 'x5'], ['x26', 'x6'], ['x26', 'x7'], ['x26', 'x8'], ['x26', 'x9'], ['x26', 'x10'], ['x26', 'x11'], ['x26', 'x12'], ['x26', 'x13'], ['x26', 'x14'], ['x26', 'x15'], ['x26', 'x16'], ['x26', 'x17'], ['x26', 'x18'], ['x26', 'x19'], ['x26', 'x20'], ['x26', 'x21'], ['x26', 'x22'], ['x26', 'x23'], ['x26', 'x24'], ['x26', 'x25'], ['x27', 'x0'], ['x27', 'x1'], ['x27', 'x2'], ['x27', 'x3'], ['x27', 'x4'], ['x27', 'x5'], ['x27', 'x6'], ['x27', 'x7'], ['x27', 'x8'], ['x27', 'x9'], ['x27', 'x10'], ['x27', 'x11'], ['x27', 'x12'], ['x27', 'x13'], ['x27', 'x14'], ['x27', 'x15'], ['x27', 'x16'], ['x27', 'x17'], ['x27', 'x18'], ['x27', 'x19'], ['x27', 'x20'], ['x27', 'x21'], ['x27', 'x22'], ['x27', 'x23'], ['x27', 'x24'], ['x27', 'x25'], ['x27', 'x26'], ['x28', 'x0'], ['x28', 'x1'], ['x28', 'x2'], ['x28', 'x3'], ['x28', 'x4'], ['x28', 'x5'], ['x28', 'x6'], ['x28', 'x7'], ['x28', 'x8'], ['x28', 'x9'], ['x28', 'x10'], ['x28', 'x11'], ['x28', 'x12'], ['x28', 'x13'], ['x28', 'x14'], ['x28', 'x15'], ['x28', 'x16'], ['x28', 'x17'], ['x28', 'x18'], ['x28', 'x19'], ['x28', 'x20'], ['x28', 'x21'], ['x28', 'x22'], ['x28', 'x23'], ['x28', 'x24'], ['x28', 'x25'], ['x28', 'x26'], ['x28', 'x27'], ['x29', 'x0'], ['x29', 'x1'], ['x29', 'x2'], ['x29', 'x3'], ['x29', 'x4'], ['x29', 'x5'], ['x29', 'x6'], ['x29', 'x7'], ['x29', 'x8'], ['x29', 'x9'], ['x29', 'x10'], ['x29', 'x11'], ['x29', 'x12'], ['x29', 'x13'], ['x29', 'x14'], ['x29', 'x15'], ['x29', 'x16'], ['x29', 'x17'], ['x29', 'x18'], ['x29', 'x19'], ['x29', 'x20'], ['x29', 'x21'], ['x29', 'x22'], ['x29', 'x23'], ['x29', 'x24'], ['x29', 'x25'], ['x29', 'x26'], ['x29', 'x27'], ['x29', 'x28'], ['x30', 'x0'], ['x30', 'x1'], ['x30', 'x2'], ['x30', 'x3'], ['x30', 'x4'], ['x30', 'x5'], ['x30', 'x6'], ['x30', 'x7'], ['x30', 'x8'], ['x30', 'x9'], ['x30', 'x10'], ['x30', 'x11'], ['x30', 'x12'], ['x30', 'x13'], ['x30', 'x14'], ['x30', 'x15'], ['x30', 'x16'], ['x30', 'x17'], ['x30', 'x18'], ['x30', 'x19'], ['x30', 'x20'], ['x30', 'x21'], ['x30', 'x22'], ['x30', 'x23'], ['x30', 'x24'], ['x30', 'x25'], ['x30', 'x26'], ['x30', 'x27'], ['x30', 'x28'], ['x30', 'x29'], ['x31', 'x0'], ['x31', 'x1'], ['x31', 'x2'], ['x31', 'x3'], ['x31', 'x4'], ['x31', 'x5'], ['x31', 'x6'], ['x31', 'x7'], ['x31', 'x8'], ['x31', 'x9'], ['x31', 'x10'], ['x31', 'x11'], ['x31', 'x12'], ['x31', 'x13'], ['x31', 'x14'], ['x31', 'x15'], ['x31', 'x16'], ['x31', 'x17'], ['x31', 'x18'], ['x31', 'x19'], ['x31', 'x20'], ['x31', 'x21'], ['x31', 'x22'], ['x31', 'x23'], ['x31', 'x24'], ['x31', 'x25'], ['x31', 'x26'], ['x31', 'x27'], ['x31', 'x28'], ['x31', 'x29'], ['x31', 'x30'], ['x32', 'x0'], ['x32', 'x1'], ['x32', 'x2'], ['x32', 'x3'], ['x32', 'x4'], ['x32', 'x5'], ['x32', 'x6'], ['x32', 'x7'], ['x32', 'x8'], ['x32', 'x9'], ['x32', 'x10'], ['x32', 'x11'], ['x32', 'x12'], ['x32', 'x13'], ['x32', 'x14'], ['x32', 'x15'], ['x32', 'x16'], ['x32', 'x17'], ['x32', 'x18'], ['x32', 'x19'], ['x32', 'x20'], ['x32', 'x21'], ['x32', 'x22'], ['x32', 'x23'], ['x32', 'x24'], ['x32', 'x25'], ['x32', 'x26'], ['x32', 'x27'], ['x32', 'x28'], ['x32', 'x29'], ['x32', 'x30'], ['x32', 'x31'], ['x33', 'x0'], ['x33', 'x1'], ['x33', 'x2'], ['x33', 'x3'], ['x33', 'x4'], ['x33', 'x5'], ['x33', 'x6'], ['x33', 'x7'], ['x33', 'x8'], ['x33', 'x9'], ['x33', 'x10'], ['x33', 'x11'], ['x33', 'x12'], ['x33', 'x13'], ['x33', 'x14'], ['x33', 'x15'], ['x33', 'x16'], ['x33', 'x17'], ['x33', 'x18'], ['x33', 'x19'], ['x33', 'x20'], ['x33', 'x21'], ['x33', 'x22'], ['x33', 'x23'], ['x33', 'x24'], ['x33', 'x25'], ['x33', 'x26'], ['x33', 'x27'], ['x33', 'x28'], ['x33', 'x29'], ['x33', 'x30'], ['x33', 'x31'], ['x33', 'x32'], ['x34', 'x0'], ['x34', 'x1'], ['x34', 'x2'], ['x34', 'x3'], ['x34', 'x4'], ['x34', 'x5'], ['x34', 'x6'], ['x34', 'x7'], ['x34', 'x8'], ['x34', 'x9'], ['x34', 'x10'], ['x34', 'x11'], ['x34', 'x12'], ['x34', 'x13'], ['x34', 'x14'], ['x34', 'x15'], ['x34', 'x16'], ['x34', 'x17'], ['x34', 'x18'], ['x34', 'x19'], ['x34', 'x20'], ['x34', 'x21'], ['x34', 'x22'], ['x34', 'x23'], ['x34', 'x24'], ['x34', 'x25'], ['x34', 'x26'], ['x34', 'x27'], ['x34', 'x28'], ['x34', 'x29'], ['x34', 'x30'], ['x34', 'x31'], ['x34', 'x32'], ['x34', 'x33'], ['x35', 'x0'], ['x35', 'x1'], ['x35', 'x2'], ['x35', 'x3'], ['x35', 'x4'], ['x35', 'x5'], ['x35', 'x6'], ['x35', 'x7'], ['x35', 'x8'], ['x35', 'x9'], ['x35', 'x10'], ['x35', 'x11'], ['x35', 'x12'], ['x35', 'x13'], ['x35', 'x14'], ['x35', 'x15'], ['x35', 'x16'], ['x35', 'x17'], ['x35', 'x18'], ['x35', 'x19'], ['x35', 'x20'], ['x35', 'x21'], ['x35', 'x22'], ['x35', 'x23'], ['x35', 'x24'], ['x35', 'x25'], ['x35', 'x26'], ['x35', 'x27'], ['x35', 'x28'], ['x35', 'x29'], ['x35', 'x30'], ['x35', 'x31'], ['x35', 'x32'], ['x35', 'x33'], ['x35', 'x34'], ['x36', 'x0'], ['x36', 'x1'], ['x36', 'x2'], ['x36', 'x3'], ['x36', 'x4'], ['x36', 'x5'], ['x36', 'x6'], ['x36', 'x7'], ['x36', 'x8'], ['x36', 'x9'], ['x36', 'x10'], ['x36', 'x11'], ['x36', 'x12'], ['x36', 'x13'], ['x36', 'x14'], ['x36', 'x15'], ['x36', 'x16'], ['x36', 'x17'], ['x36', 'x18'], ['x36', 'x19'], ['x36', 'x20'], ['x36', 'x21'], ['x36', 'x22'], ['x36', 'x23'], ['x36', 'x24'], ['x36', 'x25'], ['x36', 'x26'], ['x36', 'x27'], ['x36', 'x28'], ['x36', 'x29'], ['x36', 'x30'], ['x36', 'x31'], ['x36', 'x32'], ['x36', 'x33'], ['x36', 'x34'], ['x36', 'x35'], ['x37', 'x0'], ['x37', 'x1'], ['x37', 'x2'], ['x37', 'x3'], ['x37', 'x4'], ['x37', 'x5'], ['x37', 'x6'], ['x37', 'x7'], ['x37', 'x8'], ['x37', 'x9'], ['x37', 'x10'], ['x37', 'x11'], ['x37', 'x12'], ['x37', 'x13'], ['x37', 'x14'], ['x37', 'x15'], ['x37', 'x16'], ['x37', 'x17'], ['x37', 'x18'], ['x37', 'x19'], ['x37', 'x20'], ['x37', 'x21'], ['x37', 'x22'], ['x37', 'x23'], ['x37', 'x24'], ['x37', 'x25'], ['x37', 'x26'], ['x37', 'x27'], ['x37', 'x28'], ['x37', 'x29'], ['x37', 'x30'], ['x37', 'x31'], ['x37', 'x32'], ['x37', 'x33'], ['x37', 'x34'], ['x37', 'x35'], ['x37', 'x36'], ['x38', 'x0'], ['x38', 'x1'], ['x38', 'x2'], ['x38', 'x3'], ['x38', 'x4'], ['x38', 'x5'], ['x38', 'x6'], ['x38', 'x7'], ['x38', 'x8'], ['x38', 'x9'], ['x38', 'x10'], ['x38', 'x11'], ['x38', 'x12'], ['x38', 'x13'], ['x38', 'x14'], ['x38', 'x15'], ['x38', 'x16'], ['x38', 'x17'], ['x38', 'x18'], ['x38', 'x19'], ['x38', 'x20'], ['x38', 'x21'], ['x38', 'x22'], ['x38', 'x23'], ['x38', 'x24'], ['x38', 'x25'], ['x38', 'x26'], ['x38', 'x27'], ['x38', 'x28'], ['x38', 'x29'], ['x38', 'x30'], ['x38', 'x31'], ['x38', 'x32'], ['x38', 'x33'], ['x38', 'x34'], ['x38', 'x35'], ['x38', 'x36'], ['x38', 'x37'], ['x39', 'x0'], ['x39', 'x1'], ['x39', 'x2'], ['x39', 'x3'], ['x39', 'x4'], ['x39', 'x5'], ['x39', 'x6'], ['x39', 'x7'], ['x39', 'x8'], ['x39', 'x9'], ['x39', 'x10'], ['x39', 'x11'], ['x39', 'x12'], ['x39', 'x13'], ['x39', 'x14'], ['x39', 'x15'], ['x39', 'x16'], ['x39', 'x17'], ['x39', 'x18'], ['x39', 'x19'], ['x39', 'x20'], ['x39', 'x21'], ['x39', 'x22'], ['x39', 'x23'], ['x39', 'x24'], ['x39', 'x25'], ['x39', 'x26'], ['x39', 'x27'], ['x39', 'x28'], ['x39', 'x29'], ['x39', 'x30'], ['x39', 'x31'], ['x39', 'x32'], ['x39', 'x33'], ['x39', 'x34'], ['x39', 'x35'], ['x39', 'x36'], ['x39', 'x37'], ['x39', 'x38']]}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [180, 181, 182, 183, 2940], 'source_variables': ['x0'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [195, 196, 197, 198, 2955], 'source_variables': ['x1'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [150, 151, 152, 153, 2970], 'source_variables': ['x2'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [165, 166, 167, 168, 2985], 'source_variables': ['x3'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [210, 211, 212, 213, 3000], 'source_variables': ['x4'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [225, 226, 227, 228, 3015], 'source_variables': ['x5'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [240, 241, 242, 3540], 'source_variables': ['x6'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [255, 256, 257, 3555], 'source_variables': ['x7'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [270, 271, 272, 3510, 3511], 'source_variables': ['x8'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [285, 286, 287, 3525, 3526], 'source_variables': ['x9'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [300, 301, 302, 3480, 3481], 'source_variables': ['x10'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [315, 316, 317, 3495, 3496], 'source_variables': ['x11'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [330, 331, 332, 3450, 3451], 'source_variables': ['x12'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [345, 346, 347, 3465, 3466], 'source_variables': ['x13'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [360, 361, 362, 3420, 3421], 'source_variables': ['x14'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [375, 376, 377, 3435, 3436], 'source_variables': ['x15'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [390, 391, 392, 3390, 3391], 'source_variables': ['x16'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [405, 406, 407, 3405, 3406], 'source_variables': ['x17'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [435, 436, 3375, 3376], 'source_variables': ['x19'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [450, 451, 3330, 3331, 3332], 'source_variables': ['x20'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [465, 466, 3345, 3346, 3347], 'source_variables': ['x21'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [480, 481, 3300, 3301, 3302], 'source_variables': ['x22'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [495, 496, 3315, 3316, 3317], 'source_variables': ['x23'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [510, 511, 3270, 3271, 3272], 'source_variables': ['x24'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [525, 526, 3285, 3286, 3287], 'source_variables': ['x25'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [555, 556, 3255, 3256, 3257], 'source_variables': ['x27'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [570, 571, 3210, 3211, 3212], 'source_variables': ['x28'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [585, 586, 3225, 3226, 3227], 'source_variables': ['x29'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [600, 3180, 3181, 3182], 'source_variables': ['x30'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [615, 3195, 3196, 3197], 'source_variables': ['x31'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [645, 3165, 3166, 3167, 3168], 'source_variables': ['x33'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [660, 3030, 3031, 3032], 'source_variables': ['x34'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [675, 3045, 3046, 3047], 'source_variables': ['x35'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [120, 3060, 3061, 3062, 3063], 'source_variables': ['x36'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [135, 3075, 3076, 3077, 3078], 'source_variables': ['x37'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [90, 3090, 3091, 3092, 3093], 'source_variables': ['x38'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [105, 3105, 3106, 3107, 3108], 'source_variables': ['x39'], 'sample_index': 0}}, {'type': , 'message': 'All samples have broken chains', 'level': 30, 'data': {}}], 'embedding_context': {'embedding': {'x0': [180, 181, 182, 183, 2940], 'x1': [195, 196, 197, 198, 2955], 'x2': [150, 151, 152, 153, 2970], 'x3': [165, 166, 167, 168, 2985], 'x4': [210, 211, 212, 213, 3000], 'x5': [225, 226, 227, 228, 3015], 'x6': [240, 241, 242, 3540], 'x7': [255, 256, 257, 3555], 'x8': [270, 271, 272, 3510, 3511], 'x9': [285, 286, 287, 3525, 3526], 'x10': [300, 301, 302, 3480, 3481], 'x11': [315, 316, 317, 3495, 3496], 'x12': [330, 331, 332, 3450, 3451], 'x13': [345, 346, 347, 3465, 3466], 'x14': [360, 361, 362, 3420, 3421], 'x15': [375, 376, 377, 3435, 3436], 'x16': [390, 391, 392, 3390, 3391], 'x17': [405, 406, 407, 3405, 3406], 'x18': [420, 421, 3360, 3361], 'x19': [435, 436, 3375, 3376], 'x20': [450, 451, 3330, 3331, 3332], 'x21': [465, 466, 3345, 3346, 3347], 'x22': [480, 481, 3300, 3301, 3302], 'x23': [495, 496, 3315, 3316, 3317], 'x24': [510, 511, 3270, 3271, 3272], 'x25': [525, 526, 3285, 3286, 3287], 'x26': [540, 541, 3240, 3241, 3242], 'x27': [555, 556, 3255, 3256, 3257], 'x28': [570, 571, 3210, 3211, 3212], 'x29': [585, 586, 3225, 3226, 3227], 'x30': [600, 3180, 3181, 3182], 'x31': [615, 3195, 3196, 3197], 'x32': [630, 3150, 3151, 3152, 3153], 'x33': [645, 3165, 3166, 3167, 3168], 'x34': [660, 3030, 3031, 3032], 'x35': [675, 3045, 3046, 3047], 'x36': [120, 3060, 3061, 3062, 3063], 'x37': [135, 3075, 3076, 3077, 3078], 'x38': [90, 3090, 3091, 3092, 3093], 'x39': [105, 3105, 3106, 3107, 3108]}, 'chain_break_method': 'majority_vote', 'embedding_parameters': {}, 'chain_strength': 0.0001, 'timing': {'embedding': 0.0022098999997979263, 'unembedding': 0.0011283000003459165}}}, 'BINARY')" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "aac2922c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'timing': {'qpu_sampling_time': 21520.0,\n", + " 'qpu_anneal_time_per_sample': 20.0,\n", + " 'qpu_readout_time_per_sample': 174.62,\n", + " 'qpu_access_time': 37286.36,\n", + " 'qpu_access_overhead_time': 617.64,\n", + " 'qpu_programming_time': 15766.36,\n", + " 'qpu_delay_time_per_sample': 20.58,\n", + " 'post_processing_overhead_time': 36.0,\n", + " 'total_post_processing_time': 36.0},\n", + " 'problem_id': 'f49fda51-0bdf-47d9-8dab-e6c3296ca0c4',\n", + " 'problem_label': 'n=40_qubo_size=820_3212373321961356710',\n", + " 'warnings': [{'type': dwave.system.warnings.EnergyScaleWarning,\n", + " 'message': 'Some biases are 10^3 times stronger than others',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [[181, 180],\n", + " [2940, 180],\n", + " [182, 181],\n", + " [183, 182],\n", + " [196, 195],\n", + " [2955, 195],\n", + " [197, 196],\n", + " [198, 197],\n", + " [151, 150],\n", + " [2970, 150],\n", + " [152, 151],\n", + " [153, 152],\n", + " [166, 165],\n", + " [2985, 165],\n", + " [167, 166],\n", + " [168, 167],\n", + " [211, 210],\n", + " [3000, 210],\n", + " [212, 211],\n", + " [213, 212],\n", + " [226, 225],\n", + " [3015, 225],\n", + " [227, 226],\n", + " [228, 227],\n", + " [241, 240],\n", + " [242, 241],\n", + " [3540, 242],\n", + " [256, 255],\n", + " [257, 256],\n", + " [3555, 257],\n", + " [271, 270],\n", + " [272, 271],\n", + " [3511, 272],\n", + " [3510, 3511],\n", + " [286, 285],\n", + " [287, 286],\n", + " [3526, 287],\n", + " [3525, 3526],\n", + " [301, 300],\n", + " [302, 301],\n", + " [3481, 302],\n", + " [3480, 3481],\n", + " [316, 315],\n", + " [317, 316],\n", + " [3496, 317],\n", + " [3495, 3496],\n", + " [331, 330],\n", + " [332, 331],\n", + " [3451, 332],\n", + " [3450, 3451],\n", + " [346, 345],\n", + " [347, 346],\n", + " [3466, 347],\n", + " [3465, 3466],\n", + " [361, 360],\n", + " [362, 361],\n", + " [3421, 362],\n", + " [3420, 3421],\n", + " [376, 375],\n", + " [377, 376],\n", + " [3436, 377],\n", + " [3435, 3436],\n", + " [391, 390],\n", + " [392, 391],\n", + " [3391, 392],\n", + " [3390, 3391],\n", + " [406, 405],\n", + " [407, 406],\n", + " [3406, 407],\n", + " [3405, 3406],\n", + " [421, 420],\n", + " [3361, 421],\n", + " [3360, 3361],\n", + " [436, 435],\n", + " [3376, 436],\n", + " [3375, 3376],\n", + " [451, 450],\n", + " [3332, 451],\n", + " [3331, 3332],\n", + " [3331, 3330],\n", + " [466, 465],\n", + " [3347, 466],\n", + " [3346, 3347],\n", + " [3346, 3345],\n", + " [481, 480],\n", + " [3302, 481],\n", + " [3301, 3302],\n", + " [3301, 3300],\n", + " [496, 495],\n", + " [3317, 496],\n", + " [3316, 3317],\n", + " [3316, 3315],\n", + " [511, 510],\n", + " [3272, 511],\n", + " [3271, 3272],\n", + " [3271, 3270],\n", + " [526, 525],\n", + " [3287, 526],\n", + " [3286, 3287],\n", + " [3286, 3285],\n", + " [541, 540],\n", + " [3242, 541],\n", + " [3241, 3242],\n", + " [3241, 3240],\n", + " [556, 555],\n", + " [3257, 556],\n", + " [3256, 3257],\n", + " [3256, 3255],\n", + " [571, 570],\n", + " [3212, 571],\n", + " [3211, 3212],\n", + " [3211, 3210],\n", + " [586, 585],\n", + " [3227, 586],\n", + " [3226, 3227],\n", + " [3226, 3225],\n", + " [3182, 600],\n", + " [3181, 3182],\n", + " [3181, 3180],\n", + " [3197, 615],\n", + " [3196, 3197],\n", + " [3196, 3195],\n", + " [3153, 630],\n", + " [3151, 3150],\n", + " [3152, 3153],\n", + " [3152, 3151],\n", + " [3168, 645],\n", + " [3166, 3165],\n", + " [3167, 3168],\n", + " [3167, 3166],\n", + " [3032, 660],\n", + " [3031, 3032],\n", + " [3031, 3030],\n", + " [3047, 675],\n", + " [3046, 3047],\n", + " [3046, 3045],\n", + " [3060, 120],\n", + " [3061, 3060],\n", + " [3062, 3061],\n", + " [3063, 3062],\n", + " [3075, 135],\n", + " [3076, 3075],\n", + " [3077, 3076],\n", + " [3078, 3077],\n", + " [3090, 90],\n", + " [3091, 3090],\n", + " [3092, 3091],\n", + " [3093, 3092],\n", + " [3105, 105],\n", + " [3106, 3105],\n", + " [3107, 3106],\n", + " [3108, 3107]]}},\n", + " {'type': dwave.system.warnings.TooFewSamplesWarning,\n", + " 'message': 'Number of ground states found is within sampling error',\n", + " 'level': 30,\n", + " 'data': {'number_of_ground_states': 1,\n", + " 'num_reads': 100,\n", + " 'sampling_error_rate': 10.0}},\n", + " {'type': dwave.system.warnings.ChainStrengthWarning,\n", + " 'message': 'Some quadratic biases are stronger than the given chain strength',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [['x1', 'x0'],\n", + " ['x2', 'x0'],\n", + " ['x2', 'x1'],\n", + " ['x3', 'x0'],\n", + " ['x3', 'x1'],\n", + " ['x3', 'x2'],\n", + " ['x4', 'x0'],\n", + " ['x4', 'x1'],\n", + " ['x4', 'x2'],\n", + " ['x4', 'x3'],\n", + " ['x5', 'x0'],\n", + " ['x5', 'x1'],\n", + " ['x5', 'x2'],\n", + " ['x5', 'x3'],\n", + " ['x5', 'x4'],\n", + " ['x6', 'x0'],\n", + " ['x6', 'x1'],\n", + " ['x6', 'x2'],\n", + " ['x6', 'x3'],\n", + " ['x6', 'x4'],\n", + " ['x6', 'x5'],\n", + " ['x7', 'x0'],\n", + " ['x7', 'x1'],\n", + " ['x7', 'x2'],\n", + " ['x7', 'x3'],\n", + " ['x7', 'x4'],\n", + " ['x7', 'x5'],\n", + " ['x7', 'x6'],\n", + " ['x8', 'x0'],\n", + " ['x8', 'x1'],\n", + " ['x8', 'x2'],\n", + " ['x8', 'x3'],\n", + " ['x8', 'x4'],\n", + " ['x8', 'x5'],\n", + " ['x8', 'x6'],\n", + " ['x8', 'x7'],\n", + " ['x9', 'x0'],\n", + " ['x9', 'x1'],\n", + " ['x9', 'x2'],\n", + " ['x9', 'x3'],\n", + " ['x9', 'x4'],\n", + " ['x9', 'x5'],\n", + " ['x9', 'x6'],\n", + " ['x9', 'x7'],\n", + " ['x9', 'x8'],\n", + " ['x10', 'x0'],\n", + " ['x10', 'x1'],\n", + " ['x10', 'x2'],\n", + " ['x10', 'x3'],\n", + " ['x10', 'x4'],\n", + " ['x10', 'x5'],\n", + " ['x10', 'x6'],\n", + " ['x10', 'x7'],\n", + " ['x10', 'x8'],\n", + " ['x10', 'x9'],\n", + " ['x11', 'x0'],\n", + " ['x11', 'x1'],\n", + " ['x11', 'x2'],\n", + " ['x11', 'x3'],\n", + " ['x11', 'x4'],\n", + " ['x11', 'x5'],\n", + " ['x11', 'x6'],\n", + " ['x11', 'x7'],\n", + " ['x11', 'x8'],\n", + " ['x11', 'x9'],\n", + " ['x11', 'x10'],\n", + " ['x12', 'x0'],\n", + " ['x12', 'x1'],\n", + " ['x12', 'x2'],\n", + " ['x12', 'x3'],\n", + " ['x12', 'x4'],\n", + " ['x12', 'x5'],\n", + " ['x12', 'x6'],\n", + " ['x12', 'x7'],\n", + " ['x12', 'x8'],\n", + " ['x12', 'x9'],\n", + " ['x12', 'x10'],\n", + " ['x12', 'x11'],\n", + " ['x13', 'x0'],\n", + " ['x13', 'x1'],\n", + " ['x13', 'x2'],\n", + " ['x13', 'x3'],\n", + " ['x13', 'x4'],\n", + " ['x13', 'x5'],\n", + " ['x13', 'x6'],\n", + " ['x13', 'x7'],\n", + " ['x13', 'x8'],\n", + " ['x13', 'x9'],\n", + " ['x13', 'x10'],\n", + " ['x13', 'x11'],\n", + " ['x13', 'x12'],\n", + " ['x14', 'x0'],\n", + " ['x14', 'x1'],\n", + " ['x14', 'x2'],\n", + " ['x14', 'x3'],\n", + " ['x14', 'x4'],\n", + " ['x14', 'x5'],\n", + " ['x14', 'x6'],\n", + " ['x14', 'x7'],\n", + " ['x14', 'x8'],\n", + " ['x14', 'x9'],\n", + " ['x14', 'x10'],\n", + " ['x14', 'x11'],\n", + " ['x14', 'x12'],\n", + " ['x14', 'x13'],\n", + " ['x15', 'x0'],\n", + " ['x15', 'x1'],\n", + " ['x15', 'x2'],\n", + " ['x15', 'x3'],\n", + " ['x15', 'x4'],\n", + " ['x15', 'x5'],\n", + " ['x15', 'x6'],\n", + " ['x15', 'x7'],\n", + " ['x15', 'x8'],\n", + " ['x15', 'x9'],\n", + " ['x15', 'x10'],\n", + " ['x15', 'x11'],\n", + " ['x15', 'x12'],\n", + " ['x15', 'x13'],\n", + " ['x15', 'x14'],\n", + " ['x16', 'x0'],\n", + " ['x16', 'x1'],\n", + " ['x16', 'x2'],\n", + " ['x16', 'x3'],\n", + " ['x16', 'x4'],\n", + " ['x16', 'x5'],\n", + " ['x16', 'x6'],\n", + " ['x16', 'x7'],\n", + " ['x16', 'x8'],\n", + " ['x16', 'x9'],\n", + " ['x16', 'x10'],\n", + " ['x16', 'x11'],\n", + " ['x16', 'x12'],\n", + " ['x16', 'x13'],\n", + " ['x16', 'x14'],\n", + " ['x16', 'x15'],\n", + " ['x17', 'x0'],\n", + " ['x17', 'x1'],\n", + " ['x17', 'x2'],\n", + " ['x17', 'x3'],\n", + " ['x17', 'x4'],\n", + " ['x17', 'x5'],\n", + " ['x17', 'x6'],\n", + " ['x17', 'x7'],\n", + " ['x17', 'x8'],\n", + " ['x17', 'x9'],\n", + " ['x17', 'x10'],\n", + " ['x17', 'x11'],\n", + " ['x17', 'x12'],\n", + " ['x17', 'x13'],\n", + " ['x17', 'x14'],\n", + " ['x17', 'x15'],\n", + " ['x17', 'x16'],\n", + " ['x18', 'x0'],\n", + " ['x18', 'x1'],\n", + " ['x18', 'x2'],\n", + " ['x18', 'x3'],\n", + " ['x18', 'x4'],\n", + " ['x18', 'x5'],\n", + " ['x18', 'x6'],\n", + " ['x18', 'x7'],\n", + " ['x18', 'x8'],\n", + " ['x18', 'x9'],\n", + " ['x18', 'x10'],\n", + " ['x18', 'x11'],\n", + " ['x18', 'x12'],\n", + " ['x18', 'x13'],\n", + " ['x18', 'x14'],\n", + " ['x18', 'x15'],\n", + " ['x18', 'x16'],\n", + " ['x18', 'x17'],\n", + " ['x19', 'x0'],\n", + " ['x19', 'x1'],\n", + " ['x19', 'x2'],\n", + " ['x19', 'x3'],\n", + " ['x19', 'x4'],\n", + " ['x19', 'x5'],\n", + " ['x19', 'x6'],\n", + " ['x19', 'x7'],\n", + " ['x19', 'x8'],\n", + " ['x19', 'x9'],\n", + " ['x19', 'x10'],\n", + " ['x19', 'x11'],\n", + " ['x19', 'x12'],\n", + " ['x19', 'x13'],\n", + " ['x19', 'x14'],\n", + " ['x19', 'x15'],\n", + " ['x19', 'x16'],\n", + " ['x19', 'x17'],\n", + " ['x19', 'x18'],\n", + " ['x20', 'x0'],\n", + " ['x20', 'x1'],\n", + " ['x20', 'x2'],\n", + " ['x20', 'x3'],\n", + " ['x20', 'x4'],\n", + " ['x20', 'x5'],\n", + " ['x20', 'x6'],\n", + " ['x20', 'x7'],\n", + " ['x20', 'x8'],\n", + " ['x20', 'x9'],\n", + " ['x20', 'x10'],\n", + " ['x20', 'x11'],\n", + " ['x20', 'x12'],\n", + " ['x20', 'x13'],\n", + " ['x20', 'x14'],\n", + " ['x20', 'x15'],\n", + " ['x20', 'x16'],\n", + " ['x20', 'x17'],\n", + " ['x20', 'x18'],\n", + " ['x20', 'x19'],\n", + " ['x21', 'x0'],\n", + " ['x21', 'x1'],\n", + " ['x21', 'x2'],\n", + " ['x21', 'x3'],\n", + " ['x21', 'x4'],\n", + " ['x21', 'x5'],\n", + " ['x21', 'x6'],\n", + " ['x21', 'x7'],\n", + " ['x21', 'x8'],\n", + " ['x21', 'x9'],\n", + " ['x21', 'x10'],\n", + " ['x21', 'x11'],\n", + " ['x21', 'x12'],\n", + " ['x21', 'x13'],\n", + " ['x21', 'x14'],\n", + " ['x21', 'x15'],\n", + " ['x21', 'x16'],\n", + " ['x21', 'x17'],\n", + " ['x21', 'x18'],\n", + " ['x21', 'x19'],\n", + " ['x21', 'x20'],\n", + " ['x22', 'x0'],\n", + " ['x22', 'x1'],\n", + " ['x22', 'x2'],\n", + " ['x22', 'x3'],\n", + " ['x22', 'x4'],\n", + " ['x22', 'x5'],\n", + " ['x22', 'x6'],\n", + " ['x22', 'x7'],\n", + " ['x22', 'x8'],\n", + " ['x22', 'x9'],\n", + " ['x22', 'x10'],\n", + " ['x22', 'x11'],\n", + " ['x22', 'x12'],\n", + " ['x22', 'x13'],\n", + " ['x22', 'x14'],\n", + " ['x22', 'x15'],\n", + " ['x22', 'x16'],\n", + " ['x22', 'x17'],\n", + " ['x22', 'x18'],\n", + " ['x22', 'x19'],\n", + " ['x22', 'x20'],\n", + " ['x22', 'x21'],\n", + " ['x23', 'x0'],\n", + " ['x23', 'x1'],\n", + " ['x23', 'x2'],\n", + " ['x23', 'x3'],\n", + " ['x23', 'x4'],\n", + " ['x23', 'x5'],\n", + " ['x23', 'x6'],\n", + " ['x23', 'x7'],\n", + " ['x23', 'x8'],\n", + " ['x23', 'x9'],\n", + " ['x23', 'x10'],\n", + " ['x23', 'x11'],\n", + " ['x23', 'x12'],\n", + " ['x23', 'x13'],\n", + " ['x23', 'x14'],\n", + " ['x23', 'x15'],\n", + " ['x23', 'x16'],\n", + " ['x23', 'x17'],\n", + " ['x23', 'x18'],\n", + " ['x23', 'x19'],\n", + " ['x23', 'x20'],\n", + " ['x23', 'x21'],\n", + " ['x23', 'x22'],\n", + " ['x24', 'x0'],\n", + " ['x24', 'x1'],\n", + " ['x24', 'x2'],\n", + " ['x24', 'x3'],\n", + " ['x24', 'x4'],\n", + " ['x24', 'x5'],\n", + " ['x24', 'x6'],\n", + " ['x24', 'x7'],\n", + " ['x24', 'x8'],\n", + " ['x24', 'x9'],\n", + " ['x24', 'x10'],\n", + " ['x24', 'x11'],\n", + " ['x24', 'x12'],\n", + " ['x24', 'x13'],\n", + " ['x24', 'x14'],\n", + " ['x24', 'x15'],\n", + " ['x24', 'x16'],\n", + " ['x24', 'x17'],\n", + " ['x24', 'x18'],\n", + " ['x24', 'x19'],\n", + " ['x24', 'x20'],\n", + " ['x24', 'x21'],\n", + " ['x24', 'x22'],\n", + " ['x24', 'x23'],\n", + " ['x25', 'x0'],\n", + " ['x25', 'x1'],\n", + " ['x25', 'x2'],\n", + " ['x25', 'x3'],\n", + " ['x25', 'x4'],\n", + " ['x25', 'x5'],\n", + " ['x25', 'x6'],\n", + " ['x25', 'x7'],\n", + " ['x25', 'x8'],\n", + " ['x25', 'x9'],\n", + " ['x25', 'x10'],\n", + " ['x25', 'x11'],\n", + " ['x25', 'x12'],\n", + " ['x25', 'x13'],\n", + " ['x25', 'x14'],\n", + " ['x25', 'x15'],\n", + " ['x25', 'x16'],\n", + " ['x25', 'x17'],\n", + " ['x25', 'x18'],\n", + " ['x25', 'x19'],\n", + " ['x25', 'x20'],\n", + " ['x25', 'x21'],\n", + " ['x25', 'x22'],\n", + " ['x25', 'x23'],\n", + " ['x25', 'x24'],\n", + " ['x26', 'x0'],\n", + " ['x26', 'x1'],\n", + " ['x26', 'x2'],\n", + " ['x26', 'x3'],\n", + " ['x26', 'x4'],\n", + " ['x26', 'x5'],\n", + " ['x26', 'x6'],\n", + " ['x26', 'x7'],\n", + " ['x26', 'x8'],\n", + " ['x26', 'x9'],\n", + " ['x26', 'x10'],\n", + " ['x26', 'x11'],\n", + " ['x26', 'x12'],\n", + " ['x26', 'x13'],\n", + " ['x26', 'x14'],\n", + " ['x26', 'x15'],\n", + " ['x26', 'x16'],\n", + " ['x26', 'x17'],\n", + " ['x26', 'x18'],\n", + " ['x26', 'x19'],\n", + " ['x26', 'x20'],\n", + " ['x26', 'x21'],\n", + " ['x26', 'x22'],\n", + " ['x26', 'x23'],\n", + " ['x26', 'x24'],\n", + " ['x26', 'x25'],\n", + " ['x27', 'x0'],\n", + " ['x27', 'x1'],\n", + " ['x27', 'x2'],\n", + " ['x27', 'x3'],\n", + " ['x27', 'x4'],\n", + " ['x27', 'x5'],\n", + " ['x27', 'x6'],\n", + " ['x27', 'x7'],\n", + " ['x27', 'x8'],\n", + " ['x27', 'x9'],\n", + " ['x27', 'x10'],\n", + " ['x27', 'x11'],\n", + " ['x27', 'x12'],\n", + " ['x27', 'x13'],\n", + " ['x27', 'x14'],\n", + " ['x27', 'x15'],\n", + " ['x27', 'x16'],\n", + " ['x27', 'x17'],\n", + " ['x27', 'x18'],\n", + " ['x27', 'x19'],\n", + " ['x27', 'x20'],\n", + " ['x27', 'x21'],\n", + " ['x27', 'x22'],\n", + " ['x27', 'x23'],\n", + " ['x27', 'x24'],\n", + " ['x27', 'x25'],\n", + " ['x27', 'x26'],\n", + " ['x28', 'x0'],\n", + " ['x28', 'x1'],\n", + " ['x28', 'x2'],\n", + " ['x28', 'x3'],\n", + " ['x28', 'x4'],\n", + " ['x28', 'x5'],\n", + " ['x28', 'x6'],\n", + " ['x28', 'x7'],\n", + " ['x28', 'x8'],\n", + " ['x28', 'x9'],\n", + " ['x28', 'x10'],\n", + " ['x28', 'x11'],\n", + " ['x28', 'x12'],\n", + " ['x28', 'x13'],\n", + " ['x28', 'x14'],\n", + " ['x28', 'x15'],\n", + " ['x28', 'x16'],\n", + " ['x28', 'x17'],\n", + " ['x28', 'x18'],\n", + " ['x28', 'x19'],\n", + " ['x28', 'x20'],\n", + " ['x28', 'x21'],\n", + " ['x28', 'x22'],\n", + " ['x28', 'x23'],\n", + " ['x28', 'x24'],\n", + " ['x28', 'x25'],\n", + " ['x28', 'x26'],\n", + " ['x28', 'x27'],\n", + " ['x29', 'x0'],\n", + " ['x29', 'x1'],\n", + " ['x29', 'x2'],\n", + " ['x29', 'x3'],\n", + " ['x29', 'x4'],\n", + " ['x29', 'x5'],\n", + " ['x29', 'x6'],\n", + " ['x29', 'x7'],\n", + " ['x29', 'x8'],\n", + " ['x29', 'x9'],\n", + " ['x29', 'x10'],\n", + " ['x29', 'x11'],\n", + " ['x29', 'x12'],\n", + " ['x29', 'x13'],\n", + " ['x29', 'x14'],\n", + " ['x29', 'x15'],\n", + " ['x29', 'x16'],\n", + " ['x29', 'x17'],\n", + " ['x29', 'x18'],\n", + " ['x29', 'x19'],\n", + " ['x29', 'x20'],\n", + " ['x29', 'x21'],\n", + " ['x29', 'x22'],\n", + " ['x29', 'x23'],\n", + " ['x29', 'x24'],\n", + " ['x29', 'x25'],\n", + " ['x29', 'x26'],\n", + " ['x29', 'x27'],\n", + " ['x29', 'x28'],\n", + " ['x30', 'x0'],\n", + " ['x30', 'x1'],\n", + " ['x30', 'x2'],\n", + " ['x30', 'x3'],\n", + " ['x30', 'x4'],\n", + " ['x30', 'x5'],\n", + " ['x30', 'x6'],\n", + " ['x30', 'x7'],\n", + " ['x30', 'x8'],\n", + " ['x30', 'x9'],\n", + " ['x30', 'x10'],\n", + " ['x30', 'x11'],\n", + " ['x30', 'x12'],\n", + " ['x30', 'x13'],\n", + " ['x30', 'x14'],\n", + " ['x30', 'x15'],\n", + " ['x30', 'x16'],\n", + " ['x30', 'x17'],\n", + " ['x30', 'x18'],\n", + " ['x30', 'x19'],\n", + " ['x30', 'x20'],\n", + " ['x30', 'x21'],\n", + " ['x30', 'x22'],\n", + " ['x30', 'x23'],\n", + " ['x30', 'x24'],\n", + " ['x30', 'x25'],\n", + " ['x30', 'x26'],\n", + " ['x30', 'x27'],\n", + " ['x30', 'x28'],\n", + " ['x30', 'x29'],\n", + " ['x31', 'x0'],\n", + " ['x31', 'x1'],\n", + " ['x31', 'x2'],\n", + " ['x31', 'x3'],\n", + " ['x31', 'x4'],\n", + " ['x31', 'x5'],\n", + " ['x31', 'x6'],\n", + " ['x31', 'x7'],\n", + " ['x31', 'x8'],\n", + " ['x31', 'x9'],\n", + " ['x31', 'x10'],\n", + " ['x31', 'x11'],\n", + " ['x31', 'x12'],\n", + " ['x31', 'x13'],\n", + " ['x31', 'x14'],\n", + " ['x31', 'x15'],\n", + " ['x31', 'x16'],\n", + " ['x31', 'x17'],\n", + " ['x31', 'x18'],\n", + " ['x31', 'x19'],\n", + " ['x31', 'x20'],\n", + " ['x31', 'x21'],\n", + " ['x31', 'x22'],\n", + " ['x31', 'x23'],\n", + " ['x31', 'x24'],\n", + " ['x31', 'x25'],\n", + " ['x31', 'x26'],\n", + " ['x31', 'x27'],\n", + " ['x31', 'x28'],\n", + " ['x31', 'x29'],\n", + " ['x31', 'x30'],\n", + " ['x32', 'x0'],\n", + " ['x32', 'x1'],\n", + " ['x32', 'x2'],\n", + " ['x32', 'x3'],\n", + " ['x32', 'x4'],\n", + " ['x32', 'x5'],\n", + " ['x32', 'x6'],\n", + " ['x32', 'x7'],\n", + " ['x32', 'x8'],\n", + " ['x32', 'x9'],\n", + " ['x32', 'x10'],\n", + " ['x32', 'x11'],\n", + " ['x32', 'x12'],\n", + " ['x32', 'x13'],\n", + " ['x32', 'x14'],\n", + " ['x32', 'x15'],\n", + " ['x32', 'x16'],\n", + " ['x32', 'x17'],\n", + " ['x32', 'x18'],\n", + " ['x32', 'x19'],\n", + " ['x32', 'x20'],\n", + " ['x32', 'x21'],\n", + " ['x32', 'x22'],\n", + " ['x32', 'x23'],\n", + " ['x32', 'x24'],\n", + " ['x32', 'x25'],\n", + " ['x32', 'x26'],\n", + " ['x32', 'x27'],\n", + " ['x32', 'x28'],\n", + " ['x32', 'x29'],\n", + " ['x32', 'x30'],\n", + " ['x32', 'x31'],\n", + " ['x33', 'x0'],\n", + " ['x33', 'x1'],\n", + " ['x33', 'x2'],\n", + " ['x33', 'x3'],\n", + " ['x33', 'x4'],\n", + " ['x33', 'x5'],\n", + " ['x33', 'x6'],\n", + " ['x33', 'x7'],\n", + " ['x33', 'x8'],\n", + " ['x33', 'x9'],\n", + " ['x33', 'x10'],\n", + " ['x33', 'x11'],\n", + " ['x33', 'x12'],\n", + " ['x33', 'x13'],\n", + " ['x33', 'x14'],\n", + " ['x33', 'x15'],\n", + " ['x33', 'x16'],\n", + " ['x33', 'x17'],\n", + " ['x33', 'x18'],\n", + " ['x33', 'x19'],\n", + " ['x33', 'x20'],\n", + " ['x33', 'x21'],\n", + " ['x33', 'x22'],\n", + " ['x33', 'x23'],\n", + " ['x33', 'x24'],\n", + " ['x33', 'x25'],\n", + " ['x33', 'x26'],\n", + " ['x33', 'x27'],\n", + " ['x33', 'x28'],\n", + " ['x33', 'x29'],\n", + " ['x33', 'x30'],\n", + " ['x33', 'x31'],\n", + " ['x33', 'x32'],\n", + " ['x34', 'x0'],\n", + " ['x34', 'x1'],\n", + " ['x34', 'x2'],\n", + " ['x34', 'x3'],\n", + " ['x34', 'x4'],\n", + " ['x34', 'x5'],\n", + " ['x34', 'x6'],\n", + " ['x34', 'x7'],\n", + " ['x34', 'x8'],\n", + " ['x34', 'x9'],\n", + " ['x34', 'x10'],\n", + " ['x34', 'x11'],\n", + " ['x34', 'x12'],\n", + " ['x34', 'x13'],\n", + " ['x34', 'x14'],\n", + " ['x34', 'x15'],\n", + " ['x34', 'x16'],\n", + " ['x34', 'x17'],\n", + " ['x34', 'x18'],\n", + " ['x34', 'x19'],\n", + " ['x34', 'x20'],\n", + " ['x34', 'x21'],\n", + " ['x34', 'x22'],\n", + " ['x34', 'x23'],\n", + " ['x34', 'x24'],\n", + " ['x34', 'x25'],\n", + " ['x34', 'x26'],\n", + " ['x34', 'x27'],\n", + " ['x34', 'x28'],\n", + " ['x34', 'x29'],\n", + " ['x34', 'x30'],\n", + " ['x34', 'x31'],\n", + " ['x34', 'x32'],\n", + " ['x34', 'x33'],\n", + " ['x35', 'x0'],\n", + " ['x35', 'x1'],\n", + " ['x35', 'x2'],\n", + " ['x35', 'x3'],\n", + " ['x35', 'x4'],\n", + " ['x35', 'x5'],\n", + " ['x35', 'x6'],\n", + " ['x35', 'x7'],\n", + " ['x35', 'x8'],\n", + " ['x35', 'x9'],\n", + " ['x35', 'x10'],\n", + " ['x35', 'x11'],\n", + " ['x35', 'x12'],\n", + " ['x35', 'x13'],\n", + " ['x35', 'x14'],\n", + " ['x35', 'x15'],\n", + " ['x35', 'x16'],\n", + " ['x35', 'x17'],\n", + " ['x35', 'x18'],\n", + " ['x35', 'x19'],\n", + " ['x35', 'x20'],\n", + " ['x35', 'x21'],\n", + " ['x35', 'x22'],\n", + " ['x35', 'x23'],\n", + " ['x35', 'x24'],\n", + " ['x35', 'x25'],\n", + " ['x35', 'x26'],\n", + " ['x35', 'x27'],\n", + " ['x35', 'x28'],\n", + " ['x35', 'x29'],\n", + " ['x35', 'x30'],\n", + " ['x35', 'x31'],\n", + " ['x35', 'x32'],\n", + " ['x35', 'x33'],\n", + " ['x35', 'x34'],\n", + " ['x36', 'x0'],\n", + " ['x36', 'x1'],\n", + " ['x36', 'x2'],\n", + " ['x36', 'x3'],\n", + " ['x36', 'x4'],\n", + " ['x36', 'x5'],\n", + " ['x36', 'x6'],\n", + " ['x36', 'x7'],\n", + " ['x36', 'x8'],\n", + " ['x36', 'x9'],\n", + " ['x36', 'x10'],\n", + " ['x36', 'x11'],\n", + " ['x36', 'x12'],\n", + " ['x36', 'x13'],\n", + " ['x36', 'x14'],\n", + " ['x36', 'x15'],\n", + " ['x36', 'x16'],\n", + " ['x36', 'x17'],\n", + " ['x36', 'x18'],\n", + " ['x36', 'x19'],\n", + " ['x36', 'x20'],\n", + " ['x36', 'x21'],\n", + " ['x36', 'x22'],\n", + " ['x36', 'x23'],\n", + " ['x36', 'x24'],\n", + " ['x36', 'x25'],\n", + " ['x36', 'x26'],\n", + " ['x36', 'x27'],\n", + " ['x36', 'x28'],\n", + " ['x36', 'x29'],\n", + " ['x36', 'x30'],\n", + " ['x36', 'x31'],\n", + " ['x36', 'x32'],\n", + " ['x36', 'x33'],\n", + " ['x36', 'x34'],\n", + " ['x36', 'x35'],\n", + " ['x37', 'x0'],\n", + " ['x37', 'x1'],\n", + " ['x37', 'x2'],\n", + " ['x37', 'x3'],\n", + " ['x37', 'x4'],\n", + " ['x37', 'x5'],\n", + " ['x37', 'x6'],\n", + " ['x37', 'x7'],\n", + " ['x37', 'x8'],\n", + " ['x37', 'x9'],\n", + " ['x37', 'x10'],\n", + " ['x37', 'x11'],\n", + " ['x37', 'x12'],\n", + " ['x37', 'x13'],\n", + " ['x37', 'x14'],\n", + " ['x37', 'x15'],\n", + " ['x37', 'x16'],\n", + " ['x37', 'x17'],\n", + " ['x37', 'x18'],\n", + " ['x37', 'x19'],\n", + " ['x37', 'x20'],\n", + " ['x37', 'x21'],\n", + " ['x37', 'x22'],\n", + " ['x37', 'x23'],\n", + " ['x37', 'x24'],\n", + " ['x37', 'x25'],\n", + " ['x37', 'x26'],\n", + " ['x37', 'x27'],\n", + " ['x37', 'x28'],\n", + " ['x37', 'x29'],\n", + " ['x37', 'x30'],\n", + " ['x37', 'x31'],\n", + " ['x37', 'x32'],\n", + " ['x37', 'x33'],\n", + " ['x37', 'x34'],\n", + " ['x37', 'x35'],\n", + " ['x37', 'x36'],\n", + " ['x38', 'x0'],\n", + " ['x38', 'x1'],\n", + " ['x38', 'x2'],\n", + " ['x38', 'x3'],\n", + " ['x38', 'x4'],\n", + " ['x38', 'x5'],\n", + " ['x38', 'x6'],\n", + " ['x38', 'x7'],\n", + " ['x38', 'x8'],\n", + " ['x38', 'x9'],\n", + " ['x38', 'x10'],\n", + " ['x38', 'x11'],\n", + " ['x38', 'x12'],\n", + " ['x38', 'x13'],\n", + " ['x38', 'x14'],\n", + " ['x38', 'x15'],\n", + " ['x38', 'x16'],\n", + " ['x38', 'x17'],\n", + " ['x38', 'x18'],\n", + " ['x38', 'x19'],\n", + " ['x38', 'x20'],\n", + " ['x38', 'x21'],\n", + " ['x38', 'x22'],\n", + " ['x38', 'x23'],\n", + " ['x38', 'x24'],\n", + " ['x38', 'x25'],\n", + " ['x38', 'x26'],\n", + " ['x38', 'x27'],\n", + " ['x38', 'x28'],\n", + " ['x38', 'x29'],\n", + " ['x38', 'x30'],\n", + " ['x38', 'x31'],\n", + " ['x38', 'x32'],\n", + " ['x38', 'x33'],\n", + " ['x38', 'x34'],\n", + " ['x38', 'x35'],\n", + " ['x38', 'x36'],\n", + " ['x38', 'x37'],\n", + " ['x39', 'x0'],\n", + " ['x39', 'x1'],\n", + " ['x39', 'x2'],\n", + " ['x39', 'x3'],\n", + " ['x39', 'x4'],\n", + " ['x39', 'x5'],\n", + " ['x39', 'x6'],\n", + " ['x39', 'x7'],\n", + " ['x39', 'x8'],\n", + " ['x39', 'x9'],\n", + " ['x39', 'x10'],\n", + " ['x39', 'x11'],\n", + " ['x39', 'x12'],\n", + " ['x39', 'x13'],\n", + " ['x39', 'x14'],\n", + " ['x39', 'x15'],\n", + " ['x39', 'x16'],\n", + " ['x39', 'x17'],\n", + " ['x39', 'x18'],\n", + " ['x39', 'x19'],\n", + " ['x39', 'x20'],\n", + " ['x39', 'x21'],\n", + " ['x39', 'x22'],\n", + " ['x39', 'x23'],\n", + " ['x39', 'x24'],\n", + " ['x39', 'x25'],\n", + " ['x39', 'x26'],\n", + " ['x39', 'x27'],\n", + " ['x39', 'x28'],\n", + " ['x39', 'x29'],\n", + " ['x39', 'x30'],\n", + " ['x39', 'x31'],\n", + " ['x39', 'x32'],\n", + " ['x39', 'x33'],\n", + " ['x39', 'x34'],\n", + " ['x39', 'x35'],\n", + " ['x39', 'x36'],\n", + " ['x39', 'x37'],\n", + " ['x39', 'x38']]}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [180, 181, 182, 183, 2940],\n", + " 'source_variables': ['x0'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [195, 196, 197, 198, 2955],\n", + " 'source_variables': ['x1'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [150, 151, 152, 153, 2970],\n", + " 'source_variables': ['x2'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [165, 166, 167, 168, 2985],\n", + " 'source_variables': ['x3'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [210, 211, 212, 213, 3000],\n", + " 'source_variables': ['x4'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [225, 226, 227, 228, 3015],\n", + " 'source_variables': ['x5'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [240, 241, 242, 3540],\n", + " 'source_variables': ['x6'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [255, 256, 257, 3555],\n", + " 'source_variables': ['x7'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [270, 271, 272, 3510, 3511],\n", + " 'source_variables': ['x8'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [285, 286, 287, 3525, 3526],\n", + " 'source_variables': ['x9'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [300, 301, 302, 3480, 3481],\n", + " 'source_variables': ['x10'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [315, 316, 317, 3495, 3496],\n", + " 'source_variables': ['x11'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [330, 331, 332, 3450, 3451],\n", + " 'source_variables': ['x12'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [345, 346, 347, 3465, 3466],\n", + " 'source_variables': ['x13'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [360, 361, 362, 3420, 3421],\n", + " 'source_variables': ['x14'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [375, 376, 377, 3435, 3436],\n", + " 'source_variables': ['x15'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [390, 391, 392, 3390, 3391],\n", + " 'source_variables': ['x16'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [405, 406, 407, 3405, 3406],\n", + " 'source_variables': ['x17'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [435, 436, 3375, 3376],\n", + " 'source_variables': ['x19'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [450, 451, 3330, 3331, 3332],\n", + " 'source_variables': ['x20'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [465, 466, 3345, 3346, 3347],\n", + " 'source_variables': ['x21'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [480, 481, 3300, 3301, 3302],\n", + " 'source_variables': ['x22'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [495, 496, 3315, 3316, 3317],\n", + " 'source_variables': ['x23'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [510, 511, 3270, 3271, 3272],\n", + " 'source_variables': ['x24'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [525, 526, 3285, 3286, 3287],\n", + " 'source_variables': ['x25'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [555, 556, 3255, 3256, 3257],\n", + " 'source_variables': ['x27'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [570, 571, 3210, 3211, 3212],\n", + " 'source_variables': ['x28'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [585, 586, 3225, 3226, 3227],\n", + " 'source_variables': ['x29'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [600, 3180, 3181, 3182],\n", + " 'source_variables': ['x30'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [615, 3195, 3196, 3197],\n", + " 'source_variables': ['x31'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [645, 3165, 3166, 3167, 3168],\n", + " 'source_variables': ['x33'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [660, 3030, 3031, 3032],\n", + " 'source_variables': ['x34'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [675, 3045, 3046, 3047],\n", + " 'source_variables': ['x35'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [120, 3060, 3061, 3062, 3063],\n", + " 'source_variables': ['x36'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [135, 3075, 3076, 3077, 3078],\n", + " 'source_variables': ['x37'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [90, 3090, 3091, 3092, 3093],\n", + " 'source_variables': ['x38'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [105, 3105, 3106, 3107, 3108],\n", + " 'source_variables': ['x39'],\n", + " 'sample_index': 0}},\n", + " {'type': UserWarning,\n", + " 'message': 'All samples have broken chains',\n", + " 'level': 30,\n", + " 'data': {}}],\n", + " 'embedding_context': {'embedding': {'x0': [180, 181, 182, 183, 2940],\n", + " 'x1': [195, 196, 197, 198, 2955],\n", + " 'x2': [150, 151, 152, 153, 2970],\n", + " 'x3': [165, 166, 167, 168, 2985],\n", + " 'x4': [210, 211, 212, 213, 3000],\n", + " 'x5': [225, 226, 227, 228, 3015],\n", + " 'x6': [240, 241, 242, 3540],\n", + " 'x7': [255, 256, 257, 3555],\n", + " 'x8': [270, 271, 272, 3510, 3511],\n", + " 'x9': [285, 286, 287, 3525, 3526],\n", + " 'x10': [300, 301, 302, 3480, 3481],\n", + " 'x11': [315, 316, 317, 3495, 3496],\n", + " 'x12': [330, 331, 332, 3450, 3451],\n", + " 'x13': [345, 346, 347, 3465, 3466],\n", + " 'x14': [360, 361, 362, 3420, 3421],\n", + " 'x15': [375, 376, 377, 3435, 3436],\n", + " 'x16': [390, 391, 392, 3390, 3391],\n", + " 'x17': [405, 406, 407, 3405, 3406],\n", + " 'x18': [420, 421, 3360, 3361],\n", + " 'x19': [435, 436, 3375, 3376],\n", + " 'x20': [450, 451, 3330, 3331, 3332],\n", + " 'x21': [465, 466, 3345, 3346, 3347],\n", + " 'x22': [480, 481, 3300, 3301, 3302],\n", + " 'x23': [495, 496, 3315, 3316, 3317],\n", + " 'x24': [510, 511, 3270, 3271, 3272],\n", + " 'x25': [525, 526, 3285, 3286, 3287],\n", + " 'x26': [540, 541, 3240, 3241, 3242],\n", + " 'x27': [555, 556, 3255, 3256, 3257],\n", + " 'x28': [570, 571, 3210, 3211, 3212],\n", + " 'x29': [585, 586, 3225, 3226, 3227],\n", + " 'x30': [600, 3180, 3181, 3182],\n", + " 'x31': [615, 3195, 3196, 3197],\n", + " 'x32': [630, 3150, 3151, 3152, 3153],\n", + " 'x33': [645, 3165, 3166, 3167, 3168],\n", + " 'x34': [660, 3030, 3031, 3032],\n", + " 'x35': [675, 3045, 3046, 3047],\n", + " 'x36': [120, 3060, 3061, 3062, 3063],\n", + " 'x37': [135, 3075, 3076, 3077, 3078],\n", + " 'x38': [90, 3090, 3091, 3092, 3093],\n", + " 'x39': [105, 3105, 3106, 3107, 3108]},\n", + " 'chain_break_method': 'majority_vote',\n", + " 'embedding_parameters': {},\n", + " 'chain_strength': 0.0001,\n", + " 'timing': {'embedding': 0.0022098999997979263,\n", + " 'unembedding': 0.0011283000003459165}}}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls.info" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "808642b0", + "metadata": {}, + "outputs": [], + "source": [ + "enable_data_capture()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "b16a1b3c", + "metadata": {}, + "outputs": [], + "source": [ + "from dwave.inspector.storage import get_problem, problemdata, problemdata_bag" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "9113ed78", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'f49fda51-0bdf-47d9-8dab-e6c3296ca0c4'" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls.info[\"problem_id\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "ac768f39", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "set()" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problemdata_bag" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "1bf9953d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'80444839-7e97-4f88-8518-dea1c98e46df': }" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problemdata" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "d23c1c53", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'80444839-7e97-4f88-8518-dea1c98e46df'" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.dwave_sampleset.info[\"problem_id\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "c80bd06f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "Serving Inspector on http://127.0.0.1:18000/?problemId=80444839-7e97-4f88-8518-dea1c98e46df" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "'http://127.0.0.1:18000/?problemId=80444839-7e97-4f88-8518-dea1c98e46df'" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import dwave.inspector\n", + "from dwave.inspector.adapters import enable_data_capture\n", + "\n", + "# enable_data_capture()\n", + "\n", + "dwave.inspector.show(res.sampleset_info.dwave_sampleset)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "5c59f975", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "SampleSet(rec.array([([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1], 0.82051282, 1, 0.925),\n", + " ([0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0], -2.5 , 1, 0.925),\n", + " ([1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0], -4.5 , 1, 0.9 ),\n", + " ([0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1], -3.48717949, 1, 0.875),\n", + " ([1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0], -2.44871795, 1, 0.975),\n", + " ([1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], -9.48717949, 1, 0.875),\n", + " ([1, 1, 0, 0, 0, 0, 0, 0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6.87179487, 1, 0.775),\n", + " ([0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0], -4.03846154, 1, 0.95 ),\n", + " ([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1], -4.44871795, 1, 0.85 ),\n", + " ([1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1], -4.03846154, 1, 0.925),\n", + " ([1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0], -5.48717949, 1, 0.95 ),\n", + " ([1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0], -9.38461538, 1, 0.875),\n", + " ([1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1], -3.17948718, 1, 0.925),\n", + " ([1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1], -3.38461538, 1, 0.925),\n", + " ([0, 0, 1, 1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('energy', ', 'message': 'Some biases are 10^3 times stronger than others', 'level': 30, 'data': {'source_interactions': [[181, 180], [2940, 180], [182, 181], [183, 182], [196, 195], [2955, 195], [197, 196], [198, 197], [151, 150], [2970, 150], [152, 151], [153, 152], [166, 165], [2985, 165], [167, 166], [168, 167], [211, 210], [3000, 210], [212, 211], [213, 212], [226, 225], [3015, 225], [227, 226], [228, 227], [241, 240], [242, 241], [3540, 242], [256, 255], [257, 256], [3555, 257], [271, 270], [272, 271], [3511, 272], [3510, 3511], [286, 285], [287, 286], [3526, 287], [3525, 3526], [301, 300], [302, 301], [3481, 302], [3480, 3481], [316, 315], [317, 316], [3496, 317], [3495, 3496], [331, 330], [332, 331], [3451, 332], [3450, 3451], [346, 345], [347, 346], [3466, 347], [3465, 3466], [361, 360], [362, 361], [3421, 362], [3420, 3421], [376, 375], [377, 376], [3436, 377], [3435, 3436], [391, 390], [392, 391], [3391, 392], [3390, 3391], [406, 405], [407, 406], [3406, 407], [3405, 3406], [421, 420], [3361, 421], [3360, 3361], [436, 435], [3376, 436], [3375, 3376], [451, 450], [3332, 451], [3331, 3332], [3331, 3330], [466, 465], [3347, 466], [3346, 3347], [3346, 3345], [481, 480], [3302, 481], [3301, 3302], [3301, 3300], [496, 495], [3317, 496], [3316, 3317], [3316, 3315], [511, 510], [3272, 511], [3271, 3272], [3271, 3270], [526, 525], [3287, 526], [3286, 3287], [3286, 3285], [541, 540], [3242, 541], [3241, 3242], [3241, 3240], [556, 555], [3257, 556], [3256, 3257], [3256, 3255], [571, 570], [3212, 571], [3211, 3212], [3211, 3210], [586, 585], [3227, 586], [3226, 3227], [3226, 3225], [3182, 600], [3181, 3182], [3181, 3180], [3197, 615], [3196, 3197], [3196, 3195], [3153, 630], [3151, 3150], [3152, 3153], [3152, 3151], [3168, 645], [3166, 3165], [3167, 3168], [3167, 3166], [3032, 660], [3031, 3032], [3031, 3030], [3047, 675], [3046, 3047], [3046, 3045], [3060, 120], [3061, 3060], [3062, 3061], [3063, 3062], [3075, 135], [3076, 3075], [3077, 3076], [3078, 3077], [3090, 90], [3091, 3090], [3092, 3091], [3093, 3092], [3105, 105], [3106, 3105], [3107, 3106], [3108, 3107]]}}, {'type': , 'message': 'Number of ground states found is within sampling error', 'level': 30, 'data': {'number_of_ground_states': 1, 'num_reads': 100, 'sampling_error_rate': 10.0}}, {'type': , 'message': 'Some quadratic biases are stronger than the given chain strength', 'level': 30, 'data': {'source_interactions': [['x1', 'x0'], ['x2', 'x0'], ['x2', 'x1'], ['x3', 'x0'], ['x3', 'x1'], ['x3', 'x2'], ['x4', 'x0'], ['x4', 'x1'], ['x4', 'x2'], ['x4', 'x3'], ['x5', 'x0'], ['x5', 'x1'], ['x5', 'x2'], ['x5', 'x3'], ['x5', 'x4'], ['x6', 'x0'], ['x6', 'x1'], ['x6', 'x2'], ['x6', 'x3'], ['x6', 'x4'], ['x6', 'x5'], ['x7', 'x0'], ['x7', 'x1'], ['x7', 'x2'], ['x7', 'x3'], ['x7', 'x4'], ['x7', 'x5'], ['x7', 'x6'], ['x8', 'x0'], ['x8', 'x1'], ['x8', 'x2'], ['x8', 'x3'], ['x8', 'x4'], ['x8', 'x5'], ['x8', 'x6'], ['x8', 'x7'], ['x9', 'x0'], ['x9', 'x1'], ['x9', 'x2'], ['x9', 'x3'], ['x9', 'x4'], ['x9', 'x5'], ['x9', 'x6'], ['x9', 'x7'], ['x9', 'x8'], ['x10', 'x0'], ['x10', 'x1'], ['x10', 'x2'], ['x10', 'x3'], ['x10', 'x4'], ['x10', 'x5'], ['x10', 'x6'], ['x10', 'x7'], ['x10', 'x8'], ['x10', 'x9'], ['x11', 'x0'], ['x11', 'x1'], ['x11', 'x2'], ['x11', 'x3'], ['x11', 'x4'], ['x11', 'x5'], ['x11', 'x6'], ['x11', 'x7'], ['x11', 'x8'], ['x11', 'x9'], ['x11', 'x10'], ['x12', 'x0'], ['x12', 'x1'], ['x12', 'x2'], ['x12', 'x3'], ['x12', 'x4'], ['x12', 'x5'], ['x12', 'x6'], ['x12', 'x7'], ['x12', 'x8'], ['x12', 'x9'], ['x12', 'x10'], ['x12', 'x11'], ['x13', 'x0'], ['x13', 'x1'], ['x13', 'x2'], ['x13', 'x3'], ['x13', 'x4'], ['x13', 'x5'], ['x13', 'x6'], ['x13', 'x7'], ['x13', 'x8'], ['x13', 'x9'], ['x13', 'x10'], ['x13', 'x11'], ['x13', 'x12'], ['x14', 'x0'], ['x14', 'x1'], ['x14', 'x2'], ['x14', 'x3'], ['x14', 'x4'], ['x14', 'x5'], ['x14', 'x6'], ['x14', 'x7'], ['x14', 'x8'], ['x14', 'x9'], ['x14', 'x10'], ['x14', 'x11'], ['x14', 'x12'], ['x14', 'x13'], ['x15', 'x0'], ['x15', 'x1'], ['x15', 'x2'], ['x15', 'x3'], ['x15', 'x4'], ['x15', 'x5'], ['x15', 'x6'], ['x15', 'x7'], ['x15', 'x8'], ['x15', 'x9'], ['x15', 'x10'], ['x15', 'x11'], ['x15', 'x12'], ['x15', 'x13'], ['x15', 'x14'], ['x16', 'x0'], ['x16', 'x1'], ['x16', 'x2'], ['x16', 'x3'], ['x16', 'x4'], ['x16', 'x5'], ['x16', 'x6'], ['x16', 'x7'], ['x16', 'x8'], ['x16', 'x9'], ['x16', 'x10'], ['x16', 'x11'], ['x16', 'x12'], ['x16', 'x13'], ['x16', 'x14'], ['x16', 'x15'], ['x17', 'x0'], ['x17', 'x1'], ['x17', 'x2'], ['x17', 'x3'], ['x17', 'x4'], ['x17', 'x5'], ['x17', 'x6'], ['x17', 'x7'], ['x17', 'x8'], ['x17', 'x9'], ['x17', 'x10'], ['x17', 'x11'], ['x17', 'x12'], ['x17', 'x13'], ['x17', 'x14'], ['x17', 'x15'], ['x17', 'x16'], ['x18', 'x0'], ['x18', 'x1'], ['x18', 'x2'], ['x18', 'x3'], ['x18', 'x4'], ['x18', 'x5'], ['x18', 'x6'], ['x18', 'x7'], ['x18', 'x8'], ['x18', 'x9'], ['x18', 'x10'], ['x18', 'x11'], ['x18', 'x12'], ['x18', 'x13'], ['x18', 'x14'], ['x18', 'x15'], ['x18', 'x16'], ['x18', 'x17'], ['x19', 'x0'], ['x19', 'x1'], ['x19', 'x2'], ['x19', 'x3'], ['x19', 'x4'], ['x19', 'x5'], ['x19', 'x6'], ['x19', 'x7'], ['x19', 'x8'], ['x19', 'x9'], ['x19', 'x10'], ['x19', 'x11'], ['x19', 'x12'], ['x19', 'x13'], ['x19', 'x14'], ['x19', 'x15'], ['x19', 'x16'], ['x19', 'x17'], ['x19', 'x18'], ['x20', 'x0'], ['x20', 'x1'], ['x20', 'x2'], ['x20', 'x3'], ['x20', 'x4'], ['x20', 'x5'], ['x20', 'x6'], ['x20', 'x7'], ['x20', 'x8'], ['x20', 'x9'], ['x20', 'x10'], ['x20', 'x11'], ['x20', 'x12'], ['x20', 'x13'], ['x20', 'x14'], ['x20', 'x15'], ['x20', 'x16'], ['x20', 'x17'], ['x20', 'x18'], ['x20', 'x19'], ['x21', 'x0'], ['x21', 'x1'], ['x21', 'x2'], ['x21', 'x3'], ['x21', 'x4'], ['x21', 'x5'], ['x21', 'x6'], ['x21', 'x7'], ['x21', 'x8'], ['x21', 'x9'], ['x21', 'x10'], ['x21', 'x11'], ['x21', 'x12'], ['x21', 'x13'], ['x21', 'x14'], ['x21', 'x15'], ['x21', 'x16'], ['x21', 'x17'], ['x21', 'x18'], ['x21', 'x19'], ['x21', 'x20'], ['x22', 'x0'], ['x22', 'x1'], ['x22', 'x2'], ['x22', 'x3'], ['x22', 'x4'], ['x22', 'x5'], ['x22', 'x6'], ['x22', 'x7'], ['x22', 'x8'], ['x22', 'x9'], ['x22', 'x10'], ['x22', 'x11'], ['x22', 'x12'], ['x22', 'x13'], ['x22', 'x14'], ['x22', 'x15'], ['x22', 'x16'], ['x22', 'x17'], ['x22', 'x18'], ['x22', 'x19'], ['x22', 'x20'], ['x22', 'x21'], ['x23', 'x0'], ['x23', 'x1'], ['x23', 'x2'], ['x23', 'x3'], ['x23', 'x4'], ['x23', 'x5'], ['x23', 'x6'], ['x23', 'x7'], ['x23', 'x8'], ['x23', 'x9'], ['x23', 'x10'], ['x23', 'x11'], ['x23', 'x12'], ['x23', 'x13'], ['x23', 'x14'], ['x23', 'x15'], ['x23', 'x16'], ['x23', 'x17'], ['x23', 'x18'], ['x23', 'x19'], ['x23', 'x20'], ['x23', 'x21'], ['x23', 'x22'], ['x24', 'x0'], ['x24', 'x1'], ['x24', 'x2'], ['x24', 'x3'], ['x24', 'x4'], ['x24', 'x5'], ['x24', 'x6'], ['x24', 'x7'], ['x24', 'x8'], ['x24', 'x9'], ['x24', 'x10'], ['x24', 'x11'], ['x24', 'x12'], ['x24', 'x13'], ['x24', 'x14'], ['x24', 'x15'], ['x24', 'x16'], ['x24', 'x17'], ['x24', 'x18'], ['x24', 'x19'], ['x24', 'x20'], ['x24', 'x21'], ['x24', 'x22'], ['x24', 'x23'], ['x25', 'x0'], ['x25', 'x1'], ['x25', 'x2'], ['x25', 'x3'], ['x25', 'x4'], ['x25', 'x5'], ['x25', 'x6'], ['x25', 'x7'], ['x25', 'x8'], ['x25', 'x9'], ['x25', 'x10'], ['x25', 'x11'], ['x25', 'x12'], ['x25', 'x13'], ['x25', 'x14'], ['x25', 'x15'], ['x25', 'x16'], ['x25', 'x17'], ['x25', 'x18'], ['x25', 'x19'], ['x25', 'x20'], ['x25', 'x21'], ['x25', 'x22'], ['x25', 'x23'], ['x25', 'x24'], ['x26', 'x0'], ['x26', 'x1'], ['x26', 'x2'], ['x26', 'x3'], ['x26', 'x4'], ['x26', 'x5'], ['x26', 'x6'], ['x26', 'x7'], ['x26', 'x8'], ['x26', 'x9'], ['x26', 'x10'], ['x26', 'x11'], ['x26', 'x12'], ['x26', 'x13'], ['x26', 'x14'], ['x26', 'x15'], ['x26', 'x16'], ['x26', 'x17'], ['x26', 'x18'], ['x26', 'x19'], ['x26', 'x20'], ['x26', 'x21'], ['x26', 'x22'], ['x26', 'x23'], ['x26', 'x24'], ['x26', 'x25'], ['x27', 'x0'], ['x27', 'x1'], ['x27', 'x2'], ['x27', 'x3'], ['x27', 'x4'], ['x27', 'x5'], ['x27', 'x6'], ['x27', 'x7'], ['x27', 'x8'], ['x27', 'x9'], ['x27', 'x10'], ['x27', 'x11'], ['x27', 'x12'], ['x27', 'x13'], ['x27', 'x14'], ['x27', 'x15'], ['x27', 'x16'], ['x27', 'x17'], ['x27', 'x18'], ['x27', 'x19'], ['x27', 'x20'], ['x27', 'x21'], ['x27', 'x22'], ['x27', 'x23'], ['x27', 'x24'], ['x27', 'x25'], ['x27', 'x26'], ['x28', 'x0'], ['x28', 'x1'], ['x28', 'x2'], ['x28', 'x3'], ['x28', 'x4'], ['x28', 'x5'], ['x28', 'x6'], ['x28', 'x7'], ['x28', 'x8'], ['x28', 'x9'], ['x28', 'x10'], ['x28', 'x11'], ['x28', 'x12'], ['x28', 'x13'], ['x28', 'x14'], ['x28', 'x15'], ['x28', 'x16'], ['x28', 'x17'], ['x28', 'x18'], ['x28', 'x19'], ['x28', 'x20'], ['x28', 'x21'], ['x28', 'x22'], ['x28', 'x23'], ['x28', 'x24'], ['x28', 'x25'], ['x28', 'x26'], ['x28', 'x27'], ['x29', 'x0'], ['x29', 'x1'], ['x29', 'x2'], ['x29', 'x3'], ['x29', 'x4'], ['x29', 'x5'], ['x29', 'x6'], ['x29', 'x7'], ['x29', 'x8'], ['x29', 'x9'], ['x29', 'x10'], ['x29', 'x11'], ['x29', 'x12'], ['x29', 'x13'], ['x29', 'x14'], ['x29', 'x15'], ['x29', 'x16'], ['x29', 'x17'], ['x29', 'x18'], ['x29', 'x19'], ['x29', 'x20'], ['x29', 'x21'], ['x29', 'x22'], ['x29', 'x23'], ['x29', 'x24'], ['x29', 'x25'], ['x29', 'x26'], ['x29', 'x27'], ['x29', 'x28'], ['x30', 'x0'], ['x30', 'x1'], ['x30', 'x2'], ['x30', 'x3'], ['x30', 'x4'], ['x30', 'x5'], ['x30', 'x6'], ['x30', 'x7'], ['x30', 'x8'], ['x30', 'x9'], ['x30', 'x10'], ['x30', 'x11'], ['x30', 'x12'], ['x30', 'x13'], ['x30', 'x14'], ['x30', 'x15'], ['x30', 'x16'], ['x30', 'x17'], ['x30', 'x18'], ['x30', 'x19'], ['x30', 'x20'], ['x30', 'x21'], ['x30', 'x22'], ['x30', 'x23'], ['x30', 'x24'], ['x30', 'x25'], ['x30', 'x26'], ['x30', 'x27'], ['x30', 'x28'], ['x30', 'x29'], ['x31', 'x0'], ['x31', 'x1'], ['x31', 'x2'], ['x31', 'x3'], ['x31', 'x4'], ['x31', 'x5'], ['x31', 'x6'], ['x31', 'x7'], ['x31', 'x8'], ['x31', 'x9'], ['x31', 'x10'], ['x31', 'x11'], ['x31', 'x12'], ['x31', 'x13'], ['x31', 'x14'], ['x31', 'x15'], ['x31', 'x16'], ['x31', 'x17'], ['x31', 'x18'], ['x31', 'x19'], ['x31', 'x20'], ['x31', 'x21'], ['x31', 'x22'], ['x31', 'x23'], ['x31', 'x24'], ['x31', 'x25'], ['x31', 'x26'], ['x31', 'x27'], ['x31', 'x28'], ['x31', 'x29'], ['x31', 'x30'], ['x32', 'x0'], ['x32', 'x1'], ['x32', 'x2'], ['x32', 'x3'], ['x32', 'x4'], ['x32', 'x5'], ['x32', 'x6'], ['x32', 'x7'], ['x32', 'x8'], ['x32', 'x9'], ['x32', 'x10'], ['x32', 'x11'], ['x32', 'x12'], ['x32', 'x13'], ['x32', 'x14'], ['x32', 'x15'], ['x32', 'x16'], ['x32', 'x17'], ['x32', 'x18'], ['x32', 'x19'], ['x32', 'x20'], ['x32', 'x21'], ['x32', 'x22'], ['x32', 'x23'], ['x32', 'x24'], ['x32', 'x25'], ['x32', 'x26'], ['x32', 'x27'], ['x32', 'x28'], ['x32', 'x29'], ['x32', 'x30'], ['x32', 'x31'], ['x33', 'x0'], ['x33', 'x1'], ['x33', 'x2'], ['x33', 'x3'], ['x33', 'x4'], ['x33', 'x5'], ['x33', 'x6'], ['x33', 'x7'], ['x33', 'x8'], ['x33', 'x9'], ['x33', 'x10'], ['x33', 'x11'], ['x33', 'x12'], ['x33', 'x13'], ['x33', 'x14'], ['x33', 'x15'], ['x33', 'x16'], ['x33', 'x17'], ['x33', 'x18'], ['x33', 'x19'], ['x33', 'x20'], ['x33', 'x21'], ['x33', 'x22'], ['x33', 'x23'], ['x33', 'x24'], ['x33', 'x25'], ['x33', 'x26'], ['x33', 'x27'], ['x33', 'x28'], ['x33', 'x29'], ['x33', 'x30'], ['x33', 'x31'], ['x33', 'x32'], ['x34', 'x0'], ['x34', 'x1'], ['x34', 'x2'], ['x34', 'x3'], ['x34', 'x4'], ['x34', 'x5'], ['x34', 'x6'], ['x34', 'x7'], ['x34', 'x8'], ['x34', 'x9'], ['x34', 'x10'], ['x34', 'x11'], ['x34', 'x12'], ['x34', 'x13'], ['x34', 'x14'], ['x34', 'x15'], ['x34', 'x16'], ['x34', 'x17'], ['x34', 'x18'], ['x34', 'x19'], ['x34', 'x20'], ['x34', 'x21'], ['x34', 'x22'], ['x34', 'x23'], ['x34', 'x24'], ['x34', 'x25'], ['x34', 'x26'], ['x34', 'x27'], ['x34', 'x28'], ['x34', 'x29'], ['x34', 'x30'], ['x34', 'x31'], ['x34', 'x32'], ['x34', 'x33'], ['x35', 'x0'], ['x35', 'x1'], ['x35', 'x2'], ['x35', 'x3'], ['x35', 'x4'], ['x35', 'x5'], ['x35', 'x6'], ['x35', 'x7'], ['x35', 'x8'], ['x35', 'x9'], ['x35', 'x10'], ['x35', 'x11'], ['x35', 'x12'], ['x35', 'x13'], ['x35', 'x14'], ['x35', 'x15'], ['x35', 'x16'], ['x35', 'x17'], ['x35', 'x18'], ['x35', 'x19'], ['x35', 'x20'], ['x35', 'x21'], ['x35', 'x22'], ['x35', 'x23'], ['x35', 'x24'], ['x35', 'x25'], ['x35', 'x26'], ['x35', 'x27'], ['x35', 'x28'], ['x35', 'x29'], ['x35', 'x30'], ['x35', 'x31'], ['x35', 'x32'], ['x35', 'x33'], ['x35', 'x34'], ['x36', 'x0'], ['x36', 'x1'], ['x36', 'x2'], ['x36', 'x3'], ['x36', 'x4'], ['x36', 'x5'], ['x36', 'x6'], ['x36', 'x7'], ['x36', 'x8'], ['x36', 'x9'], ['x36', 'x10'], ['x36', 'x11'], ['x36', 'x12'], ['x36', 'x13'], ['x36', 'x14'], ['x36', 'x15'], ['x36', 'x16'], ['x36', 'x17'], ['x36', 'x18'], ['x36', 'x19'], ['x36', 'x20'], ['x36', 'x21'], ['x36', 'x22'], ['x36', 'x23'], ['x36', 'x24'], ['x36', 'x25'], ['x36', 'x26'], ['x36', 'x27'], ['x36', 'x28'], ['x36', 'x29'], ['x36', 'x30'], ['x36', 'x31'], ['x36', 'x32'], ['x36', 'x33'], ['x36', 'x34'], ['x36', 'x35'], ['x37', 'x0'], ['x37', 'x1'], ['x37', 'x2'], ['x37', 'x3'], ['x37', 'x4'], ['x37', 'x5'], ['x37', 'x6'], ['x37', 'x7'], ['x37', 'x8'], ['x37', 'x9'], ['x37', 'x10'], ['x37', 'x11'], ['x37', 'x12'], ['x37', 'x13'], ['x37', 'x14'], ['x37', 'x15'], ['x37', 'x16'], ['x37', 'x17'], ['x37', 'x18'], ['x37', 'x19'], ['x37', 'x20'], ['x37', 'x21'], ['x37', 'x22'], ['x37', 'x23'], ['x37', 'x24'], ['x37', 'x25'], ['x37', 'x26'], ['x37', 'x27'], ['x37', 'x28'], ['x37', 'x29'], ['x37', 'x30'], ['x37', 'x31'], ['x37', 'x32'], ['x37', 'x33'], ['x37', 'x34'], ['x37', 'x35'], ['x37', 'x36'], ['x38', 'x0'], ['x38', 'x1'], ['x38', 'x2'], ['x38', 'x3'], ['x38', 'x4'], ['x38', 'x5'], ['x38', 'x6'], ['x38', 'x7'], ['x38', 'x8'], ['x38', 'x9'], ['x38', 'x10'], ['x38', 'x11'], ['x38', 'x12'], ['x38', 'x13'], ['x38', 'x14'], ['x38', 'x15'], ['x38', 'x16'], ['x38', 'x17'], ['x38', 'x18'], ['x38', 'x19'], ['x38', 'x20'], ['x38', 'x21'], ['x38', 'x22'], ['x38', 'x23'], ['x38', 'x24'], ['x38', 'x25'], ['x38', 'x26'], ['x38', 'x27'], ['x38', 'x28'], ['x38', 'x29'], ['x38', 'x30'], ['x38', 'x31'], ['x38', 'x32'], ['x38', 'x33'], ['x38', 'x34'], ['x38', 'x35'], ['x38', 'x36'], ['x38', 'x37'], ['x39', 'x0'], ['x39', 'x1'], ['x39', 'x2'], ['x39', 'x3'], ['x39', 'x4'], ['x39', 'x5'], ['x39', 'x6'], ['x39', 'x7'], ['x39', 'x8'], ['x39', 'x9'], ['x39', 'x10'], ['x39', 'x11'], ['x39', 'x12'], ['x39', 'x13'], ['x39', 'x14'], ['x39', 'x15'], ['x39', 'x16'], ['x39', 'x17'], ['x39', 'x18'], ['x39', 'x19'], ['x39', 'x20'], ['x39', 'x21'], ['x39', 'x22'], ['x39', 'x23'], ['x39', 'x24'], ['x39', 'x25'], ['x39', 'x26'], ['x39', 'x27'], ['x39', 'x28'], ['x39', 'x29'], ['x39', 'x30'], ['x39', 'x31'], ['x39', 'x32'], ['x39', 'x33'], ['x39', 'x34'], ['x39', 'x35'], ['x39', 'x36'], ['x39', 'x37'], ['x39', 'x38']]}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [180, 181, 182, 183, 2940], 'source_variables': ['x0'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [195, 196, 197, 198, 2955], 'source_variables': ['x1'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [150, 151, 152, 153, 2970], 'source_variables': ['x2'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [165, 166, 167, 168, 2985], 'source_variables': ['x3'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [210, 211, 212, 213, 3000], 'source_variables': ['x4'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [225, 226, 227, 228, 3015], 'source_variables': ['x5'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [240, 241, 242, 3540], 'source_variables': ['x6'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [255, 256, 257, 3555], 'source_variables': ['x7'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [270, 271, 272, 3510, 3511], 'source_variables': ['x8'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [285, 286, 287, 3525, 3526], 'source_variables': ['x9'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [300, 301, 302, 3480, 3481], 'source_variables': ['x10'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [315, 316, 317, 3495, 3496], 'source_variables': ['x11'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [330, 331, 332, 3450, 3451], 'source_variables': ['x12'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [345, 346, 347, 3465, 3466], 'source_variables': ['x13'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [360, 361, 362, 3420, 3421], 'source_variables': ['x14'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [375, 376, 377, 3435, 3436], 'source_variables': ['x15'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [390, 391, 392, 3390, 3391], 'source_variables': ['x16'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [405, 406, 407, 3405, 3406], 'source_variables': ['x17'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [435, 436, 3375, 3376], 'source_variables': ['x19'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [450, 451, 3330, 3331, 3332], 'source_variables': ['x20'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [465, 466, 3345, 3346, 3347], 'source_variables': ['x21'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [480, 481, 3300, 3301, 3302], 'source_variables': ['x22'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [495, 496, 3315, 3316, 3317], 'source_variables': ['x23'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [510, 511, 3270, 3271, 3272], 'source_variables': ['x24'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [525, 526, 3285, 3286, 3287], 'source_variables': ['x25'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [555, 556, 3255, 3256, 3257], 'source_variables': ['x27'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [570, 571, 3210, 3211, 3212], 'source_variables': ['x28'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [585, 586, 3225, 3226, 3227], 'source_variables': ['x29'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [600, 3180, 3181, 3182], 'source_variables': ['x30'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [615, 3195, 3196, 3197], 'source_variables': ['x31'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [645, 3165, 3166, 3167, 3168], 'source_variables': ['x33'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [660, 3030, 3031, 3032], 'source_variables': ['x34'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [675, 3045, 3046, 3047], 'source_variables': ['x35'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [120, 3060, 3061, 3062, 3063], 'source_variables': ['x36'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [135, 3075, 3076, 3077, 3078], 'source_variables': ['x37'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [90, 3090, 3091, 3092, 3093], 'source_variables': ['x38'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [105, 3105, 3106, 3107, 3108], 'source_variables': ['x39'], 'sample_index': 0}}, {'type': , 'message': 'All samples have broken chains', 'level': 30, 'data': {}}], 'embedding_context': {'embedding': {'x0': [180, 181, 182, 183, 2940], 'x1': [195, 196, 197, 198, 2955], 'x2': [150, 151, 152, 153, 2970], 'x3': [165, 166, 167, 168, 2985], 'x4': [210, 211, 212, 213, 3000], 'x5': [225, 226, 227, 228, 3015], 'x6': [240, 241, 242, 3540], 'x7': [255, 256, 257, 3555], 'x8': [270, 271, 272, 3510, 3511], 'x9': [285, 286, 287, 3525, 3526], 'x10': [300, 301, 302, 3480, 3481], 'x11': [315, 316, 317, 3495, 3496], 'x12': [330, 331, 332, 3450, 3451], 'x13': [345, 346, 347, 3465, 3466], 'x14': [360, 361, 362, 3420, 3421], 'x15': [375, 376, 377, 3435, 3436], 'x16': [390, 391, 392, 3390, 3391], 'x17': [405, 406, 407, 3405, 3406], 'x18': [420, 421, 3360, 3361], 'x19': [435, 436, 3375, 3376], 'x20': [450, 451, 3330, 3331, 3332], 'x21': [465, 466, 3345, 3346, 3347], 'x22': [480, 481, 3300, 3301, 3302], 'x23': [495, 496, 3315, 3316, 3317], 'x24': [510, 511, 3270, 3271, 3272], 'x25': [525, 526, 3285, 3286, 3287], 'x26': [540, 541, 3240, 3241, 3242], 'x27': [555, 556, 3255, 3256, 3257], 'x28': [570, 571, 3210, 3211, 3212], 'x29': [585, 586, 3225, 3226, 3227], 'x30': [600, 3180, 3181, 3182], 'x31': [615, 3195, 3196, 3197], 'x32': [630, 3150, 3151, 3152, 3153], 'x33': [645, 3165, 3166, 3167, 3168], 'x34': [660, 3030, 3031, 3032], 'x35': [675, 3045, 3046, 3047], 'x36': [120, 3060, 3061, 3062, 3063], 'x37': [135, 3075, 3076, 3077, 3078], 'x38': [90, 3090, 3091, 3092, 3093], 'x39': [105, 3105, 3106, 3107, 3108]}, 'chain_break_method': 'majority_vote', 'embedding_parameters': {}, 'chain_strength': 0.0001, 'timing': {'embedding': 0.0022098999997979263, 'unembedding': 0.0011283000003459165}}}, 'BINARY')" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "63f9a5af", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.float64(1.0)" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.chain_break_fraction" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "9a3218a1", + "metadata": {}, + "outputs": [], + "source": [ + "def communities_to_list(sample, communities_number) -> list:\n", + " communities = []\n", + " for k in range(communities_number):\n", + " subcommunity = []\n", + " for i in sample:\n", + " if sample[i] == k:\n", + " key = int(i[1:])\n", + " subcommunity.append(key)\n", + " communities.append(subcommunity)\n", + "\n", + " return communities" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "6ee50a17", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'x0': np.int8(1),\n", + " 'x1': np.int8(1),\n", + " 'x10': np.int8(0),\n", + " 'x11': np.int8(0),\n", + " 'x12': np.int8(1),\n", + " 'x13': np.int8(1),\n", + " 'x14': np.int8(1),\n", + " 'x15': np.int8(0),\n", + " 'x16': np.int8(1),\n", + " 'x17': np.int8(1),\n", + " 'x18': np.int8(1),\n", + " 'x19': np.int8(1),\n", + " 'x2': np.int8(1),\n", + " 'x20': np.int8(1),\n", + " 'x21': np.int8(1),\n", + " 'x22': np.int8(1),\n", + " 'x23': np.int8(1),\n", + " 'x24': np.int8(0),\n", + " 'x25': np.int8(1),\n", + " 'x26': np.int8(1),\n", + " 'x27': np.int8(1),\n", + " 'x28': np.int8(1),\n", + " 'x29': np.int8(1),\n", + " 'x3': np.int8(0),\n", + " 'x30': np.int8(1),\n", + " 'x31': np.int8(1),\n", + " 'x32': np.int8(1),\n", + " 'x33': np.int8(0),\n", + " 'x34': np.int8(1),\n", + " 'x35': np.int8(1),\n", + " 'x36': np.int8(1),\n", + " 'x37': np.int8(0),\n", + " 'x38': np.int8(1),\n", + " 'x39': np.int8(0),\n", + " 'x4': np.int8(0),\n", + " 'x40': np.int8(1),\n", + " 'x41': np.int8(1),\n", + " 'x42': np.int8(0),\n", + " 'x43': np.int8(1),\n", + " 'x44': np.int8(0),\n", + " 'x45': np.int8(0),\n", + " 'x46': np.int8(1),\n", + " 'x47': np.int8(1),\n", + " 'x48': np.int8(0),\n", + " 'x49': np.int8(1),\n", + " 'x5': np.int8(1),\n", + " 'x50': np.int8(1),\n", + " 'x51': np.int8(1),\n", + " 'x52': np.int8(1),\n", + " 'x53': np.int8(1),\n", + " 'x54': np.int8(0),\n", + " 'x55': np.int8(0),\n", + " 'x56': np.int8(0),\n", + " 'x57': np.int8(0),\n", + " 'x58': np.int8(0),\n", + " 'x59': np.int8(0),\n", + " 'x6': np.int8(1),\n", + " 'x60': np.int8(0),\n", + " 'x61': np.int8(1),\n", + " 'x62': np.int8(0),\n", + " 'x63': np.int8(0),\n", + " 'x64': np.int8(0),\n", + " 'x65': np.int8(0),\n", + " 'x66': np.int8(0),\n", + " 'x67': np.int8(1),\n", + " 'x68': np.int8(1),\n", + " 'x69': np.int8(1),\n", + " 'x7': np.int8(0),\n", + " 'x70': np.int8(1),\n", + " 'x71': np.int8(1),\n", + " 'x72': np.int8(0),\n", + " 'x73': np.int8(1),\n", + " 'x74': np.int8(0),\n", + " 'x75': np.int8(0),\n", + " 'x76': np.int8(0),\n", + " 'x77': np.int8(1),\n", + " 'x78': np.int8(1),\n", + " 'x79': np.int8(1),\n", + " 'x8': np.int8(0),\n", + " 'x80': np.int8(0),\n", + " 'x81': np.int8(0),\n", + " 'x82': np.int8(1),\n", + " 'x83': np.int8(1),\n", + " 'x84': np.int8(0),\n", + " 'x85': np.int8(1),\n", + " 'x86': np.int8(1),\n", + " 'x87': np.int8(0),\n", + " 'x88': np.int8(0),\n", + " 'x89': np.int8(1),\n", + " 'x9': np.int8(0),\n", + " 'x90': np.int8(0),\n", + " 'x91': np.int8(0),\n", + " 'x92': np.int8(1),\n", + " 'x93': np.int8(0),\n", + " 'x94': np.int8(1),\n", + " 'x95': np.int8(0),\n", + " 'x96': np.int8(1),\n", + " 'x97': np.int8(0),\n", + " 'x98': np.int8(0),\n", + " 'x99': np.int8(1)}" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.dwave_sampleset.first.sample" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "1dff148f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.17768595041322313" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "nx.community.modularity(G, communities_to_list(res.sampleset_info.dwave_sampleset.first.sample, 2))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "qomm_env", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/QHyper/setup.py b/QHyper/setup.py new file mode 100644 index 0000000..157dc3a --- /dev/null +++ b/QHyper/setup.py @@ -0,0 +1,29 @@ +from setuptools import setup, find_packages + + +DESCRIPTION = 'Quantum and classical problem solvers' +LONG_DESCRIPTION = 'A package that allows to build and solve quantum and classical problems using predefined solvers and problems.' + + +# Setting up +setup( + name="qhyper", + version='0.3.4', + author="ACC Cyfronet AGH", + author_email="jzawalska@agh.edu.pl", + description=DESCRIPTION, + long_description_content_type="text/markdown", + long_description=LONG_DESCRIPTION, + packages=find_packages(exclude=['tests']), + install_requires=['numpy~=1.26.4', 'PennyLane~=0.38', 'tdqm', 'sympy==1.13.1', 'dwave-system', 'gurobipy', 'pandas', 'wfcommons'], + keywords=['python', 'qhyper', 'quantum', 'solver', 'experiment'], + license='MIT', + classifiers=[ + "Development Status :: 1 - Planning", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "Operating System :: Unix", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + ] +) diff --git a/QHyper/solvers/base.py b/QHyper/solvers/base.py index fc4b373..fdbac6d 100644 --- a/QHyper/solvers/base.py +++ b/QHyper/solvers/base.py @@ -7,7 +7,7 @@ from dataclasses import dataclass, field import numpy as np -from typing import Any +from typing import Any, Optional from QHyper.problems.base import Problem from QHyper.optimizers import OptimizationResult @@ -21,6 +21,57 @@ class SolverException(Exception): pass +# class SamplesetDataHandler + + +@dataclass +class SamplesetData: + """ + Class for storing additional sampleset information. + Attributes + ---------- + dwave_sampleset_metadata : np.ndarray + Record array containing metadata obtained from D-Wave: + - qpu_sampling_time_us, + - qpu_anneal_time_per_sample_us, + - qpu_readout_time_per_sample_us, + - qpu_access_time_us, + - qpu_access_overhead_time_us, + - qpu_programming_time_us, + - qpu_delay_time_per_sample_us, + - total_post_processing_time_us, + - post_processing_overhead_time_us, + + The time units are microseconds (us) according to the D-Wave Docs (July 2025): + https://docs.dwavequantum.com/en/latest/quantum_research/operation_timing.html. + + + time_measurements : np.ndarray + Record array containining information about time measurements of: + - find_clique_embedding_time_s - in case of clique embedding: + first call to that function after installment results + in the embedding search (might take minutes), next calls are accessing the clique + emedding cache file, + or + - find_heuristic_embedding_time_s - in case of heuristic embedding: search for heuristic embedding, + - fixed_embedding_composite_time_s - creating FixedEmbeddingComposite object, + - sample_func_time_s - method execution of the .sample function - communication with the solver itself. + (https://dwave-systemdocs.readthedocs.io/en/link_fix/reference/composites/generated/dwave.system.composites.FixedEmbeddingComposite.sample.html#dwave.system.composites.FixedEmbeddingComposite.sample), + + """ + dwave_sampleset_metadata: np.ndarray | None = None + time_measurements: np.ndarray | None = None + dwave_sampleset: dict | None = None + timing: dict | None = None + problem_id: str | int | float = None + community_hash: str | int | None = None + chain_strength: float | None = None + chain_break_fraction: float | None = None + chain_break_method: str | None = None + embedding: dict | None = None + warnings: dict | None = None + community: list[int] | None = None + @dataclass class SolverResult: """ @@ -37,10 +88,14 @@ class SolverResult: History of the solver. Each element of the list represents the values of the objective function at each iteration - there can be multiple results per each iteration (epoch). + sampleset_info : Optional[SamplesetData] + Additional information about the sampleset in case of sampling-based + methods such as with quantum annealing. """ probabilities: np.recarray params: dict[Any, Any] history: list[list[OptimizationResult]] = field(default_factory=list) + sampleset_info: Optional[SamplesetData] = None class Solver(ABC): diff --git a/QHyper/solvers/quantum_annealing/dwave/advantage.py b/QHyper/solvers/quantum_annealing/dwave/advantage.py index 481ba1d..a85f7e3 100644 --- a/QHyper/solvers/quantum_annealing/dwave/advantage.py +++ b/QHyper/solvers/quantum_annealing/dwave/advantage.py @@ -1,22 +1,51 @@ import os -from typing import Any +from typing import Any, Callable, Dict import numpy as np import numpy.typing as npt from dataclasses import dataclass from collections import defaultdict from QHyper.problems.base import Problem -from QHyper.solvers.base import Solver, SolverResult +from QHyper.solvers.base import Solver, SolverResult, SamplesetData from QHyper.converter import Converter from QHyper.constraint import Polynomial -from dwave.system import DWaveSampler, EmbeddingComposite +from dwave.system import DWaveSampler from dwave.system.composites import FixedEmbeddingComposite from dimod import BinaryQuadraticModel from dwave.embedding.pegasus import find_clique_embedding +from minorminer import find_embedding +from dwave.system import LeapHybridBQMSampler +import warnings +import pickle +import dwave.inspector +from dwave.inspector.adapters import enable_data_capture +from enum import Enum -DWAVE_API_TOKEN = os.environ.get('DWAVE_API_TOKEN') +import time +import dimod +import json + + +DWAVE_API_TOKEN = os.environ.get("DWAVE_API_TOKEN") + + +def enable_DWave_inspector_results_data_capture(): + """Enables DWave Inspector sampler's results saving in local memory.""" + enable_data_capture() + + +class TimeUnits(str, Enum): + S = "s" + US = "us" + + +class Timing: + FIND_CLIQUE_EMBEDDING = f"find_clique_embedding_time_{TimeUnits.S}" + FIND_HEURISTIC_EMBEDDING = f"find_heuristic_embedding_time_{TimeUnits.S}" + FIXED_EMBEDDING_COMPOSITE = f"fixed_embedding_composite_time_{TimeUnits.S}" + SAMPLE_FUNCTION = f"sample_func_time_{TimeUnits.S}" @dataclass @@ -39,66 +68,161 @@ class Advantage(Solver): use_clique_embedding: bool, default False Find clique for the embedding **config: Any - Config for the D-Wave solver. Documentation available at https://docs.dwavequantum.com + Config for the D-Wave solver. Documentation available at https://docs.dwavequantum.com """ problem: Problem penalty_weights: list[float] | None = None + version: str | None = None + region: str | None = None num_reads: int = 1 chain_strength: float | None = None token: str | None = None - def __init__(self, - problem: Problem, - penalty_weights: list[float] | None = None, - num_reads: int = 1, - chain_strength: float | None = None, - use_clique_embedding: bool = False, - token: str | None = None, - **config: Any) -> None: + def __init__( + self, + problem: Problem, + penalty_weights: list[float] | None = None, + version: str | None = None, + region: str | None = None, + num_reads: int = 1, + chain_strength: float | None = None, + use_clique_embedding: bool = False, + token: str | None = None, + elapse_times: bool = False, + **config: Any, + ) -> None: self.problem = problem self.penalty_weights = penalty_weights self.num_reads = num_reads self.chain_strength = chain_strength self.use_clique_embedding = use_clique_embedding - self.sampler = DWaveSampler( + self.version = version + self.region = region + if (self.version and not self.region) or (self.region and not self.version): + raise ValueError("Both 'version' and 'region' must be specified together.") + if self.version and self.region: + self.sampler = DWaveSampler( + solver=self.version, region=self.region, token=token or DWAVE_API_TOKEN, **config) + else: + self.sampler = DWaveSampler(token=token or DWAVE_API_TOKEN, **config) self.token = token + self.elapse_times = elapse_times + self.times: Dict = {} if use_clique_embedding: - args = self.weigths if self.weigths else [] + args = self.penalty_weights if self.penalty_weights else [] qubo = Converter.create_qubo(self.problem, args) qubo_terms, offset = convert_qubo_keys(qubo) bqm = BinaryQuadraticModel.from_qubo(qubo_terms, offset=offset) - self.embedding = find_clique_embedding( - bqm.to_networkx_graph(), - target_graph=self.sampler.to_networkx_graph() + self.embedding = execute_timed( + lambda: find_clique_embedding( + bqm.to_networkx_graph(), + target_graph=self.sampler.to_networkx_graph(), + ), + self.elapse_times, + self.times, + Timing.FIND_CLIQUE_EMBEDDING, ) - def solve(self, penalty_weights: list[float] | None = None) -> Any: - if penalty_weights is None and self.penalty_weights is None: - penalty_weights = [1.] * (len(self.problem.constraints) + 1) - penalty_weights = self.penalty_weights if penalty_weights is None else penalty_weights + enable_DWave_inspector_results_data_capture() - if not self.use_clique_embedding: - embedding_compose = EmbeddingComposite(self.sampler) - else: - embedding_compose = FixedEmbeddingComposite( - self.sampler, self.embedding) + def solve( + self, + penalty_weights: list[float] | None = None, + return_metadata: bool = False, + saving_path: str | None = None, + label: str | None = None + ) -> Any: + if penalty_weights is None and self.penalty_weights is None: + penalty_weights = [1.0] * (len(self.problem.constraints) + 1) + penalty_weights = ( + self.penalty_weights if penalty_weights is None else penalty_weights + ) qubo = Converter.create_qubo(self.problem, penalty_weights) qubo_terms, offset = convert_qubo_keys(qubo) bqm = BinaryQuadraticModel.from_qubo(qubo_terms, offset=offset) - sampleset = embedding_compose.sample( - bqm, num_reads=self.num_reads, chain_strength=self.chain_strength + + label = f"{label}_" + f"n={str(self.problem.G.number_of_nodes())}_" + f"comm_hash={str(hash(tuple(self.problem.community)))}_" + + if not self.use_clique_embedding: + self.embedding = execute_timed( + lambda: find_embedding( + bqm.to_networkx_graph(), + self.sampler.to_networkx_graph(), + ), + self.elapse_times, + self.times, + Timing.FIND_HEURISTIC_EMBEDDING, + ) + + embedding_compose = execute_timed( + lambda: FixedEmbeddingComposite(self.sampler, self.embedding), + self.elapse_times, + self.times, + Timing.FIXED_EMBEDDING_COMPOSITE, ) + # Additional sampling info + return_embedding = True + + start = time.perf_counter() + sampleset = embedding_compose.sample( + bqm, + num_reads=self.num_reads, + chain_strength=self.chain_strength, + return_embedding=return_embedding, + warnings=dwave.system.warnings.SAVE, + label=label+str(hash(tuple(qubo_terms.items()))) + ) + # Promise is supposed to be returned, needs resolving + sampleset.resolve() + end = time.perf_counter() + if self.elapse_times: + self.times[Timing.SAMPLE_FUNCTION] = end - start + + first = next(sampleset.data(sorted_by=["energy"], name="Sample", index=True)) + + chain_break_fraction = first.chain_break_fraction + + # There might a case when the problem solution failed and there is no info in return + try: + problem_id = sampleset.info["problem_id"] + embedding_context = sampleset.info["embedding_context"] + chain_strength_extracted = embedding_context["chain_strength"] + chain_break_method = embedding_context["chain_break_method"] + embedding_extracted = embedding_context["embedding"] + timing = sampleset.info["timing"] + warnings_sampleset = sampleset.info.get("warnings", {}) + except Exception as e: + print(f"Could not extract info from sampleset.info: {e}") + problem_id = None + embedding_context = None + chain_break_method = None + embedding_extracted = None + timing = None + warnings_sampleset = None + + + label += f"_id={problem_id}" + + # try: + # pickle_bytes = pickle.dumps(sampleset.to_serializable()) + # with open(f"{saving_path}_{label}_serializable.pkl" if saving_path else f"{label}_sampleset_adv_serializable.pkl", "wb") as f: + # f.write(pickle_bytes) + # except Exception as e: + # print(f"Could not save serializable sampleset to .pkl file: {e}") + result = np.recarray( (len(sampleset),), - dtype=([(v, int) for v in sampleset.variables] - + [('probability', float)] - + [('energy', float)]) + dtype=( + [(v, int) for v in sampleset.variables] + + [("probability", float)] + + [("energy", float)] + ), ) num_of_shots = sampleset.record.num_occurrences.sum() @@ -106,15 +230,55 @@ def solve(self, penalty_weights: list[float] | None = None) -> Any: for var in sampleset.variables: result[var][i] = solution.sample[var] - result['probability'][i] = ( - solution.num_occurrences / num_of_shots) - result['energy'][i] = solution.energy + result["probability"][i] = solution.num_occurrences / num_of_shots + result["energy"][i] = solution.energy - return SolverResult(result, {"penalty_weights": penalty_weights}, []) + + + if return_metadata and (not "timing" in sampleset.info or not sampleset.info["timing"]): + warnings.warn( + "No timing information available for the sampleset " + + f" for problem with community: {self.problem.community}" + + f" problem_id: {problem_id}", UserWarning + ) + + if return_metadata: + if "timing" in sampleset.info and sampleset.info["timing"]: + dwave_sampleset_metadata=time_dict_to_ndarray( + add_time_units_to_dwave_timing_info( + sampleset.info["timing"], TimeUnits.US + ) + ) + else: + dwave_sampleset_metadata=None + sampleset_info = SamplesetData( + dwave_sampleset_metadata=dwave_sampleset_metadata, + time_measurements=time_dict_to_ndarray(self.times), + dwave_sampleset=sampleset, + timing=timing, + problem_id=problem_id, + community_hash=hash(tuple(self.problem.community)), + chain_strength=chain_strength_extracted, + chain_break_fraction=chain_break_fraction, + chain_break_method=chain_break_method, + embedding=embedding_extracted, + warnings=warnings_sampleset, + community=self.problem.community, + ) + else: + sampleset_info = None - def prepare_solver_result(self, result: defaultdict, arguments: npt.NDArray) -> SolverResult: - sorted_keys = sorted(result.keys(), key=lambda x: int(''.join(filter(str.isdigit, x)))) - values = ''.join(str(result[key]) for key in sorted_keys) + return SolverResult( + result, {"penalty_weights": penalty_weights}, [], sampleset_info + ) + + def prepare_solver_result( + self, result: defaultdict, arguments: npt.NDArray + ) -> SolverResult: + sorted_keys = sorted( + result.keys(), key=lambda x: int("".join(filter(str.isdigit, x))) + ) + values = "".join(str(result[key]) for key in sorted_keys) probabilities = {values: 100.0} parameters = {values: arguments} @@ -137,3 +301,66 @@ def convert_qubo_keys(qubo: Polynomial) -> tuple[dict[tuple, float], float]: new_qubo[new_key] += v return (new_qubo, offset) + + +def execute_timed( + func: Callable, measure_time: bool, times_dict: Dict, key: str +) -> Any: + """ + Execute a function with optional timing measurement. + + Parameters: + ----------- + func : callable + The function to execute and potentially time. + measure_time : bool + Whether to measure execution time. + times_dict : dict + Dictionary where timing results will be stored. + key : str + Key to use for storing the timing result. + Returns: + -------- + The result of func executed. + """ + if measure_time: + start_time = time.perf_counter() + result = func() + times_dict[key] = time.perf_counter() - start_time + return result + else: + return func() + + +def time_dict_to_ndarray(sampleset_info_times: dict[str, float]) -> np.ndarray: + dtype = [(key, float) for key in sampleset_info_times] + result = np.recarray((), dtype=dtype) + for key, value in sampleset_info_times.items(): + setattr(result, key, value) + + return result + + +def add_time_units_to_dwave_timing_info( + dwave_sampleset_info_timing: dict[str, float], time_unit: TimeUnits = TimeUnits.US +) -> dict[str, float]: + """ + Add time units to the D-Wave timing info. + + Parameters: + ----------- + dwave_sampleset_info_timing : dict[str, float] + DWave dictionary with timing information. + time_unit : TimeUnits, optional + The time unit to append to the keys (default by DWave docs is TimeUnits.US). + + Returns: + -------- + np.ndarray + A record array with the timing information and units. + """ + dwave_keys_with_unit = [ + key + f"_{time_unit.value}" for key in dwave_sampleset_info_timing.keys() + ] + return dict(zip(dwave_keys_with_unit, dwave_sampleset_info_timing.values())) + diff --git a/QHyper/solvers/quantum_annealing/dwave/results_handler.py b/QHyper/solvers/quantum_annealing/dwave/results_handler.py new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/tests/__init__.py b/QHyper/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/QHyper/tests/test_converter.py b/QHyper/tests/test_converter.py new file mode 100644 index 0000000..6562a82 --- /dev/null +++ b/QHyper/tests/test_converter.py @@ -0,0 +1,272 @@ +import sympy +from dimod import ConstrainedQuadraticModel, DiscreteQuadraticModel, BinaryPolynomial, make_quadratic_cqm, BINARY + +from QHyper.polynomial import Polynomial +from QHyper.problems.base import Problem +from QHyper.parser import from_sympy +from QHyper.converter import Converter +from QHyper.constraint import Constraint, Operator, MethodsForInequalities + + +class SimpleProblem(Problem): + def __init__(self, objective_function, + constraints, method_for_inequalities) -> None: + self.objective_function = objective_function + self.constraints = constraints + self.method_for_inequalities = method_for_inequalities + + def get_score(self, result: str, penalty: float = 0) -> float: + # todo implement + return 0 + + +def test_example_0(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy(variables[0] + variables[1]) + + constraint_le = Constraint(objective_function, Polynomial(1), + Operator.LE, MethodsForInequalities.SLACKS_LOG_2, "s",) + + constraint_le_1 = Constraint(objective_function, Polynomial(2), + Operator.LE, MethodsForInequalities.SLACKS_LOG_2, "t",) + problem = SimpleProblem( + objective_function, [constraint_le, constraint_le_1], + MethodsForInequalities.SLACKS_LOG_2) + + weights = [2., 4., 8.] + qubo = Converter.create_qubo(problem, weights) + + expected = Polynomial({ + ('s_0', 'x0'): 8, + ('s_0', 'x1'): 8, + ('s_0', 's_0'): 4, + ('s_0', ): -8, + ('t_0', 'x0'): 16, + ('t_1', 'x0'): 16, + ('t_0', 'x1'): 16, + ('t_1', 'x1'): 16, + ('t_0', 't_0'): 8, + ('t_1', 't_1'): 8, + ('t_0', ): -32, + ('t_0', 't_1'): 16, + ('t_1', ): -32, + ('x0', 'x0'): 12, + ('x1', 'x1'): 12, + ('x0', ): -38, + ('x0', 'x1'): 24, + ('x1', ): -38, + (): 36, + }) + assert qubo==expected + + +def test_example_1(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy(- (2 * variables[0] + 5 * variables[1] + variables[0] * variables[1])) + + constraint_eq_lhs = Polynomial({("x0",): 1, ("x1",): 1}) + constraint_eq = Constraint(constraint_eq_lhs, Polynomial(1), Operator.EQ) + + constraint_le_lhs = Polynomial({("x0",): 5, ("x1",): 2}) + constraint_le = Constraint(constraint_le_lhs, Polynomial(5), + Operator.LE, MethodsForInequalities.SLACKS_LOG_2, "s") + + problem = SimpleProblem( + objective_function, [constraint_eq, constraint_le], + MethodsForInequalities.SLACKS_LOG_2) + weights = [1., 2., 3.] + qubo = Converter.create_qubo(problem, weights) + + expected = Polynomial({ + ("s_0", "x0"): 30, + ("s_0", "x1"): 12, + ("s_1", "x0"): 60, + ("s_2", "x0"): 60, + ("s_1", "x1"): 24, + ("s_0", "s_0"): 3, + ("s_0", "s_1"): 12, + ("s_0", "s_2"): 12, + ("s_0",): -30, + ("s_1", "s_1"): 12, + ("s_2", "s_2"): 12, + ("s_1",): -60, + ("s_1", "s_2"): 24, + ("s_2",): -60, + ("s_2", "x1"): 24, + ("x0", "x0"): 77, + ("x1", "x1"): 14, + ("x0",): -156, + ("x0", "x1"): 63, + ("x1",): -69, + (): 77, + }) + + assert qubo == expected + + +def test_example_2(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy( + 5 * variables[0] + + 2 * variables[1] + + variables[0] * variables[1] + ) + + constraint_le_lhs = Polynomial({("x0",): 5, ("x1",): 2}) + constraint_le = Constraint(constraint_le_lhs, Polynomial(5), + Operator.LE, MethodsForInequalities.UNBALANCED_PENALIZATION) + + weights = [1., 1., 1.] + problem = SimpleProblem( + objective_function, [constraint_le], + MethodsForInequalities.SLACKS_LOG_2) + qubo = Converter.create_qubo(problem, weights) + + expected = Polynomial({ + ("x0", "x0"): 25, + ("x0", "x1"): 21, + ("x0",): -40, + ("x1", "x1"): 4, + ("x1",): -16, + (): 20, + }) + + assert qubo == expected + + +def test_example_3(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy( + 5 * variables[0] + + 2 * variables[1] + + variables[0] * variables[1] + ) + + constraint_le_lhs = Polynomial({("x0",): 5, ("x1",): 2}) + constraint_le = Constraint(constraint_le_lhs, Polynomial(5), + Operator.LE, MethodsForInequalities.UNBALANCED_PENALIZATION) + + constraint_le_lhs_2 = Polynomial({("x0",): 3, ("x1",): 4}) + constraint_le_2 = Constraint(constraint_le_lhs_2, Polynomial(7), + Operator.LE, MethodsForInequalities.UNBALANCED_PENALIZATION) + + problem = SimpleProblem( + objective_function, [constraint_le, constraint_le_2], + MethodsForInequalities.UNBALANCED_PENALIZATION) + weights = [1., 1., 1., 1., 1.] + qubo = Converter.create_qubo(problem, weights) + + expected = Polynomial({ + ("x0", "x0"): 34, + ("x0", "x1"): 45, + ("x0",): -79, + ("x1", "x1"): 20, + ("x1",): -68, + (): 62, + }) + + assert qubo == expected + + +def test_example_4(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy( + 5 * variables[0] + + 2 * variables[1] + + variables[0] * variables[1] + ) + + constraint_eq_lhs = Polynomial({("x0",): 1, ("x1",): 1}) + constraint_eq = Constraint(constraint_eq_lhs, Polynomial(1), Operator.EQ) + + problem = SimpleProblem( + objective_function, [constraint_eq], + MethodsForInequalities.UNBALANCED_PENALIZATION) + weights = [1., 6.] + qubo = Converter.create_qubo(problem, weights) + + expected = Polynomial({ + ("x0", "x0"): 6, + ("x0", "x1"): 13, + ("x0",): -7, + ("x1", "x1"): 6, + ("x1",): -10, + (): 6, + }) + + assert qubo == expected + + +def test_to_dqm(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy(variables[0] + variables[1]) + + problem = SimpleProblem( + objective_function, [], + MethodsForInequalities.SLACKS_LOG_2) + + dqm = Converter.to_dqm(problem) + + created_dqm = DiscreteQuadraticModel() + for variable in variables: + added_variable = created_dqm.add_variable(2, str(variable)) + created_dqm.set_linear( + added_variable, + [1.0, 1.0] + ) + + print(created_dqm.variables == dqm.variables) + + assert created_dqm.variables == dqm.variables + + +def test_to_cqm(): + num_variables = 2 + variables = sympy.symbols( + " ".join([f"x{i}" for i in range(num_variables)]) + ) + objective_function = from_sympy(variables[0] + variables[1]) + + constraint_le = Constraint(objective_function, Polynomial(1), + Operator.LE, MethodsForInequalities.SLACKS_LOG_2, "s",) + + problem = SimpleProblem( + objective_function, [constraint_le], + MethodsForInequalities.SLACKS_LOG_2) + + cqm = Converter.to_cqm(problem) + + created_cqm = make_quadratic_cqm( + BinaryPolynomial( + objective_function.terms, + BINARY + )) + + created_variables = objective_function.get_variables() + created_variables.update(constraint_le.lhs.get_variables()) + + for variable in created_variables: + created_cqm.add_variable(BINARY, str(variable)) + + lhs = [tuple([*key, value]) for key, value in constraint_le.lhs.terms.items()] + created_cqm.add_constraint(lhs, constraint_le.operator.value, label=0) + + assert created_cqm.variables == cqm.variables diff --git a/QHyper/tests/test_optimizers.py b/QHyper/tests/test_optimizers.py new file mode 100644 index 0000000..189d644 --- /dev/null +++ b/QHyper/tests/test_optimizers.py @@ -0,0 +1,70 @@ +import numpy as np +import pytest + +from QHyper.optimizers.cem import CEM +from QHyper.optimizers.grid_search import GridSearch +from QHyper.optimizers.random import Random +from QHyper.optimizers.scipy_minimizer import ScipyOptimizer +from QHyper.optimizers.qml_gradient_descent import QmlGradientDescent +from QHyper.optimizers.base import OptimizationResult, OptimizationParameter + +np.random.seed(1244) + + +def function(args) -> OptimizationResult: + x, y, z = args + return OptimizationResult((x + y + z)**2, np.array([x, y, z]), [[]]) + + +def test_scipy(): + minimizer = ScipyOptimizer( + maxfun=100, + method='L-BFGS-B' + ) + init = OptimizationParameter( + init=[1., 0.5, -0.3], min=[-1, -1, -1], max=[1, 1, 1]) + result = minimizer.minimize(function, init) + assert result.value == pytest.approx(0, rel=1e-6, abs=1e-6) + + +def test_qml(): + minimizer = QmlGradientDescent() + init = OptimizationParameter(init=[1., 0.5, -0.3]) + result = minimizer.minimize(function, init) + assert result.value == pytest.approx(0, rel=1e-6, abs=1e-6) + + +def test_random(): + minimizer = Random( + processes=1, + number_of_samples=1000, + disable_tqdm=True, + ) + init = OptimizationParameter( + init=[1., 0.5, -0.3], min=[-1, -1, -1], max=[1, 1, 1]) + result = minimizer.minimize(function, init) + assert result.value == pytest.approx(0, rel=1e-6, abs=1e-6) + + +def test_cem(): + minimizer = CEM( + processes=1, + samples_per_epoch=100, + epochs=3, + disable_tqdm=True, + ) + init = OptimizationParameter( + init=[1., 0.5, -0.3], min=[-1, -1, -1], max=[1, 1, 1]) + result = minimizer.minimize(function, init) + assert result.value == pytest.approx(0, rel=1e-6, abs=1e-6) + + +def test_grid(): + minimizer = GridSearch( + processes=1, + disable_tqdm=True, + ) + init = OptimizationParameter( + step=[0.5, 0.5, 0.5], min=[-1, -1, -1], max=[1, 1, 1]) + result = minimizer.minimize(function, init) + assert result.value == pytest.approx(0, rel=1e-6, abs=1e-6) diff --git a/QHyper/tests/test_optimizers_full.py b/QHyper/tests/test_optimizers_full.py new file mode 100644 index 0000000..d7cecdf --- /dev/null +++ b/QHyper/tests/test_optimizers_full.py @@ -0,0 +1,237 @@ +import numpy as np +import pytest +import random + +from QHyper.solvers import solver_from_config +from QHyper.util import weighted_avg_evaluation + + +def get_problem_config(): + problem_config = { + "type": "knapsack", + "max_weight": 2, + "item_weights": [1, 1, 1], + "item_values": [2, 2, 1], + } + + params_config = { + 'gamma': { + 'init': [0.5]*5, + 'min': [0]*5, + 'max': [2*np.pi]*5, + }, + 'beta': { + 'init': [1]*5, + 'min': [0]*5, + 'max': [2*np.pi]*5, + }, + # 'angles': [[0.5]*5, [1]*5], + # 'hyper_args': [1, 2.5, 2.5], + } + hyper_optimizer_bounds = 3*[(1, 10)] + + return problem_config, params_config, hyper_optimizer_bounds + + +def run_solver(solver_config): + np.random.seed(0) + random.seed(0) + + solver = solver_from_config(solver_config) + results = solver.solve() + return weighted_avg_evaluation( + results.probabilities, solver.problem.get_score, 0) + + +def run_hyper_optimizer(solver_config): + np.random.seed(0) + random.seed(0) + + solver = solver_from_config(solver_config) + results = solver.solve() + return results.value + + +def test_scipy(): + problem_config, params_config, _ = get_problem_config() + + solver_config = { + "solver": { + "name": "QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 5, + **params_config, + "optimizer": { + "type": "scipy", + "maxfun": 10, + # "bounds": [(0, 2*np.pi)]*10, + 'method': 'L-BFGS-B', + 'options': { + 'maxiter': 10, + } + }, + }, + "problem": problem_config + } + + result = run_solver(solver_config) + assert result == pytest.approx(-0.4697774822) + + +def test_qml(): + problem_config, params_config, _ = get_problem_config() + + solver_config = { + "solver": { + "name": "QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 5, + **params_config, + "optimizer": { + "type": "qml", + "steps": 10 + }, + }, + "problem": problem_config + } + + result = run_solver(solver_config) + assert result == pytest.approx(-0.4015307189) + + +def test_qml_qaoa(): + problem_config, params_config, _ = get_problem_config() + + solver_config = { + "solver": { + "name": "QML_QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 5, + "backend": "default.qubit", + **params_config, + "optimizer": { + "type": "qml", + "name": "adam", + "steps": 10 + }, + }, + "problem": problem_config + } + + result = run_solver(solver_config) + assert result == pytest.approx(-0.4015307189) + + +def test_random(): + problem_config, params_config, hyperoptimizer_bounds = get_problem_config() + + solver_config = { + "solver": { + "name": "QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 5, + **params_config, + # "type": "vqa", + # "pqc": { + # "type": "qaoa", + # "layers": 5, + # "backend": "default.qubit", + # }, + "optimizer": { + "type": "qml", + "steps": 10 + }, + + # "params_inits": params_config, + }, + "hyper_optimizer": { + "optimizer": { + "type": "random", + "processes": 1, + "number_of_samples": 2, + "disable_tqdm": False + }, + 'penalty_weights': { + 'min': [1]*3, + 'max': [10]*3, + }, + }, + "problem": problem_config + } + + result = run_hyper_optimizer(solver_config) + assert result == pytest.approx(-0.5250361108, rel=1e-6, abs=1e-6) + + +def test_cem(): + problem_config, params_config, hyperoptimizer_bounds = get_problem_config() + + solver_config = { + "solver": { + "name": "QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 5, + **params_config, + "optimizer": { + "type": "qml", + "steps": 10 + }, + }, + "hyper_optimizer": { + "optimizer": { + "type": "cem", + "processes": 1, + "samples_per_epoch": 2, + "epochs": 2, + "disable_tqdm": False, + }, + 'penalty_weights': { + 'min': [1]*3, + 'max': [10]*3, + 'init': [1, 2.5, 2.5], + }, + }, + "problem": problem_config + } + + result = run_hyper_optimizer(solver_config) + assert result == pytest.approx(-0.5078221819, rel=1e-6, abs=1e-6) + + +def test_grid(): + problem_config, params_config, hyperoptimizer_bounds = get_problem_config() + + solver_config = { + "solver": { + "name": "QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 5, + **params_config, + "optimizer": { + "type": "qml", + "steps": 10 + }, + }, + "hyper_optimizer": { + "optimizer": { + "type": "grid", + "processes": 1, + "disable_tqdm": False, + }, + 'penalty_weights': { + 'min': [1]*3, + 'max': [10]*3, + 'step': [8, 7, 6], + }, + }, + "problem": problem_config + } + + result = run_hyper_optimizer(solver_config) + assert result == pytest.approx(-1.014492067) diff --git a/QHyper/tests/test_problems.py b/QHyper/tests/test_problems.py new file mode 100644 index 0000000..5246001 --- /dev/null +++ b/QHyper/tests/test_problems.py @@ -0,0 +1,127 @@ +import numpy as np +import networkx as nx + +from QHyper.problems.tsp import TravelingSalesmanProblem +from QHyper.problems.community_detection import ( + CommunityDetectionProblem, Network) +from QHyper.problems.knapsack import Item, KnapsackProblem + +np.random.seed(1244) + + +def test_knapsack(): + problem = KnapsackProblem(max_weight=2, item_weights=[1, 1, 1], + item_values=[2, 2, 1]) + + assert problem.knapsack.items == [ + Item(weight=1, value=2), Item(weight=1, value=2), + Item(weight=1, value=1) + ] + + assert problem.objective_function == { + ('x0',): -2, ('x1',): -2, ('x2',): -1} + + assert [constraint.lhs for constraint in problem.constraints] == [ + {('x3',): -1, ('x4',): -1, (): 1}, + {('x0',): -1, ('x1',): -1, ('x2',): -1, ('x3',): 1, ('x4',): 2} + ] + + +def test_TSP(): + problem = TravelingSalesmanProblem( + number_of_cities=4, cities_coords=[(0, 0), (0, 3), (4, 0), (4, 3)]) + assert problem.objective_function == { + ('x0', 'x15'): 1.0, + ('x0', 'x7'): 1.0, + ('x1', 'x14'): 1.0, + ('x1', 'x6'): 1.0, + ('x11', 'x4'): 1.0, + ('x10', 'x5'): 1.0, + ('x11', 'x12'): 1.0, + ('x12', 'x3'): 1.0, + ('x15', 'x8'): 1.0, + ('x13', 'x2'): 1.0, + ('x2', 'x5'): 1.0, + ('x3', 'x4'): 1.0, + ('x6', 'x9'): 1.0, + ('x7', 'x8'): 1.0, + ('x10', 'x13'): 1.0, + ('x14', 'x9'): 1.0, + ('x1', 'x15'): 0.8, + ('x0', 'x14'): 0.8, + ('x11', 'x13'): 0.8, + ('x0', 'x6'): 0.8, + ('x1', 'x7'): 0.8, + ('x2', 'x4'): 0.8, + ('x10', 'x12'): 0.8, + ('x10', 'x4'): 0.8, + ('x11', 'x5'): 0.8, + ('x13', 'x3'): 0.8, + ('x12', 'x2'): 0.8, + ('x3', 'x5'): 0.8, + ('x6', 'x8'): 0.8, + ('x7', 'x9'): 0.8, + ('x15', 'x9'): 0.8, + ('x14', 'x8'): 0.8, + ('x0', 'x13'): 0.6, + ('x0', 'x5'): 0.6, + ('x1', 'x12'): 0.6, + ('x1', 'x4'): 0.6, + ('x10', 'x15'): 0.6, + ('x10', 'x7'): 0.6, + ('x11', 'x14'): 0.6, + ('x12', 'x9'): 0.6, + ('x11', 'x6'): 0.6, + ('x13', 'x8'): 0.6, + ('x14', 'x3'): 0.6, + ('x15', 'x2'): 0.6, + ('x2', 'x7'): 0.6, + ('x3', 'x6'): 0.6, + ('x4', 'x9'): 0.6, + ('x5', 'x8'): 0.6, + } + + assert [constraint.lhs for constraint in problem.constraints] == [ + {('x0',): -1, ('x4',): -1, ('x8',): -1, ('x12',): -1, (): 1}, + {('x1',): -1, ('x5',): -1, ('x9',): -1, ('x13',): -1, (): 1}, + {('x2',): -1, ('x6',): -1, ('x10',): -1, ('x14',): -1, (): 1}, + {('x3',): -1, ('x7',): -1, ('x11',): -1, ('x15',): -1, (): 1}, + {('x0',): -1, ('x1',): -1, ('x2',): -1, ('x3',): -1, (): 1}, + {('x4',): -1, ('x5',): -1, ('x6',): -1, ('x7',): -1, (): 1}, + {('x8',): -1, ('x9',): -1, ('x10',): -1, ('x11',): -1, (): 1}, + {('x12',): -1, ('x13',): -1, ('x14',): -1, ('x15',): -1, (): 1} + ] + + +def test_CDP(): + G = nx.Graph() + G.add_edges_from([(0,1),(1,2),(2,3),(3,0)]) + problem = CommunityDetectionProblem(Network(G), 2) + + assert problem.objective_function == { + ('s0', 's2'): -1.0, ('s1', 's3'): -1.0, + ('s0', 's4'): 1.0, ('s1', 's5'): 1.0, + ('s0', 's6'): -1.0, ('s1', 's7'): -1.0, + ('s2', 's4'): -1.0, ('s3', 's5'): -1.0, + ('s2', 's6'): 1.0, ('s3', 's7'): 1.0, + ('s4', 's6'): -1.0, ('s5', 's7'): -1.0 + } + + assert [constraint.lhs for constraint in problem.constraints] == [ + {('s0',): 1.0, ('s1',): 1.0, (): -1.0}, + {('s2',): 1.0, ('s3',): 1.0, (): -1.0}, + {('s4',): 1.0, ('s5',): 1.0, (): -1.0}, + {('s6',): 1.0, ('s7',): 1.0, (): -1.0} + ] + + problem_no_one_hot = CommunityDetectionProblem(Network(G), 2, False) + + assert problem_no_one_hot.objective_function == { + ('x0', 'x0'): 0.5, ('x0', 'x1'): -1.0, + ('x0', 'x2'): 1.0, ('x0', 'x3'): -1.0, + ('x1', 'x1'): 0.5, ('x1', 'x2'): -1.0, + ('x1', 'x3'): 1.0, ('x2', 'x2'): 0.5, + ('x2', 'x3'): -1.0, ('x3', 'x3'): 0.5 + } + + assert problem_no_one_hot.constraints == [] diff --git a/QHyper/tests/test_util.py b/QHyper/tests/test_util.py new file mode 100644 index 0000000..afbf917 --- /dev/null +++ b/QHyper/tests/test_util.py @@ -0,0 +1,124 @@ +import numpy as np + +from QHyper.util import ( + weighted_avg_evaluation, sort_solver_results, add_evaluation_to_results) + + +dtype = [('x0', 'i4'), ('x1', 'i4'), ('x2', 'i4'), ('x3', 'i4'), + ('x4', 'i4'), ('probability', 'f8')] +SOLVER_RESULTS = np.array([ + (0, 0, 0, 0, 0, 0.05214763286171284), + (0, 0, 0, 0, 1, 0.047456206684648256), + (0, 0, 0, 1, 0, 0.06747850816202812), + (0, 0, 0, 1, 1, 0.1207346328578372), + (0, 0, 1, 0, 0, 0.019935786631066668), + (0, 0, 1, 0, 1, 0.005007856642765267), + (0, 0, 1, 1, 0, 0.01005580974423947), + (0, 0, 1, 1, 1, 0.022499649875754597), + (0, 1, 0, 0, 0, 0.027125455378550354), + (0, 1, 0, 0, 1, 0.028211751547797856), + (0, 1, 0, 1, 0, 0.008350237539872896), + (0, 1, 0, 1, 1, 0.03202691762829461), + (0, 1, 1, 0, 0, 0.003062964564235747), + (0, 1, 1, 0, 1, 0.012204283239546117), + (0, 1, 1, 1, 0, 0.08663358863146411), + (0, 1, 1, 1, 1, 0.003494550808116975), + (1, 0, 0, 0, 0, 0.027125455378550347), + (1, 0, 0, 0, 1, 0.028211751547797856), + (1, 0, 0, 1, 0, 0.008350237539872908), + (1, 0, 0, 1, 1, 0.03202691762829463), + (1, 0, 1, 0, 0, 0.0030629645642357367), + (1, 0, 1, 0, 1, 0.012204283239546128), + (1, 0, 1, 1, 0, 0.08663358863146413), + (1, 0, 1, 1, 1, 0.0034945508081169743), + (1, 1, 0, 0, 0, 0.010496304111296366), + (1, 1, 0, 0, 1, 0.015135842196383593), + (1, 1, 0, 1, 0, 0.11572493713978199), + (1, 1, 0, 1, 1, 0.010027077049355402), + (1, 1, 1, 0, 0, 0.007232224863605771), + (1, 1, 1, 0, 1, 0.013160777387316473), + (1, 1, 1, 1, 0, 0.039326178047044726), + (1, 1, 1, 1, 1, 0.0413610770694037), +], dtype=dtype).view(np.recarray) + + +def score_function(x, p): + if x['x0'] == 1 and x['x1'] == 0: + return p + tmp = x.tolist()[:5] + return tmp.count(1) * tmp.count(0) + + +def test_weighted_avg_evaluation(): + assert weighted_avg_evaluation( + SOLVER_RESULTS, score_function, penalty=-1, limit_results=10, + normalize=True + ) == 3.5342418902991257 + + +def test_sort_solver_results(): + dtype = [('x0', 'i4'), ('x1', 'i4'), ('x2', 'i4'), ('x3', 'i4'), + ('x4', 'i4'), ('probability', 'f8')] + + sorted = np.array([ + (0, 0, 0, 1, 1, 0.1207346328578372), + (1, 1, 0, 1, 0, 0.11572493713978199), + (1, 0, 1, 1, 0, 0.08663358863146413), + (0, 1, 1, 1, 0, 0.08663358863146411), + (0, 0, 0, 1, 0, 0.06747850816202812), + (0, 0, 0, 0, 0, 0.05214763286171284), + (0, 0, 0, 0, 1, 0.047456206684648256), + (1, 1, 1, 1, 1, 0.0413610770694037), + (1, 1, 1, 1, 0, 0.039326178047044726), + (1, 0, 0, 1, 1, 0.03202691762829463), + ], dtype=dtype).view(np.recarray) + + assert np.array_equal( + sort_solver_results(SOLVER_RESULTS, limit_results=10), + sorted) + + +def test_add_evaluation_to_results(): + dtype = np.dtype( + [('x0', 'i4'), ('x1', 'i4'), ('x2', 'i4'), ('x3', 'i4'), + ('x4', 'i4'), ('probability', 'f8'), ('evaluation', 'f8')]) + + template = np.array([ + (0, 0, 0, 0, 0, 0.05214763286171284, 0), + (0, 0, 0, 0, 1, 0.047456206684648256, 4), + (0, 0, 0, 1, 0, 0.06747850816202812, 4), + (0, 0, 0, 1, 1, 0.1207346328578372, 6), + (0, 0, 1, 0, 0, 0.019935786631066668, 4), + (0, 0, 1, 0, 1, 0.005007856642765267, 6), + (0, 0, 1, 1, 0, 0.01005580974423947, 6), + (0, 0, 1, 1, 1, 0.022499649875754597, 6), + (0, 1, 0, 0, 0, 0.027125455378550354, 4), + (0, 1, 0, 0, 1, 0.028211751547797856, 6), + (0, 1, 0, 1, 0, 0.008350237539872896, 6), + (0, 1, 0, 1, 1, 0.03202691762829461, 6), + (0, 1, 1, 0, 0, 0.003062964564235747, 6), + (0, 1, 1, 0, 1, 0.012204283239546117, 6), + (0, 1, 1, 1, 0, 0.08663358863146411, 6), + (0, 1, 1, 1, 1, 0.003494550808116975, 4), + (1, 0, 0, 0, 0, 0.027125455378550347, -1), + (1, 0, 0, 0, 1, 0.028211751547797856, -1), + (1, 0, 0, 1, 0, 0.008350237539872908, -1), + (1, 0, 0, 1, 1, 0.03202691762829463, -1), + (1, 0, 1, 0, 0, 0.0030629645642357367, -1), + (1, 0, 1, 0, 1, 0.012204283239546128, -1), + (1, 0, 1, 1, 0, 0.08663358863146413, -1), + (1, 0, 1, 1, 1, 0.0034945508081169743, -1), + (1, 1, 0, 0, 0, 0.010496304111296366, 6), + (1, 1, 0, 0, 1, 0.015135842196383593, 6), + (1, 1, 0, 1, 0, 0.11572493713978199, 6), + (1, 1, 0, 1, 1, 0.010027077049355402, 4), + (1, 1, 1, 0, 0, 0.007232224863605771, 6), + (1, 1, 1, 0, 1, 0.013160777387316473, 4), + (1, 1, 1, 1, 0, 0.039326178047044726, 4), + (1, 1, 1, 1, 1, 0.0413610770694037, 0), + ], dtype=dtype).view(np.recarray).astype(dtype) + + result = add_evaluation_to_results(SOLVER_RESULTS, score_function, -1) + + for patter, value in zip(template, result): + assert np.allclose(patter.tolist(), value.tolist()) diff --git a/QHyper/tests/test_vqa.py b/QHyper/tests/test_vqa.py new file mode 100644 index 0000000..95ef3c6 --- /dev/null +++ b/QHyper/tests/test_vqa.py @@ -0,0 +1,205 @@ +import numpy as np +import pytest + +from QHyper.solvers import solver_from_config + +np.random.seed(1244) + + +def assert_probabilities(probabilities, expected_probabilities): + for rec in probabilities: + key = ''.join([str(rec[f'x{i}']) for i in range(5)]) + assert rec.probability == pytest.approx(expected_probabilities[key]) + + +def get_problem_config(): + problem_config = { + "type": "knapsack", + "max_weight": 2, + "item_weights": [1, 1, 1], + "item_values": [2, 2, 1], + } + + params_config = { + 'gamma': { + 'init': [0.5]*3, + }, + 'beta': { + 'init': [1]*3, + }, + # penalty_weights': { + # 'angles': [[0.5]*3, [1]*3], + # 'hyper_args': [1, 2.5, 2.5], + } + hyper_optimizer_bounds = 3*[(1, 10)] + + return problem_config, params_config, hyper_optimizer_bounds + + +def run_solver(solver_config): + vqa = solver_from_config(solver_config) + return vqa.solve(None) + + +def test_qaoa(): + problem_config, params_config, _ = get_problem_config() + + solver_config = { + "solver": { + 'name': 'QAOA', + 'category': 'gate_based', + 'platform': 'pennylane', + 'layers': 3, + 'penalty_weights': [1, 2.5, 2.5], + **params_config + }, + "problem": problem_config + } + + solver_results = run_solver(solver_config) + assert_probabilities(solver_results.probabilities, { + '00000': 0.052147632, + '00001': 0.047456206, + '00010': 0.067478508, + '00011': 0.120734632, + '00100': 0.019935786, + '00101': 0.005007856, + '00110': 0.010055809, + '00111': 0.022499649, + '01000': 0.027125455, + '01001': 0.028211751, + '01010': 0.008350237, + '01011': 0.032026917, + '01100': 0.003062964, + '01101': 0.012204283, + '01110': 0.086633588, + '01111': 0.003494550, + '10000': 0.027125455, + '10001': 0.028211751, + '10010': 0.008350237, + '10011': 0.032026917, + '10100': 0.003062964, + '10101': 0.012204283, + '10110': 0.086633588, + '10111': 0.003494550, + '11000': 0.010496304, + '11001': 0.015135842, + '11010': 0.115724937, + '11011': 0.010027077, + '11100': 0.007232224, + '11101': 0.013160777, + '11110': 0.039326178, + '11111': 0.041361077, + }) + + +def test_wfqaoa(): + problem_config, params_config, _ = get_problem_config() + + solver_config = { + "solver": { + 'name': 'WF_QAOA', + 'category': 'gate_based', + 'platform': 'pennylane', + "layers": 3, + "limit_results": 10, + "penalty": 2, + "backend": "default.qubit", + "penalty_weights": [1, 2.5, 2.5], + **params_config, + }, + "problem": problem_config + } + + solver_results = run_solver(solver_config) + assert_probabilities(solver_results.probabilities, { + '00000': 0.052147632, + '00001': 0.047456206, + '00010': 0.067478508, + '00011': 0.120734632, + '00100': 0.019935786, + '00101': 0.005007856, + '00110': 0.010055809, + '00111': 0.022499649, + '01000': 0.027125455, + '01001': 0.028211751, + '01010': 0.008350237, + '01011': 0.032026917, + '01100': 0.003062964, + '01101': 0.012204283, + '01110': 0.086633588, + '01111': 0.003494550, + '10000': 0.027125455, + '10001': 0.028211751, + '10010': 0.008350237, + '10011': 0.032026917, + '10100': 0.003062964, + '10101': 0.012204283, + '10110': 0.086633588, + '10111': 0.003494550, + '11000': 0.010496304, + '11001': 0.015135842, + '11010': 0.115724937, + '11011': 0.010027077, + '11100': 0.007232224, + '11101': 0.013160777, + '11110': 0.039326178, + '11111': 0.041361077, + }) + + +def test_hqaoa(): + problem_config, params_config, _ = get_problem_config() + + solver_config = { + "solver": { + "name": "H_QAOA", + "category": "gate_based", + "platform": "pennylane", + "layers": 3, + "limit_results": 10, + "penalty": 2, + "backend": "default.qubit", + **params_config, + 'penalty_weights': { + 'init': [1, 2.5, 2.5], + } + }, + "problem": problem_config + } + + solver_results = run_solver(solver_config) + assert_probabilities(solver_results.probabilities, { + '00000': 0.052147632, + '00001': 0.047456206, + '00010': 0.067478508, + '00011': 0.120734632, + '00100': 0.019935786, + '00101': 0.005007856, + '00110': 0.010055809, + '00111': 0.022499649, + '01000': 0.027125455, + '01001': 0.028211751, + '01010': 0.008350237, + '01011': 0.032026917, + '01100': 0.003062964, + '01101': 0.012204283, + '01110': 0.086633588, + '01111': 0.003494550, + '10000': 0.027125455, + '10001': 0.028211751, + '10010': 0.008350237, + '10011': 0.032026917, + '10100': 0.003062964, + '10101': 0.012204283, + '10110': 0.086633588, + '10111': 0.003494550, + '11000': 0.010496304, + '11001': 0.015135842, + '11010': 0.115724937, + '11011': 0.010027077, + '11100': 0.007232224, + '11101': 0.013160777, + '11110': 0.039326178, + '11111': 0.041361077, + }) diff --git a/requirements/prod.txt b/requirements/prod.txt index 8feee23..ad58b1b 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -6,4 +6,5 @@ dwave-system gurobipy types-tqdm pandas +autoray==0.6.11 git+https://github.com/wfcommons/wfcommons.git@main diff --git a/results/id_2_sampleset_adv.npy b/results/id_2_sampleset_adv.npy new file mode 100644 index 0000000..8c997de Binary files /dev/null and b/results/id_2_sampleset_adv.npy differ diff --git a/results/id_2_sampleset_adv.pkl b/results/id_2_sampleset_adv.pkl new file mode 100644 index 0000000..38159ad Binary files /dev/null and b/results/id_2_sampleset_adv.pkl differ diff --git a/results/id_2_sampleset_adv_serializable.pkl b/results/id_2_sampleset_adv_serializable.pkl new file mode 100644 index 0000000..cef71e8 Binary files /dev/null and b/results/id_2_sampleset_adv_serializable.pkl differ diff --git a/results/id_3_sampleset_adv.npy b/results/id_3_sampleset_adv.npy new file mode 100644 index 0000000..c8a2a5f Binary files /dev/null and b/results/id_3_sampleset_adv.npy differ diff --git a/results/id_3_sampleset_adv.pkl b/results/id_3_sampleset_adv.pkl new file mode 100644 index 0000000..6986fce Binary files /dev/null and b/results/id_3_sampleset_adv.pkl differ diff --git a/results/id_3_sampleset_adv_serializable.pkl b/results/id_3_sampleset_adv_serializable.pkl new file mode 100644 index 0000000..e33d32b Binary files /dev/null and b/results/id_3_sampleset_adv_serializable.pkl differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.npy b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.npy new file mode 100644 index 0000000..d707c68 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.npy differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.pkl b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.pkl new file mode 100644 index 0000000..ab7b00b Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983.pkl differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983_serializable.pkl b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983_serializable.pkl new file mode 100644 index 0000000..dae2683 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=13405b3c-3335-440b-b2dd-c1edbeaaa983_serializable.pkl differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.npy b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.npy new file mode 100644 index 0000000..62faa60 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.npy differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.pkl b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.pkl new file mode 100644 index 0000000..f8c7a07 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d.pkl differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d_serializable.pkl b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d_serializable.pkl new file mode 100644 index 0000000..d3dc0cf Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=4a68406a-ed58-425a-8ebb-ad305bd39f5d_serializable.pkl differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.npy b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.npy new file mode 100644 index 0000000..1e32620 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.npy differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.pkl b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.pkl new file mode 100644 index 0000000..a8bc132 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece.pkl differ diff --git a/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece_serializable.pkl b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece_serializable.pkl new file mode 100644 index 0000000..3a27b03 Binary files /dev/null and b/results/id_4_sampleset_adv_n=100_qubo_size=5050__id=d423a56c-8031-4adb-93c4-87570c44fece_serializable.pkl differ diff --git a/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.npy b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.npy new file mode 100644 index 0000000..f83500c Binary files /dev/null and b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.npy differ diff --git a/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.pkl b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.pkl new file mode 100644 index 0000000..057f64d Binary files /dev/null and b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f.pkl differ diff --git a/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f_serializable.pkl b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f_serializable.pkl new file mode 100644 index 0000000..5f90262 Binary files /dev/null and b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=4c229f8d-3aff-4a4e-a7e2-0b8fba413a5f_serializable.pkl differ diff --git a/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.npy b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.npy new file mode 100644 index 0000000..b384902 Binary files /dev/null and b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.npy differ diff --git a/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.pkl b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.pkl new file mode 100644 index 0000000..7695a35 Binary files /dev/null and b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762.pkl differ diff --git a/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762_serializable.pkl b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762_serializable.pkl new file mode 100644 index 0000000..1af5544 Binary files /dev/null and b/results/id_5_sampleset_adv_n=100_qubo_size=5050__id=7b9c1f42-b02f-40b6-8533-7e4e257b4762_serializable.pkl differ diff --git a/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.npy b/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.npy new file mode 100644 index 0000000..9c4b563 Binary files /dev/null and b/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.npy differ diff --git a/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.pkl b/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.pkl new file mode 100644 index 0000000..b65496c Binary files /dev/null and b/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6.pkl differ diff --git a/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6_serializable.pkl b/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6_serializable.pkl new file mode 100644 index 0000000..ee935e4 Binary files /dev/null and b/results/id_5_sampleset_adv_n=10_qubo_size=54__id=230d8e15-8928-4853-a1b1-7b8b0a777ad6_serializable.pkl differ diff --git a/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.npy b/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.npy new file mode 100644 index 0000000..b5f6cfe Binary files /dev/null and b/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.npy differ diff --git a/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.pkl b/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.pkl new file mode 100644 index 0000000..79f78a2 Binary files /dev/null and b/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0.pkl differ diff --git a/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0_serializable.pkl b/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0_serializable.pkl new file mode 100644 index 0000000..5aff4f7 Binary files /dev/null and b/results/id_5_sampleset_adv_n=10_qubo_size=55__id=9d732e40-b80a-4ea4-a0dc-59f194b75fb0_serializable.pkl differ diff --git a/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.npy b/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.npy new file mode 100644 index 0000000..53e578a Binary files /dev/null and b/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.npy differ diff --git a/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.pkl b/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.pkl new file mode 100644 index 0000000..4d1f635 Binary files /dev/null and b/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402.pkl differ diff --git a/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402_serializable.pkl b/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402_serializable.pkl new file mode 100644 index 0000000..fb4b37f Binary files /dev/null and b/results/id_6_sampleset_adv_n=40_qubo_size=820__id=4c6e33cc-982b-479c-9776-a1193a72e402_serializable.pkl differ diff --git a/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.npy b/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.npy new file mode 100644 index 0000000..3dc9508 Binary files /dev/null and b/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.npy differ diff --git a/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.pkl b/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.pkl new file mode 100644 index 0000000..d1ac6b1 Binary files /dev/null and b/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4.pkl differ diff --git a/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl b/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl new file mode 100644 index 0000000..4b08914 Binary files /dev/null and b/results/id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl differ diff --git a/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.npy b/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.npy new file mode 100644 index 0000000..4b7a192 Binary files /dev/null and b/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.npy differ diff --git a/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.pkl b/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.pkl new file mode 100644 index 0000000..17393fa Binary files /dev/null and b/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df.pkl differ diff --git a/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df_serializable.pkl b/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df_serializable.pkl new file mode 100644 index 0000000..ea42e2d Binary files /dev/null and b/results/id_9_sampleset_adv_n=40_qubo_size=820__id=80444839-7e97-4f88-8518-dea1c98e46df_serializable.pkl differ diff --git a/results/sampleset_adv.npy b/results/sampleset_adv.npy new file mode 100644 index 0000000..d341076 Binary files /dev/null and b/results/sampleset_adv.npy differ diff --git a/results/sampleset_adv.pkl b/results/sampleset_adv.pkl new file mode 100644 index 0000000..b006831 Binary files /dev/null and b/results/sampleset_adv.pkl differ diff --git a/results/sampleset_adv_serializable.pkl b/results/sampleset_adv_serializable.pkl new file mode 100644 index 0000000..9b6ff10 Binary files /dev/null and b/results/sampleset_adv_serializable.pkl differ diff --git a/results/t.ipynb b/results/t.ipynb new file mode 100644 index 0000000..9ecf993 --- /dev/null +++ b/results/t.ipynb @@ -0,0 +1,3244 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 22, + "id": "274afc65", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The autoreload extension is already loaded. To reload it, use:\n", + " %reload_ext autoreload\n" + ] + } + ], + "source": [ + "import networkx as nx\n", + "\n", + "from QHyper.problems.community_detection import CommunityDetectionProblem, Network\n", + "from QHyper.solvers.quantum_annealing.dwave.advantage import Advantage\n", + "\n", + "import numpy as np\n", + "import pickle\n", + "\n", + "%load_ext autoreload\n", + "%autoreload 2" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "6d6f570b", + "metadata": {}, + "outputs": [], + "source": [ + "from dwave.inspector.adapters import enable_data_capture\n", + "\n", + "\n", + "enable_data_capture()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "aa1b2d30", + "metadata": {}, + "outputs": [], + "source": [ + "G = nx.powerlaw_cluster_graph(40, 1, 0.01)\n", + "network = Network(graph=G)\n", + "problem = CommunityDetectionProblem(network_data=network, communities=2, one_hot_encoding=False)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "a54cdc6c", + "metadata": {}, + "outputs": [], + "source": [ + "adv = Advantage(problem=problem, num_reads=100, use_clique_embedding=True, elapse_times=True, chain_strength=0.0001)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "4de7b5f9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Could not save sampleset to .json file: 'SampleSet' object has no attribute 'to_file'\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\basia\\Desktop\\Praca_Inzynierska_2024\\QHyper\\QHyper\\solvers\\quantum_annealing\\dwave\\advantage.py:243: UserWarning: No timing information available for the sampleset. \n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "id = 9\n", + "res = adv.solve(return_metadata=True, saving_path=f\"id_{id}_sampleset_adv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "4b50ef7a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.float64(0.9)" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.chain_break_fraction" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "48e5b695", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "StructuredSolver(name='Advantage_system4.1', graph_id='01d07086e1')\n" + ] + } + ], + "source": [ + "from dwave.inspector import storage\n", + "from dwave.inspector.storage import get_problem, problemdata\n", + "\n", + "\n", + "problem_data = storage.get_problem(res.sampleset_info.problem_id)\n", + "\n", + "response = problem_data.response\n", + "solver = problem_data.solver\n", + "print(response)\n", + "print(solver)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "b46ff5b6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "{'f49fda51-0bdf-47d9-8dab-e6c3296ca0c4': }\n" + ] + } + ], + "source": [ + "from dwave.inspector.storage import get_problem, problemdata\n", + "\n", + "\n", + "pd = get_problem(res.sampleset_info.problem_id)\n", + "print(pd.response)\n", + "print(problemdata)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "c2ef60ac", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'type': dwave.system.warnings.EnergyScaleWarning,\n", + " 'message': 'Some biases are 10^3 times stronger than others',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [(181, 180),\n", + " (2940, 180),\n", + " (182, 181),\n", + " (183, 182),\n", + " (196, 195),\n", + " (2955, 195),\n", + " (197, 196),\n", + " (198, 197),\n", + " (151, 150),\n", + " (2970, 150),\n", + " (152, 151),\n", + " (153, 152),\n", + " (166, 165),\n", + " (2985, 165),\n", + " (167, 166),\n", + " (168, 167),\n", + " (211, 210),\n", + " (3000, 210),\n", + " (212, 211),\n", + " (213, 212),\n", + " (226, 225),\n", + " (3015, 225),\n", + " (227, 226),\n", + " (228, 227),\n", + " (241, 240),\n", + " (242, 241),\n", + " (3540, 242),\n", + " (256, 255),\n", + " (257, 256),\n", + " (3555, 257),\n", + " (271, 270),\n", + " (272, 271),\n", + " (3511, 272),\n", + " (3510, 3511),\n", + " (286, 285),\n", + " (287, 286),\n", + " (3526, 287),\n", + " (3525, 3526),\n", + " (301, 300),\n", + " (302, 301),\n", + " (3481, 302),\n", + " (3480, 3481),\n", + " (316, 315),\n", + " (317, 316),\n", + " (3496, 317),\n", + " (3495, 3496),\n", + " (331, 330),\n", + " (332, 331),\n", + " (3451, 332),\n", + " (3450, 3451),\n", + " (346, 345),\n", + " (347, 346),\n", + " (3466, 347),\n", + " (3465, 3466),\n", + " (361, 360),\n", + " (362, 361),\n", + " (3421, 362),\n", + " (3420, 3421),\n", + " (376, 375),\n", + " (377, 376),\n", + " (3436, 377),\n", + " (3435, 3436),\n", + " (391, 390),\n", + " (392, 391),\n", + " (3391, 392),\n", + " (3390, 3391),\n", + " (406, 405),\n", + " (407, 406),\n", + " (3406, 407),\n", + " (3405, 3406),\n", + " (421, 420),\n", + " (3361, 421),\n", + " (3360, 3361),\n", + " (436, 435),\n", + " (3376, 436),\n", + " (3375, 3376),\n", + " (451, 450),\n", + " (3332, 451),\n", + " (3331, 3332),\n", + " (3331, 3330),\n", + " (466, 465),\n", + " (3347, 466),\n", + " (3346, 3347),\n", + " (3346, 3345),\n", + " (481, 480),\n", + " (3302, 481),\n", + " (3301, 3302),\n", + " (3301, 3300),\n", + " (496, 495),\n", + " (3317, 496),\n", + " (3316, 3317),\n", + " (3316, 3315),\n", + " (511, 510),\n", + " (3272, 511),\n", + " (3271, 3272),\n", + " (3271, 3270),\n", + " (526, 525),\n", + " (3287, 526),\n", + " (3286, 3287),\n", + " (3286, 3285),\n", + " (541, 540),\n", + " (3242, 541),\n", + " (3241, 3242),\n", + " (3241, 3240),\n", + " (556, 555),\n", + " (3257, 556),\n", + " (3256, 3257),\n", + " (3256, 3255),\n", + " (571, 570),\n", + " (3212, 571),\n", + " (3211, 3212),\n", + " (3211, 3210),\n", + " (586, 585),\n", + " (3227, 586),\n", + " (3226, 3227),\n", + " (3226, 3225),\n", + " (3182, 600),\n", + " (3181, 3182),\n", + " (3181, 3180),\n", + " (3197, 615),\n", + " (3196, 3197),\n", + " (3196, 3195),\n", + " (3153, 630),\n", + " (3151, 3150),\n", + " (3152, 3153),\n", + " (3152, 3151),\n", + " (3168, 645),\n", + " (3166, 3165),\n", + " (3167, 3168),\n", + " (3167, 3166),\n", + " (3032, 660),\n", + " (3031, 3032),\n", + " (3031, 3030),\n", + " (3047, 675),\n", + " (3046, 3047),\n", + " (3046, 3045),\n", + " (3060, 120),\n", + " (3061, 3060),\n", + " (3062, 3061),\n", + " (3063, 3062),\n", + " (3075, 135),\n", + " (3076, 3075),\n", + " (3077, 3076),\n", + " (3078, 3077),\n", + " (3090, 90),\n", + " (3091, 3090),\n", + " (3092, 3091),\n", + " (3093, 3092),\n", + " (3105, 105),\n", + " (3106, 3105),\n", + " (3107, 3106),\n", + " (3108, 3107)]}},\n", + " {'type': dwave.system.warnings.TooFewSamplesWarning,\n", + " 'message': 'Number of ground states found is within sampling error',\n", + " 'level': 30,\n", + " 'data': {'number_of_ground_states': np.int64(1),\n", + " 'num_reads': np.int64(100),\n", + " 'sampling_error_rate': np.float64(10.0)}},\n", + " {'type': dwave.system.warnings.ChainStrengthWarning,\n", + " 'message': 'Some quadratic biases are stronger than the given chain strength',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [('x1', 'x0'),\n", + " ('x2', 'x0'),\n", + " ('x2', 'x1'),\n", + " ('x3', 'x0'),\n", + " ('x3', 'x1'),\n", + " ('x3', 'x2'),\n", + " ('x4', 'x0'),\n", + " ('x4', 'x1'),\n", + " ('x4', 'x2'),\n", + " ('x4', 'x3'),\n", + " ('x5', 'x0'),\n", + " ('x5', 'x1'),\n", + " ('x5', 'x2'),\n", + " ('x5', 'x3'),\n", + " ('x5', 'x4'),\n", + " ('x6', 'x0'),\n", + " ('x6', 'x1'),\n", + " ('x6', 'x2'),\n", + " ('x6', 'x3'),\n", + " ('x6', 'x4'),\n", + " ('x6', 'x5'),\n", + " ('x7', 'x0'),\n", + " ('x7', 'x1'),\n", + " ('x7', 'x2'),\n", + " ('x7', 'x3'),\n", + " ('x7', 'x4'),\n", + " ('x7', 'x5'),\n", + " ('x7', 'x6'),\n", + " ('x8', 'x0'),\n", + " ('x8', 'x1'),\n", + " ('x8', 'x2'),\n", + " ('x8', 'x3'),\n", + " ('x8', 'x4'),\n", + " ('x8', 'x5'),\n", + " ('x8', 'x6'),\n", + " ('x8', 'x7'),\n", + " ('x9', 'x0'),\n", + " ('x9', 'x1'),\n", + " ('x9', 'x2'),\n", + " ('x9', 'x3'),\n", + " ('x9', 'x4'),\n", + " ('x9', 'x5'),\n", + " ('x9', 'x6'),\n", + " ('x9', 'x7'),\n", + " ('x9', 'x8'),\n", + " ('x10', 'x0'),\n", + " ('x10', 'x1'),\n", + " ('x10', 'x2'),\n", + " ('x10', 'x3'),\n", + " ('x10', 'x4'),\n", + " ('x10', 'x5'),\n", + " ('x10', 'x6'),\n", + " ('x10', 'x7'),\n", + " ('x10', 'x8'),\n", + " ('x10', 'x9'),\n", + " ('x11', 'x0'),\n", + " ('x11', 'x1'),\n", + " ('x11', 'x2'),\n", + " ('x11', 'x3'),\n", + " ('x11', 'x4'),\n", + " ('x11', 'x5'),\n", + " ('x11', 'x6'),\n", + " ('x11', 'x7'),\n", + " ('x11', 'x8'),\n", + " ('x11', 'x9'),\n", + " ('x11', 'x10'),\n", + " ('x12', 'x0'),\n", + " ('x12', 'x1'),\n", + " ('x12', 'x2'),\n", + " ('x12', 'x3'),\n", + " ('x12', 'x4'),\n", + " ('x12', 'x5'),\n", + " ('x12', 'x6'),\n", + " ('x12', 'x7'),\n", + " ('x12', 'x8'),\n", + " ('x12', 'x9'),\n", + " ('x12', 'x10'),\n", + " ('x12', 'x11'),\n", + " ('x13', 'x0'),\n", + " ('x13', 'x1'),\n", + " ('x13', 'x2'),\n", + " ('x13', 'x3'),\n", + " ('x13', 'x4'),\n", + " ('x13', 'x5'),\n", + " ('x13', 'x6'),\n", + " ('x13', 'x7'),\n", + " ('x13', 'x8'),\n", + " ('x13', 'x9'),\n", + " ('x13', 'x10'),\n", + " ('x13', 'x11'),\n", + " ('x13', 'x12'),\n", + " ('x14', 'x0'),\n", + " ('x14', 'x1'),\n", + " ('x14', 'x2'),\n", + " ('x14', 'x3'),\n", + " ('x14', 'x4'),\n", + " ('x14', 'x5'),\n", + " ('x14', 'x6'),\n", + " ('x14', 'x7'),\n", + " ('x14', 'x8'),\n", + " ('x14', 'x9'),\n", + " ('x14', 'x10'),\n", + " ('x14', 'x11'),\n", + " ('x14', 'x12'),\n", + " ('x14', 'x13'),\n", + " ('x15', 'x0'),\n", + " ('x15', 'x1'),\n", + " ('x15', 'x2'),\n", + " ('x15', 'x3'),\n", + " ('x15', 'x4'),\n", + " ('x15', 'x5'),\n", + " ('x15', 'x6'),\n", + " ('x15', 'x7'),\n", + " ('x15', 'x8'),\n", + " ('x15', 'x9'),\n", + " ('x15', 'x10'),\n", + " ('x15', 'x11'),\n", + " ('x15', 'x12'),\n", + " ('x15', 'x13'),\n", + " ('x15', 'x14'),\n", + " ('x16', 'x0'),\n", + " ('x16', 'x1'),\n", + " ('x16', 'x2'),\n", + " ('x16', 'x3'),\n", + " ('x16', 'x4'),\n", + " ('x16', 'x5'),\n", + " ('x16', 'x6'),\n", + " ('x16', 'x7'),\n", + " ('x16', 'x8'),\n", + " ('x16', 'x9'),\n", + " ('x16', 'x10'),\n", + " ('x16', 'x11'),\n", + " ('x16', 'x12'),\n", + " ('x16', 'x13'),\n", + " ('x16', 'x14'),\n", + " ('x16', 'x15'),\n", + " ('x17', 'x0'),\n", + " ('x17', 'x1'),\n", + " ('x17', 'x2'),\n", + " ('x17', 'x3'),\n", + " ('x17', 'x4'),\n", + " ('x17', 'x5'),\n", + " ('x17', 'x6'),\n", + " ('x17', 'x7'),\n", + " ('x17', 'x8'),\n", + " ('x17', 'x9'),\n", + " ('x17', 'x10'),\n", + " ('x17', 'x11'),\n", + " ('x17', 'x12'),\n", + " ('x17', 'x13'),\n", + " ('x17', 'x14'),\n", + " ('x17', 'x15'),\n", + " ('x17', 'x16'),\n", + " ('x18', 'x0'),\n", + " ('x18', 'x1'),\n", + " ('x18', 'x2'),\n", + " ('x18', 'x3'),\n", + " ('x18', 'x4'),\n", + " ('x18', 'x5'),\n", + " ('x18', 'x6'),\n", + " ('x18', 'x7'),\n", + " ('x18', 'x8'),\n", + " ('x18', 'x9'),\n", + " ('x18', 'x10'),\n", + " ('x18', 'x11'),\n", + " ('x18', 'x12'),\n", + " ('x18', 'x13'),\n", + " ('x18', 'x14'),\n", + " ('x18', 'x15'),\n", + " ('x18', 'x16'),\n", + " ('x18', 'x17'),\n", + " ('x19', 'x0'),\n", + " ('x19', 'x1'),\n", + " ('x19', 'x2'),\n", + " ('x19', 'x3'),\n", + " ('x19', 'x4'),\n", + " ('x19', 'x5'),\n", + " ('x19', 'x6'),\n", + " ('x19', 'x7'),\n", + " ('x19', 'x8'),\n", + " ('x19', 'x9'),\n", + " ('x19', 'x10'),\n", + " ('x19', 'x11'),\n", + " ('x19', 'x12'),\n", + " ('x19', 'x13'),\n", + " ('x19', 'x14'),\n", + " ('x19', 'x15'),\n", + " ('x19', 'x16'),\n", + " ('x19', 'x17'),\n", + " ('x19', 'x18'),\n", + " ('x20', 'x0'),\n", + " ('x20', 'x1'),\n", + " ('x20', 'x2'),\n", + " ('x20', 'x3'),\n", + " ('x20', 'x4'),\n", + " ('x20', 'x5'),\n", + " ('x20', 'x6'),\n", + " ('x20', 'x7'),\n", + " ('x20', 'x8'),\n", + " ('x20', 'x9'),\n", + " ('x20', 'x10'),\n", + " ('x20', 'x11'),\n", + " ('x20', 'x12'),\n", + " ('x20', 'x13'),\n", + " ('x20', 'x14'),\n", + " ('x20', 'x15'),\n", + " ('x20', 'x16'),\n", + " ('x20', 'x17'),\n", + " ('x20', 'x18'),\n", + " ('x20', 'x19'),\n", + " ('x21', 'x0'),\n", + " ('x21', 'x1'),\n", + " ('x21', 'x2'),\n", + " ('x21', 'x3'),\n", + " ('x21', 'x4'),\n", + " ('x21', 'x5'),\n", + " ('x21', 'x6'),\n", + " ('x21', 'x7'),\n", + " ('x21', 'x8'),\n", + " ('x21', 'x9'),\n", + " ('x21', 'x10'),\n", + " ('x21', 'x11'),\n", + " ('x21', 'x12'),\n", + " ('x21', 'x13'),\n", + " ('x21', 'x14'),\n", + " ('x21', 'x15'),\n", + " ('x21', 'x16'),\n", + " ('x21', 'x17'),\n", + " ('x21', 'x18'),\n", + " ('x21', 'x19'),\n", + " ('x21', 'x20'),\n", + " ('x22', 'x0'),\n", + " ('x22', 'x1'),\n", + " ('x22', 'x2'),\n", + " ('x22', 'x3'),\n", + " ('x22', 'x4'),\n", + " ('x22', 'x5'),\n", + " ('x22', 'x6'),\n", + " ('x22', 'x7'),\n", + " ('x22', 'x8'),\n", + " ('x22', 'x9'),\n", + " ('x22', 'x10'),\n", + " ('x22', 'x11'),\n", + " ('x22', 'x12'),\n", + " ('x22', 'x13'),\n", + " ('x22', 'x14'),\n", + " ('x22', 'x15'),\n", + " ('x22', 'x16'),\n", + " ('x22', 'x17'),\n", + " ('x22', 'x18'),\n", + " ('x22', 'x19'),\n", + " ('x22', 'x20'),\n", + " ('x22', 'x21'),\n", + " ('x23', 'x0'),\n", + " ('x23', 'x1'),\n", + " ('x23', 'x2'),\n", + " ('x23', 'x3'),\n", + " ('x23', 'x4'),\n", + " ('x23', 'x5'),\n", + " ('x23', 'x6'),\n", + " ('x23', 'x7'),\n", + " ('x23', 'x8'),\n", + " ('x23', 'x9'),\n", + " ('x23', 'x10'),\n", + " ('x23', 'x11'),\n", + " ('x23', 'x12'),\n", + " ('x23', 'x13'),\n", + " ('x23', 'x14'),\n", + " ('x23', 'x15'),\n", + " ('x23', 'x16'),\n", + " ('x23', 'x17'),\n", + " ('x23', 'x18'),\n", + " ('x23', 'x19'),\n", + " ('x23', 'x20'),\n", + " ('x23', 'x21'),\n", + " ('x23', 'x22'),\n", + " ('x24', 'x0'),\n", + " ('x24', 'x1'),\n", + " ('x24', 'x2'),\n", + " ('x24', 'x3'),\n", + " ('x24', 'x4'),\n", + " ('x24', 'x5'),\n", + " ('x24', 'x6'),\n", + " ('x24', 'x7'),\n", + " ('x24', 'x8'),\n", + " ('x24', 'x9'),\n", + " ('x24', 'x10'),\n", + " ('x24', 'x11'),\n", + " ('x24', 'x12'),\n", + " ('x24', 'x13'),\n", + " ('x24', 'x14'),\n", + " ('x24', 'x15'),\n", + " ('x24', 'x16'),\n", + " ('x24', 'x17'),\n", + " ('x24', 'x18'),\n", + " ('x24', 'x19'),\n", + " ('x24', 'x20'),\n", + " ('x24', 'x21'),\n", + " ('x24', 'x22'),\n", + " ('x24', 'x23'),\n", + " ('x25', 'x0'),\n", + " ('x25', 'x1'),\n", + " ('x25', 'x2'),\n", + " ('x25', 'x3'),\n", + " ('x25', 'x4'),\n", + " ('x25', 'x5'),\n", + " ('x25', 'x6'),\n", + " ('x25', 'x7'),\n", + " ('x25', 'x8'),\n", + " ('x25', 'x9'),\n", + " ('x25', 'x10'),\n", + " ('x25', 'x11'),\n", + " ('x25', 'x12'),\n", + " ('x25', 'x13'),\n", + " ('x25', 'x14'),\n", + " ('x25', 'x15'),\n", + " ('x25', 'x16'),\n", + " ('x25', 'x17'),\n", + " ('x25', 'x18'),\n", + " ('x25', 'x19'),\n", + " ('x25', 'x20'),\n", + " ('x25', 'x21'),\n", + " ('x25', 'x22'),\n", + " ('x25', 'x23'),\n", + " ('x25', 'x24'),\n", + " ('x26', 'x0'),\n", + " ('x26', 'x1'),\n", + " ('x26', 'x2'),\n", + " ('x26', 'x3'),\n", + " ('x26', 'x4'),\n", + " ('x26', 'x5'),\n", + " ('x26', 'x6'),\n", + " ('x26', 'x7'),\n", + " ('x26', 'x8'),\n", + " ('x26', 'x9'),\n", + " ('x26', 'x10'),\n", + " ('x26', 'x11'),\n", + " ('x26', 'x12'),\n", + " ('x26', 'x13'),\n", + " ('x26', 'x14'),\n", + " ('x26', 'x15'),\n", + " ('x26', 'x16'),\n", + " ('x26', 'x17'),\n", + " ('x26', 'x18'),\n", + " ('x26', 'x19'),\n", + " ('x26', 'x20'),\n", + " ('x26', 'x21'),\n", + " ('x26', 'x22'),\n", + " ('x26', 'x23'),\n", + " ('x26', 'x24'),\n", + " ('x26', 'x25'),\n", + " ('x27', 'x0'),\n", + " ('x27', 'x1'),\n", + " ('x27', 'x2'),\n", + " ('x27', 'x3'),\n", + " ('x27', 'x4'),\n", + " ('x27', 'x5'),\n", + " ('x27', 'x6'),\n", + " ('x27', 'x7'),\n", + " ('x27', 'x8'),\n", + " ('x27', 'x9'),\n", + " ('x27', 'x10'),\n", + " ('x27', 'x11'),\n", + " ('x27', 'x12'),\n", + " ('x27', 'x13'),\n", + " ('x27', 'x14'),\n", + " ('x27', 'x15'),\n", + " ('x27', 'x16'),\n", + " ('x27', 'x17'),\n", + " ('x27', 'x18'),\n", + " ('x27', 'x19'),\n", + " ('x27', 'x20'),\n", + " ('x27', 'x21'),\n", + " ('x27', 'x22'),\n", + " ('x27', 'x23'),\n", + " ('x27', 'x24'),\n", + " ('x27', 'x25'),\n", + " ('x27', 'x26'),\n", + " ('x28', 'x0'),\n", + " ('x28', 'x1'),\n", + " ('x28', 'x2'),\n", + " ('x28', 'x3'),\n", + " ('x28', 'x4'),\n", + " ('x28', 'x5'),\n", + " ('x28', 'x6'),\n", + " ('x28', 'x7'),\n", + " ('x28', 'x8'),\n", + " ('x28', 'x9'),\n", + " ('x28', 'x10'),\n", + " ('x28', 'x11'),\n", + " ('x28', 'x12'),\n", + " ('x28', 'x13'),\n", + " ('x28', 'x14'),\n", + " ('x28', 'x15'),\n", + " ('x28', 'x16'),\n", + " ('x28', 'x17'),\n", + " ('x28', 'x18'),\n", + " ('x28', 'x19'),\n", + " ('x28', 'x20'),\n", + " ('x28', 'x21'),\n", + " ('x28', 'x22'),\n", + " ('x28', 'x23'),\n", + " ('x28', 'x24'),\n", + " ('x28', 'x25'),\n", + " ('x28', 'x26'),\n", + " ('x28', 'x27'),\n", + " ('x29', 'x0'),\n", + " ('x29', 'x1'),\n", + " ('x29', 'x2'),\n", + " ('x29', 'x3'),\n", + " ('x29', 'x4'),\n", + " ('x29', 'x5'),\n", + " ('x29', 'x6'),\n", + " ('x29', 'x7'),\n", + " ('x29', 'x8'),\n", + " ('x29', 'x9'),\n", + " ('x29', 'x10'),\n", + " ('x29', 'x11'),\n", + " ('x29', 'x12'),\n", + " ('x29', 'x13'),\n", + " ('x29', 'x14'),\n", + " ('x29', 'x15'),\n", + " ('x29', 'x16'),\n", + " ('x29', 'x17'),\n", + " ('x29', 'x18'),\n", + " ('x29', 'x19'),\n", + " ('x29', 'x20'),\n", + " ('x29', 'x21'),\n", + " ('x29', 'x22'),\n", + " ('x29', 'x23'),\n", + " ('x29', 'x24'),\n", + " ('x29', 'x25'),\n", + " ('x29', 'x26'),\n", + " ('x29', 'x27'),\n", + " ('x29', 'x28'),\n", + " ('x30', 'x0'),\n", + " ('x30', 'x1'),\n", + " ('x30', 'x2'),\n", + " ('x30', 'x3'),\n", + " ('x30', 'x4'),\n", + " ('x30', 'x5'),\n", + " ('x30', 'x6'),\n", + " ('x30', 'x7'),\n", + " ('x30', 'x8'),\n", + " ('x30', 'x9'),\n", + " ('x30', 'x10'),\n", + " ('x30', 'x11'),\n", + " ('x30', 'x12'),\n", + " ('x30', 'x13'),\n", + " ('x30', 'x14'),\n", + " ('x30', 'x15'),\n", + " ('x30', 'x16'),\n", + " ('x30', 'x17'),\n", + " ('x30', 'x18'),\n", + " ('x30', 'x19'),\n", + " ('x30', 'x20'),\n", + " ('x30', 'x21'),\n", + " ('x30', 'x22'),\n", + " ('x30', 'x23'),\n", + " ('x30', 'x24'),\n", + " ('x30', 'x25'),\n", + " ('x30', 'x26'),\n", + " ('x30', 'x27'),\n", + " ('x30', 'x28'),\n", + " ('x30', 'x29'),\n", + " ('x31', 'x0'),\n", + " ('x31', 'x1'),\n", + " ('x31', 'x2'),\n", + " ('x31', 'x3'),\n", + " ('x31', 'x4'),\n", + " ('x31', 'x5'),\n", + " ('x31', 'x6'),\n", + " ('x31', 'x7'),\n", + " ('x31', 'x8'),\n", + " ('x31', 'x9'),\n", + " ('x31', 'x10'),\n", + " ('x31', 'x11'),\n", + " ('x31', 'x12'),\n", + " ('x31', 'x13'),\n", + " ('x31', 'x14'),\n", + " ('x31', 'x15'),\n", + " ('x31', 'x16'),\n", + " ('x31', 'x17'),\n", + " ('x31', 'x18'),\n", + " ('x31', 'x19'),\n", + " ('x31', 'x20'),\n", + " ('x31', 'x21'),\n", + " ('x31', 'x22'),\n", + " ('x31', 'x23'),\n", + " ('x31', 'x24'),\n", + " ('x31', 'x25'),\n", + " ('x31', 'x26'),\n", + " ('x31', 'x27'),\n", + " ('x31', 'x28'),\n", + " ('x31', 'x29'),\n", + " ('x31', 'x30'),\n", + " ('x32', 'x0'),\n", + " ('x32', 'x1'),\n", + " ('x32', 'x2'),\n", + " ('x32', 'x3'),\n", + " ('x32', 'x4'),\n", + " ('x32', 'x5'),\n", + " ('x32', 'x6'),\n", + " ('x32', 'x7'),\n", + " ('x32', 'x8'),\n", + " ('x32', 'x9'),\n", + " ('x32', 'x10'),\n", + " ('x32', 'x11'),\n", + " ('x32', 'x12'),\n", + " ('x32', 'x13'),\n", + " ('x32', 'x14'),\n", + " ('x32', 'x15'),\n", + " ('x32', 'x16'),\n", + " ('x32', 'x17'),\n", + " ('x32', 'x18'),\n", + " ('x32', 'x19'),\n", + " ('x32', 'x20'),\n", + " ('x32', 'x21'),\n", + " ('x32', 'x22'),\n", + " ('x32', 'x23'),\n", + " ('x32', 'x24'),\n", + " ('x32', 'x25'),\n", + " ('x32', 'x26'),\n", + " ('x32', 'x27'),\n", + " ('x32', 'x28'),\n", + " ('x32', 'x29'),\n", + " ('x32', 'x30'),\n", + " ('x32', 'x31'),\n", + " ('x33', 'x0'),\n", + " ('x33', 'x1'),\n", + " ('x33', 'x2'),\n", + " ('x33', 'x3'),\n", + " ('x33', 'x4'),\n", + " ('x33', 'x5'),\n", + " ('x33', 'x6'),\n", + " ('x33', 'x7'),\n", + " ('x33', 'x8'),\n", + " ('x33', 'x9'),\n", + " ('x33', 'x10'),\n", + " ('x33', 'x11'),\n", + " ('x33', 'x12'),\n", + " ('x33', 'x13'),\n", + " ('x33', 'x14'),\n", + " ('x33', 'x15'),\n", + " ('x33', 'x16'),\n", + " ('x33', 'x17'),\n", + " ('x33', 'x18'),\n", + " ('x33', 'x19'),\n", + " ('x33', 'x20'),\n", + " ('x33', 'x21'),\n", + " ('x33', 'x22'),\n", + " ('x33', 'x23'),\n", + " ('x33', 'x24'),\n", + " ('x33', 'x25'),\n", + " ('x33', 'x26'),\n", + " ('x33', 'x27'),\n", + " ('x33', 'x28'),\n", + " ('x33', 'x29'),\n", + " ('x33', 'x30'),\n", + " ('x33', 'x31'),\n", + " ('x33', 'x32'),\n", + " ('x34', 'x0'),\n", + " ('x34', 'x1'),\n", + " ('x34', 'x2'),\n", + " ('x34', 'x3'),\n", + " ('x34', 'x4'),\n", + " ('x34', 'x5'),\n", + " ('x34', 'x6'),\n", + " ('x34', 'x7'),\n", + " ('x34', 'x8'),\n", + " ('x34', 'x9'),\n", + " ('x34', 'x10'),\n", + " ('x34', 'x11'),\n", + " ('x34', 'x12'),\n", + " ('x34', 'x13'),\n", + " ('x34', 'x14'),\n", + " ('x34', 'x15'),\n", + " ('x34', 'x16'),\n", + " ('x34', 'x17'),\n", + " ('x34', 'x18'),\n", + " ('x34', 'x19'),\n", + " ('x34', 'x20'),\n", + " ('x34', 'x21'),\n", + " ('x34', 'x22'),\n", + " ('x34', 'x23'),\n", + " ('x34', 'x24'),\n", + " ('x34', 'x25'),\n", + " ('x34', 'x26'),\n", + " ('x34', 'x27'),\n", + " ('x34', 'x28'),\n", + " ('x34', 'x29'),\n", + " ('x34', 'x30'),\n", + " ('x34', 'x31'),\n", + " ('x34', 'x32'),\n", + " ('x34', 'x33'),\n", + " ('x35', 'x0'),\n", + " ('x35', 'x1'),\n", + " ('x35', 'x2'),\n", + " ('x35', 'x3'),\n", + " ('x35', 'x4'),\n", + " ('x35', 'x5'),\n", + " ('x35', 'x6'),\n", + " ('x35', 'x7'),\n", + " ('x35', 'x8'),\n", + " ('x35', 'x9'),\n", + " ('x35', 'x10'),\n", + " ('x35', 'x11'),\n", + " ('x35', 'x12'),\n", + " ('x35', 'x13'),\n", + " ('x35', 'x14'),\n", + " ('x35', 'x15'),\n", + " ('x35', 'x16'),\n", + " ('x35', 'x17'),\n", + " ('x35', 'x18'),\n", + " ('x35', 'x19'),\n", + " ('x35', 'x20'),\n", + " ('x35', 'x21'),\n", + " ('x35', 'x22'),\n", + " ('x35', 'x23'),\n", + " ('x35', 'x24'),\n", + " ('x35', 'x25'),\n", + " ('x35', 'x26'),\n", + " ('x35', 'x27'),\n", + " ('x35', 'x28'),\n", + " ('x35', 'x29'),\n", + " ('x35', 'x30'),\n", + " ('x35', 'x31'),\n", + " ('x35', 'x32'),\n", + " ('x35', 'x33'),\n", + " ('x35', 'x34'),\n", + " ('x36', 'x0'),\n", + " ('x36', 'x1'),\n", + " ('x36', 'x2'),\n", + " ('x36', 'x3'),\n", + " ('x36', 'x4'),\n", + " ('x36', 'x5'),\n", + " ('x36', 'x6'),\n", + " ('x36', 'x7'),\n", + " ('x36', 'x8'),\n", + " ('x36', 'x9'),\n", + " ('x36', 'x10'),\n", + " ('x36', 'x11'),\n", + " ('x36', 'x12'),\n", + " ('x36', 'x13'),\n", + " ('x36', 'x14'),\n", + " ('x36', 'x15'),\n", + " ('x36', 'x16'),\n", + " ('x36', 'x17'),\n", + " ('x36', 'x18'),\n", + " ('x36', 'x19'),\n", + " ('x36', 'x20'),\n", + " ('x36', 'x21'),\n", + " ('x36', 'x22'),\n", + " ('x36', 'x23'),\n", + " ('x36', 'x24'),\n", + " ('x36', 'x25'),\n", + " ('x36', 'x26'),\n", + " ('x36', 'x27'),\n", + " ('x36', 'x28'),\n", + " ('x36', 'x29'),\n", + " ('x36', 'x30'),\n", + " ('x36', 'x31'),\n", + " ('x36', 'x32'),\n", + " ('x36', 'x33'),\n", + " ('x36', 'x34'),\n", + " ('x36', 'x35'),\n", + " ('x37', 'x0'),\n", + " ('x37', 'x1'),\n", + " ('x37', 'x2'),\n", + " ('x37', 'x3'),\n", + " ('x37', 'x4'),\n", + " ('x37', 'x5'),\n", + " ('x37', 'x6'),\n", + " ('x37', 'x7'),\n", + " ('x37', 'x8'),\n", + " ('x37', 'x9'),\n", + " ('x37', 'x10'),\n", + " ('x37', 'x11'),\n", + " ('x37', 'x12'),\n", + " ('x37', 'x13'),\n", + " ('x37', 'x14'),\n", + " ('x37', 'x15'),\n", + " ('x37', 'x16'),\n", + " ('x37', 'x17'),\n", + " ('x37', 'x18'),\n", + " ('x37', 'x19'),\n", + " ('x37', 'x20'),\n", + " ('x37', 'x21'),\n", + " ('x37', 'x22'),\n", + " ('x37', 'x23'),\n", + " ('x37', 'x24'),\n", + " ('x37', 'x25'),\n", + " ('x37', 'x26'),\n", + " ('x37', 'x27'),\n", + " ('x37', 'x28'),\n", + " ('x37', 'x29'),\n", + " ('x37', 'x30'),\n", + " ('x37', 'x31'),\n", + " ('x37', 'x32'),\n", + " ('x37', 'x33'),\n", + " ('x37', 'x34'),\n", + " ('x37', 'x35'),\n", + " ('x37', 'x36'),\n", + " ('x38', 'x0'),\n", + " ('x38', 'x1'),\n", + " ('x38', 'x2'),\n", + " ('x38', 'x3'),\n", + " ('x38', 'x4'),\n", + " ('x38', 'x5'),\n", + " ('x38', 'x6'),\n", + " ('x38', 'x7'),\n", + " ('x38', 'x8'),\n", + " ('x38', 'x9'),\n", + " ('x38', 'x10'),\n", + " ('x38', 'x11'),\n", + " ('x38', 'x12'),\n", + " ('x38', 'x13'),\n", + " ('x38', 'x14'),\n", + " ('x38', 'x15'),\n", + " ('x38', 'x16'),\n", + " ('x38', 'x17'),\n", + " ('x38', 'x18'),\n", + " ('x38', 'x19'),\n", + " ('x38', 'x20'),\n", + " ('x38', 'x21'),\n", + " ('x38', 'x22'),\n", + " ('x38', 'x23'),\n", + " ('x38', 'x24'),\n", + " ('x38', 'x25'),\n", + " ('x38', 'x26'),\n", + " ('x38', 'x27'),\n", + " ('x38', 'x28'),\n", + " ('x38', 'x29'),\n", + " ('x38', 'x30'),\n", + " ('x38', 'x31'),\n", + " ('x38', 'x32'),\n", + " ('x38', 'x33'),\n", + " ('x38', 'x34'),\n", + " ('x38', 'x35'),\n", + " ('x38', 'x36'),\n", + " ('x38', 'x37'),\n", + " ('x39', 'x0'),\n", + " ('x39', 'x1'),\n", + " ('x39', 'x2'),\n", + " ('x39', 'x3'),\n", + " ('x39', 'x4'),\n", + " ('x39', 'x5'),\n", + " ('x39', 'x6'),\n", + " ('x39', 'x7'),\n", + " ('x39', 'x8'),\n", + " ('x39', 'x9'),\n", + " ('x39', 'x10'),\n", + " ('x39', 'x11'),\n", + " ('x39', 'x12'),\n", + " ('x39', 'x13'),\n", + " ('x39', 'x14'),\n", + " ('x39', 'x15'),\n", + " ('x39', 'x16'),\n", + " ('x39', 'x17'),\n", + " ('x39', 'x18'),\n", + " ('x39', 'x19'),\n", + " ('x39', 'x20'),\n", + " ('x39', 'x21'),\n", + " ('x39', 'x22'),\n", + " ('x39', 'x23'),\n", + " ('x39', 'x24'),\n", + " ('x39', 'x25'),\n", + " ('x39', 'x26'),\n", + " ('x39', 'x27'),\n", + " ('x39', 'x28'),\n", + " ('x39', 'x29'),\n", + " ('x39', 'x30'),\n", + " ('x39', 'x31'),\n", + " ('x39', 'x32'),\n", + " ('x39', 'x33'),\n", + " ('x39', 'x34'),\n", + " ('x39', 'x35'),\n", + " ('x39', 'x36'),\n", + " ('x39', 'x37'),\n", + " ('x39', 'x38')]}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (180, 181, 182, 183, 2940),\n", + " 'source_variables': ['x0'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (195, 196, 197, 198, 2955),\n", + " 'source_variables': ['x1'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (150, 151, 152, 153, 2970),\n", + " 'source_variables': ['x2'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (165, 166, 167, 168, 2985),\n", + " 'source_variables': ['x3'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (210, 211, 212, 213, 3000),\n", + " 'source_variables': ['x4'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (225, 226, 227, 228, 3015),\n", + " 'source_variables': ['x5'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (240, 241, 242, 3540),\n", + " 'source_variables': ['x6'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (255, 256, 257, 3555),\n", + " 'source_variables': ['x7'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (270, 271, 272, 3510, 3511),\n", + " 'source_variables': ['x8'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (285, 286, 287, 3525, 3526),\n", + " 'source_variables': ['x9'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (300, 301, 302, 3480, 3481),\n", + " 'source_variables': ['x10'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (315, 316, 317, 3495, 3496),\n", + " 'source_variables': ['x11'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (330, 331, 332, 3450, 3451),\n", + " 'source_variables': ['x12'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (345, 346, 347, 3465, 3466),\n", + " 'source_variables': ['x13'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (360, 361, 362, 3420, 3421),\n", + " 'source_variables': ['x14'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (375, 376, 377, 3435, 3436),\n", + " 'source_variables': ['x15'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (390, 391, 392, 3390, 3391),\n", + " 'source_variables': ['x16'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (405, 406, 407, 3405, 3406),\n", + " 'source_variables': ['x17'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (435, 436, 3375, 3376),\n", + " 'source_variables': ['x19'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (450, 451, 3330, 3331, 3332),\n", + " 'source_variables': ['x20'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (465, 466, 3345, 3346, 3347),\n", + " 'source_variables': ['x21'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (480, 481, 3300, 3301, 3302),\n", + " 'source_variables': ['x22'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (495, 496, 3315, 3316, 3317),\n", + " 'source_variables': ['x23'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (510, 511, 3270, 3271, 3272),\n", + " 'source_variables': ['x24'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (525, 526, 3285, 3286, 3287),\n", + " 'source_variables': ['x25'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (555, 556, 3255, 3256, 3257),\n", + " 'source_variables': ['x27'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (570, 571, 3210, 3211, 3212),\n", + " 'source_variables': ['x28'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (585, 586, 3225, 3226, 3227),\n", + " 'source_variables': ['x29'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (600, 3180, 3181, 3182),\n", + " 'source_variables': ['x30'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (615, 3195, 3196, 3197),\n", + " 'source_variables': ['x31'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (645, 3165, 3166, 3167, 3168),\n", + " 'source_variables': ['x33'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (660, 3030, 3031, 3032),\n", + " 'source_variables': ['x34'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (675, 3045, 3046, 3047),\n", + " 'source_variables': ['x35'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (120, 3060, 3061, 3062, 3063),\n", + " 'source_variables': ['x36'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (135, 3075, 3076, 3077, 3078),\n", + " 'source_variables': ['x37'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (90, 3090, 3091, 3092, 3093),\n", + " 'source_variables': ['x38'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': (105, 3105, 3106, 3107, 3108),\n", + " 'source_variables': ['x39'],\n", + " 'sample_index': 0}},\n", + " {'type': UserWarning,\n", + " 'message': 'All samples have broken chains',\n", + " 'level': 30,\n", + " 'data': {}}]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.warnings" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "d4c2274c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "Serving Inspector on http://127.0.0.1:18000/?problemId=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "'http://127.0.0.1:18000/?problemId=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4'" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import dwave.inspector\n", + "\n", + "\n", + "dwave.inspector.show(res.sampleset_info.dwave_sampleset)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "14c5103f", + "metadata": {}, + "outputs": [], + "source": [ + "from dimod import SampleSet\n", + "\n", + "\n", + "id = 4\n", + "with open(f\"id_7_sampleset_adv_n=40_qubo_size=820__id=f49fda51-0bdf-47d9-8dab-e6c3296ca0c4_serializable.pkl\", \"rb\") as f:\n", + " l = pickle.load(f)\n", + "\n", + "\n", + "ls = SampleSet.from_serializable(l)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "7cc0ed7b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "SampleSet(rec.array([([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1], 0.82051282, 1, 0.925),\n", + " ([0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0], -2.5 , 1, 0.925),\n", + " ([1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0], -4.5 , 1, 0.9 ),\n", + " ([0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1], -3.48717949, 1, 0.875),\n", + " ([1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0], -2.44871795, 1, 0.975),\n", + " ([1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0], -9.48717949, 1, 0.875),\n", + " ([1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1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717949, 1, 0.975),\n", + " ([1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0], -3.48717949, 1, 0.95 ),\n", + " ([0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1], -8.03846154, 1, 0.925),\n", + " ([1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], -4.87179487, 1, 0.975),\n", + " ([0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1], -5.48717949, 1, 0.875),\n", + " ([1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0], -3.48717949, 1, 0.875),\n", + " ([0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1], -8.03846154, 1, 0.85 ),\n", + " ([1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0], -6.87179487, 1, 0.775),\n", + " ([0, 1, 1, 1, 1, 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, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0], -2.29487179, 1, 0.95 ),\n", + " ([1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0], -5.17948718, 1, 0.975),\n", + " ([1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0], 0.66666667, 1, 0.95 ),\n", + " ([0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0], 0.51282051, 1, 1. ),\n", + " ([0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], -2.5 , 1, 0.925),\n", + " ([1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0], -6.87179487, 1, 0.925),\n", + " ([1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1], -2.44871795, 1, 0.9 )],\n", + " dtype=[('sample', 'i1', (40,)), ('energy', ', 'message': 'Some biases are 10^3 times stronger than others', 'level': 30, 'data': {'source_interactions': [[181, 180], [2940, 180], [182, 181], [183, 182], [196, 195], [2955, 195], [197, 196], [198, 197], [151, 150], [2970, 150], [152, 151], [153, 152], [166, 165], [2985, 165], [167, 166], [168, 167], [211, 210], [3000, 210], [212, 211], [213, 212], [226, 225], [3015, 225], [227, 226], [228, 227], [241, 240], [242, 241], [3540, 242], [256, 255], [257, 256], [3555, 257], [271, 270], [272, 271], [3511, 272], [3510, 3511], [286, 285], [287, 286], [3526, 287], [3525, 3526], [301, 300], [302, 301], [3481, 302], [3480, 3481], [316, 315], [317, 316], [3496, 317], [3495, 3496], [331, 330], [332, 331], [3451, 332], [3450, 3451], [346, 345], [347, 346], [3466, 347], [3465, 3466], [361, 360], [362, 361], [3421, 362], [3420, 3421], [376, 375], [377, 376], [3436, 377], [3435, 3436], [391, 390], [392, 391], [3391, 392], [3390, 3391], [406, 405], [407, 406], [3406, 407], [3405, 3406], [421, 420], [3361, 421], [3360, 3361], [436, 435], [3376, 436], [3375, 3376], [451, 450], [3332, 451], [3331, 3332], [3331, 3330], [466, 465], [3347, 466], [3346, 3347], [3346, 3345], [481, 480], [3302, 481], [3301, 3302], [3301, 3300], [496, 495], [3317, 496], [3316, 3317], [3316, 3315], [511, 510], [3272, 511], [3271, 3272], [3271, 3270], [526, 525], [3287, 526], [3286, 3287], [3286, 3285], [541, 540], [3242, 541], [3241, 3242], [3241, 3240], [556, 555], [3257, 556], [3256, 3257], [3256, 3255], [571, 570], [3212, 571], [3211, 3212], [3211, 3210], [586, 585], [3227, 586], [3226, 3227], [3226, 3225], [3182, 600], [3181, 3182], [3181, 3180], [3197, 615], [3196, 3197], [3196, 3195], [3153, 630], [3151, 3150], [3152, 3153], [3152, 3151], [3168, 645], [3166, 3165], [3167, 3168], [3167, 3166], [3032, 660], [3031, 3032], [3031, 3030], [3047, 675], [3046, 3047], [3046, 3045], [3060, 120], [3061, 3060], [3062, 3061], [3063, 3062], [3075, 135], [3076, 3075], [3077, 3076], [3078, 3077], [3090, 90], [3091, 3090], [3092, 3091], [3093, 3092], [3105, 105], [3106, 3105], [3107, 3106], [3108, 3107]]}}, {'type': , 'message': 'Number of ground states found is within sampling error', 'level': 30, 'data': {'number_of_ground_states': 1, 'num_reads': 100, 'sampling_error_rate': 10.0}}, {'type': , 'message': 'Some quadratic biases are stronger than the given chain strength', 'level': 30, 'data': {'source_interactions': [['x1', 'x0'], ['x2', 'x0'], ['x2', 'x1'], ['x3', 'x0'], ['x3', 'x1'], ['x3', 'x2'], ['x4', 'x0'], ['x4', 'x1'], ['x4', 'x2'], ['x4', 'x3'], ['x5', 'x0'], ['x5', 'x1'], ['x5', 'x2'], ['x5', 'x3'], ['x5', 'x4'], ['x6', 'x0'], ['x6', 'x1'], ['x6', 'x2'], ['x6', 'x3'], ['x6', 'x4'], ['x6', 'x5'], ['x7', 'x0'], ['x7', 'x1'], ['x7', 'x2'], ['x7', 'x3'], ['x7', 'x4'], ['x7', 'x5'], ['x7', 'x6'], ['x8', 'x0'], ['x8', 'x1'], ['x8', 'x2'], ['x8', 'x3'], ['x8', 'x4'], ['x8', 'x5'], ['x8', 'x6'], ['x8', 'x7'], ['x9', 'x0'], ['x9', 'x1'], ['x9', 'x2'], ['x9', 'x3'], ['x9', 'x4'], ['x9', 'x5'], ['x9', 'x6'], ['x9', 'x7'], ['x9', 'x8'], ['x10', 'x0'], ['x10', 'x1'], ['x10', 'x2'], ['x10', 'x3'], ['x10', 'x4'], ['x10', 'x5'], ['x10', 'x6'], ['x10', 'x7'], ['x10', 'x8'], ['x10', 'x9'], ['x11', 'x0'], ['x11', 'x1'], ['x11', 'x2'], ['x11', 'x3'], ['x11', 'x4'], ['x11', 'x5'], ['x11', 'x6'], ['x11', 'x7'], ['x11', 'x8'], ['x11', 'x9'], ['x11', 'x10'], ['x12', 'x0'], ['x12', 'x1'], ['x12', 'x2'], ['x12', 'x3'], ['x12', 'x4'], ['x12', 'x5'], ['x12', 'x6'], ['x12', 'x7'], ['x12', 'x8'], ['x12', 'x9'], ['x12', 'x10'], ['x12', 'x11'], ['x13', 'x0'], ['x13', 'x1'], ['x13', 'x2'], ['x13', 'x3'], ['x13', 'x4'], ['x13', 'x5'], ['x13', 'x6'], ['x13', 'x7'], ['x13', 'x8'], ['x13', 'x9'], ['x13', 'x10'], ['x13', 'x11'], ['x13', 'x12'], ['x14', 'x0'], ['x14', 'x1'], ['x14', 'x2'], ['x14', 'x3'], ['x14', 'x4'], ['x14', 'x5'], ['x14', 'x6'], ['x14', 'x7'], ['x14', 'x8'], ['x14', 'x9'], ['x14', 'x10'], ['x14', 'x11'], ['x14', 'x12'], ['x14', 'x13'], ['x15', 'x0'], ['x15', 'x1'], ['x15', 'x2'], ['x15', 'x3'], ['x15', 'x4'], ['x15', 'x5'], ['x15', 'x6'], ['x15', 'x7'], ['x15', 'x8'], ['x15', 'x9'], ['x15', 'x10'], ['x15', 'x11'], ['x15', 'x12'], ['x15', 'x13'], ['x15', 'x14'], ['x16', 'x0'], ['x16', 'x1'], ['x16', 'x2'], ['x16', 'x3'], ['x16', 'x4'], ['x16', 'x5'], ['x16', 'x6'], ['x16', 'x7'], ['x16', 'x8'], ['x16', 'x9'], ['x16', 'x10'], ['x16', 'x11'], ['x16', 'x12'], ['x16', 'x13'], ['x16', 'x14'], ['x16', 'x15'], ['x17', 'x0'], ['x17', 'x1'], ['x17', 'x2'], ['x17', 'x3'], ['x17', 'x4'], ['x17', 'x5'], ['x17', 'x6'], ['x17', 'x7'], ['x17', 'x8'], ['x17', 'x9'], ['x17', 'x10'], ['x17', 'x11'], ['x17', 'x12'], ['x17', 'x13'], ['x17', 'x14'], ['x17', 'x15'], ['x17', 'x16'], ['x18', 'x0'], ['x18', 'x1'], ['x18', 'x2'], ['x18', 'x3'], ['x18', 'x4'], ['x18', 'x5'], ['x18', 'x6'], ['x18', 'x7'], ['x18', 'x8'], ['x18', 'x9'], ['x18', 'x10'], ['x18', 'x11'], ['x18', 'x12'], ['x18', 'x13'], ['x18', 'x14'], ['x18', 'x15'], ['x18', 'x16'], ['x18', 'x17'], ['x19', 'x0'], ['x19', 'x1'], ['x19', 'x2'], ['x19', 'x3'], ['x19', 'x4'], ['x19', 'x5'], ['x19', 'x6'], ['x19', 'x7'], ['x19', 'x8'], ['x19', 'x9'], ['x19', 'x10'], ['x19', 'x11'], ['x19', 'x12'], ['x19', 'x13'], ['x19', 'x14'], ['x19', 'x15'], ['x19', 'x16'], ['x19', 'x17'], ['x19', 'x18'], ['x20', 'x0'], ['x20', 'x1'], ['x20', 'x2'], ['x20', 'x3'], ['x20', 'x4'], ['x20', 'x5'], ['x20', 'x6'], ['x20', 'x7'], ['x20', 'x8'], ['x20', 'x9'], ['x20', 'x10'], ['x20', 'x11'], ['x20', 'x12'], ['x20', 'x13'], ['x20', 'x14'], ['x20', 'x15'], ['x20', 'x16'], ['x20', 'x17'], ['x20', 'x18'], ['x20', 'x19'], ['x21', 'x0'], ['x21', 'x1'], ['x21', 'x2'], ['x21', 'x3'], ['x21', 'x4'], ['x21', 'x5'], ['x21', 'x6'], ['x21', 'x7'], ['x21', 'x8'], ['x21', 'x9'], ['x21', 'x10'], ['x21', 'x11'], ['x21', 'x12'], ['x21', 'x13'], ['x21', 'x14'], ['x21', 'x15'], ['x21', 'x16'], ['x21', 'x17'], ['x21', 'x18'], ['x21', 'x19'], ['x21', 'x20'], ['x22', 'x0'], ['x22', 'x1'], ['x22', 'x2'], ['x22', 'x3'], ['x22', 'x4'], ['x22', 'x5'], ['x22', 'x6'], ['x22', 'x7'], ['x22', 'x8'], ['x22', 'x9'], ['x22', 'x10'], ['x22', 'x11'], ['x22', 'x12'], ['x22', 'x13'], ['x22', 'x14'], ['x22', 'x15'], ['x22', 'x16'], ['x22', 'x17'], ['x22', 'x18'], ['x22', 'x19'], ['x22', 'x20'], ['x22', 'x21'], ['x23', 'x0'], ['x23', 'x1'], ['x23', 'x2'], ['x23', 'x3'], ['x23', 'x4'], ['x23', 'x5'], ['x23', 'x6'], ['x23', 'x7'], ['x23', 'x8'], ['x23', 'x9'], ['x23', 'x10'], ['x23', 'x11'], ['x23', 'x12'], ['x23', 'x13'], ['x23', 'x14'], ['x23', 'x15'], ['x23', 'x16'], ['x23', 'x17'], ['x23', 'x18'], ['x23', 'x19'], ['x23', 'x20'], ['x23', 'x21'], ['x23', 'x22'], ['x24', 'x0'], ['x24', 'x1'], ['x24', 'x2'], ['x24', 'x3'], ['x24', 'x4'], ['x24', 'x5'], ['x24', 'x6'], ['x24', 'x7'], ['x24', 'x8'], ['x24', 'x9'], ['x24', 'x10'], ['x24', 'x11'], ['x24', 'x12'], ['x24', 'x13'], ['x24', 'x14'], ['x24', 'x15'], ['x24', 'x16'], ['x24', 'x17'], ['x24', 'x18'], ['x24', 'x19'], ['x24', 'x20'], ['x24', 'x21'], ['x24', 'x22'], ['x24', 'x23'], ['x25', 'x0'], ['x25', 'x1'], ['x25', 'x2'], ['x25', 'x3'], ['x25', 'x4'], ['x25', 'x5'], ['x25', 'x6'], ['x25', 'x7'], ['x25', 'x8'], ['x25', 'x9'], ['x25', 'x10'], ['x25', 'x11'], ['x25', 'x12'], ['x25', 'x13'], ['x25', 'x14'], ['x25', 'x15'], ['x25', 'x16'], ['x25', 'x17'], ['x25', 'x18'], ['x25', 'x19'], ['x25', 'x20'], ['x25', 'x21'], ['x25', 'x22'], ['x25', 'x23'], ['x25', 'x24'], ['x26', 'x0'], ['x26', 'x1'], ['x26', 'x2'], ['x26', 'x3'], ['x26', 'x4'], ['x26', 'x5'], ['x26', 'x6'], ['x26', 'x7'], ['x26', 'x8'], ['x26', 'x9'], ['x26', 'x10'], ['x26', 'x11'], ['x26', 'x12'], ['x26', 'x13'], ['x26', 'x14'], ['x26', 'x15'], ['x26', 'x16'], ['x26', 'x17'], ['x26', 'x18'], ['x26', 'x19'], ['x26', 'x20'], ['x26', 'x21'], ['x26', 'x22'], ['x26', 'x23'], ['x26', 'x24'], ['x26', 'x25'], ['x27', 'x0'], ['x27', 'x1'], ['x27', 'x2'], ['x27', 'x3'], ['x27', 'x4'], ['x27', 'x5'], ['x27', 'x6'], ['x27', 'x7'], ['x27', 'x8'], ['x27', 'x9'], ['x27', 'x10'], ['x27', 'x11'], ['x27', 'x12'], ['x27', 'x13'], ['x27', 'x14'], ['x27', 'x15'], ['x27', 'x16'], ['x27', 'x17'], ['x27', 'x18'], ['x27', 'x19'], ['x27', 'x20'], ['x27', 'x21'], ['x27', 'x22'], ['x27', 'x23'], ['x27', 'x24'], ['x27', 'x25'], ['x27', 'x26'], ['x28', 'x0'], ['x28', 'x1'], ['x28', 'x2'], ['x28', 'x3'], ['x28', 'x4'], ['x28', 'x5'], ['x28', 'x6'], ['x28', 'x7'], ['x28', 'x8'], ['x28', 'x9'], ['x28', 'x10'], ['x28', 'x11'], ['x28', 'x12'], ['x28', 'x13'], ['x28', 'x14'], ['x28', 'x15'], ['x28', 'x16'], ['x28', 'x17'], ['x28', 'x18'], ['x28', 'x19'], ['x28', 'x20'], ['x28', 'x21'], ['x28', 'x22'], ['x28', 'x23'], ['x28', 'x24'], ['x28', 'x25'], ['x28', 'x26'], ['x28', 'x27'], ['x29', 'x0'], ['x29', 'x1'], ['x29', 'x2'], ['x29', 'x3'], ['x29', 'x4'], ['x29', 'x5'], ['x29', 'x6'], ['x29', 'x7'], ['x29', 'x8'], ['x29', 'x9'], ['x29', 'x10'], ['x29', 'x11'], ['x29', 'x12'], ['x29', 'x13'], ['x29', 'x14'], ['x29', 'x15'], ['x29', 'x16'], ['x29', 'x17'], ['x29', 'x18'], ['x29', 'x19'], ['x29', 'x20'], ['x29', 'x21'], ['x29', 'x22'], ['x29', 'x23'], ['x29', 'x24'], ['x29', 'x25'], ['x29', 'x26'], ['x29', 'x27'], ['x29', 'x28'], ['x30', 'x0'], ['x30', 'x1'], ['x30', 'x2'], ['x30', 'x3'], ['x30', 'x4'], ['x30', 'x5'], ['x30', 'x6'], ['x30', 'x7'], ['x30', 'x8'], ['x30', 'x9'], ['x30', 'x10'], ['x30', 'x11'], ['x30', 'x12'], ['x30', 'x13'], ['x30', 'x14'], ['x30', 'x15'], ['x30', 'x16'], ['x30', 'x17'], ['x30', 'x18'], ['x30', 'x19'], ['x30', 'x20'], ['x30', 'x21'], ['x30', 'x22'], ['x30', 'x23'], ['x30', 'x24'], ['x30', 'x25'], ['x30', 'x26'], ['x30', 'x27'], ['x30', 'x28'], ['x30', 'x29'], ['x31', 'x0'], ['x31', 'x1'], ['x31', 'x2'], ['x31', 'x3'], ['x31', 'x4'], ['x31', 'x5'], ['x31', 'x6'], ['x31', 'x7'], ['x31', 'x8'], ['x31', 'x9'], ['x31', 'x10'], ['x31', 'x11'], ['x31', 'x12'], ['x31', 'x13'], ['x31', 'x14'], ['x31', 'x15'], ['x31', 'x16'], ['x31', 'x17'], ['x31', 'x18'], ['x31', 'x19'], ['x31', 'x20'], ['x31', 'x21'], ['x31', 'x22'], ['x31', 'x23'], ['x31', 'x24'], ['x31', 'x25'], ['x31', 'x26'], ['x31', 'x27'], ['x31', 'x28'], ['x31', 'x29'], ['x31', 'x30'], ['x32', 'x0'], ['x32', 'x1'], ['x32', 'x2'], ['x32', 'x3'], ['x32', 'x4'], ['x32', 'x5'], ['x32', 'x6'], ['x32', 'x7'], ['x32', 'x8'], ['x32', 'x9'], ['x32', 'x10'], ['x32', 'x11'], ['x32', 'x12'], ['x32', 'x13'], ['x32', 'x14'], ['x32', 'x15'], ['x32', 'x16'], ['x32', 'x17'], ['x32', 'x18'], ['x32', 'x19'], ['x32', 'x20'], ['x32', 'x21'], ['x32', 'x22'], ['x32', 'x23'], ['x32', 'x24'], ['x32', 'x25'], ['x32', 'x26'], ['x32', 'x27'], ['x32', 'x28'], ['x32', 'x29'], ['x32', 'x30'], ['x32', 'x31'], ['x33', 'x0'], ['x33', 'x1'], ['x33', 'x2'], ['x33', 'x3'], ['x33', 'x4'], ['x33', 'x5'], ['x33', 'x6'], ['x33', 'x7'], ['x33', 'x8'], ['x33', 'x9'], ['x33', 'x10'], ['x33', 'x11'], ['x33', 'x12'], ['x33', 'x13'], ['x33', 'x14'], ['x33', 'x15'], ['x33', 'x16'], ['x33', 'x17'], ['x33', 'x18'], ['x33', 'x19'], ['x33', 'x20'], ['x33', 'x21'], ['x33', 'x22'], ['x33', 'x23'], ['x33', 'x24'], ['x33', 'x25'], ['x33', 'x26'], ['x33', 'x27'], ['x33', 'x28'], ['x33', 'x29'], ['x33', 'x30'], ['x33', 'x31'], ['x33', 'x32'], ['x34', 'x0'], ['x34', 'x1'], ['x34', 'x2'], ['x34', 'x3'], ['x34', 'x4'], ['x34', 'x5'], ['x34', 'x6'], ['x34', 'x7'], ['x34', 'x8'], ['x34', 'x9'], ['x34', 'x10'], ['x34', 'x11'], ['x34', 'x12'], ['x34', 'x13'], ['x34', 'x14'], ['x34', 'x15'], ['x34', 'x16'], ['x34', 'x17'], ['x34', 'x18'], ['x34', 'x19'], ['x34', 'x20'], ['x34', 'x21'], ['x34', 'x22'], ['x34', 'x23'], ['x34', 'x24'], ['x34', 'x25'], ['x34', 'x26'], ['x34', 'x27'], ['x34', 'x28'], ['x34', 'x29'], ['x34', 'x30'], ['x34', 'x31'], ['x34', 'x32'], ['x34', 'x33'], ['x35', 'x0'], ['x35', 'x1'], ['x35', 'x2'], ['x35', 'x3'], ['x35', 'x4'], ['x35', 'x5'], ['x35', 'x6'], ['x35', 'x7'], ['x35', 'x8'], ['x35', 'x9'], ['x35', 'x10'], ['x35', 'x11'], ['x35', 'x12'], ['x35', 'x13'], ['x35', 'x14'], ['x35', 'x15'], ['x35', 'x16'], ['x35', 'x17'], ['x35', 'x18'], ['x35', 'x19'], ['x35', 'x20'], ['x35', 'x21'], ['x35', 'x22'], ['x35', 'x23'], ['x35', 'x24'], ['x35', 'x25'], ['x35', 'x26'], ['x35', 'x27'], ['x35', 'x28'], ['x35', 'x29'], ['x35', 'x30'], ['x35', 'x31'], ['x35', 'x32'], ['x35', 'x33'], ['x35', 'x34'], ['x36', 'x0'], ['x36', 'x1'], ['x36', 'x2'], ['x36', 'x3'], ['x36', 'x4'], ['x36', 'x5'], ['x36', 'x6'], ['x36', 'x7'], ['x36', 'x8'], ['x36', 'x9'], ['x36', 'x10'], ['x36', 'x11'], ['x36', 'x12'], ['x36', 'x13'], ['x36', 'x14'], ['x36', 'x15'], ['x36', 'x16'], ['x36', 'x17'], ['x36', 'x18'], ['x36', 'x19'], ['x36', 'x20'], ['x36', 'x21'], ['x36', 'x22'], ['x36', 'x23'], ['x36', 'x24'], ['x36', 'x25'], ['x36', 'x26'], ['x36', 'x27'], ['x36', 'x28'], ['x36', 'x29'], ['x36', 'x30'], ['x36', 'x31'], ['x36', 'x32'], ['x36', 'x33'], ['x36', 'x34'], ['x36', 'x35'], ['x37', 'x0'], ['x37', 'x1'], ['x37', 'x2'], ['x37', 'x3'], ['x37', 'x4'], ['x37', 'x5'], ['x37', 'x6'], ['x37', 'x7'], ['x37', 'x8'], ['x37', 'x9'], ['x37', 'x10'], ['x37', 'x11'], ['x37', 'x12'], ['x37', 'x13'], ['x37', 'x14'], ['x37', 'x15'], ['x37', 'x16'], ['x37', 'x17'], ['x37', 'x18'], ['x37', 'x19'], ['x37', 'x20'], ['x37', 'x21'], ['x37', 'x22'], ['x37', 'x23'], ['x37', 'x24'], ['x37', 'x25'], ['x37', 'x26'], ['x37', 'x27'], ['x37', 'x28'], ['x37', 'x29'], ['x37', 'x30'], ['x37', 'x31'], ['x37', 'x32'], ['x37', 'x33'], ['x37', 'x34'], ['x37', 'x35'], ['x37', 'x36'], ['x38', 'x0'], ['x38', 'x1'], ['x38', 'x2'], ['x38', 'x3'], ['x38', 'x4'], ['x38', 'x5'], ['x38', 'x6'], ['x38', 'x7'], ['x38', 'x8'], ['x38', 'x9'], ['x38', 'x10'], ['x38', 'x11'], ['x38', 'x12'], ['x38', 'x13'], ['x38', 'x14'], ['x38', 'x15'], ['x38', 'x16'], ['x38', 'x17'], ['x38', 'x18'], ['x38', 'x19'], ['x38', 'x20'], ['x38', 'x21'], ['x38', 'x22'], ['x38', 'x23'], ['x38', 'x24'], ['x38', 'x25'], ['x38', 'x26'], ['x38', 'x27'], ['x38', 'x28'], ['x38', 'x29'], ['x38', 'x30'], ['x38', 'x31'], ['x38', 'x32'], ['x38', 'x33'], ['x38', 'x34'], ['x38', 'x35'], ['x38', 'x36'], ['x38', 'x37'], ['x39', 'x0'], ['x39', 'x1'], ['x39', 'x2'], ['x39', 'x3'], ['x39', 'x4'], ['x39', 'x5'], ['x39', 'x6'], ['x39', 'x7'], ['x39', 'x8'], ['x39', 'x9'], ['x39', 'x10'], ['x39', 'x11'], ['x39', 'x12'], ['x39', 'x13'], ['x39', 'x14'], ['x39', 'x15'], ['x39', 'x16'], ['x39', 'x17'], ['x39', 'x18'], ['x39', 'x19'], ['x39', 'x20'], ['x39', 'x21'], ['x39', 'x22'], ['x39', 'x23'], ['x39', 'x24'], ['x39', 'x25'], ['x39', 'x26'], ['x39', 'x27'], ['x39', 'x28'], ['x39', 'x29'], ['x39', 'x30'], ['x39', 'x31'], ['x39', 'x32'], ['x39', 'x33'], ['x39', 'x34'], ['x39', 'x35'], ['x39', 'x36'], ['x39', 'x37'], ['x39', 'x38']]}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [180, 181, 182, 183, 2940], 'source_variables': ['x0'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [195, 196, 197, 198, 2955], 'source_variables': ['x1'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [150, 151, 152, 153, 2970], 'source_variables': ['x2'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [165, 166, 167, 168, 2985], 'source_variables': ['x3'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [210, 211, 212, 213, 3000], 'source_variables': ['x4'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [225, 226, 227, 228, 3015], 'source_variables': ['x5'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [240, 241, 242, 3540], 'source_variables': ['x6'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [255, 256, 257, 3555], 'source_variables': ['x7'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [270, 271, 272, 3510, 3511], 'source_variables': ['x8'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [285, 286, 287, 3525, 3526], 'source_variables': ['x9'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [300, 301, 302, 3480, 3481], 'source_variables': ['x10'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [315, 316, 317, 3495, 3496], 'source_variables': ['x11'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [330, 331, 332, 3450, 3451], 'source_variables': ['x12'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [345, 346, 347, 3465, 3466], 'source_variables': ['x13'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [360, 361, 362, 3420, 3421], 'source_variables': ['x14'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [375, 376, 377, 3435, 3436], 'source_variables': ['x15'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [390, 391, 392, 3390, 3391], 'source_variables': ['x16'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [405, 406, 407, 3405, 3406], 'source_variables': ['x17'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [435, 436, 3375, 3376], 'source_variables': ['x19'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [450, 451, 3330, 3331, 3332], 'source_variables': ['x20'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [465, 466, 3345, 3346, 3347], 'source_variables': ['x21'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [480, 481, 3300, 3301, 3302], 'source_variables': ['x22'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [495, 496, 3315, 3316, 3317], 'source_variables': ['x23'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [510, 511, 3270, 3271, 3272], 'source_variables': ['x24'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [525, 526, 3285, 3286, 3287], 'source_variables': ['x25'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [555, 556, 3255, 3256, 3257], 'source_variables': ['x27'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [570, 571, 3210, 3211, 3212], 'source_variables': ['x28'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [585, 586, 3225, 3226, 3227], 'source_variables': ['x29'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [600, 3180, 3181, 3182], 'source_variables': ['x30'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [615, 3195, 3196, 3197], 'source_variables': ['x31'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [645, 3165, 3166, 3167, 3168], 'source_variables': ['x33'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [660, 3030, 3031, 3032], 'source_variables': ['x34'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [675, 3045, 3046, 3047], 'source_variables': ['x35'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [120, 3060, 3061, 3062, 3063], 'source_variables': ['x36'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [135, 3075, 3076, 3077, 3078], 'source_variables': ['x37'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [90, 3090, 3091, 3092, 3093], 'source_variables': ['x38'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [105, 3105, 3106, 3107, 3108], 'source_variables': ['x39'], 'sample_index': 0}}, {'type': , 'message': 'All samples have broken chains', 'level': 30, 'data': {}}], 'embedding_context': {'embedding': {'x0': [180, 181, 182, 183, 2940], 'x1': [195, 196, 197, 198, 2955], 'x2': [150, 151, 152, 153, 2970], 'x3': [165, 166, 167, 168, 2985], 'x4': [210, 211, 212, 213, 3000], 'x5': [225, 226, 227, 228, 3015], 'x6': [240, 241, 242, 3540], 'x7': [255, 256, 257, 3555], 'x8': [270, 271, 272, 3510, 3511], 'x9': [285, 286, 287, 3525, 3526], 'x10': [300, 301, 302, 3480, 3481], 'x11': [315, 316, 317, 3495, 3496], 'x12': [330, 331, 332, 3450, 3451], 'x13': [345, 346, 347, 3465, 3466], 'x14': [360, 361, 362, 3420, 3421], 'x15': [375, 376, 377, 3435, 3436], 'x16': [390, 391, 392, 3390, 3391], 'x17': [405, 406, 407, 3405, 3406], 'x18': [420, 421, 3360, 3361], 'x19': [435, 436, 3375, 3376], 'x20': [450, 451, 3330, 3331, 3332], 'x21': [465, 466, 3345, 3346, 3347], 'x22': [480, 481, 3300, 3301, 3302], 'x23': [495, 496, 3315, 3316, 3317], 'x24': [510, 511, 3270, 3271, 3272], 'x25': [525, 526, 3285, 3286, 3287], 'x26': [540, 541, 3240, 3241, 3242], 'x27': [555, 556, 3255, 3256, 3257], 'x28': [570, 571, 3210, 3211, 3212], 'x29': [585, 586, 3225, 3226, 3227], 'x30': [600, 3180, 3181, 3182], 'x31': [615, 3195, 3196, 3197], 'x32': [630, 3150, 3151, 3152, 3153], 'x33': [645, 3165, 3166, 3167, 3168], 'x34': [660, 3030, 3031, 3032], 'x35': [675, 3045, 3046, 3047], 'x36': [120, 3060, 3061, 3062, 3063], 'x37': [135, 3075, 3076, 3077, 3078], 'x38': [90, 3090, 3091, 3092, 3093], 'x39': [105, 3105, 3106, 3107, 3108]}, 'chain_break_method': 'majority_vote', 'embedding_parameters': {}, 'chain_strength': 0.0001, 'timing': {'embedding': 0.0022098999997979263, 'unembedding': 0.0011283000003459165}}}, 'BINARY')" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "aac2922c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'timing': {'qpu_sampling_time': 21520.0,\n", + " 'qpu_anneal_time_per_sample': 20.0,\n", + " 'qpu_readout_time_per_sample': 174.62,\n", + " 'qpu_access_time': 37286.36,\n", + " 'qpu_access_overhead_time': 617.64,\n", + " 'qpu_programming_time': 15766.36,\n", + " 'qpu_delay_time_per_sample': 20.58,\n", + " 'post_processing_overhead_time': 36.0,\n", + " 'total_post_processing_time': 36.0},\n", + " 'problem_id': 'f49fda51-0bdf-47d9-8dab-e6c3296ca0c4',\n", + " 'problem_label': 'n=40_qubo_size=820_3212373321961356710',\n", + " 'warnings': [{'type': dwave.system.warnings.EnergyScaleWarning,\n", + " 'message': 'Some biases are 10^3 times stronger than others',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [[181, 180],\n", + " [2940, 180],\n", + " [182, 181],\n", + " [183, 182],\n", + " [196, 195],\n", + " [2955, 195],\n", + " [197, 196],\n", + " [198, 197],\n", + " [151, 150],\n", + " [2970, 150],\n", + " [152, 151],\n", + " [153, 152],\n", + " [166, 165],\n", + " [2985, 165],\n", + " [167, 166],\n", + " [168, 167],\n", + " [211, 210],\n", + " [3000, 210],\n", + " [212, 211],\n", + " [213, 212],\n", + " [226, 225],\n", + " [3015, 225],\n", + " [227, 226],\n", + " [228, 227],\n", + " [241, 240],\n", + " [242, 241],\n", + " [3540, 242],\n", + " [256, 255],\n", + " [257, 256],\n", + " [3555, 257],\n", + " [271, 270],\n", + " [272, 271],\n", + " [3511, 272],\n", + " [3510, 3511],\n", + " [286, 285],\n", + " [287, 286],\n", + " [3526, 287],\n", + " [3525, 3526],\n", + " [301, 300],\n", + " [302, 301],\n", + " [3481, 302],\n", + " [3480, 3481],\n", + " [316, 315],\n", + " [317, 316],\n", + " [3496, 317],\n", + " [3495, 3496],\n", + " [331, 330],\n", + " [332, 331],\n", + " [3451, 332],\n", + " [3450, 3451],\n", + " [346, 345],\n", + " [347, 346],\n", + " [3466, 347],\n", + " [3465, 3466],\n", + " [361, 360],\n", + " [362, 361],\n", + " [3421, 362],\n", + " [3420, 3421],\n", + " [376, 375],\n", + " [377, 376],\n", + " [3436, 377],\n", + " [3435, 3436],\n", + " [391, 390],\n", + " [392, 391],\n", + " [3391, 392],\n", + " [3390, 3391],\n", + " [406, 405],\n", + " [407, 406],\n", + " [3406, 407],\n", + " [3405, 3406],\n", + " [421, 420],\n", + " [3361, 421],\n", + " [3360, 3361],\n", + " [436, 435],\n", + " [3376, 436],\n", + " [3375, 3376],\n", + " [451, 450],\n", + " [3332, 451],\n", + " [3331, 3332],\n", + " [3331, 3330],\n", + " [466, 465],\n", + " [3347, 466],\n", + " [3346, 3347],\n", + " [3346, 3345],\n", + " [481, 480],\n", + " [3302, 481],\n", + " [3301, 3302],\n", + " [3301, 3300],\n", + " [496, 495],\n", + " [3317, 496],\n", + " [3316, 3317],\n", + " [3316, 3315],\n", + " [511, 510],\n", + " [3272, 511],\n", + " [3271, 3272],\n", + " [3271, 3270],\n", + " [526, 525],\n", + " [3287, 526],\n", + " [3286, 3287],\n", + " [3286, 3285],\n", + " [541, 540],\n", + " [3242, 541],\n", + " [3241, 3242],\n", + " [3241, 3240],\n", + " [556, 555],\n", + " [3257, 556],\n", + " [3256, 3257],\n", + " [3256, 3255],\n", + " [571, 570],\n", + " [3212, 571],\n", + " [3211, 3212],\n", + " [3211, 3210],\n", + " [586, 585],\n", + " [3227, 586],\n", + " [3226, 3227],\n", + " [3226, 3225],\n", + " [3182, 600],\n", + " [3181, 3182],\n", + " [3181, 3180],\n", + " [3197, 615],\n", + " [3196, 3197],\n", + " [3196, 3195],\n", + " [3153, 630],\n", + " [3151, 3150],\n", + " [3152, 3153],\n", + " [3152, 3151],\n", + " [3168, 645],\n", + " [3166, 3165],\n", + " [3167, 3168],\n", + " [3167, 3166],\n", + " [3032, 660],\n", + " [3031, 3032],\n", + " [3031, 3030],\n", + " [3047, 675],\n", + " [3046, 3047],\n", + " [3046, 3045],\n", + " [3060, 120],\n", + " [3061, 3060],\n", + " [3062, 3061],\n", + " [3063, 3062],\n", + " [3075, 135],\n", + " [3076, 3075],\n", + " [3077, 3076],\n", + " [3078, 3077],\n", + " [3090, 90],\n", + " [3091, 3090],\n", + " [3092, 3091],\n", + " [3093, 3092],\n", + " [3105, 105],\n", + " [3106, 3105],\n", + " [3107, 3106],\n", + " [3108, 3107]]}},\n", + " {'type': dwave.system.warnings.TooFewSamplesWarning,\n", + " 'message': 'Number of ground states found is within sampling error',\n", + " 'level': 30,\n", + " 'data': {'number_of_ground_states': 1,\n", + " 'num_reads': 100,\n", + " 'sampling_error_rate': 10.0}},\n", + " {'type': dwave.system.warnings.ChainStrengthWarning,\n", + " 'message': 'Some quadratic biases are stronger than the given chain strength',\n", + " 'level': 30,\n", + " 'data': {'source_interactions': [['x1', 'x0'],\n", + " ['x2', 'x0'],\n", + " ['x2', 'x1'],\n", + " ['x3', 'x0'],\n", + " ['x3', 'x1'],\n", + " ['x3', 'x2'],\n", + " ['x4', 'x0'],\n", + " ['x4', 'x1'],\n", + " ['x4', 'x2'],\n", + " ['x4', 'x3'],\n", + " ['x5', 'x0'],\n", + " ['x5', 'x1'],\n", + " ['x5', 'x2'],\n", + " ['x5', 'x3'],\n", + " ['x5', 'x4'],\n", + " ['x6', 'x0'],\n", + " ['x6', 'x1'],\n", + " ['x6', 'x2'],\n", + " ['x6', 'x3'],\n", + " ['x6', 'x4'],\n", + " ['x6', 'x5'],\n", + " ['x7', 'x0'],\n", + " ['x7', 'x1'],\n", + " ['x7', 'x2'],\n", + " ['x7', 'x3'],\n", + " ['x7', 'x4'],\n", + " ['x7', 'x5'],\n", + " ['x7', 'x6'],\n", + " ['x8', 'x0'],\n", + " ['x8', 'x1'],\n", + " ['x8', 'x2'],\n", + " ['x8', 'x3'],\n", + " ['x8', 'x4'],\n", + " ['x8', 'x5'],\n", + " ['x8', 'x6'],\n", + " ['x8', 'x7'],\n", + " ['x9', 'x0'],\n", + " ['x9', 'x1'],\n", + " ['x9', 'x2'],\n", + " ['x9', 'x3'],\n", + " ['x9', 'x4'],\n", + " ['x9', 'x5'],\n", + " ['x9', 'x6'],\n", + " ['x9', 'x7'],\n", + " ['x9', 'x8'],\n", + " ['x10', 'x0'],\n", + " ['x10', 'x1'],\n", + " ['x10', 'x2'],\n", + " ['x10', 'x3'],\n", + " ['x10', 'x4'],\n", + " ['x10', 'x5'],\n", + " ['x10', 'x6'],\n", + " ['x10', 'x7'],\n", + " ['x10', 'x8'],\n", + " ['x10', 'x9'],\n", + " ['x11', 'x0'],\n", + " ['x11', 'x1'],\n", + " ['x11', 'x2'],\n", + " ['x11', 'x3'],\n", + " ['x11', 'x4'],\n", + " ['x11', 'x5'],\n", + " ['x11', 'x6'],\n", + " ['x11', 'x7'],\n", + " ['x11', 'x8'],\n", + " ['x11', 'x9'],\n", + " ['x11', 'x10'],\n", + " ['x12', 'x0'],\n", + " ['x12', 'x1'],\n", + " ['x12', 'x2'],\n", + " ['x12', 'x3'],\n", + " ['x12', 'x4'],\n", + " ['x12', 'x5'],\n", + " ['x12', 'x6'],\n", + " ['x12', 'x7'],\n", + " ['x12', 'x8'],\n", + " ['x12', 'x9'],\n", + " ['x12', 'x10'],\n", + " ['x12', 'x11'],\n", + " ['x13', 'x0'],\n", + " ['x13', 'x1'],\n", + " ['x13', 'x2'],\n", + " ['x13', 'x3'],\n", + " ['x13', 'x4'],\n", + " ['x13', 'x5'],\n", + " ['x13', 'x6'],\n", + " ['x13', 'x7'],\n", + " ['x13', 'x8'],\n", + " ['x13', 'x9'],\n", + " ['x13', 'x10'],\n", + " ['x13', 'x11'],\n", + " ['x13', 'x12'],\n", + " ['x14', 'x0'],\n", + " ['x14', 'x1'],\n", + " ['x14', 'x2'],\n", + " ['x14', 'x3'],\n", + " ['x14', 'x4'],\n", + " ['x14', 'x5'],\n", + " ['x14', 'x6'],\n", + " ['x14', 'x7'],\n", + " ['x14', 'x8'],\n", + " ['x14', 'x9'],\n", + " ['x14', 'x10'],\n", + " ['x14', 'x11'],\n", + " ['x14', 'x12'],\n", + " ['x14', 'x13'],\n", + " ['x15', 'x0'],\n", + " ['x15', 'x1'],\n", + " ['x15', 'x2'],\n", + " ['x15', 'x3'],\n", + " ['x15', 'x4'],\n", + " ['x15', 'x5'],\n", + " ['x15', 'x6'],\n", + " ['x15', 'x7'],\n", + " ['x15', 'x8'],\n", + " ['x15', 'x9'],\n", + " ['x15', 'x10'],\n", + " ['x15', 'x11'],\n", + " ['x15', 'x12'],\n", + " ['x15', 'x13'],\n", + " ['x15', 'x14'],\n", + " ['x16', 'x0'],\n", + " ['x16', 'x1'],\n", + " ['x16', 'x2'],\n", + " ['x16', 'x3'],\n", + " ['x16', 'x4'],\n", + " ['x16', 'x5'],\n", + " ['x16', 'x6'],\n", + " ['x16', 'x7'],\n", + " ['x16', 'x8'],\n", + " ['x16', 'x9'],\n", + " ['x16', 'x10'],\n", + " ['x16', 'x11'],\n", + " ['x16', 'x12'],\n", + " ['x16', 'x13'],\n", + " ['x16', 'x14'],\n", + " ['x16', 'x15'],\n", + " ['x17', 'x0'],\n", + " ['x17', 'x1'],\n", + " ['x17', 'x2'],\n", + " ['x17', 'x3'],\n", + " ['x17', 'x4'],\n", + " ['x17', 'x5'],\n", + " ['x17', 'x6'],\n", + " ['x17', 'x7'],\n", + " ['x17', 'x8'],\n", + " ['x17', 'x9'],\n", + " ['x17', 'x10'],\n", + " ['x17', 'x11'],\n", + " ['x17', 'x12'],\n", + " ['x17', 'x13'],\n", + " ['x17', 'x14'],\n", + " ['x17', 'x15'],\n", + " ['x17', 'x16'],\n", + " ['x18', 'x0'],\n", + " ['x18', 'x1'],\n", + " ['x18', 'x2'],\n", + " ['x18', 'x3'],\n", + " ['x18', 'x4'],\n", + " ['x18', 'x5'],\n", + " ['x18', 'x6'],\n", + " ['x18', 'x7'],\n", + " ['x18', 'x8'],\n", + " ['x18', 'x9'],\n", + " ['x18', 'x10'],\n", + " ['x18', 'x11'],\n", + " ['x18', 'x12'],\n", + " ['x18', 'x13'],\n", + " ['x18', 'x14'],\n", + " ['x18', 'x15'],\n", + " ['x18', 'x16'],\n", + " ['x18', 'x17'],\n", + " ['x19', 'x0'],\n", + " ['x19', 'x1'],\n", + " ['x19', 'x2'],\n", + " ['x19', 'x3'],\n", + " ['x19', 'x4'],\n", + " ['x19', 'x5'],\n", + " ['x19', 'x6'],\n", + " ['x19', 'x7'],\n", + " ['x19', 'x8'],\n", + " ['x19', 'x9'],\n", + " ['x19', 'x10'],\n", + " ['x19', 'x11'],\n", + " ['x19', 'x12'],\n", + " ['x19', 'x13'],\n", + " ['x19', 'x14'],\n", + " ['x19', 'x15'],\n", + " ['x19', 'x16'],\n", + " ['x19', 'x17'],\n", + " ['x19', 'x18'],\n", + " ['x20', 'x0'],\n", + " ['x20', 'x1'],\n", + " ['x20', 'x2'],\n", + " ['x20', 'x3'],\n", + " ['x20', 'x4'],\n", + " ['x20', 'x5'],\n", + " ['x20', 'x6'],\n", + " ['x20', 'x7'],\n", + " ['x20', 'x8'],\n", + " ['x20', 'x9'],\n", + " ['x20', 'x10'],\n", + " ['x20', 'x11'],\n", + " ['x20', 'x12'],\n", + " ['x20', 'x13'],\n", + " ['x20', 'x14'],\n", + " ['x20', 'x15'],\n", + " ['x20', 'x16'],\n", + " ['x20', 'x17'],\n", + " ['x20', 'x18'],\n", + " ['x20', 'x19'],\n", + " ['x21', 'x0'],\n", + " ['x21', 'x1'],\n", + " ['x21', 'x2'],\n", + " ['x21', 'x3'],\n", + " ['x21', 'x4'],\n", + " ['x21', 'x5'],\n", + " ['x21', 'x6'],\n", + " ['x21', 'x7'],\n", + " ['x21', 'x8'],\n", + " ['x21', 'x9'],\n", + " ['x21', 'x10'],\n", + " ['x21', 'x11'],\n", + " ['x21', 'x12'],\n", + " ['x21', 'x13'],\n", + " ['x21', 'x14'],\n", + " ['x21', 'x15'],\n", + " ['x21', 'x16'],\n", + " ['x21', 'x17'],\n", + " ['x21', 'x18'],\n", + " ['x21', 'x19'],\n", + " ['x21', 'x20'],\n", + " ['x22', 'x0'],\n", + " ['x22', 'x1'],\n", + " ['x22', 'x2'],\n", + " ['x22', 'x3'],\n", + " ['x22', 'x4'],\n", + " ['x22', 'x5'],\n", + " ['x22', 'x6'],\n", + " ['x22', 'x7'],\n", + " ['x22', 'x8'],\n", + " ['x22', 'x9'],\n", + " ['x22', 'x10'],\n", + " ['x22', 'x11'],\n", + " ['x22', 'x12'],\n", + " ['x22', 'x13'],\n", + " ['x22', 'x14'],\n", + " ['x22', 'x15'],\n", + " ['x22', 'x16'],\n", + " ['x22', 'x17'],\n", + " ['x22', 'x18'],\n", + " ['x22', 'x19'],\n", + " ['x22', 'x20'],\n", + " ['x22', 'x21'],\n", + " ['x23', 'x0'],\n", + " ['x23', 'x1'],\n", + " ['x23', 'x2'],\n", + " ['x23', 'x3'],\n", + " ['x23', 'x4'],\n", + " ['x23', 'x5'],\n", + " ['x23', 'x6'],\n", + " ['x23', 'x7'],\n", + " ['x23', 'x8'],\n", + " ['x23', 'x9'],\n", + " ['x23', 'x10'],\n", + " ['x23', 'x11'],\n", + " ['x23', 'x12'],\n", + " ['x23', 'x13'],\n", + " ['x23', 'x14'],\n", + " ['x23', 'x15'],\n", + " ['x23', 'x16'],\n", + " ['x23', 'x17'],\n", + " ['x23', 'x18'],\n", + " ['x23', 'x19'],\n", + " ['x23', 'x20'],\n", + " ['x23', 'x21'],\n", + " ['x23', 'x22'],\n", + " ['x24', 'x0'],\n", + " ['x24', 'x1'],\n", + " ['x24', 'x2'],\n", + " ['x24', 'x3'],\n", + " ['x24', 'x4'],\n", + " ['x24', 'x5'],\n", + " ['x24', 'x6'],\n", + " ['x24', 'x7'],\n", + " ['x24', 'x8'],\n", + " ['x24', 'x9'],\n", + " ['x24', 'x10'],\n", + " ['x24', 'x11'],\n", + " ['x24', 'x12'],\n", + " ['x24', 'x13'],\n", + " ['x24', 'x14'],\n", + " ['x24', 'x15'],\n", + " ['x24', 'x16'],\n", + " ['x24', 'x17'],\n", + " ['x24', 'x18'],\n", + " ['x24', 'x19'],\n", + " ['x24', 'x20'],\n", + " ['x24', 'x21'],\n", + " ['x24', 'x22'],\n", + " ['x24', 'x23'],\n", + " ['x25', 'x0'],\n", + " ['x25', 'x1'],\n", + " ['x25', 'x2'],\n", + " ['x25', 'x3'],\n", + " ['x25', 'x4'],\n", + " ['x25', 'x5'],\n", + " ['x25', 'x6'],\n", + " ['x25', 'x7'],\n", + " ['x25', 'x8'],\n", + " ['x25', 'x9'],\n", + " ['x25', 'x10'],\n", + " ['x25', 'x11'],\n", + " ['x25', 'x12'],\n", + " ['x25', 'x13'],\n", + " ['x25', 'x14'],\n", + " ['x25', 'x15'],\n", + " ['x25', 'x16'],\n", + " ['x25', 'x17'],\n", + " ['x25', 'x18'],\n", + " ['x25', 'x19'],\n", + " ['x25', 'x20'],\n", + " ['x25', 'x21'],\n", + " ['x25', 'x22'],\n", + " ['x25', 'x23'],\n", + " ['x25', 'x24'],\n", + " ['x26', 'x0'],\n", + " ['x26', 'x1'],\n", + " ['x26', 'x2'],\n", + " ['x26', 'x3'],\n", + " ['x26', 'x4'],\n", + " ['x26', 'x5'],\n", + " ['x26', 'x6'],\n", + " ['x26', 'x7'],\n", + " ['x26', 'x8'],\n", + " ['x26', 'x9'],\n", + " ['x26', 'x10'],\n", + " ['x26', 'x11'],\n", + " ['x26', 'x12'],\n", + " ['x26', 'x13'],\n", + " ['x26', 'x14'],\n", + " ['x26', 'x15'],\n", + " ['x26', 'x16'],\n", + " ['x26', 'x17'],\n", + " ['x26', 'x18'],\n", + " ['x26', 'x19'],\n", + " ['x26', 'x20'],\n", + " ['x26', 'x21'],\n", + " ['x26', 'x22'],\n", + " ['x26', 'x23'],\n", + " ['x26', 'x24'],\n", + " ['x26', 'x25'],\n", + " ['x27', 'x0'],\n", + " ['x27', 'x1'],\n", + " ['x27', 'x2'],\n", + " ['x27', 'x3'],\n", + " ['x27', 'x4'],\n", + " ['x27', 'x5'],\n", + " ['x27', 'x6'],\n", + " ['x27', 'x7'],\n", + " ['x27', 'x8'],\n", + " ['x27', 'x9'],\n", + " ['x27', 'x10'],\n", + " ['x27', 'x11'],\n", + " ['x27', 'x12'],\n", + " ['x27', 'x13'],\n", + " ['x27', 'x14'],\n", + " ['x27', 'x15'],\n", + " ['x27', 'x16'],\n", + " ['x27', 'x17'],\n", + " ['x27', 'x18'],\n", + " ['x27', 'x19'],\n", + " ['x27', 'x20'],\n", + " ['x27', 'x21'],\n", + " ['x27', 'x22'],\n", + " ['x27', 'x23'],\n", + " ['x27', 'x24'],\n", + " ['x27', 'x25'],\n", + " ['x27', 'x26'],\n", + " ['x28', 'x0'],\n", + " ['x28', 'x1'],\n", + " ['x28', 'x2'],\n", + " ['x28', 'x3'],\n", + " ['x28', 'x4'],\n", + " ['x28', 'x5'],\n", + " ['x28', 'x6'],\n", + " ['x28', 'x7'],\n", + " ['x28', 'x8'],\n", + " ['x28', 'x9'],\n", + " ['x28', 'x10'],\n", + " ['x28', 'x11'],\n", + " ['x28', 'x12'],\n", + " ['x28', 'x13'],\n", + " ['x28', 'x14'],\n", + " ['x28', 'x15'],\n", + " ['x28', 'x16'],\n", + " ['x28', 'x17'],\n", + " ['x28', 'x18'],\n", + " ['x28', 'x19'],\n", + " ['x28', 'x20'],\n", + " ['x28', 'x21'],\n", + " ['x28', 'x22'],\n", + " ['x28', 'x23'],\n", + " ['x28', 'x24'],\n", + " ['x28', 'x25'],\n", + " ['x28', 'x26'],\n", + " ['x28', 'x27'],\n", + " ['x29', 'x0'],\n", + " ['x29', 'x1'],\n", + " ['x29', 'x2'],\n", + " ['x29', 'x3'],\n", + " ['x29', 'x4'],\n", + " ['x29', 'x5'],\n", + " ['x29', 'x6'],\n", + " ['x29', 'x7'],\n", + " ['x29', 'x8'],\n", + " ['x29', 'x9'],\n", + " ['x29', 'x10'],\n", + " ['x29', 'x11'],\n", + " ['x29', 'x12'],\n", + " ['x29', 'x13'],\n", + " ['x29', 'x14'],\n", + " ['x29', 'x15'],\n", + " ['x29', 'x16'],\n", + " ['x29', 'x17'],\n", + " ['x29', 'x18'],\n", + " ['x29', 'x19'],\n", + " ['x29', 'x20'],\n", + " ['x29', 'x21'],\n", + " ['x29', 'x22'],\n", + " ['x29', 'x23'],\n", + " ['x29', 'x24'],\n", + " ['x29', 'x25'],\n", + " ['x29', 'x26'],\n", + " ['x29', 'x27'],\n", + " ['x29', 'x28'],\n", + " ['x30', 'x0'],\n", + " ['x30', 'x1'],\n", + " ['x30', 'x2'],\n", + " ['x30', 'x3'],\n", + " ['x30', 'x4'],\n", + " ['x30', 'x5'],\n", + " ['x30', 'x6'],\n", + " ['x30', 'x7'],\n", + " ['x30', 'x8'],\n", + " ['x30', 'x9'],\n", + " ['x30', 'x10'],\n", + " ['x30', 'x11'],\n", + " ['x30', 'x12'],\n", + " ['x30', 'x13'],\n", + " ['x30', 'x14'],\n", + " ['x30', 'x15'],\n", + " ['x30', 'x16'],\n", + " ['x30', 'x17'],\n", + " ['x30', 'x18'],\n", + " ['x30', 'x19'],\n", + " ['x30', 'x20'],\n", + " ['x30', 'x21'],\n", + " ['x30', 'x22'],\n", + " ['x30', 'x23'],\n", + " ['x30', 'x24'],\n", + " ['x30', 'x25'],\n", + " ['x30', 'x26'],\n", + " ['x30', 'x27'],\n", + " ['x30', 'x28'],\n", + " ['x30', 'x29'],\n", + " ['x31', 'x0'],\n", + " ['x31', 'x1'],\n", + " ['x31', 'x2'],\n", + " ['x31', 'x3'],\n", + " ['x31', 'x4'],\n", + " ['x31', 'x5'],\n", + " ['x31', 'x6'],\n", + " ['x31', 'x7'],\n", + " ['x31', 'x8'],\n", + " ['x31', 'x9'],\n", + " ['x31', 'x10'],\n", + " ['x31', 'x11'],\n", + " ['x31', 'x12'],\n", + " ['x31', 'x13'],\n", + " ['x31', 'x14'],\n", + " ['x31', 'x15'],\n", + " ['x31', 'x16'],\n", + " ['x31', 'x17'],\n", + " ['x31', 'x18'],\n", + " ['x31', 'x19'],\n", + " ['x31', 'x20'],\n", + " ['x31', 'x21'],\n", + " ['x31', 'x22'],\n", + " ['x31', 'x23'],\n", + " ['x31', 'x24'],\n", + " ['x31', 'x25'],\n", + " ['x31', 'x26'],\n", + " ['x31', 'x27'],\n", + " ['x31', 'x28'],\n", + " ['x31', 'x29'],\n", + " ['x31', 'x30'],\n", + " ['x32', 'x0'],\n", + " ['x32', 'x1'],\n", + " ['x32', 'x2'],\n", + " ['x32', 'x3'],\n", + " ['x32', 'x4'],\n", + " ['x32', 'x5'],\n", + " ['x32', 'x6'],\n", + " ['x32', 'x7'],\n", + " ['x32', 'x8'],\n", + " ['x32', 'x9'],\n", + " ['x32', 'x10'],\n", + " ['x32', 'x11'],\n", + " ['x32', 'x12'],\n", + " ['x32', 'x13'],\n", + " ['x32', 'x14'],\n", + " ['x32', 'x15'],\n", + " ['x32', 'x16'],\n", + " ['x32', 'x17'],\n", + " ['x32', 'x18'],\n", + " ['x32', 'x19'],\n", + " ['x32', 'x20'],\n", + " ['x32', 'x21'],\n", + " ['x32', 'x22'],\n", + " ['x32', 'x23'],\n", + " ['x32', 'x24'],\n", + " ['x32', 'x25'],\n", + " ['x32', 'x26'],\n", + " ['x32', 'x27'],\n", + " ['x32', 'x28'],\n", + " ['x32', 'x29'],\n", + " ['x32', 'x30'],\n", + " ['x32', 'x31'],\n", + " ['x33', 'x0'],\n", + " ['x33', 'x1'],\n", + " ['x33', 'x2'],\n", + " ['x33', 'x3'],\n", + " ['x33', 'x4'],\n", + " ['x33', 'x5'],\n", + " ['x33', 'x6'],\n", + " ['x33', 'x7'],\n", + " ['x33', 'x8'],\n", + " ['x33', 'x9'],\n", + " ['x33', 'x10'],\n", + " ['x33', 'x11'],\n", + " ['x33', 'x12'],\n", + " ['x33', 'x13'],\n", + " ['x33', 'x14'],\n", + " ['x33', 'x15'],\n", + " ['x33', 'x16'],\n", + " ['x33', 'x17'],\n", + " ['x33', 'x18'],\n", + " ['x33', 'x19'],\n", + " ['x33', 'x20'],\n", + " ['x33', 'x21'],\n", + " ['x33', 'x22'],\n", + " ['x33', 'x23'],\n", + " ['x33', 'x24'],\n", + " ['x33', 'x25'],\n", + " ['x33', 'x26'],\n", + " ['x33', 'x27'],\n", + " ['x33', 'x28'],\n", + " ['x33', 'x29'],\n", + " ['x33', 'x30'],\n", + " ['x33', 'x31'],\n", + " ['x33', 'x32'],\n", + " ['x34', 'x0'],\n", + " ['x34', 'x1'],\n", + " ['x34', 'x2'],\n", + " ['x34', 'x3'],\n", + " ['x34', 'x4'],\n", + " ['x34', 'x5'],\n", + " ['x34', 'x6'],\n", + " ['x34', 'x7'],\n", + " ['x34', 'x8'],\n", + " ['x34', 'x9'],\n", + " ['x34', 'x10'],\n", + " ['x34', 'x11'],\n", + " ['x34', 'x12'],\n", + " ['x34', 'x13'],\n", + " ['x34', 'x14'],\n", + " ['x34', 'x15'],\n", + " ['x34', 'x16'],\n", + " ['x34', 'x17'],\n", + " ['x34', 'x18'],\n", + " ['x34', 'x19'],\n", + " ['x34', 'x20'],\n", + " ['x34', 'x21'],\n", + " ['x34', 'x22'],\n", + " ['x34', 'x23'],\n", + " ['x34', 'x24'],\n", + " ['x34', 'x25'],\n", + " ['x34', 'x26'],\n", + " ['x34', 'x27'],\n", + " ['x34', 'x28'],\n", + " ['x34', 'x29'],\n", + " ['x34', 'x30'],\n", + " ['x34', 'x31'],\n", + " ['x34', 'x32'],\n", + " ['x34', 'x33'],\n", + " ['x35', 'x0'],\n", + " ['x35', 'x1'],\n", + " ['x35', 'x2'],\n", + " ['x35', 'x3'],\n", + " ['x35', 'x4'],\n", + " ['x35', 'x5'],\n", + " ['x35', 'x6'],\n", + " ['x35', 'x7'],\n", + " ['x35', 'x8'],\n", + " ['x35', 'x9'],\n", + " ['x35', 'x10'],\n", + " ['x35', 'x11'],\n", + " ['x35', 'x12'],\n", + " ['x35', 'x13'],\n", + " ['x35', 'x14'],\n", + " ['x35', 'x15'],\n", + " ['x35', 'x16'],\n", + " ['x35', 'x17'],\n", + " ['x35', 'x18'],\n", + " ['x35', 'x19'],\n", + " ['x35', 'x20'],\n", + " ['x35', 'x21'],\n", + " ['x35', 'x22'],\n", + " ['x35', 'x23'],\n", + " ['x35', 'x24'],\n", + " ['x35', 'x25'],\n", + " ['x35', 'x26'],\n", + " ['x35', 'x27'],\n", + " ['x35', 'x28'],\n", + " ['x35', 'x29'],\n", + " ['x35', 'x30'],\n", + " ['x35', 'x31'],\n", + " ['x35', 'x32'],\n", + " ['x35', 'x33'],\n", + " ['x35', 'x34'],\n", + " ['x36', 'x0'],\n", + " ['x36', 'x1'],\n", + " ['x36', 'x2'],\n", + " ['x36', 'x3'],\n", + " ['x36', 'x4'],\n", + " ['x36', 'x5'],\n", + " ['x36', 'x6'],\n", + " ['x36', 'x7'],\n", + " ['x36', 'x8'],\n", + " ['x36', 'x9'],\n", + " ['x36', 'x10'],\n", + " ['x36', 'x11'],\n", + " ['x36', 'x12'],\n", + " ['x36', 'x13'],\n", + " ['x36', 'x14'],\n", + " ['x36', 'x15'],\n", + " ['x36', 'x16'],\n", + " ['x36', 'x17'],\n", + " ['x36', 'x18'],\n", + " ['x36', 'x19'],\n", + " ['x36', 'x20'],\n", + " ['x36', 'x21'],\n", + " ['x36', 'x22'],\n", + " ['x36', 'x23'],\n", + " ['x36', 'x24'],\n", + " ['x36', 'x25'],\n", + " ['x36', 'x26'],\n", + " ['x36', 'x27'],\n", + " ['x36', 'x28'],\n", + " ['x36', 'x29'],\n", + " ['x36', 'x30'],\n", + " ['x36', 'x31'],\n", + " ['x36', 'x32'],\n", + " ['x36', 'x33'],\n", + " ['x36', 'x34'],\n", + " ['x36', 'x35'],\n", + " ['x37', 'x0'],\n", + " ['x37', 'x1'],\n", + " ['x37', 'x2'],\n", + " ['x37', 'x3'],\n", + " ['x37', 'x4'],\n", + " ['x37', 'x5'],\n", + " ['x37', 'x6'],\n", + " ['x37', 'x7'],\n", + " ['x37', 'x8'],\n", + " ['x37', 'x9'],\n", + " ['x37', 'x10'],\n", + " ['x37', 'x11'],\n", + " ['x37', 'x12'],\n", + " ['x37', 'x13'],\n", + " ['x37', 'x14'],\n", + " ['x37', 'x15'],\n", + " ['x37', 'x16'],\n", + " ['x37', 'x17'],\n", + " ['x37', 'x18'],\n", + " ['x37', 'x19'],\n", + " ['x37', 'x20'],\n", + " ['x37', 'x21'],\n", + " ['x37', 'x22'],\n", + " ['x37', 'x23'],\n", + " ['x37', 'x24'],\n", + " ['x37', 'x25'],\n", + " ['x37', 'x26'],\n", + " ['x37', 'x27'],\n", + " ['x37', 'x28'],\n", + " ['x37', 'x29'],\n", + " ['x37', 'x30'],\n", + " ['x37', 'x31'],\n", + " ['x37', 'x32'],\n", + " ['x37', 'x33'],\n", + " ['x37', 'x34'],\n", + " ['x37', 'x35'],\n", + " ['x37', 'x36'],\n", + " ['x38', 'x0'],\n", + " ['x38', 'x1'],\n", + " ['x38', 'x2'],\n", + " ['x38', 'x3'],\n", + " ['x38', 'x4'],\n", + " ['x38', 'x5'],\n", + " ['x38', 'x6'],\n", + " ['x38', 'x7'],\n", + " ['x38', 'x8'],\n", + " ['x38', 'x9'],\n", + " ['x38', 'x10'],\n", + " ['x38', 'x11'],\n", + " ['x38', 'x12'],\n", + " ['x38', 'x13'],\n", + " ['x38', 'x14'],\n", + " ['x38', 'x15'],\n", + " ['x38', 'x16'],\n", + " ['x38', 'x17'],\n", + " ['x38', 'x18'],\n", + " ['x38', 'x19'],\n", + " ['x38', 'x20'],\n", + " ['x38', 'x21'],\n", + " ['x38', 'x22'],\n", + " ['x38', 'x23'],\n", + " ['x38', 'x24'],\n", + " ['x38', 'x25'],\n", + " ['x38', 'x26'],\n", + " ['x38', 'x27'],\n", + " ['x38', 'x28'],\n", + " ['x38', 'x29'],\n", + " ['x38', 'x30'],\n", + " ['x38', 'x31'],\n", + " ['x38', 'x32'],\n", + " ['x38', 'x33'],\n", + " ['x38', 'x34'],\n", + " ['x38', 'x35'],\n", + " ['x38', 'x36'],\n", + " ['x38', 'x37'],\n", + " ['x39', 'x0'],\n", + " ['x39', 'x1'],\n", + " ['x39', 'x2'],\n", + " ['x39', 'x3'],\n", + " ['x39', 'x4'],\n", + " ['x39', 'x5'],\n", + " ['x39', 'x6'],\n", + " ['x39', 'x7'],\n", + " ['x39', 'x8'],\n", + " ['x39', 'x9'],\n", + " ['x39', 'x10'],\n", + " ['x39', 'x11'],\n", + " ['x39', 'x12'],\n", + " ['x39', 'x13'],\n", + " ['x39', 'x14'],\n", + " ['x39', 'x15'],\n", + " ['x39', 'x16'],\n", + " ['x39', 'x17'],\n", + " ['x39', 'x18'],\n", + " ['x39', 'x19'],\n", + " ['x39', 'x20'],\n", + " ['x39', 'x21'],\n", + " ['x39', 'x22'],\n", + " ['x39', 'x23'],\n", + " ['x39', 'x24'],\n", + " ['x39', 'x25'],\n", + " ['x39', 'x26'],\n", + " ['x39', 'x27'],\n", + " ['x39', 'x28'],\n", + " ['x39', 'x29'],\n", + " ['x39', 'x30'],\n", + " ['x39', 'x31'],\n", + " ['x39', 'x32'],\n", + " ['x39', 'x33'],\n", + " ['x39', 'x34'],\n", + " ['x39', 'x35'],\n", + " ['x39', 'x36'],\n", + " ['x39', 'x37'],\n", + " ['x39', 'x38']]}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [180, 181, 182, 183, 2940],\n", + " 'source_variables': ['x0'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [195, 196, 197, 198, 2955],\n", + " 'source_variables': ['x1'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [150, 151, 152, 153, 2970],\n", + " 'source_variables': ['x2'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [165, 166, 167, 168, 2985],\n", + " 'source_variables': ['x3'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [210, 211, 212, 213, 3000],\n", + " 'source_variables': ['x4'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [225, 226, 227, 228, 3015],\n", + " 'source_variables': ['x5'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [240, 241, 242, 3540],\n", + " 'source_variables': ['x6'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [255, 256, 257, 3555],\n", + " 'source_variables': ['x7'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [270, 271, 272, 3510, 3511],\n", + " 'source_variables': ['x8'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [285, 286, 287, 3525, 3526],\n", + " 'source_variables': ['x9'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [300, 301, 302, 3480, 3481],\n", + " 'source_variables': ['x10'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [315, 316, 317, 3495, 3496],\n", + " 'source_variables': ['x11'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [330, 331, 332, 3450, 3451],\n", + " 'source_variables': ['x12'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [345, 346, 347, 3465, 3466],\n", + " 'source_variables': ['x13'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [360, 361, 362, 3420, 3421],\n", + " 'source_variables': ['x14'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [375, 376, 377, 3435, 3436],\n", + " 'source_variables': ['x15'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [390, 391, 392, 3390, 3391],\n", + " 'source_variables': ['x16'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [405, 406, 407, 3405, 3406],\n", + " 'source_variables': ['x17'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [435, 436, 3375, 3376],\n", + " 'source_variables': ['x19'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [450, 451, 3330, 3331, 3332],\n", + " 'source_variables': ['x20'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [465, 466, 3345, 3346, 3347],\n", + " 'source_variables': ['x21'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [480, 481, 3300, 3301, 3302],\n", + " 'source_variables': ['x22'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [495, 496, 3315, 3316, 3317],\n", + " 'source_variables': ['x23'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [510, 511, 3270, 3271, 3272],\n", + " 'source_variables': ['x24'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [525, 526, 3285, 3286, 3287],\n", + " 'source_variables': ['x25'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [555, 556, 3255, 3256, 3257],\n", + " 'source_variables': ['x27'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [570, 571, 3210, 3211, 3212],\n", + " 'source_variables': ['x28'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [585, 586, 3225, 3226, 3227],\n", + " 'source_variables': ['x29'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [600, 3180, 3181, 3182],\n", + " 'source_variables': ['x30'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [615, 3195, 3196, 3197],\n", + " 'source_variables': ['x31'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [645, 3165, 3166, 3167, 3168],\n", + " 'source_variables': ['x33'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [660, 3030, 3031, 3032],\n", + " 'source_variables': ['x34'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [675, 3045, 3046, 3047],\n", + " 'source_variables': ['x35'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [120, 3060, 3061, 3062, 3063],\n", + " 'source_variables': ['x36'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [135, 3075, 3076, 3077, 3078],\n", + " 'source_variables': ['x37'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [90, 3090, 3091, 3092, 3093],\n", + " 'source_variables': ['x38'],\n", + " 'sample_index': 0}},\n", + " {'type': dwave.system.warnings.ChainBreakWarning,\n", + " 'message': 'Lowest-energy samples contain a broken chain',\n", + " 'level': 40,\n", + " 'data': {'target_variables': [105, 3105, 3106, 3107, 3108],\n", + " 'source_variables': ['x39'],\n", + " 'sample_index': 0}},\n", + " {'type': UserWarning,\n", + " 'message': 'All samples have broken chains',\n", + " 'level': 30,\n", + " 'data': {}}],\n", + " 'embedding_context': {'embedding': {'x0': [180, 181, 182, 183, 2940],\n", + " 'x1': [195, 196, 197, 198, 2955],\n", + " 'x2': [150, 151, 152, 153, 2970],\n", + " 'x3': [165, 166, 167, 168, 2985],\n", + " 'x4': [210, 211, 212, 213, 3000],\n", + " 'x5': [225, 226, 227, 228, 3015],\n", + " 'x6': [240, 241, 242, 3540],\n", + " 'x7': [255, 256, 257, 3555],\n", + " 'x8': [270, 271, 272, 3510, 3511],\n", + " 'x9': [285, 286, 287, 3525, 3526],\n", + " 'x10': [300, 301, 302, 3480, 3481],\n", + " 'x11': [315, 316, 317, 3495, 3496],\n", + " 'x12': [330, 331, 332, 3450, 3451],\n", + " 'x13': [345, 346, 347, 3465, 3466],\n", + " 'x14': [360, 361, 362, 3420, 3421],\n", + " 'x15': [375, 376, 377, 3435, 3436],\n", + " 'x16': [390, 391, 392, 3390, 3391],\n", + " 'x17': [405, 406, 407, 3405, 3406],\n", + " 'x18': [420, 421, 3360, 3361],\n", + " 'x19': [435, 436, 3375, 3376],\n", + " 'x20': [450, 451, 3330, 3331, 3332],\n", + " 'x21': [465, 466, 3345, 3346, 3347],\n", + " 'x22': [480, 481, 3300, 3301, 3302],\n", + " 'x23': [495, 496, 3315, 3316, 3317],\n", + " 'x24': [510, 511, 3270, 3271, 3272],\n", + " 'x25': [525, 526, 3285, 3286, 3287],\n", + " 'x26': [540, 541, 3240, 3241, 3242],\n", + " 'x27': [555, 556, 3255, 3256, 3257],\n", + " 'x28': [570, 571, 3210, 3211, 3212],\n", + " 'x29': [585, 586, 3225, 3226, 3227],\n", + " 'x30': [600, 3180, 3181, 3182],\n", + " 'x31': [615, 3195, 3196, 3197],\n", + " 'x32': [630, 3150, 3151, 3152, 3153],\n", + " 'x33': [645, 3165, 3166, 3167, 3168],\n", + " 'x34': [660, 3030, 3031, 3032],\n", + " 'x35': [675, 3045, 3046, 3047],\n", + " 'x36': [120, 3060, 3061, 3062, 3063],\n", + " 'x37': [135, 3075, 3076, 3077, 3078],\n", + " 'x38': [90, 3090, 3091, 3092, 3093],\n", + " 'x39': [105, 3105, 3106, 3107, 3108]},\n", + " 'chain_break_method': 'majority_vote',\n", + " 'embedding_parameters': {},\n", + " 'chain_strength': 0.0001,\n", + " 'timing': {'embedding': 0.0022098999997979263,\n", + " 'unembedding': 0.0011283000003459165}}}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls.info" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "808642b0", + "metadata": {}, + "outputs": [], + "source": [ + "enable_data_capture()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "b16a1b3c", + "metadata": {}, + "outputs": [], + "source": [ + "from dwave.inspector.storage import get_problem, problemdata, problemdata_bag" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "9113ed78", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'f49fda51-0bdf-47d9-8dab-e6c3296ca0c4'" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls.info[\"problem_id\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "ac768f39", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "set()" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problemdata_bag" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "1bf9953d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'80444839-7e97-4f88-8518-dea1c98e46df': }" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "problemdata" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "d23c1c53", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'80444839-7e97-4f88-8518-dea1c98e46df'" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.dwave_sampleset.info[\"problem_id\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "c80bd06f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "" + ], + "text/plain": [ + "Serving Inspector on http://127.0.0.1:18000/?problemId=80444839-7e97-4f88-8518-dea1c98e46df" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "'http://127.0.0.1:18000/?problemId=80444839-7e97-4f88-8518-dea1c98e46df'" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import dwave.inspector\n", + "from dwave.inspector.adapters import enable_data_capture\n", + "\n", + "# enable_data_capture()\n", + "\n", + "dwave.inspector.show(res.sampleset_info.dwave_sampleset)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "5c59f975", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "SampleSet(rec.array([([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1], 0.82051282, 1, 0.925),\n", + " ([0, 0, 1, 0, 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, 0, 1], -8.03846154, 1, 0.925),\n", + " ([1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0], -4.87179487, 1, 0.975),\n", + " ([0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1], -5.48717949, 1, 0.875),\n", + " ([1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0], -3.48717949, 1, 0.875),\n", + " ([0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1], -8.03846154, 1, 0.85 ),\n", + " ([1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0], -6.87179487, 1, 0.775),\n", + " ([0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0], -4.03846154, 1, 0.95 ),\n", + " ([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1], -4.44871795, 1, 0.85 ),\n", + " ([1,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 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0], 0.66666667, 1, 0.95 ),\n", + " ([0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0], 0.51282051, 1, 1. ),\n", + " ([0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0], -2.5 , 1, 0.925),\n", + " ([1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0], -6.87179487, 1, 0.925),\n", + " ([1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1], -2.44871795, 1, 0.9 )],\n", + " dtype=[('sample', 'i1', (40,)), ('energy', ', 'message': 'Some biases are 10^3 times stronger than others', 'level': 30, 'data': {'source_interactions': [[181, 180], [2940, 180], [182, 181], [183, 182], [196, 195], [2955, 195], [197, 196], [198, 197], [151, 150], [2970, 150], [152, 151], [153, 152], [166, 165], [2985, 165], [167, 166], [168, 167], [211, 210], [3000, 210], [212, 211], [213, 212], [226, 225], [3015, 225], [227, 226], [228, 227], [241, 240], [242, 241], [3540, 242], [256, 255], [257, 256], [3555, 257], [271, 270], [272, 271], [3511, 272], [3510, 3511], [286, 285], [287, 286], [3526, 287], [3525, 3526], [301, 300], [302, 301], [3481, 302], [3480, 3481], [316, 315], [317, 316], [3496, 317], [3495, 3496], [331, 330], [332, 331], [3451, 332], [3450, 3451], [346, 345], [347, 346], [3466, 347], [3465, 3466], [361, 360], [362, 361], [3421, 362], [3420, 3421], [376, 375], [377, 376], [3436, 377], [3435, 3436], [391, 390], [392, 391], [3391, 392], [3390, 3391], [406, 405], [407, 406], [3406, 407], [3405, 3406], [421, 420], [3361, 421], [3360, 3361], [436, 435], [3376, 436], [3375, 3376], [451, 450], [3332, 451], [3331, 3332], [3331, 3330], [466, 465], [3347, 466], [3346, 3347], [3346, 3345], [481, 480], [3302, 481], [3301, 3302], [3301, 3300], [496, 495], [3317, 496], [3316, 3317], [3316, 3315], [511, 510], [3272, 511], [3271, 3272], [3271, 3270], [526, 525], [3287, 526], [3286, 3287], [3286, 3285], [541, 540], [3242, 541], [3241, 3242], [3241, 3240], [556, 555], [3257, 556], [3256, 3257], [3256, 3255], [571, 570], [3212, 571], [3211, 3212], [3211, 3210], [586, 585], [3227, 586], [3226, 3227], [3226, 3225], [3182, 600], [3181, 3182], [3181, 3180], [3197, 615], [3196, 3197], [3196, 3195], [3153, 630], [3151, 3150], [3152, 3153], [3152, 3151], [3168, 645], [3166, 3165], [3167, 3168], [3167, 3166], [3032, 660], [3031, 3032], [3031, 3030], [3047, 675], [3046, 3047], [3046, 3045], [3060, 120], [3061, 3060], [3062, 3061], [3063, 3062], [3075, 135], [3076, 3075], [3077, 3076], [3078, 3077], [3090, 90], [3091, 3090], [3092, 3091], [3093, 3092], [3105, 105], [3106, 3105], [3107, 3106], [3108, 3107]]}}, {'type': , 'message': 'Number of ground states found is within sampling error', 'level': 30, 'data': {'number_of_ground_states': 1, 'num_reads': 100, 'sampling_error_rate': 10.0}}, {'type': , 'message': 'Some quadratic biases are stronger than the given chain strength', 'level': 30, 'data': {'source_interactions': [['x1', 'x0'], ['x2', 'x0'], ['x2', 'x1'], ['x3', 'x0'], ['x3', 'x1'], ['x3', 'x2'], ['x4', 'x0'], ['x4', 'x1'], ['x4', 'x2'], ['x4', 'x3'], ['x5', 'x0'], ['x5', 'x1'], ['x5', 'x2'], ['x5', 'x3'], ['x5', 'x4'], ['x6', 'x0'], ['x6', 'x1'], ['x6', 'x2'], ['x6', 'x3'], ['x6', 'x4'], ['x6', 'x5'], ['x7', 'x0'], ['x7', 'x1'], ['x7', 'x2'], ['x7', 'x3'], ['x7', 'x4'], ['x7', 'x5'], ['x7', 'x6'], ['x8', 'x0'], ['x8', 'x1'], ['x8', 'x2'], ['x8', 'x3'], ['x8', 'x4'], ['x8', 'x5'], ['x8', 'x6'], ['x8', 'x7'], ['x9', 'x0'], ['x9', 'x1'], ['x9', 'x2'], ['x9', 'x3'], ['x9', 'x4'], ['x9', 'x5'], ['x9', 'x6'], ['x9', 'x7'], ['x9', 'x8'], ['x10', 'x0'], ['x10', 'x1'], ['x10', 'x2'], ['x10', 'x3'], ['x10', 'x4'], ['x10', 'x5'], ['x10', 'x6'], ['x10', 'x7'], ['x10', 'x8'], ['x10', 'x9'], ['x11', 'x0'], ['x11', 'x1'], ['x11', 'x2'], ['x11', 'x3'], ['x11', 'x4'], ['x11', 'x5'], ['x11', 'x6'], ['x11', 'x7'], ['x11', 'x8'], ['x11', 'x9'], ['x11', 'x10'], ['x12', 'x0'], ['x12', 'x1'], ['x12', 'x2'], ['x12', 'x3'], ['x12', 'x4'], ['x12', 'x5'], ['x12', 'x6'], ['x12', 'x7'], ['x12', 'x8'], ['x12', 'x9'], ['x12', 'x10'], ['x12', 'x11'], ['x13', 'x0'], ['x13', 'x1'], ['x13', 'x2'], ['x13', 'x3'], ['x13', 'x4'], ['x13', 'x5'], ['x13', 'x6'], ['x13', 'x7'], ['x13', 'x8'], ['x13', 'x9'], ['x13', 'x10'], ['x13', 'x11'], ['x13', 'x12'], ['x14', 'x0'], ['x14', 'x1'], ['x14', 'x2'], ['x14', 'x3'], ['x14', 'x4'], ['x14', 'x5'], ['x14', 'x6'], ['x14', 'x7'], ['x14', 'x8'], ['x14', 'x9'], ['x14', 'x10'], ['x14', 'x11'], ['x14', 'x12'], ['x14', 'x13'], ['x15', 'x0'], ['x15', 'x1'], ['x15', 'x2'], ['x15', 'x3'], ['x15', 'x4'], ['x15', 'x5'], ['x15', 'x6'], ['x15', 'x7'], ['x15', 'x8'], ['x15', 'x9'], ['x15', 'x10'], ['x15', 'x11'], ['x15', 'x12'], ['x15', 'x13'], ['x15', 'x14'], ['x16', 'x0'], ['x16', 'x1'], ['x16', 'x2'], ['x16', 'x3'], ['x16', 'x4'], ['x16', 'x5'], ['x16', 'x6'], ['x16', 'x7'], ['x16', 'x8'], ['x16', 'x9'], ['x16', 'x10'], ['x16', 'x11'], ['x16', 'x12'], ['x16', 'x13'], ['x16', 'x14'], ['x16', 'x15'], ['x17', 'x0'], ['x17', 'x1'], ['x17', 'x2'], ['x17', 'x3'], ['x17', 'x4'], ['x17', 'x5'], ['x17', 'x6'], ['x17', 'x7'], ['x17', 'x8'], ['x17', 'x9'], ['x17', 'x10'], ['x17', 'x11'], ['x17', 'x12'], ['x17', 'x13'], ['x17', 'x14'], ['x17', 'x15'], ['x17', 'x16'], ['x18', 'x0'], ['x18', 'x1'], ['x18', 'x2'], ['x18', 'x3'], ['x18', 'x4'], ['x18', 'x5'], ['x18', 'x6'], ['x18', 'x7'], ['x18', 'x8'], ['x18', 'x9'], ['x18', 'x10'], ['x18', 'x11'], ['x18', 'x12'], ['x18', 'x13'], ['x18', 'x14'], ['x18', 'x15'], ['x18', 'x16'], ['x18', 'x17'], ['x19', 'x0'], ['x19', 'x1'], ['x19', 'x2'], ['x19', 'x3'], ['x19', 'x4'], ['x19', 'x5'], ['x19', 'x6'], ['x19', 'x7'], ['x19', 'x8'], ['x19', 'x9'], ['x19', 'x10'], ['x19', 'x11'], ['x19', 'x12'], ['x19', 'x13'], ['x19', 'x14'], ['x19', 'x15'], ['x19', 'x16'], ['x19', 'x17'], ['x19', 'x18'], ['x20', 'x0'], ['x20', 'x1'], ['x20', 'x2'], ['x20', 'x3'], ['x20', 'x4'], ['x20', 'x5'], ['x20', 'x6'], ['x20', 'x7'], ['x20', 'x8'], ['x20', 'x9'], ['x20', 'x10'], ['x20', 'x11'], ['x20', 'x12'], ['x20', 'x13'], ['x20', 'x14'], ['x20', 'x15'], ['x20', 'x16'], ['x20', 'x17'], ['x20', 'x18'], ['x20', 'x19'], ['x21', 'x0'], ['x21', 'x1'], ['x21', 'x2'], ['x21', 'x3'], ['x21', 'x4'], ['x21', 'x5'], ['x21', 'x6'], ['x21', 'x7'], ['x21', 'x8'], ['x21', 'x9'], ['x21', 'x10'], ['x21', 'x11'], ['x21', 'x12'], ['x21', 'x13'], ['x21', 'x14'], ['x21', 'x15'], ['x21', 'x16'], ['x21', 'x17'], ['x21', 'x18'], ['x21', 'x19'], ['x21', 'x20'], ['x22', 'x0'], ['x22', 'x1'], ['x22', 'x2'], ['x22', 'x3'], ['x22', 'x4'], ['x22', 'x5'], ['x22', 'x6'], ['x22', 'x7'], ['x22', 'x8'], ['x22', 'x9'], ['x22', 'x10'], ['x22', 'x11'], ['x22', 'x12'], ['x22', 'x13'], ['x22', 'x14'], ['x22', 'x15'], ['x22', 'x16'], ['x22', 'x17'], ['x22', 'x18'], ['x22', 'x19'], ['x22', 'x20'], ['x22', 'x21'], ['x23', 'x0'], ['x23', 'x1'], ['x23', 'x2'], ['x23', 'x3'], ['x23', 'x4'], ['x23', 'x5'], ['x23', 'x6'], ['x23', 'x7'], ['x23', 'x8'], ['x23', 'x9'], ['x23', 'x10'], ['x23', 'x11'], ['x23', 'x12'], ['x23', 'x13'], ['x23', 'x14'], ['x23', 'x15'], ['x23', 'x16'], ['x23', 'x17'], ['x23', 'x18'], ['x23', 'x19'], ['x23', 'x20'], ['x23', 'x21'], ['x23', 'x22'], ['x24', 'x0'], ['x24', 'x1'], ['x24', 'x2'], ['x24', 'x3'], ['x24', 'x4'], ['x24', 'x5'], ['x24', 'x6'], ['x24', 'x7'], ['x24', 'x8'], ['x24', 'x9'], ['x24', 'x10'], ['x24', 'x11'], ['x24', 'x12'], ['x24', 'x13'], ['x24', 'x14'], ['x24', 'x15'], ['x24', 'x16'], ['x24', 'x17'], ['x24', 'x18'], ['x24', 'x19'], ['x24', 'x20'], ['x24', 'x21'], ['x24', 'x22'], ['x24', 'x23'], ['x25', 'x0'], ['x25', 'x1'], ['x25', 'x2'], ['x25', 'x3'], ['x25', 'x4'], ['x25', 'x5'], ['x25', 'x6'], ['x25', 'x7'], ['x25', 'x8'], ['x25', 'x9'], ['x25', 'x10'], ['x25', 'x11'], ['x25', 'x12'], ['x25', 'x13'], ['x25', 'x14'], ['x25', 'x15'], ['x25', 'x16'], ['x25', 'x17'], ['x25', 'x18'], ['x25', 'x19'], ['x25', 'x20'], ['x25', 'x21'], ['x25', 'x22'], ['x25', 'x23'], ['x25', 'x24'], ['x26', 'x0'], ['x26', 'x1'], ['x26', 'x2'], ['x26', 'x3'], ['x26', 'x4'], ['x26', 'x5'], ['x26', 'x6'], ['x26', 'x7'], ['x26', 'x8'], ['x26', 'x9'], ['x26', 'x10'], ['x26', 'x11'], ['x26', 'x12'], ['x26', 'x13'], ['x26', 'x14'], ['x26', 'x15'], ['x26', 'x16'], ['x26', 'x17'], ['x26', 'x18'], ['x26', 'x19'], ['x26', 'x20'], ['x26', 'x21'], ['x26', 'x22'], ['x26', 'x23'], ['x26', 'x24'], ['x26', 'x25'], ['x27', 'x0'], ['x27', 'x1'], ['x27', 'x2'], ['x27', 'x3'], ['x27', 'x4'], ['x27', 'x5'], ['x27', 'x6'], ['x27', 'x7'], ['x27', 'x8'], ['x27', 'x9'], ['x27', 'x10'], ['x27', 'x11'], ['x27', 'x12'], ['x27', 'x13'], ['x27', 'x14'], ['x27', 'x15'], ['x27', 'x16'], ['x27', 'x17'], ['x27', 'x18'], ['x27', 'x19'], ['x27', 'x20'], ['x27', 'x21'], ['x27', 'x22'], ['x27', 'x23'], ['x27', 'x24'], ['x27', 'x25'], ['x27', 'x26'], ['x28', 'x0'], ['x28', 'x1'], ['x28', 'x2'], ['x28', 'x3'], ['x28', 'x4'], ['x28', 'x5'], ['x28', 'x6'], ['x28', 'x7'], ['x28', 'x8'], ['x28', 'x9'], ['x28', 'x10'], ['x28', 'x11'], ['x28', 'x12'], ['x28', 'x13'], ['x28', 'x14'], ['x28', 'x15'], ['x28', 'x16'], ['x28', 'x17'], ['x28', 'x18'], ['x28', 'x19'], ['x28', 'x20'], ['x28', 'x21'], ['x28', 'x22'], ['x28', 'x23'], ['x28', 'x24'], ['x28', 'x25'], ['x28', 'x26'], ['x28', 'x27'], ['x29', 'x0'], ['x29', 'x1'], ['x29', 'x2'], ['x29', 'x3'], ['x29', 'x4'], ['x29', 'x5'], ['x29', 'x6'], ['x29', 'x7'], ['x29', 'x8'], ['x29', 'x9'], ['x29', 'x10'], ['x29', 'x11'], ['x29', 'x12'], ['x29', 'x13'], ['x29', 'x14'], ['x29', 'x15'], ['x29', 'x16'], ['x29', 'x17'], ['x29', 'x18'], ['x29', 'x19'], ['x29', 'x20'], ['x29', 'x21'], ['x29', 'x22'], ['x29', 'x23'], ['x29', 'x24'], ['x29', 'x25'], ['x29', 'x26'], ['x29', 'x27'], ['x29', 'x28'], ['x30', 'x0'], ['x30', 'x1'], ['x30', 'x2'], ['x30', 'x3'], ['x30', 'x4'], ['x30', 'x5'], ['x30', 'x6'], ['x30', 'x7'], ['x30', 'x8'], ['x30', 'x9'], ['x30', 'x10'], ['x30', 'x11'], ['x30', 'x12'], ['x30', 'x13'], ['x30', 'x14'], ['x30', 'x15'], ['x30', 'x16'], ['x30', 'x17'], ['x30', 'x18'], ['x30', 'x19'], ['x30', 'x20'], ['x30', 'x21'], ['x30', 'x22'], ['x30', 'x23'], ['x30', 'x24'], ['x30', 'x25'], ['x30', 'x26'], ['x30', 'x27'], ['x30', 'x28'], ['x30', 'x29'], ['x31', 'x0'], ['x31', 'x1'], ['x31', 'x2'], ['x31', 'x3'], ['x31', 'x4'], ['x31', 'x5'], ['x31', 'x6'], ['x31', 'x7'], ['x31', 'x8'], ['x31', 'x9'], ['x31', 'x10'], ['x31', 'x11'], ['x31', 'x12'], ['x31', 'x13'], ['x31', 'x14'], ['x31', 'x15'], ['x31', 'x16'], ['x31', 'x17'], ['x31', 'x18'], ['x31', 'x19'], ['x31', 'x20'], ['x31', 'x21'], ['x31', 'x22'], ['x31', 'x23'], ['x31', 'x24'], ['x31', 'x25'], ['x31', 'x26'], ['x31', 'x27'], ['x31', 'x28'], ['x31', 'x29'], ['x31', 'x30'], ['x32', 'x0'], ['x32', 'x1'], ['x32', 'x2'], ['x32', 'x3'], ['x32', 'x4'], ['x32', 'x5'], ['x32', 'x6'], ['x32', 'x7'], ['x32', 'x8'], ['x32', 'x9'], ['x32', 'x10'], ['x32', 'x11'], ['x32', 'x12'], ['x32', 'x13'], ['x32', 'x14'], ['x32', 'x15'], ['x32', 'x16'], ['x32', 'x17'], ['x32', 'x18'], ['x32', 'x19'], ['x32', 'x20'], ['x32', 'x21'], ['x32', 'x22'], ['x32', 'x23'], ['x32', 'x24'], ['x32', 'x25'], ['x32', 'x26'], ['x32', 'x27'], ['x32', 'x28'], ['x32', 'x29'], ['x32', 'x30'], ['x32', 'x31'], ['x33', 'x0'], ['x33', 'x1'], ['x33', 'x2'], ['x33', 'x3'], ['x33', 'x4'], ['x33', 'x5'], ['x33', 'x6'], ['x33', 'x7'], ['x33', 'x8'], ['x33', 'x9'], ['x33', 'x10'], ['x33', 'x11'], ['x33', 'x12'], ['x33', 'x13'], ['x33', 'x14'], ['x33', 'x15'], ['x33', 'x16'], ['x33', 'x17'], ['x33', 'x18'], ['x33', 'x19'], ['x33', 'x20'], ['x33', 'x21'], ['x33', 'x22'], ['x33', 'x23'], ['x33', 'x24'], ['x33', 'x25'], ['x33', 'x26'], ['x33', 'x27'], ['x33', 'x28'], ['x33', 'x29'], ['x33', 'x30'], ['x33', 'x31'], ['x33', 'x32'], ['x34', 'x0'], ['x34', 'x1'], ['x34', 'x2'], ['x34', 'x3'], ['x34', 'x4'], ['x34', 'x5'], ['x34', 'x6'], ['x34', 'x7'], ['x34', 'x8'], ['x34', 'x9'], ['x34', 'x10'], ['x34', 'x11'], ['x34', 'x12'], ['x34', 'x13'], ['x34', 'x14'], ['x34', 'x15'], ['x34', 'x16'], ['x34', 'x17'], ['x34', 'x18'], ['x34', 'x19'], ['x34', 'x20'], ['x34', 'x21'], ['x34', 'x22'], ['x34', 'x23'], ['x34', 'x24'], ['x34', 'x25'], ['x34', 'x26'], ['x34', 'x27'], ['x34', 'x28'], ['x34', 'x29'], ['x34', 'x30'], ['x34', 'x31'], ['x34', 'x32'], ['x34', 'x33'], ['x35', 'x0'], ['x35', 'x1'], ['x35', 'x2'], ['x35', 'x3'], ['x35', 'x4'], ['x35', 'x5'], ['x35', 'x6'], ['x35', 'x7'], ['x35', 'x8'], ['x35', 'x9'], ['x35', 'x10'], ['x35', 'x11'], ['x35', 'x12'], ['x35', 'x13'], ['x35', 'x14'], ['x35', 'x15'], ['x35', 'x16'], ['x35', 'x17'], ['x35', 'x18'], ['x35', 'x19'], ['x35', 'x20'], ['x35', 'x21'], ['x35', 'x22'], ['x35', 'x23'], ['x35', 'x24'], ['x35', 'x25'], ['x35', 'x26'], ['x35', 'x27'], ['x35', 'x28'], ['x35', 'x29'], ['x35', 'x30'], ['x35', 'x31'], ['x35', 'x32'], ['x35', 'x33'], ['x35', 'x34'], ['x36', 'x0'], ['x36', 'x1'], ['x36', 'x2'], ['x36', 'x3'], ['x36', 'x4'], ['x36', 'x5'], ['x36', 'x6'], ['x36', 'x7'], ['x36', 'x8'], ['x36', 'x9'], ['x36', 'x10'], ['x36', 'x11'], ['x36', 'x12'], ['x36', 'x13'], ['x36', 'x14'], ['x36', 'x15'], ['x36', 'x16'], ['x36', 'x17'], ['x36', 'x18'], ['x36', 'x19'], ['x36', 'x20'], ['x36', 'x21'], ['x36', 'x22'], ['x36', 'x23'], ['x36', 'x24'], ['x36', 'x25'], ['x36', 'x26'], ['x36', 'x27'], ['x36', 'x28'], ['x36', 'x29'], ['x36', 'x30'], ['x36', 'x31'], ['x36', 'x32'], ['x36', 'x33'], ['x36', 'x34'], ['x36', 'x35'], ['x37', 'x0'], ['x37', 'x1'], ['x37', 'x2'], ['x37', 'x3'], ['x37', 'x4'], ['x37', 'x5'], ['x37', 'x6'], ['x37', 'x7'], ['x37', 'x8'], ['x37', 'x9'], ['x37', 'x10'], ['x37', 'x11'], ['x37', 'x12'], ['x37', 'x13'], ['x37', 'x14'], ['x37', 'x15'], ['x37', 'x16'], ['x37', 'x17'], ['x37', 'x18'], ['x37', 'x19'], ['x37', 'x20'], ['x37', 'x21'], ['x37', 'x22'], ['x37', 'x23'], ['x37', 'x24'], ['x37', 'x25'], ['x37', 'x26'], ['x37', 'x27'], ['x37', 'x28'], ['x37', 'x29'], ['x37', 'x30'], ['x37', 'x31'], ['x37', 'x32'], ['x37', 'x33'], ['x37', 'x34'], ['x37', 'x35'], ['x37', 'x36'], ['x38', 'x0'], ['x38', 'x1'], ['x38', 'x2'], ['x38', 'x3'], ['x38', 'x4'], ['x38', 'x5'], ['x38', 'x6'], ['x38', 'x7'], ['x38', 'x8'], ['x38', 'x9'], ['x38', 'x10'], ['x38', 'x11'], ['x38', 'x12'], ['x38', 'x13'], ['x38', 'x14'], ['x38', 'x15'], ['x38', 'x16'], ['x38', 'x17'], ['x38', 'x18'], ['x38', 'x19'], ['x38', 'x20'], ['x38', 'x21'], ['x38', 'x22'], ['x38', 'x23'], ['x38', 'x24'], ['x38', 'x25'], ['x38', 'x26'], ['x38', 'x27'], ['x38', 'x28'], ['x38', 'x29'], ['x38', 'x30'], ['x38', 'x31'], ['x38', 'x32'], ['x38', 'x33'], ['x38', 'x34'], ['x38', 'x35'], ['x38', 'x36'], ['x38', 'x37'], ['x39', 'x0'], ['x39', 'x1'], ['x39', 'x2'], ['x39', 'x3'], ['x39', 'x4'], ['x39', 'x5'], ['x39', 'x6'], ['x39', 'x7'], ['x39', 'x8'], ['x39', 'x9'], ['x39', 'x10'], ['x39', 'x11'], ['x39', 'x12'], ['x39', 'x13'], ['x39', 'x14'], ['x39', 'x15'], ['x39', 'x16'], ['x39', 'x17'], ['x39', 'x18'], ['x39', 'x19'], ['x39', 'x20'], ['x39', 'x21'], ['x39', 'x22'], ['x39', 'x23'], ['x39', 'x24'], ['x39', 'x25'], ['x39', 'x26'], ['x39', 'x27'], ['x39', 'x28'], ['x39', 'x29'], ['x39', 'x30'], ['x39', 'x31'], ['x39', 'x32'], ['x39', 'x33'], ['x39', 'x34'], ['x39', 'x35'], ['x39', 'x36'], ['x39', 'x37'], ['x39', 'x38']]}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [180, 181, 182, 183, 2940], 'source_variables': ['x0'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [195, 196, 197, 198, 2955], 'source_variables': ['x1'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [150, 151, 152, 153, 2970], 'source_variables': ['x2'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [165, 166, 167, 168, 2985], 'source_variables': ['x3'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [210, 211, 212, 213, 3000], 'source_variables': ['x4'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [225, 226, 227, 228, 3015], 'source_variables': ['x5'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [240, 241, 242, 3540], 'source_variables': ['x6'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [255, 256, 257, 3555], 'source_variables': ['x7'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [270, 271, 272, 3510, 3511], 'source_variables': ['x8'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [285, 286, 287, 3525, 3526], 'source_variables': ['x9'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [300, 301, 302, 3480, 3481], 'source_variables': ['x10'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [315, 316, 317, 3495, 3496], 'source_variables': ['x11'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [330, 331, 332, 3450, 3451], 'source_variables': ['x12'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [345, 346, 347, 3465, 3466], 'source_variables': ['x13'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [360, 361, 362, 3420, 3421], 'source_variables': ['x14'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [375, 376, 377, 3435, 3436], 'source_variables': ['x15'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [390, 391, 392, 3390, 3391], 'source_variables': ['x16'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [405, 406, 407, 3405, 3406], 'source_variables': ['x17'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [435, 436, 3375, 3376], 'source_variables': ['x19'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [450, 451, 3330, 3331, 3332], 'source_variables': ['x20'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [465, 466, 3345, 3346, 3347], 'source_variables': ['x21'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [480, 481, 3300, 3301, 3302], 'source_variables': ['x22'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [495, 496, 3315, 3316, 3317], 'source_variables': ['x23'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [510, 511, 3270, 3271, 3272], 'source_variables': ['x24'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [525, 526, 3285, 3286, 3287], 'source_variables': ['x25'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [555, 556, 3255, 3256, 3257], 'source_variables': ['x27'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [570, 571, 3210, 3211, 3212], 'source_variables': ['x28'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [585, 586, 3225, 3226, 3227], 'source_variables': ['x29'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [600, 3180, 3181, 3182], 'source_variables': ['x30'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [615, 3195, 3196, 3197], 'source_variables': ['x31'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [645, 3165, 3166, 3167, 3168], 'source_variables': ['x33'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [660, 3030, 3031, 3032], 'source_variables': ['x34'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [675, 3045, 3046, 3047], 'source_variables': ['x35'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [120, 3060, 3061, 3062, 3063], 'source_variables': ['x36'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [135, 3075, 3076, 3077, 3078], 'source_variables': ['x37'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [90, 3090, 3091, 3092, 3093], 'source_variables': ['x38'], 'sample_index': 0}}, {'type': , 'message': 'Lowest-energy samples contain a broken chain', 'level': 40, 'data': {'target_variables': [105, 3105, 3106, 3107, 3108], 'source_variables': ['x39'], 'sample_index': 0}}, {'type': , 'message': 'All samples have broken chains', 'level': 30, 'data': {}}], 'embedding_context': {'embedding': {'x0': [180, 181, 182, 183, 2940], 'x1': [195, 196, 197, 198, 2955], 'x2': [150, 151, 152, 153, 2970], 'x3': [165, 166, 167, 168, 2985], 'x4': [210, 211, 212, 213, 3000], 'x5': [225, 226, 227, 228, 3015], 'x6': [240, 241, 242, 3540], 'x7': [255, 256, 257, 3555], 'x8': [270, 271, 272, 3510, 3511], 'x9': [285, 286, 287, 3525, 3526], 'x10': [300, 301, 302, 3480, 3481], 'x11': [315, 316, 317, 3495, 3496], 'x12': [330, 331, 332, 3450, 3451], 'x13': [345, 346, 347, 3465, 3466], 'x14': [360, 361, 362, 3420, 3421], 'x15': [375, 376, 377, 3435, 3436], 'x16': [390, 391, 392, 3390, 3391], 'x17': [405, 406, 407, 3405, 3406], 'x18': [420, 421, 3360, 3361], 'x19': [435, 436, 3375, 3376], 'x20': [450, 451, 3330, 3331, 3332], 'x21': [465, 466, 3345, 3346, 3347], 'x22': [480, 481, 3300, 3301, 3302], 'x23': [495, 496, 3315, 3316, 3317], 'x24': [510, 511, 3270, 3271, 3272], 'x25': [525, 526, 3285, 3286, 3287], 'x26': [540, 541, 3240, 3241, 3242], 'x27': [555, 556, 3255, 3256, 3257], 'x28': [570, 571, 3210, 3211, 3212], 'x29': [585, 586, 3225, 3226, 3227], 'x30': [600, 3180, 3181, 3182], 'x31': [615, 3195, 3196, 3197], 'x32': [630, 3150, 3151, 3152, 3153], 'x33': [645, 3165, 3166, 3167, 3168], 'x34': [660, 3030, 3031, 3032], 'x35': [675, 3045, 3046, 3047], 'x36': [120, 3060, 3061, 3062, 3063], 'x37': [135, 3075, 3076, 3077, 3078], 'x38': [90, 3090, 3091, 3092, 3093], 'x39': [105, 3105, 3106, 3107, 3108]}, 'chain_break_method': 'majority_vote', 'embedding_parameters': {}, 'chain_strength': 0.0001, 'timing': {'embedding': 0.0022098999997979263, 'unembedding': 0.0011283000003459165}}}, 'BINARY')" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ls" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "63f9a5af", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.float64(1.0)" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.chain_break_fraction" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "9a3218a1", + "metadata": {}, + "outputs": [], + "source": [ + "def communities_to_list(sample, communities_number) -> list:\n", + " communities = []\n", + " for k in range(communities_number):\n", + " subcommunity = []\n", + " for i in sample:\n", + " if sample[i] == k:\n", + " key = int(i[1:])\n", + " subcommunity.append(key)\n", + " communities.append(subcommunity)\n", + "\n", + " return communities" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "6ee50a17", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'x0': np.int8(1),\n", + " 'x1': np.int8(1),\n", + " 'x10': np.int8(0),\n", + " 'x11': np.int8(0),\n", + " 'x12': np.int8(1),\n", + " 'x13': np.int8(1),\n", + " 'x14': np.int8(1),\n", + " 'x15': np.int8(0),\n", + " 'x16': np.int8(1),\n", + " 'x17': np.int8(1),\n", + " 'x18': np.int8(1),\n", + " 'x19': np.int8(1),\n", + " 'x2': np.int8(1),\n", + " 'x20': np.int8(1),\n", + " 'x21': np.int8(1),\n", + " 'x22': np.int8(1),\n", + " 'x23': np.int8(1),\n", + " 'x24': np.int8(0),\n", + " 'x25': np.int8(1),\n", + " 'x26': np.int8(1),\n", + " 'x27': np.int8(1),\n", + " 'x28': np.int8(1),\n", + " 'x29': np.int8(1),\n", + " 'x3': np.int8(0),\n", + " 'x30': np.int8(1),\n", + " 'x31': np.int8(1),\n", + " 'x32': np.int8(1),\n", + " 'x33': np.int8(0),\n", + " 'x34': np.int8(1),\n", + " 'x35': np.int8(1),\n", + " 'x36': np.int8(1),\n", + " 'x37': np.int8(0),\n", + " 'x38': np.int8(1),\n", + " 'x39': np.int8(0),\n", + " 'x4': np.int8(0),\n", + " 'x40': np.int8(1),\n", + " 'x41': np.int8(1),\n", + " 'x42': np.int8(0),\n", + " 'x43': np.int8(1),\n", + " 'x44': np.int8(0),\n", + " 'x45': np.int8(0),\n", + " 'x46': np.int8(1),\n", + " 'x47': np.int8(1),\n", + " 'x48': np.int8(0),\n", + " 'x49': np.int8(1),\n", + " 'x5': np.int8(1),\n", + " 'x50': np.int8(1),\n", + " 'x51': np.int8(1),\n", + " 'x52': np.int8(1),\n", + " 'x53': np.int8(1),\n", + " 'x54': np.int8(0),\n", + " 'x55': np.int8(0),\n", + " 'x56': np.int8(0),\n", + " 'x57': np.int8(0),\n", + " 'x58': np.int8(0),\n", + " 'x59': np.int8(0),\n", + " 'x6': np.int8(1),\n", + " 'x60': np.int8(0),\n", + " 'x61': np.int8(1),\n", + " 'x62': np.int8(0),\n", + " 'x63': np.int8(0),\n", + " 'x64': np.int8(0),\n", + " 'x65': np.int8(0),\n", + " 'x66': np.int8(0),\n", + " 'x67': np.int8(1),\n", + " 'x68': np.int8(1),\n", + " 'x69': np.int8(1),\n", + " 'x7': np.int8(0),\n", + " 'x70': np.int8(1),\n", + " 'x71': np.int8(1),\n", + " 'x72': np.int8(0),\n", + " 'x73': np.int8(1),\n", + " 'x74': np.int8(0),\n", + " 'x75': np.int8(0),\n", + " 'x76': np.int8(0),\n", + " 'x77': np.int8(1),\n", + " 'x78': np.int8(1),\n", + " 'x79': np.int8(1),\n", + " 'x8': np.int8(0),\n", + " 'x80': np.int8(0),\n", + " 'x81': np.int8(0),\n", + " 'x82': np.int8(1),\n", + " 'x83': np.int8(1),\n", + " 'x84': np.int8(0),\n", + " 'x85': np.int8(1),\n", + " 'x86': np.int8(1),\n", + " 'x87': np.int8(0),\n", + " 'x88': np.int8(0),\n", + " 'x89': np.int8(1),\n", + " 'x9': np.int8(0),\n", + " 'x90': np.int8(0),\n", + " 'x91': np.int8(0),\n", + " 'x92': np.int8(1),\n", + " 'x93': np.int8(0),\n", + " 'x94': np.int8(1),\n", + " 'x95': np.int8(0),\n", + " 'x96': np.int8(1),\n", + " 'x97': np.int8(0),\n", + " 'x98': np.int8(0),\n", + " 'x99': np.int8(1)}" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res.sampleset_info.dwave_sampleset.first.sample" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "1dff148f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.17768595041322313" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "nx.community.modularity(G, communities_to_list(res.sampleset_info.dwave_sampleset.first.sample, 2))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "qomm_env", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}